From: Nick Alcock Date: Fri, 25 Apr 2025 20:22:20 +0000 (+0100) Subject: libctf: dump: dump struct-based bitfields X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8586d4d1fd6b405831bc4b95c658f596a17b00cf;p=thirdparty%2Fbinutils-gdb.git libctf: dump: dump struct-based bitfields --- diff --git a/libctf/ctf-dump.c b/libctf/ctf-dump.c index d318b576a3d..f76dec97fb6 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;