Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't panic on underflow/overflow when testing #20

Open
kiedtl opened this issue Sep 17, 2024 · 2 comments
Open

Don't panic on underflow/overflow when testing #20

kiedtl opened this issue Sep 17, 2024 · 2 comments
Labels
lang-fix Correct existing language feature.

Comments

@kiedtl
Copy link
Owner

kiedtl commented Sep 17, 2024

image

Panic'ing was good placeholder behavior (so not technically a bug), but ideally this should print a backtrace and continue on with testing.

@kiedtl kiedtl added the lang-fix Correct existing language feature. label Sep 17, 2024
@kiedtl
Copy link
Owner Author

kiedtl commented Sep 17, 2024

Really this is an issue with the underlying emulator rather than the test harness.

In addition to printing a stack trace, the instruction should be identified properly, as part of the backtrace:

at Instruction: Orot <sk>
at foo:12
at bar:84

@kiedtl
Copy link
Owner Author

kiedtl commented Sep 17, 2024

Right after creating this issue, ran into another backtrace-related problem:

image

This happens because the current function is pushing stuff onto the return stack, so when backtrace unwinds it can't handle RST size not being even.

I've patched this for now with a "paranoid mode" for backtrace-printing that decrements ptr by 1 if the RST size isn't event, effectively treating every possible pair of bytes as if it were an address (yes, this results in a lot of junk data in the trace), but ideally if the return stack state is known at time of panic then the VM should simply skip those bytes that aren't addresses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang-fix Correct existing language feature.
Projects
None yet
Development

No branches or pull requests

1 participant