diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2021-01-05 13:25:56 +0000 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2021-01-05 14:53:40 +0000 |
commit | b4b6ea46807ec9c01ed4f4f18a50840358d16c28 (patch) | |
tree | 538a4618b793ecaa88896e1a66ba9b28ba601734 /libctf | |
parent | 608a333d7d1ce111a4f69acea0ea6c7a2e81a766 (diff) | |
download | gdb-b4b6ea46807ec9c01ed4f4f18a50840358d16c28.zip gdb-b4b6ea46807ec9c01ed4f4f18a50840358d16c28.tar.gz gdb-b4b6ea46807ec9c01ed4f4f18a50840358d16c28.tar.bz2 |
libctf, ld: fix formatting of forwards to unions and enums
The type printer was unconditionally printing these as if they were
forwards to structs, even if they were forwards to unions or enums.
ld/ChangeLog
2021-01-05 Nick Alcock <nick.alcock@oracle.com>
* testsuite/ld-ctf/enum-forward.c: New test.
* testsuite/ld-ctf/enum-forward.c: New results.
libctf/ChangeLog
2021-01-05 Nick Alcock <nick.alcock@oracle.com>
* ctf-types.c (ctf_type_aname): Print forwards to unions and enums
properly.
Diffstat (limited to 'libctf')
-rw-r--r-- | libctf/ChangeLog | 5 | ||||
-rw-r--r-- | libctf/ctf-types.c | 21 |
2 files changed, 25 insertions, 1 deletions
diff --git a/libctf/ChangeLog b/libctf/ChangeLog index 4c62cf1..0aaf306 100644 --- a/libctf/ChangeLog +++ b/libctf/ChangeLog @@ -1,5 +1,10 @@ 2021-01-05 Nick Alcock <nick.alcock@oracle.com> + * ctf-types.c (ctf_type_aname): Print forwards to unions and enums + properly. + +2021-01-05 Nick Alcock <nick.alcock@oracle.com> + * ctf-impl.h (ctf_dict_t) <ctf_pptrtab>: New. <ctf_pptrtab_len>: New. <ctf_pptrtab_typemax>: New. diff --git a/libctf/ctf-types.c b/libctf/ctf-types.c index 6275be0..4129fbc 100644 --- a/libctf/ctf-types.c +++ b/libctf/ctf-types.c @@ -834,7 +834,6 @@ ctf_type_aname (ctf_dict_t *fp, ctf_id_t type) } break; case CTF_K_STRUCT: - case CTF_K_FORWARD: ctf_decl_sprintf (&cd, "struct %s", name); break; case CTF_K_UNION: @@ -843,6 +842,26 @@ ctf_type_aname (ctf_dict_t *fp, ctf_id_t type) case CTF_K_ENUM: ctf_decl_sprintf (&cd, "enum %s", name); break; + case CTF_K_FORWARD: + { + switch (ctf_type_kind_forwarded (fp, cdp->cd_type)) + { + case CTF_K_STRUCT: + ctf_decl_sprintf (&cd, "struct %s", name); + break; + case CTF_K_UNION: + ctf_decl_sprintf (&cd, "union %s", name); + break; + case CTF_K_ENUM: + ctf_decl_sprintf (&cd, "enum %s", name); + break; + default: + ctf_set_errno (fp, ECTF_CORRUPT); + ctf_decl_fini (&cd); + return NULL; + } + break; + } case CTF_K_VOLATILE: ctf_decl_sprintf (&cd, "volatile"); break; |