diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2021-03-18 12:37:52 +0000 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2021-03-18 12:40:41 +0000 |
commit | d7b1416ef2c46ee9b8bfe4e5ceb87b371d49504c (patch) | |
tree | 5ffb5632494d12c100d5c2891d00fa729149b3cd /libctf/ctf-impl.h | |
parent | 08c428aff4a793b63c7dd2229ae172879623e3a2 (diff) | |
download | gdb-d7b1416ef2c46ee9b8bfe4e5ceb87b371d49504c.zip gdb-d7b1416ef2c46ee9b8bfe4e5ceb87b371d49504c.tar.gz gdb-d7b1416ef2c46ee9b8bfe4e5ceb87b371d49504c.tar.bz2 |
libctf: types: unify code dealing with small-vs-large struct members
This completes the job of unifying what was once three separate code
paths full of duplication for every function dealing with querying the
properties of struct and union members. The dynamic code path was
already removed: this change removes the distinction between small and
large members, by adding a helper that copies out members from the vlen,
expanding small members into large ones as it does so.
This makes it possible to have *more* representations of things like
structure members without needing to change the querying functions at
all. It also lets us check for buffer overruns more effectively,
verifying that we don't accidentally overrun the end of the vlen in
either the dynamic or static type case.
libctf/ChangeLog
2021-03-18 Nick Alcock <nick.alcock@oracle.com>
* ctf-impl.h (ctf_next_t) <ctn_tp>: New.
<u.ctn_mp>: Remove.
<u.ctn_lmp>: Remove.
<u.ctn_vlen>: New.
* ctf-types.c (ctf_struct_member): New.
(ctf_member_next): Use it, dropping separate large/small code paths.
(ctf_type_align): Likewise.
(ctf_member_info): Likewise.
(ctf_type_rvisit): Likewise.
Diffstat (limited to 'libctf/ctf-impl.h')
-rw-r--r-- | libctf/ctf-impl.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libctf/ctf-impl.h b/libctf/ctf-impl.h index 87dd03b..ad4af32 100644 --- a/libctf/ctf-impl.h +++ b/libctf/ctf-impl.h @@ -530,6 +530,7 @@ struct ctf_next ctf_id_t ctn_type; ssize_t ctn_size; ssize_t ctn_increment; + const ctf_type_t *ctn_tp; uint32_t ctn_n; /* Some iterators contain other iterators, in addition to their other @@ -542,8 +543,7 @@ struct ctf_next members, and the structure, variable and enum members, etc. */ union { - const ctf_member_t *ctn_mp; - const ctf_lmember_t *ctn_lmp; + unsigned char *ctn_vlen; const ctf_enum_t *ctn_en; const ctf_dvdef_t *ctn_dvd; ctf_next_hkv_t *ctn_sorted_hkv; |