* [Bug symtab/28159] [gdb/symtab] gdb generates .gdb_index with only empty hashtable entries, then fails to recognize it as empty
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 ` cvs-commit at gcc dot gnu.org
2021-08-06 22:23 ` vries at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-08-06 19:52 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28159
--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=cc6b3d766d6694d4c4ee14b75f6529365a443a98
commit cc6b3d766d6694d4c4ee14b75f6529365a443a98
Author: Tom de Vries <tdevries@suse.de>
Date: Fri Aug 6 21:52:41 2021 +0200
[gdb/symtab] Recognize .gdb_index symbol table with empty entries as empty
When reading a .gdb_index that contains a non-empty symbol table with only
empty entries, gdb doesn't recognize it as empty.
Fix this by recognizing that the constant pool is empty, and then setting
the
symbol table to empty.
Tested on x86_64-linux.
gdb/ChangeLog:
2021-08-01 Tom de Vries <tdevries@suse.de>
PR symtab/28159
* dwarf2/read.c (read_gdb_index_from_buffer): Handle symbol table
filled with empty entries.
gdb/testsuite/ChangeLog:
2021-08-01 Tom de Vries <tdevries@suse.de>
PR symtab/28159
* gdb.dwarf2/dw2-zero-range.exp: Remove kfail.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug symtab/28159] [gdb/symtab] gdb generates .gdb_index with only empty hashtable entries, then fails to recognize it as empty
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
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2021-08-06 22:23 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28159
--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #0)
> This shows two problems:
> - gdb generates such an index
Fixed by:
...
diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
index 4e00c716d91..5de07a6c07b 100644
--- a/gdb/dwarf2/index-write.c
+++ b/gdb/dwarf2/index-write.c
@@ -1385,6 +1385,9 @@ write_gdbindex (dwarf2_per_objfile *per_objfile, FILE
*out_file,
uniquify_cu_indices (&symtab);
data_buf symtab_vec, constant_pool;
+ if (symtab.n_elements == 0)
+ symtab.data.resize (0);
+
write_hash_table (&symtab, symtab_vec, constant_pool);
write_gdbindex_1(out_file, objfile_cu_list, types_cu_list, addr_vec,
...
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug symtab/28159] [gdb/symtab] gdb generates .gdb_index with only empty hashtable entries, then fails to recognize it as empty
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
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: tromey at sourceware dot org @ 2021-08-14 21:35 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28159
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org
--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
I wonder if gdb should refuse to write an empty index.
My psymtab rewrite branch does this, but maybe it
could be done upstream separately.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug symtab/28159] [gdb/symtab] gdb generates .gdb_index with only empty hashtable entries, then fails to recognize it as empty
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
` (2 preceding siblings ...)
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
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2021-08-24 12:18 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28159
--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom Tromey from comment #3)
> I wonder if gdb should refuse to write an empty index.
> My psymtab rewrite branch does this, but maybe it
> could be done upstream separately.
Conversely, I start to wonder why gdb refuses to read an empty index. If
that's an accurate representation of the debug info, why fall back to partial
symbols?
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug symtab/28159] [gdb/symtab] gdb generates .gdb_index with only empty hashtable entries, then fails to recognize it as empty
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
` (3 preceding siblings ...)
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
6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2021-08-26 12:39 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28159
--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #2)
> (In reply to Tom de Vries from comment #0)
> > This shows two problems:
> > - gdb generates such an index
>
> Fixed by:
> ...
> diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
> index 4e00c716d91..5de07a6c07b 100644
> --- a/gdb/dwarf2/index-write.c
> +++ b/gdb/dwarf2/index-write.c
> @@ -1385,6 +1385,9 @@ write_gdbindex (dwarf2_per_objfile *per_objfile, FILE
> *out_file,
> uniquify_cu_indices (&symtab);
>
> data_buf symtab_vec, constant_pool;
> + if (symtab.n_elements == 0)
> + symtab.data.resize (0);
> +
> write_hash_table (&symtab, symtab_vec, constant_pool);
>
> write_gdbindex_1(out_file, objfile_cu_list, types_cu_list, addr_vec,
> ...
Submitted here:
https://sourceware.org/pipermail/gdb-patches/2021-August/181673.html .
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug symtab/28159] [gdb/symtab] gdb generates .gdb_index with only empty hashtable entries, then fails to recognize it as empty
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
` (4 preceding siblings ...)
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
6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2021-08-30 14:10 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28159
--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
Committed:
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=34daac4b169da3cb9df3e8bac6347cae630a99dd
:
[gdb/symtab] Don't write .gdb_index symbol table with empty entries
author Tom de Vries <tdevries@suse.de>
Fri, 27 Aug 2021 15:14:49 +0000 (17:14 +0200)
committer Tom de Vries <tdevries@suse.de>
Fri, 27 Aug 2021 15:14:49 +0000 (17:14 +0200)
commit 34daac4b169da3cb9df3e8bac6347cae630a99dd
tree f3ce338b4bd3c8cf74e39c5376a0d20399a96ca8 tree
parent 426f7bbfd4179a5b81f87fa324a854c370e4b07a commit | diff
[gdb/symtab] Don't write .gdb_index symbol table with empty entries
When comparing the sizes of the index files generated for shlib
outputs/gdb.dwarf2/dw2-zero-range/shr1.sl, I noticed a large difference
between .debug_names:
...
$ gdb -q -batch $shlib -ex "save gdb-index -dwarf-5 ."
$ du -b -h shr1.sl.debug_names shr1.sl.debug_str
61 shr1.sl.debug_names
0 shr1.sl.debug_str
...
and .gdb_index:
...
$ gdb -q -batch $shlib -ex "save gdb-index ."
$ du -b -h shr1.sl.gdb-index
8.2K shr1.sl.gdb-index
...
The problem is that the .gdb_index contains a non-empty symbol table with only
empty entries.
Fix this by making the symbol table empty, such that we have instead:
...
$ du -b -h shr1.sl.gdb-index
184 shr1.sl.gdb-index
...
Tested on x86_64-linux.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug symtab/28159] [gdb/symtab] gdb generates .gdb_index with only empty hashtable entries, then fails to recognize it as empty
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
` (5 preceding siblings ...)
2021-08-30 14:10 ` vries at gcc dot gnu.org
@ 2021-08-30 14:11 ` vries at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2021-08-30 14:11 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28159
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |12.1
--- Comment #7 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #0)
> This shows two problems:
> - gdb generates such an index
> - gdb should recognize that such an index is empty
Both problems are now fixed, marking resolved-fixed.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread