target/common: Fix dasm traces truncation when using SnitchSim #64
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using the
verification.py
library andSnitchSim
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 inipc.cc
erroneously checks for EOF before thefread
attempt, instead of after thefread
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, sinceSnitchSim.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.