diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2025-04-25 21:22:20 +0100 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2025-04-25 21:23:08 +0100 |
commit | 8586d4d1fd6b405831bc4b95c658f596a17b00cf (patch) | |
tree | 0e725635120aa66fa69a0a7f9a020fc4f5f026c8 /libctf | |
parent | fa2ed703f76e85111b520d81fa990f4c4cd9f88f (diff) | |
download | binutils-8586d4d1fd6b405831bc4b95c658f596a17b00cf.zip binutils-8586d4d1fd6b405831bc4b95c658f596a17b00cf.tar.gz binutils-8586d4d1fd6b405831bc4b95c658f596a17b00cf.tar.bz2 |
libctf: dump: dump struct-based bitfields
Diffstat (limited to 'libctf')
-rw-r--r-- | libctf/ctf-dump.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/libctf/ctf-dump.c b/libctf/ctf-dump.c index d318b57..f76dec9 100644 --- a/libctf/ctf-dump.c +++ b/libctf/ctf-dump.c @@ -723,12 +723,26 @@ ctf_dump_member (ctf_dict_t *fp, const char *name, ctf_id_t id, | CTF_FT_ID)) == NULL) return -1; /* errno is set for us. */ - if (asprintf (&bit, "[0x%lx] %s: %s\n", offset, name, typestr) < 0) + if (asprintf (&bit, "[0x%lx] %s:", offset, name) < 0) goto oom; + *state->cdm_str = str_append (*state->cdm_str, bit); + free (bit); + + if (bit_width > 0) + { + if (asprintf (&bit, "%i:", bit_width) < 0) + goto oom; + *state->cdm_str = str_append (*state->cdm_str, bit); + free (bit); + } + if (asprintf (&bit, " %s\n", typestr) < 0) + goto oom; *state->cdm_str = str_append (*state->cdm_str, bit); + free (typestr); free (bit); + typestr = NULL; bit = NULL; |