Skip to content
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

Demangle flags symbols #3915

Merged
merged 4 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions librz/core/disasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2349,7 +2349,7 @@ static void ds_show_flags(RzDisasmState *ds, bool overlapped) {
}
} else {
if (outline) {
rz_cons_printf("%s", flag->name);
rz_cons_printf(FLAG_PREFIX "%s", flag->name);
} else {
rz_cons_printf("%s%s", comma, flag->name);
}
Expand Down Expand Up @@ -3418,8 +3418,10 @@ static void ds_print_fcn_name(RzDisasmState *ds) {
if (ds->core->vmode && (rz_str_startswith(flag->name, "sym.") || (flag_sym = rz_flag_get_by_spaces(ds->core->flags, ds->analysis_op.jump, RZ_FLAGS_FS_SYMBOLS, NULL))) && flag_sym->demangled) {
return;
}
ds_begin_comment(ds);
ds_comment(ds, true, "; %s", flag->name);
if (ds->core->flags->realnames && flag->realname) {
ds_begin_comment(ds);
ds_comment(ds, true, "; %s", flag->name);
}
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/db/analysis/riscv
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ e asm.pseudo=1
pd 5
EOF
EXPECT=<<EOF
0x00010178 ef00c01f jmp ra ; sym.printf
0x00010178 ef00c01f jmp ra
0x0001017c 930784fe a5 = s0 - 24
0x00010180 93850700 a1 = a5
0x00010184 b7170200 a5 = 0x21
Expand Down
12 changes: 12 additions & 0 deletions test/db/cmd/cmd_flags
Original file line number Diff line number Diff line change
Expand Up @@ -719,3 +719,15 @@ EXPECT=<<EOF
..bss
EOF
RUN

NAME=pd shows real names and flag name in comments
FILE=bins/elf/demangle-test-cpp
CMDS=<<EOF
pd 1 @ 0x000011ef @e:asm.flags.real=true
pd 1 @ 0x000011ef @e:asm.flags.real=false
EOF
EXPECT=<<EOF
0x000011ef call std::vector<int, std::allocator<int> >::vector() ; method.std::vector_int__std::allocator_int___.vector
0x000011ef call method.std::vector_int__std::allocator_int___.vector
EOF
RUN
Loading