Etm4 t32 return address fix#92
Open
sayhal01 wants to merge 1 commit into
Open
Conversation
6f2b1a6 to
fdbdaae
Compare
For M-profile tracing, the preferred exception return address may lie within a restartable 32-bit T32 instruction. The decoder searches for the preferred return address at instruction boundaries. When the address lies within a 32-bit Thumb instruction, it can be skipped, causing tracing to continue past the exception return point and emit an incorrect instruction range. Detect this case and stop tracing at the preferred return address when it falls within the current Thumb-2 instruction. Add regression snapshot tests covering exception return addresses at an instruction boundary, within a 32-bit T32 instruction, and at the next instruction boundary to validate the behaviour and prevent future regressions. Signed-off-by: Sayani Halder <sayani.halder@arm.com>
fdbdaae to
6d5bf90
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.
opencsd: etm4: handle exception return addresses inside T32 instructions
When processing an exception packet, the ETMv4 decoder traces to the
preferred exception return address using traceInstrToWP(). For M-profile
devices, the preferred exception return address may lie within a
restartable or interrupt-continuable 32-bit T32 instruction.
The decoder advances by instruction boundaries while searching for the
target address. When the preferred return address lies inside a 32-bit
Thumb instruction, the address is skipped and never matched directly,
causing tracing to continue past the exception return point and emit an
incorrect instruction range.
Detect this case and treat the preferred return address as reached when
it falls within the current decoded Thumb-2 instruction, ensuring the
instruction range reported before the exception matches the expected
execution flow.
Add regression snapshot tests covering exception return addresses at an
instruction boundary, within a 32-bit T32 instruction, and at the next
instruction boundary to validate the behaviour and prevent future
regressions.
Signed-off-by: Your Name your.email@example.com