diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2025-04-03 15:04:59 +0100 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2025-04-03 15:04:59 +0100 |
commit | 85e17b0379c0d2150673f947bddec70fa75a6114 (patch) | |
tree | 401998f151a9f0472404a22f97159b2b3d606686 /libctf/ctf-dump.c | |
parent | 2c704841079ffa9618a440b3ca23ac4de3552e19 (diff) | |
download | binutils-85e17b0379c0d2150673f947bddec70fa75a6114.zip binutils-85e17b0379c0d2150673f947bddec70fa75a6114.tar.gz binutils-85e17b0379c0d2150673f947bddec70fa75a6114.tar.bz2 |
libctf, dump: reduce overqualification of variable names
We don't want the names in the variable-names list to be qualified
with their types: we only want the linkage, and the raw name. The
full type immediately follows anyway.
In the type list, qualify everything.
Tests adjusted.
Diffstat (limited to 'libctf/ctf-dump.c')
-rw-r--r-- | libctf/ctf-dump.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libctf/ctf-dump.c b/libctf/ctf-dump.c index ad43666..94eac10 100644 --- a/libctf/ctf-dump.c +++ b/libctf/ctf-dump.c @@ -614,6 +614,7 @@ ctf_dump_var (ctf_dict_t *fp, ctf_id_t type, { char *str; char *typestr; + int linkage; ctf_dump_state_t *state = arg; ctf_id_t otype = type; @@ -625,7 +626,11 @@ ctf_dump_var (ctf_dict_t *fp, ctf_id_t type, /* Specialized var dumper: only dump the linkage, not the type kind or anything related. */ - if ((typestr = ctf_type_aname (fp, type)) == NULL) + if ((linkage = ctf_type_linkage (fp, type)) < 0 + || asprintf (&typestr, "%s%s", linkage == 0 ? "static " + : (linkage == 2 ? "extern " : + (linkage == 1 ? "" : "(invalid linkage) ")), + ctf_type_name_raw (fp, type)) < 0) { ctf_err_warn (fp, 1, ctf_errno (fp), _("cannot format name dumping var 0x%lx"), type); |