libctf: create: structure and union member addition

There is one API addition here:

int ctf_add_member_bitfield (ctf_dict_t *, ctf_id_t souid,
                             const char *, ctf_id_t type,
                             unsigned long bit_offset,
                             int bit_width);

SoU addition handles the representational changes for bitfields and for
CTF_K_BIG structs (i.e. all structs you can add members to), errors out if
you add bitfields to structs that aren't created with the
CTF_ADD_STRUCT_BITFIELDS flag, and arranges to add padding as needed if
there is too much of a gap for the offsets to encode in one hop (that
part is still untested).
This commit is contained in:
Nick Alcock
2025-04-24 16:47:14 +01:00
parent cd8ea31666
commit 20e6f72dc7
5 changed files with 223 additions and 88 deletions

View File

@@ -812,6 +812,8 @@ extern char *ctf_str_append_noerr (char *, const char *);
extern ctf_id_t ctf_type_resolve_unsliced (ctf_dict_t *, ctf_id_t);
extern int ctf_type_kind_unsliced (ctf_dict_t *, ctf_id_t);
extern ssize_t ctf_type_align_natural (ctf_dict_t *fp, ctf_id_t prev_type,
ctf_id_t type, ssize_t bit_offset);
_libctf_printflike_ (1, 2)
extern void ctf_dprintf (const char *, ...);