public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/28159] New: [gdb/symtab] gdb generates .gdb_index with only empty hashtable entries, then fails to recognize it as empty
@ 2021-08-01 11:26 vries at gcc dot gnu.org
  2021-08-06 19:52 ` [Bug symtab/28159] " cvs-commit at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2021-08-01 11:26 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28159

            Bug ID: 28159
           Summary: [gdb/symtab] gdb generates .gdb_index with only empty
                    hashtable entries, then fails to recognize it as empty
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

While working on the test-case for PR28004, I ran the test-case with target
boards cc-with-debug-names and cc-with-gdb-index.

I noticed a difference in behaviour between the two:
- in the .debug_names case, the index was found to be empty, and
  consequently gdb falls back on partial symbols
- in the .gdb_index case, the index was not found to be empty

I debugged this and found that this was caused by the .gdb_index having a hash
table of 8192 bytes, all 0, in other words, it's filled with empty entries.

This shows two problems:
- gdb generates such an index
- gdb should recognize that such an index is empty

The second problem is fixed by:
...
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index de84c47b626..3f9c017360a 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -2777,6 +2777,15 @@ to use the section anyway."),
   ++i;
   map->constant_pool = buffer.slice (metadata[i]);

+  if (map->constant_pool.empty () && !map->symbol_table.empty ())
+    {
+      map->symbol_table
+       = offset_view (gdb::array_view<const gdb_byte> (symbol_table,
+                                                       symbol_table));
+    }
+
   return 1;
 }

...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2021-08-30 14:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-01 11:26 [Bug symtab/28159] New: [gdb/symtab] gdb generates .gdb_index with only empty hashtable entries, then fails to recognize it as empty vries at gcc dot gnu.org
2021-08-06 19:52 ` [Bug symtab/28159] " cvs-commit at gcc dot gnu.org
2021-08-06 22:23 ` vries at gcc dot gnu.org
2021-08-14 21:35 ` tromey at sourceware dot org
2021-08-24 12:18 ` vries at gcc dot gnu.org
2021-08-26 12:39 ` vries at gcc dot gnu.org
2021-08-30 14:10 ` vries at gcc dot gnu.org
2021-08-30 14:11 ` vries at gcc dot gnu.org

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).