]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
libctf, dump: correctly dump non-root-visible types
authorNick Alcock <nick.alcock@oracle.com>
Mon, 15 Jul 2024 18:39:48 +0000 (19:39 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Wed, 31 Jul 2024 20:02:04 +0000 (21:02 +0100)
The flag test when dumping non-root-visible tyeps was doubly wrong: the
flags word is a *bitfield* containing CTF_ADD_ROOT as one possible
value, so needs | and & testing, not just ==, and CTF_ADD_NONROOT is 0,
so cannot be tested for this way: one must check for the non-presence of
CTF_ADD_ROOT.

libctf/
* ctf-dump.c (ctf_dump_format_type): Fix non-root flag test.

libctf/ctf-dump.c

index 80a3b2652971b75df096a25ecfacfceb44f0e9b2..cd41996084d8a02bbc862d2a5811b15c1117e15d 100644 (file)
@@ -106,7 +106,7 @@ ctf_dump_format_type (ctf_dict_t *fp, ctf_id_t id, int flag)
       const char *idstr = "";
 
       id = new_id;
-      if (flag == CTF_ADD_NONROOT)
+      if (!(flag & CTF_ADD_ROOT))
        {
          nonroot_leader = "{";
          nonroot_trailer = "}";