mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-23 21:29:49 +00:00
Add asm.flags.prefix (true by default) ##disasm
* Drops the ;-- prefix in all the flags in the disasm * Evaluate switching to true, after testing iaito and other tools
This commit is contained in:
parent
52dba742f1
commit
ae53a1c45e
@ -3648,6 +3648,7 @@ R_API int r_core_config_init(RCore *core) {
|
||||
SETBPREF ("asm.optype", "false", "show opcode type next to the instruction bytes");
|
||||
SETBPREF ("asm.lines.fcn", "true", "show function boundary lines");
|
||||
SETBPREF ("asm.flags", "true", "show flags");
|
||||
SETBPREF ("asm.flags.prefix", "true", "show ;-- before the flags");
|
||||
SETICB ("asm.flags.maxname", 0, &cb_maxname, "maximum length of flag name with smart chopping");
|
||||
SETI ("asm.flags.limit", 0, "maximum number of flags to show in a single offset");
|
||||
SETBPREF ("asm.flags.right", "false", "show flags as comments at the right side of the disassembly");
|
||||
|
@ -127,6 +127,7 @@ typedef struct r_disasm_state_t {
|
||||
int linesout;
|
||||
int adistrick;
|
||||
bool asm_meta;
|
||||
bool flags_prefix;
|
||||
bool asm_xrefs_code;
|
||||
int asm_demangle;
|
||||
bool asm_instr;
|
||||
@ -849,6 +850,7 @@ static RDisasmState *ds_init(RCore *core) {
|
||||
ds->show_marks = r_config_get_i (core->config, "asm.marks");
|
||||
ds->show_noisy_comments = r_config_get_i (core->config, "asm.noisy");
|
||||
ds->pre = DS_PRE_NONE;
|
||||
ds->flags_prefix = r_config_get_b (ds->core->config, "asm.flags.prefix");
|
||||
ds->ocomment = NULL;
|
||||
ds->linesopts = 0;
|
||||
ds->lastfail = 0;
|
||||
@ -927,7 +929,7 @@ static void ds_reflines_init(RDisasmState *ds) {
|
||||
RAnal *anal = ds->core->anal;
|
||||
|
||||
lastaddr = UT64_MAX;
|
||||
int limit = r_config_get_i (ds->core->config, "asm.lines.limit");
|
||||
st64 limit = r_config_get_i (ds->core->config, "asm.lines.limit");
|
||||
const bool inlimit = (limit > 0 && ds->len < limit);
|
||||
|
||||
if (inlimit && (ds->show_lines_bb || ds->pj)) {
|
||||
@ -2553,23 +2555,29 @@ static void ds_show_flags(RDisasmState *ds, bool overlapped) {
|
||||
|
||||
if (ds->asm_demangle && flag->realname) {
|
||||
if (!strncmp (flag->name, "switch.", 7)) {
|
||||
r_cons_printf (FLAG_PREFIX"switch");
|
||||
if (ds->flags_prefix) {
|
||||
r_cons_printf (FLAG_PREFIX);
|
||||
}
|
||||
r_cons_printf ("switch:");
|
||||
} else if (!strncmp (flag->name, "case.", 5)) {
|
||||
if (nth > 0) {
|
||||
__preline_flag (ds, flag);
|
||||
}
|
||||
if (ds->flags_prefix) {
|
||||
r_cons_printf (FLAG_PREFIX);
|
||||
}
|
||||
if (!strncmp (flag->name + 5, "default", 7)) {
|
||||
r_cons_printf (FLAG_PREFIX "default:"); // %s:", flag->name);
|
||||
r_cons_printf ("default:"); // %s:", flag->name);
|
||||
r_str_ncpy (addr, flag->name + 5 + strlen ("default."), sizeof (addr));
|
||||
nth = 0;
|
||||
} else if (case_prev != case_start) {
|
||||
r_cons_printf (FLAG_PREFIX "case %d...%d:", case_start, case_prev);
|
||||
r_cons_printf ("case %d...%d:", case_start, case_prev);
|
||||
if (iter != uniqlist->head && iter != uniqlist->tail) {
|
||||
iter = iter->p;
|
||||
}
|
||||
case_start = case_current;
|
||||
} else {
|
||||
r_cons_printf (FLAG_PREFIX "case %d:", case_prev);
|
||||
r_cons_printf ("case %d:", case_prev);
|
||||
case_start = -1;
|
||||
}
|
||||
case_prev = case_current;
|
||||
@ -2589,7 +2597,9 @@ static void ds_show_flags(RDisasmState *ds, bool overlapped) {
|
||||
if (name) {
|
||||
r_str_ansi_filter (name, NULL, NULL, -1);
|
||||
if (!ds->flags_inline || nth == 0) {
|
||||
r_cons_printf (FLAG_PREFIX);
|
||||
if (ds->flags_prefix) {
|
||||
r_cons_printf (FLAG_PREFIX);
|
||||
}
|
||||
if (overlapped) {
|
||||
r_cons_printf ("%s(0x%08"PFMT64x")%s ",
|
||||
ds->show_color ? ds->color_offset : "", ds->at,
|
||||
|
@ -484,7 +484,7 @@ pd 3 @ 0x3ec1
|
||||
EOF
|
||||
EXPECT=<<EOF
|
||||
| 0x00003ec1 add rax, rbx
|
||||
| ;-- switch
|
||||
| ;-- switch:
|
||||
| 0x00003ec4 jmp rax ; switch table (275 cases) at 0x172d8
|
||||
| ;-- case 110: ; from 0x00003ec4
|
||||
| ; CODE XREF from main @ 0x3ec4(x)
|
||||
|
@ -147,7 +147,7 @@ EXPECT=<<EOF
|
||||
0x10000116e call sym.func.100004401
|
||||
0x100001179 str.1_ABCFGHLOPRSTUWabcdefghiklmnopqrstuvwx
|
||||
0x100001186 call sym.imp.getopt
|
||||
;-- switch
|
||||
;-- switch:
|
||||
0x100001233 str.CLICOLOR
|
||||
0x100001246 call sym.imp.setenv
|
||||
0x100001253 str.bin_ls
|
||||
|
Loading…
Reference in New Issue
Block a user