public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] [gdb/symtab] Dump qualified name of cooked_index_entry
@ 2023-08-10 16:07 Tom de Vries
  2023-08-10 16:07 ` [PATCH v2 2/2] [gdb/symtab] Fix off-by-one error in cooked_indexer::recurse Tom de Vries
  2023-08-10 17:46 ` [PATCH v2 1/2] [gdb/symtab] Dump qualified name of cooked_index_entry Tom Tromey
  0 siblings, 2 replies; 4+ messages in thread
From: Tom de Vries @ 2023-08-10 16:07 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

When doing "maint print objfiles" for the exec of test-case
gdb.dwarf2/pr13961.exp, we get:
...
    [25] ((cooked_index_entry *) 0x37b25d0)
    name:       foo
    canonical:  foo
    DWARF tag:  DW_TAG_class_type
    flags:      0x0 []
    DIE offset: 0x2a
    parent:     ((cooked_index_entry *) 0)

    [26] ((cooked_index_entry *) 0x37b2630)
    name:       foo
    canonical:  foo
    DWARF tag:  DW_TAG_class_type
    flags:      0x0 []
    DIE offset: 0x25
    parent:     ((cooked_index_entry *) 0x37b25d0) [foo]
...

By following the parent links in the text, we can conclude that the qualified
name of DIE 0x25 is foo::foo (which is incorrect, that's PR symtab/30739).

But it's not evident, and also hard to verify in a test-case.

Add dumping of the qualified name, such that we have:
...
    [25] ((cooked_index_entry *) 0x333b5d0)
    name:       foo
    canonical:  foo
    qualified:  foo
    DWARF tag:  DW_TAG_class_type
    flags:      0x0 []
    DIE offset: 0x2a
    parent:     ((cooked_index_entry *) 0)

    [26] ((cooked_index_entry *) 0x333b630)
    name:       foo
    canonical:  foo
    qualified:  foo::foo
    DWARF tag:  DW_TAG_class_type
    flags:      0x0 []
    DIE offset: 0x25
    parent:     ((cooked_index_entry *) 0x333b5d0) [foo]
...

Tested on x86_64-linux.
---
 gdb/dwarf2/cooked-index.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c
index 92ef0e35c5e..351f0016402 100644
--- a/gdb/dwarf2/cooked-index.c
+++ b/gdb/dwarf2/cooked-index.c
@@ -565,6 +565,8 @@ cooked_index::get_main () const
 void
 cooked_index::dump (gdbarch *arch) const
 {
+  auto_obstack temp_storage;
+
   /* Ensure the index is done building.  */
   this->wait ();
 
@@ -579,6 +581,7 @@ cooked_index::dump (gdbarch *arch) const
       gdb_printf ("    [%zu] ((cooked_index_entry *) %p)\n", i++, entry);
       gdb_printf ("    name:       %s\n", entry->name);
       gdb_printf ("    canonical:  %s\n", entry->canonical);
+      gdb_printf ("    qualified:  %s\n", entry->full_name (&temp_storage, false));
       gdb_printf ("    DWARF tag:  %s\n", dwarf_tag_name (entry->tag));
       gdb_printf ("    flags:      %s\n", to_string (entry->flags).c_str ());
       gdb_printf ("    DIE offset: 0x%" PRIx64 "\n",

base-commit: 67bed49ec852aee39172fc867a89ec78c4903883
-- 
2.35.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-10 17:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-10 16:07 [PATCH v2 1/2] [gdb/symtab] Dump qualified name of cooked_index_entry Tom de Vries
2023-08-10 16:07 ` [PATCH v2 2/2] [gdb/symtab] Fix off-by-one error in cooked_indexer::recurse Tom de Vries
2023-08-10 17:46   ` Tom Tromey
2023-08-10 17:46 ` [PATCH v2 1/2] [gdb/symtab] Dump qualified name of cooked_index_entry Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).