bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/21319] New: readelf --debug-dump=gdb_index fails to dump v


From: john.delsignore at roguewave dot com
Subject: [Bug binutils/21319] New: readelf --debug-dump=gdb_index fails to dump valid address tables
Date: Mon, 27 Mar 2017 15:52:12 +0000

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

            Bug ID: 21319
           Summary: readelf --debug-dump=gdb_index fails to dump valid
                    address tables
           Product: binutils
           Version: 2.28
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: john.delsignore at roguewave dot com
  Target Milestone: ---

Created attachment 9950
  --> https://sourceware.org/bugzilla/attachment.cgi?id=9950&action=edit
Compressed tar file with ELF executable file containing a .gdb_index that
demonstrates the readelf bug, and a patch to dwarf.c that fixes the bug.

readelf --debug-dump=gdb_index fails to dump valid address tables. It prints
the warning "readelf: Warning: Address table extends beyond end of section.",
and then abandons dumping the section.

For example, tx_ttf_vector was built with GCC Split-DWARF and .gdb_index using
the gold linker, and when dumping the section, it prints the following:

fed:/nfs/fedora25-x8664/u0/home/jdelsign/tvbld/linux-x86-64/fedora25-x8664/totalview.develop/debugger/src/tests/bld/gcc_6.3.1_split-dwarf-gdb-index_64>/bin/readelf
--debug-dump=gdb_index tx_ttf_vector
Contents of the .gdb_index section:
Version 7
readelf: Warning: Address table extends beyond end of section.
fed:/nfs/fedora25-x8664/u0/home/jdelsign/tvbld/linux-x86-64/fedora25-x8664/totalview.develop/debugger/src/tests/bld/gcc_6.3.1_split-dwarf-gdb-index_64>

I tracked the bug to a problem in the dwarf.c module used by readelf. The check
for the address table extending off the end of the section is wrong. It is
multiplying the address_table_size by "(2 + 8 + 4)", which was presumably
intended to be the size of an address table element, but address_table_size is
already the size of the address table in bytes, not the count of entries.

In fact, "(2 + 8 + 4)" is not the size of an address table entry, which is two
64-bit addresses and one 32-bit index into the CU table, meaning the entry size
is "(2 * 8 + 4)".

I attached the executable file tx_ttf_vector, and a patch to dwarf.c that fixes
the bug.

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]