libctf: create: non-root-visible types should not appear in name tables
authorNick Alcock <nick.alcock@oracle.com>
Mon, 21 Oct 2019 10:27:43 +0000 (11:27 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Fri, 26 Jun 2020 14:56:39 +0000 (15:56 +0100)
commitfe4c2d55634c700ba527ac4183e05c66e9f93c62
tree67eeb7d1fa76d860f2d2473eddc9c7f4533cc6c9
parent094e34f22146ad53eb93da22e480cab428bd23b5
libctf: create: non-root-visible types should not appear in name tables

We were accidentally interning newly-added and newly-opened
non-root-visible types into name tables, and removing names from name
tables when such types were removed.  This is very wrong: the whole
point of non-root-visible types is they do not go in name tables and
cannot be looked up by name.  This bug made non-root-visible types
basically identical to root-visible types, right back to the earliest
days of libctf in the Solaris era.

libctf/
* ctf-open.c (init_types): Only intern root-visible types.
* ctf-create.c (ctf_dtd_insert): Likewise.
(ctf_dtd_delete): Only remove root-visible types.
(ctf_rollback): Likewise.
(ctf_add_generic): Adjust.
(ctf_add_struct_sized): Adjust comment.
(ctf_add_union_sized): Likewise.
(ctf_add_enum): Likewise.
* ctf-impl.h (ctf_dtd_insert): Adjust prototype.
libctf/ChangeLog
libctf/ctf-create.c
libctf/ctf-impl.h
libctf/ctf-open.c