diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2019-06-27 13:15:37 +0100 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2019-07-01 11:05:59 +0100 |
commit | c550e7ba937e6a5e04c17275efc362a74f8fd1b1 (patch) | |
tree | dc5fcab486d821c4f7664b80417224c37d14ed52 /libctf | |
parent | 900e33b9cf45dd70012af7fc509119edebb93339 (diff) | |
download | gdb-c550e7ba937e6a5e04c17275efc362a74f8fd1b1.zip gdb-c550e7ba937e6a5e04c17275efc362a74f8fd1b1.tar.gz gdb-c550e7ba937e6a5e04c17275efc362a74f8fd1b1.tar.bz2 |
libctf: disambiguate hex output in dumps
We were sometimes printing hex values without prefixing them with '0x',
leading to confusion about what base the numbers were actually in.
libctf/
* ctf-dump.c (ctf_dump_format_type): Prefix hex strings with 0x.
(ctf_dump_funcs): Likewise.
Diffstat (limited to 'libctf')
-rw-r--r-- | libctf/ChangeLog | 5 | ||||
-rw-r--r-- | libctf/ctf-dump.c | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/libctf/ChangeLog b/libctf/ChangeLog index 2324aeb..d91abd2 100644 --- a/libctf/ChangeLog +++ b/libctf/ChangeLog @@ -1,3 +1,8 @@ +2019-06-28 Nick Alcock <nick.alcock@oracle.com> + + * ctf-dump.c (ctf_dump_format_type): Prefix hex strings with 0x. + (ctf_dump_funcs): Likewise. + 2019-06-19 Nick Alcock <nick.alcock@oracle.com> * ctf-open-bfd.c: Add swap.h and ctf-endian.h. diff --git a/libctf/ctf-dump.c b/libctf/ctf-dump.c index 3dac435..0e8ab20 100644 --- a/libctf/ctf-dump.c +++ b/libctf/ctf-dump.c @@ -121,7 +121,7 @@ ctf_dump_format_type (ctf_file_t *fp, ctf_id_t id) } else { - if (asprintf (&bit, " %lx: %s (size %lx)", id, buf[0] == '\0' ? + if (asprintf (&bit, " %lx: %s (size 0x%lx)", id, buf[0] == '\0' ? "(nameless)" : buf, (unsigned long) ctf_type_size (fp, id)) < 0) goto oom; @@ -280,12 +280,12 @@ ctf_dump_funcs (ctf_file_t *fp, ctf_dump_state_t *state) sym_name = ctf_lookup_symbol_name (fp, i); if (sym_name[0] == '\0') { - if (asprintf (&bit, "%lx ", (unsigned long) i) < 0) + if (asprintf (&bit, "0x%lx ", (unsigned long) i) < 0) goto oom; } else { - if (asprintf (&bit, "%s (%lx) ", sym_name, (unsigned long) i) < 0) + if (asprintf (&bit, "%s (0x%lx) ", sym_name, (unsigned long) i) < 0) goto oom; } str = ctf_str_append (str, bit); |