diff options
author | Ulrich Drepper <drepper@redhat.com> | 2008-01-12 07:15:51 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2008-01-12 07:15:51 +0000 |
commit | ebe0fcef1bbc8327d99b435ea346bba5858fd3bd (patch) | |
tree | 3ae58edc80dd78b82f2a7083c929fab4a9c66771 /libcpu | |
parent | fd47989094090138b0c857d067ac7ff05e7b6d91 (diff) | |
download | elfutils-ebe0fcef1bbc8327d99b435ea346bba5858fd3bd.tar.gz |
Minimal use of symbol callback functions.
Diffstat (limited to 'libcpu')
-rw-r--r-- | libcpu/ChangeLog | 7 | ||||
-rw-r--r-- | libcpu/i386_disasm.c | 15 |
2 files changed, 14 insertions, 8 deletions
diff --git a/libcpu/ChangeLog b/libcpu/ChangeLog index f4478795..e87f7573 100644 --- a/libcpu/ChangeLog +++ b/libcpu/ChangeLog @@ -1,9 +1,14 @@ 2008-01-11 Ulrich Drepper <drepper@redhat.com> - * i386_disasm.c (struct output)buffer): Add labelbuf, labelbufsize, + * i386_disasm.c (struct output_buffer): Remove symcb and symcbarg. + (i386_disasm): Remove appropriate initializers. + Use symcb to lookup symbol strings. + + * i386_disasm.c (struct output_buffer): Add labelbuf, labelbufsize, symaddr_use, and symaddr fields. (i386_disasm): Remove labelbuf and labelbufsize variables. Add back %e format. Implement %a and %l formats. + * i386_data.h (general_mod$r_m): Set symaddr_use and symaddr for %rip base addressing. diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c index 57a870f1..f8a06cc4 100644 --- a/libcpu/i386_disasm.c +++ b/libcpu/i386_disasm.c @@ -197,8 +197,6 @@ struct output_data const uint8_t *data; const uint8_t **param_start; const uint8_t *end; - DisasmGetSymCB_t symcb; - void *symcbarg; char *labelbuf; size_t labelbufsize; enum @@ -237,7 +235,6 @@ struct output_data } while (0) -#include <stdio.h> int i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr, const char *fmt, DisasmOutputCB_t outcb, DisasmGetSymCB_t symcb, @@ -260,9 +257,7 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr, .bufsize = bufsize, .bufcntp = &bufcnt, .param_start = ¶m_start, - .end = end, - .symcb = symcb, - .symcbarg = symcbarg + .end = end }; int retval = 0; @@ -840,11 +835,17 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr, // XXX Lookup symbol based on symaddr const char *symstr = NULL; + if (symcb != NULL + && symcb (0 /* XXX */, 0 /* XXX */, symaddr, + &output_data.labelbuf, + &output_data.labelbufsize, symcbarg) == 0) + symstr = output_data.labelbuf; size_t bufavail = bufsize - bufcnt; int r = 0; if (symstr != NULL) - r = snprintf (&buf[bufcnt], bufavail, "# %s", symstr); + r = snprintf (&buf[bufcnt], bufavail, "# <%s>", + symstr); else if (output_data.symaddr_use == addr_abs_always || output_data.symaddr_use == addr_rel_always) r = snprintf (&buf[bufcnt], bufavail, "# %#" PRIx64, |