-
-
Notifications
You must be signed in to change notification settings - Fork 837
Added the disass-style
command to the debugger
#2907
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
Added the disass-style
command to the debugger
#2907
Conversation
The command will set the disassembler to either output decimal or hex representations of immediates. This is to make disassembly more clear so you don't have to convert values in a different tool.
First off: your editor appears to use soft tabs. Please use hard tabs to avoid causing reindentation issues. Second: please use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be good to merge after fixing these 3 issues.
Co-authored-by: Vicki Pfau <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More nits, sorry.
} else { | ||
written = snprintf(buffer, blen, "$%02X", op.immediate); | ||
if(disassemblyStyle == DISASSEMBLY_STYLE_HEX) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(disassemblyStyle == DISASSEMBLY_STYLE_HEX) { | |
if (disassemblyStyle == DISASSEMBLY_STYLE_HEX) { |
@@ -45,6 +47,15 @@ static const char* _armConditions[] = { | |||
"nv" | |||
}; | |||
|
|||
static int _decodeImmediate(int imm, enum mDisassemblyStyle disassemblyStyle, char* buffer, int blen) { | |||
switch(disassemblyStyle) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switch(disassemblyStyle) { | |
switch (disassemblyStyle) { |
Also, I meant having both the default and explicit cases separately listed, but it should probably be done with an if/else like you have in the SM83 implementation.
if (disassemblyStyle == DISASSEMBLY_STYLE_HEX) { | ||
written = snprintf(buffer, blen, "$%04X", pc + (int8_t) op.immediate); | ||
} else { | ||
written = snprintf(buffer, blen, "%05i", pc + (int8_t) op.immediate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
written = snprintf(buffer, blen, "%05i", pc + (int8_t) op.immediate); | |
written = snprintf(buffer, blen, "%i", pc + (int8_t) op.immediate); |
if(disassemblyStyle == DISASSEMBLY_STYLE_HEX) { | ||
written = snprintf(buffer, blen, "$%02X", pc + (int8_t) op.immediate); | ||
} else { | ||
written = snprintf(buffer, blen, "%03i", pc + (int8_t) op.immediate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
written = snprintf(buffer, blen, "%03i", pc + (int8_t) op.immediate); | |
written = snprintf(buffer, blen, "%i", pc + (int8_t) op.immediate); |
Any updates on this PR? |
The command will set the disassembler to either output decimal or hex representations of immediates. This is to make disassembly more clear so you don't have to convert values in a different tool. The command works on both ARM and sm83 code. This commit was originally made to solve #2553. Unfortunately that issue was actually invalid. However I already had the functionality of changing between decimal and hex for immediates implemented, so I added a command that would control it.