Fix misleading debug output when unpriv test traps#1441
Open
Jjateen wants to merge 1 commit intoriscv:act4from
Open
Fix misleading debug output when unpriv test traps#1441Jjateen wants to merge 1 commit intoriscv:act4from
Jjateen wants to merge 1 commit intoriscv:act4from
Conversation
5b3fc47 to
dedf93b
Compare
When the M-mode trap handler aborted a test due to an unsupported instruction, failure_type 3 fell through to failedtest_saveresults_int, which reconstructed a non-existent beq/ld instruction pair and filled failing_reg, failing_value, and expected_value with garbage. The reporter then printed those garbage values as "Bad Value" / "Expected Value", making the output look like a register comparison failure rather than a trap abort. Two fixes in rvtest_failure_code.h: - Add a dispatch for failure_type == 3 at failedtest_saveresults that branches to a new failedtest_saveresults_trap label, bypassing the integer beq/ld reconstruction entirely and jumping straight to the common string-pointer loading path. - After printing "RVCP: Test Info:" in failedtest_report, check for failure_type == 3 and branch directly to failedtest_report_traphandler, skipping the instruction / approximate address / register / bad-value / expected-value fields that are meaningless for a trap abort. After the fix the output for a trapped test is: RVCP-SUMMARY: TEST FAILED - Test File "..." RVCP: DEBUG INFORMATION FOLLOWS RVCP: Test Info: "The trap handler aborted the test before normal completion!" RVCP: Address of instruction that trapped (XEPC): 0x... RVCP: Instruction that trapped: 0x... RVCP: END OF DEBUG INFORMATION This applies to both the ref-model build step (where sail now produces a clear trap message before exiting non-zero) and to the selfcheck ELF running on the DUT. Fixes riscv#1359.
dedf93b to
00298c0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 the M-mode trap handler aborted a test due to an unsupported instruction, failure_type 3 fell through to failedtest_saveresults_int, which reconstructed a non-existent beq/ld instruction pair and filled failing_reg, failing_value, and expected_value with garbage. The reporter then printed those garbage values as "Bad Value" / "Expected Value", making the output look like a register comparison failure rather than a trap abort.
Two fixes in rvtest_failure_code.h:
After the fix the output for a trapped test is:
RVCP-SUMMARY: TEST FAILED - Test File "..."
RVCP: DEBUG INFORMATION FOLLOWS
RVCP: Test Info: "The trap handler aborted the test before normal completion!"
RVCP: Address of instruction that trapped (XEPC): 0x...
RVCP: Instruction that trapped: 0x...
RVCP: END OF DEBUG INFORMATION
This applies to both the ref-model build step (where sail now produces a clear trap message before exiting non-zero) and to the selfcheck ELF running on the DUT.
Fixes #1359.