Add comment on load opcodes with the loaded value #3289
Merged
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.
Your checklist for this pull request
Detailed description
First time user of Rizin here, I was doing some analysis on Xtensa code. (esp8266 firmware.) I found that in that architecture 32 bit constant values are loaded into registers by a PC relative load operation, loading the constant from the code segment.
For example:
0x4000bf52 l32r a5, 0x400003f4
As 0x400003f4 is in the ROM as well, the loaded value is known at analysis time, and is usually needed to understand the analyzed function. So I was looking for ways to have the actual value shown in the disassembly, and ultimately came up with the change in this PR.
This modifies the disassembly output by adding a comment to it:
0x4000bf52 l32r a5, 0x400003f4 ; refval: 0x0000ff00
Actually I'm not yet happy with the change though, there are some things to refine on it:
I'm looking for some feedback if this change is deemed worthy for further improvements, or I should just drop it in favor of a different approach.
Test plan
(Tested manually so far, I'll look for unit tests for the disassebly functionality.)