aboutsummaryrefslogtreecommitdiff
path: root/libctf
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2020-06-02 20:28:16 +0100
committerNick Alcock <nick.alcock@oracle.com>2020-07-22 17:57:27 +0100
commitab769488e75272c3cbea4626a346fd0c336b2de6 (patch)
treef8df0e4cc998210af7387454f4e72bdd2c55979c /libctf
parent2484ca436ac68716636a7aca3826bca3cda243a4 (diff)
downloadgdb-ab769488e75272c3cbea4626a346fd0c336b2de6.zip
gdb-ab769488e75272c3cbea4626a346fd0c336b2de6.tar.gz
gdb-ab769488e75272c3cbea4626a346fd0c336b2de6.tar.bz2
libctf, create: member names of "" and NULL should be the same
This matters for the case of unnamed bitfields, whose names are the null string. These are special in that they are the only members whose "names" are allowed to be duplicated in a single struct, but we were only handling this for the case where name == NULL. Translate "" to NULL to help callers. libctf/ * ctf-create.c (ctf_add_member_offset): Support names of "" as if they were the null pointer.
Diffstat (limited to 'libctf')
-rw-r--r--libctf/ChangeLog5
-rw-r--r--libctf/ctf-create.c3
2 files changed, 8 insertions, 0 deletions
diff --git a/libctf/ChangeLog b/libctf/ChangeLog
index 61aebd1..acff0b1 100644
--- a/libctf/ChangeLog
+++ b/libctf/ChangeLog
@@ -1,5 +1,10 @@
2020-07-22 Nick Alcock <nick.alcock@oracle.com>
+ * ctf-create.c (ctf_add_member_offset): Support names of ""
+ as if they were the null pointer.
+
+2020-07-22 Nick Alcock <nick.alcock@oracle.com>
+
* ctf-open.c (init_types): Remove typeless CTF_K_FORWARD
special-casing.
diff --git a/libctf/ctf-create.c b/libctf/ctf-create.c
index bc0ad80..848e725 100644
--- a/libctf/ctf-create.c
+++ b/libctf/ctf-create.c
@@ -1371,6 +1371,9 @@ ctf_add_member_offset (ctf_file_t *fp, ctf_id_t souid, const char *name,
if (dtd == NULL)
return (ctf_set_errno (fp, ECTF_BADID));
+ if (name != NULL && name[0] == '\0')
+ name = NULL;
+
kind = LCTF_INFO_KIND (fp, dtd->dtd_data.ctt_info);
root = LCTF_INFO_ISROOT (fp, dtd->dtd_data.ctt_info);
vlen = LCTF_INFO_VLEN (fp, dtd->dtd_data.ctt_info);