mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-01 00:51:19 +00:00
Fix cpp names demangling
This commit is contained in:
parent
3f894a465a
commit
8f4b2cdf5b
@ -75,11 +75,19 @@ R_API char *r_bin_demangle_java(const char *str) {
|
||||
|
||||
R_API char *r_bin_demangle_cxx(const char *str) {
|
||||
char *out;
|
||||
int flags = DMGL_TYPES | DMGL_PARAMS | DMGL_ANSI | DMGL_VERBOSE; // | DMGL_RET_POSTFIX | DMGL_TYPES;
|
||||
int flags = DMGL_NO_OPTS; // DMGL_TYPES | DMGL_PARAMS | DMGL_ANSI | DMGL_VERBOSE; // | DMGL_RET_POSTFIX | DMGL_TYPES;
|
||||
if (*str==str[1] && *str=='_') str++;
|
||||
else if (!strncmp (str, "__symbol_stub1_", 15))
|
||||
str += 15;
|
||||
else if (!strncmp (str, "sym.imp.", 8))
|
||||
str += 8;
|
||||
else if (!strncmp (str, "imp.", 4))
|
||||
str += 4;
|
||||
out = cplus_demangle_v3 (str, flags);
|
||||
|
||||
if (out)
|
||||
r_str_replace_char (out, ' ', 0);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
@ -774,6 +774,15 @@ static int bin_symbols (RCore *r, int mode, ut64 baddr, ut64 laddr, int va, ut64
|
||||
r_anal_hint_set_bits (r->anal, addr, 16);
|
||||
}
|
||||
|
||||
if (r_config_get_i (r->config, "asm.demangle")) {
|
||||
char *demname = r_bin_demangle (r->bin->cur, name);
|
||||
|
||||
if (demname) {
|
||||
free (name);
|
||||
name = demname;
|
||||
}
|
||||
}
|
||||
|
||||
r_name_filter (name, 80);
|
||||
if (cname) {
|
||||
RFlagItem *flag_item = NULL;
|
||||
|
@ -769,6 +769,7 @@ R_API int r_core_config_init(RCore *core) {
|
||||
SETICB("asm.bits", 32, &cb_asmbits, "Word size in bits at assembler");
|
||||
SETPREF("asm.functions", "true", "Show functions in disassembly");
|
||||
SETPREF("asm.xrefs", "true", "Show xrefs in disassembly");
|
||||
SETPREF("asm.demangle", "false", "Show demangled symbols");
|
||||
#if 0
|
||||
r_config_set (cfg, "asm.offseg", "false");
|
||||
r_config_desc (cfg, "asm.offseg", "Show offsets as in 16 bit segment addressing mode");
|
||||
|
@ -8,6 +8,8 @@
|
||||
static int r_name_validate_char(const char ch) {
|
||||
if ((ch>='a' && ch<='z') || (ch>='A' && ch<='Z') || (ch>='0' && ch<='9'))
|
||||
return R_TRUE;
|
||||
if (isprint (ch))
|
||||
return R_TRUE;
|
||||
switch (ch) {
|
||||
case '.':
|
||||
case '_':
|
||||
|
Loading…
Reference in New Issue
Block a user