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

IN trap triggers panic when EOF is reached #57

Open
dxrcy opened this issue Dec 20, 2024 · 1 comment · May be fixed by #58
Open

IN trap triggers panic when EOF is reached #57

dxrcy opened this issue Dec 20, 2024 · 1 comment · May be fixed by #58

Comments

@dxrcy
Copy link
Contributor

dxrcy commented Dec 20, 2024

IN
printf | lace run hw.asm
thread 'main' panicked at src/runtime.rs:439:38:
called `Result::unwrap()` on an `Err` value: Error { kind: UnexpectedEof, message: "failed to fill whole buffer" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This is unfortunately an bug which I have introduced.

Possible solutions:

  1. Block indefinitely (not sure how this could be useful with piped input).
  2. Immediately halt / terminate the program.
  3. Put some dummy value in R0 (eg. 0).
  4. Don't modify R0 (this seems dangerous).

I think 2. and 3. are the best solutions.

@rozukke
Copy link
Owner

rozukke commented Dec 21, 2024

I think the traditional wisdom is to exit gracefully when an EOF is reached during a step that requires input, so 2 sounds good.

@dxrcy dxrcy linked a pull request Dec 21, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants