aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2021-02-10 12:30:46 +0100
committerTom de Vries <tdevries@suse.de>2021-02-10 12:30:46 +0100
commit52ff20fe7ba8e8de2660339fff5308ed932e2b32 (patch)
tree4e690f3bfe0f2769938e5833d660da23074ca1a2 /binutils
parentee4c3d88019ed88c3110e22cda16891aed14f818 (diff)
downloadfsf-binutils-gdb-52ff20fe7ba8e8de2660339fff5308ed932e2b32.zip
fsf-binutils-gdb-52ff20fe7ba8e8de2660339fff5308ed932e2b32.tar.gz
fsf-binutils-gdb-52ff20fe7ba8e8de2660339fff5308ed932e2b32.tar.bz2
[binutils] Handle presence of both .debug_ranges and .debug_rnglists
With exec: ... $ g++ src/gdb/testsuite/gdb.cp/cpexprs.cc -gdwarf-5 -fdebug-types-section ... I run into: ... $ readelf -w a.out > READELF readelf: Error: Invalid range list entry type 126 readelf: Error: Invalid range list entry type 60 ... The executable contains both a .debug_rnglists section (for CU cpexprs.cc) and a .debug_ranges section (for other CUs, like crti.S). But when executing display_debug_ranges for say, section .debug_rnglists it also tries to use the range list references related to section .debug_ranges. Fix this by filtering out the .debug_range references when handling .debug_rnglists and vice versa. binutils/ChangeLog: 2021-02-10 Tom de Vries <tdevries@suse.de> PR binutils/27371 * dwarf.c (display_debug_ranges): Filter range lists according to section.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/dwarf.c17
2 files changed, 22 insertions, 1 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 0e59683..1d6b967 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2021-02-10 Tom de Vries <tdevries@suse.de>
+
+ PR binutils/27371
+ * dwarf.c (display_debug_ranges): Filter range lists according to
+ section.
+
2021-02-09 Tom de Vries <tdevries@suse.de>
PR binutils/27370
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index d6eb892..84d63f6 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -7673,7 +7673,15 @@ display_debug_ranges (struct dwarf_section *section,
num_range_list = 0;
for (i = 0; i < num_debug_info_entries; i++)
- num_range_list += debug_information [i].num_range_lists;
+ {
+ if (debug_information [i].dwarf_version < 5 && is_rnglists)
+ /* Skip .debug_rnglists reference. */
+ continue;
+ if (debug_information [i].dwarf_version >= 5 && !is_rnglists)
+ /* Skip .debug_range reference. */
+ continue;
+ num_range_list += debug_information [i].num_range_lists;
+ }
if (num_range_list == 0)
{
@@ -7692,6 +7700,13 @@ display_debug_ranges (struct dwarf_section *section,
debug_info *debug_info_p = &debug_information[i];
unsigned int j;
+ if (debug_information [i].dwarf_version < 5 && is_rnglists)
+ /* Skip .debug_rnglists reference. */
+ continue;
+ if (debug_information [i].dwarf_version >= 5 && !is_rnglists)
+ /* Skip .debug_range reference. */
+ continue;
+
for (j = 0; j < debug_info_p->num_range_lists; j++)
{
range_entry_fill->ranges_offset = debug_info_p->range_lists[j];