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

target/common: Fix dasm traces truncation when using SnitchSim #64

Merged
merged 1 commit into from
Nov 16, 2023

Conversation

Raragyay
Copy link
Contributor

When using the verification.py library and SnitchSim to run a simulation then read results from the kernel execution, the IPC thread will crash the whole program once SnitchSim has finished issuing the read commands. This is because the current check for EOF in ipc.cc erroneously checks for EOF before the fread attempt, instead of after the fread attempt. See the following StackOverflow for how this is usually corrected:

https://stackoverflow.com/questions/5431941/why-is-while-feoffile-always-wrong

Because of this erroneous check, the last operation (which is usually a read memory operation) will be doubly executed, causing the attempt to write to and flush rx to fail, since SnitchSim.py will have already closed the pipe and directory. As such, the program crashes and the .dasm traces are never fully written out.

This PR fixes the EOF check in ipc.cc to correctly check for EOF or errors after a read attempt instead of before.

@colluca
Copy link
Collaborator

colluca commented Nov 16, 2023

Thanks a lot for your contribution @Raragyay!

@colluca colluca merged commit 7f91f1b into pulp-platform:main Nov 16, 2023
12 checks passed
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 this pull request may close these issues.

2 participants