mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-27 15:10:53 +00:00
Avoid trailing spaces for unnamed symbols and use shorter reloc type names
* Do not flag unnamed symbols to avoid messy disasm outputs * Hide symbol flags with paddr=0
This commit is contained in:
parent
91a7f9b196
commit
ae814bc438
@ -2652,9 +2652,9 @@ static void fill_symbol_bind_and_type (struct r_bin_elf_symbol_t *ret, Elf_(Sym)
|
||||
}
|
||||
switch (ELF_ST_TYPE (sym->st_info)) {
|
||||
case STT_NOTYPE: s_type ("NOTYPE"); break;
|
||||
case STT_OBJECT: s_type ("OBJECT"); break;
|
||||
case STT_OBJECT: s_type ("OBJ"); break;
|
||||
case STT_FUNC: s_type ("FUNC"); break;
|
||||
case STT_SECTION: s_type ("SECTION"); break;
|
||||
case STT_SECTION: s_type ("SECT"); break;
|
||||
case STT_FILE: s_type ("FILE"); break;
|
||||
case STT_COMMON: s_type ("COMMON"); break;
|
||||
case STT_TLS: s_type ("TLS"); break;
|
||||
@ -2663,7 +2663,7 @@ static void fill_symbol_bind_and_type (struct r_bin_elf_symbol_t *ret, Elf_(Sym)
|
||||
case STT_HIOS: s_type ("HIOS"); break;
|
||||
case STT_LOPROC: s_type ("LOPROC"); break;
|
||||
case STT_HIPROC: s_type ("HIPROC"); break;
|
||||
default: s_type ("UNKNOWN");
|
||||
default: s_type ("UNK");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1679,7 +1679,7 @@ static const char *getPrefixFor(const char *s) {
|
||||
if (!strcmp (s, "NOTYPE")) {
|
||||
return "loc";
|
||||
}
|
||||
if (!strcmp (s, "OBJECT")) {
|
||||
if (!strcmp (s, "OBJ")) {
|
||||
return "obj";
|
||||
}
|
||||
}
|
||||
@ -1879,20 +1879,24 @@ static int bin_symbols_internal(RCore *r, int mode, ut64 laddr, int va, ut64 at,
|
||||
} else {
|
||||
const char *fn, *n;
|
||||
RFlagItem *fi;
|
||||
n = sn.demname ? sn.demname : sn.name;
|
||||
fn = sn.demflag ? sn.demflag : sn.nameflag;
|
||||
char *fnp = (r->bin->prefix) ?
|
||||
r_str_newf ("%s.%s", r->bin->prefix, fn):
|
||||
strdup (fn);
|
||||
fi = r_flag_set (r->flags, fnp, addr, symbol->size);
|
||||
if (fi) {
|
||||
r_flag_item_set_realname (fi, n);
|
||||
} else {
|
||||
if (fn) {
|
||||
eprintf ("[Warning] Can't find flag (%s)\n", fn);
|
||||
if (*sn.name && symbol->paddr) {
|
||||
n = sn.demname ? sn.demname : sn.name;
|
||||
fn = sn.demflag ? sn.demflag : sn.nameflag;
|
||||
char *fnp = (r->bin->prefix) ?
|
||||
r_str_newf ("%s.%s", r->bin->prefix, fn):
|
||||
strdup (fn);
|
||||
fi = r_flag_set (r->flags, fnp, addr, symbol->size);
|
||||
if (fi) {
|
||||
r_flag_item_set_realname (fi, n);
|
||||
} else {
|
||||
if (fn) {
|
||||
eprintf ("[Warning] Can't find flag (%s)\n", fn);
|
||||
}
|
||||
}
|
||||
free (fnp);
|
||||
} else {
|
||||
// we dont want unnamed symbols to be flagged
|
||||
}
|
||||
free (fnp);
|
||||
}
|
||||
if (sn.demname) {
|
||||
r_meta_add (r->anal, R_META_TYPE_COMMENT,
|
||||
@ -1952,12 +1956,16 @@ static int bin_symbols_internal(RCore *r, int mode, ut64 laddr, int va, ut64 at,
|
||||
r->bin->prefix, name, symbol->size, addr);
|
||||
}
|
||||
} else {
|
||||
if (symbol->dup_count) {
|
||||
r_cons_printf ("f sym.%s_%d %u 0x%08"PFMT64x"\n",
|
||||
name, symbol->dup_count, symbol->size, addr);
|
||||
if (*name) {
|
||||
if (symbol->dup_count) {
|
||||
r_cons_printf ("f sym.%s_%d %u 0x%08"PFMT64x"\n",
|
||||
name, symbol->dup_count, symbol->size, addr);
|
||||
} else {
|
||||
r_cons_printf ("f sym.%s %u 0x%08"PFMT64x"\n",
|
||||
name, symbol->size, addr);
|
||||
}
|
||||
} else {
|
||||
r_cons_printf ("f sym.%s %u 0x%08"PFMT64x"\n",
|
||||
name, symbol->size, addr);
|
||||
// we dont want unnamed symbol flags
|
||||
}
|
||||
}
|
||||
binfile = r_core_bin_cur (r);
|
||||
@ -1986,10 +1994,10 @@ static int bin_symbols_internal(RCore *r, int mode, ut64 laddr, int va, ut64 at,
|
||||
const char *name = r_str_get (sn.demname? sn.demname: symbol->name);
|
||||
// const char *fwd = r_str_get (symbol->forwarder);
|
||||
r_cons_printf ("%03u 0x%08"PFMT64x" 0x%08"PFMT64x" "
|
||||
"%6s %6s %4d %s\n",
|
||||
"%6s %6s %4d%s%s\n",
|
||||
symbol->ordinal,
|
||||
symbol->paddr, addr, bind, type,
|
||||
symbol->size, name);
|
||||
symbol->size, *name? " ": "", name);
|
||||
// r_cons_printf ("vaddr=0x%08"PFMT64x" paddr=0x%08"PFMT64x" ord=%03u "
|
||||
// "fwd=%s sz=%u bind=%s type=%s name=%s\n",
|
||||
// addr, symbol->paddr, symbol->ordinal, fwd,
|
||||
|
Loading…
Reference in New Issue
Block a user