diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2020-06-02 20:25:02 +0100 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2020-07-22 17:57:24 +0100 |
commit | 437061996d8d25ba902903e15952cfc14257b839 (patch) | |
tree | fb385ed0087bb5f53706387960c5ea828e23a826 /libctf | |
parent | 9943fa3a7320158e209a0339a4022a8165e9d5a6 (diff) | |
download | gdb-437061996d8d25ba902903e15952cfc14257b839.zip gdb-437061996d8d25ba902903e15952cfc14257b839.tar.gz gdb-437061996d8d25ba902903e15952cfc14257b839.tar.bz2 |
libctf, types: allow ctf_type_reference of dynamic slices
One spot was missed when we rejigged ctf_update into ctf_serialize and
allowed all operations on dynamic containers: ctf_type_reference of
slices. A dynamic slice's vlen state is stored in the dtu_slice member,
so fetch it from there.
libctf/
* ctf-types.c (ctf_type_reference): Add support for dynamic slices.
Diffstat (limited to 'libctf')
-rw-r--r-- | libctf/ChangeLog | 4 | ||||
-rw-r--r-- | libctf/ctf-types.c | 15 |
2 files changed, 16 insertions, 3 deletions
diff --git a/libctf/ChangeLog b/libctf/ChangeLog index 598b93a..8dd6651 100644 --- a/libctf/ChangeLog +++ b/libctf/ChangeLog @@ -1,5 +1,9 @@ 2020-07-22 Nick Alcock <nick.alcock@oracle.com> + * ctf-types.c (ctf_type_reference): Add support for dynamic slices. + +2020-07-22 Nick Alcock <nick.alcock@oracle.com> + * ctf-create.c (ctf_serialize): Add cast. (ctf_add_slice): Likewise. diff --git a/libctf/ctf-types.c b/libctf/ctf-types.c index 35253cb..9c10905 100644 --- a/libctf/ctf-types.c +++ b/libctf/ctf-types.c @@ -680,10 +680,19 @@ ctf_type_reference (ctf_file_t *fp, ctf_id_t type) /* Slices store their type in an unusual place. */ case CTF_K_SLICE: { + ctf_dtdef_t *dtd; const ctf_slice_t *sp; - ssize_t increment; - (void) ctf_get_ctt_size (fp, tp, NULL, &increment); - sp = (const ctf_slice_t *) ((uintptr_t) tp + increment); + + if ((dtd = ctf_dynamic_type (ofp, type)) == NULL) + { + ssize_t increment; + + (void) ctf_get_ctt_size (fp, tp, NULL, &increment); + sp = (const ctf_slice_t *) ((uintptr_t) tp + increment); + } + else + sp = &dtd->dtd_u.dtu_slice; + return sp->cts_type; } default: |