aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2021-08-06 21:52:41 +0200
committerTom de Vries <tdevries@suse.de>2021-08-06 21:52:41 +0200
commitcc6b3d766d6694d4c4ee14b75f6529365a443a98 (patch)
treeb8b6a3f69f731c3e5ecb9ed45fadf86d6caf91de /gdb
parentfd986183343387b019080d81838ad9371593b219 (diff)
downloadbinutils-cc6b3d766d6694d4c4ee14b75f6529365a443a98.zip
binutils-cc6b3d766d6694d4c4ee14b75f6529365a443a98.tar.gz
binutils-cc6b3d766d6694d4c4ee14b75f6529365a443a98.tar.bz2
[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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/dwarf2/read.c9
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp22
2 files changed, 11 insertions, 20 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index bac02b5..8dc2be6 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 ())
+ {
+ /* An empty constant pool implies that all symbol table entries are
+ empty. Make map->symbol_table.empty () == true. */
+ map->symbol_table
+ = offset_view (gdb::array_view<const gdb_byte> (symbol_table,
+ symbol_table));
+ }
+
return 1;
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp b/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp
index 4f2ac0f..e43f59e 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp
@@ -139,16 +139,7 @@ foreach_with_prefix ranges_sect {ranges rnglists} {
}
}
- if { $have_complaint } {
- pass $test
- } else {
- set index [have_index $lib1]
- if { $index == "gdb_index" } {
- kfail symtab/28159 $test
- } else {
- fail $test
- }
- }
+ gdb_assert { $have_complaint } $test
}
if { ! $readnow_p } {
@@ -164,16 +155,7 @@ foreach_with_prefix ranges_sect {ranges rnglists} {
gdb_load $lib1
set test "Zero address complaint - unrelocated - psymtab"
set have_complaint [regexp $re.* $gdb_file_cmd_msg]
- if { $have_complaint } {
- pass $test
- } else {
- set index [have_index $lib1]
- if { $index == "gdb_index" } {
- kfail symtab/28159 $test
- } else {
- fail $test
- }
- }
+ gdb_assert { $have_complaint } $test
}
if { ! $readnow_p } {