[PATCH v4 3/7] bfd: Improve nm and objdump without section header
Simon Marchi
simon.marchi@polymtl.ca
Mon Jul 10 03:30:01 GMT 2023
> It works for me:
>
> $ make check TESTS="gdb.base/eu-strip-infcall.exp"
> ....
> === gdb Summary ===
>
> # of expected passes 1
>
> My change only impacts files without section header. eu-strip-infcall.exp does
> "eu-strip -f ${binfile}.debug $binfile", which doesn't remove section header.
>
I can reliably reproduce the problem on two separate machine, one Ubuntu
22.04 and one failrly up to date Arch Linux. elfutils version 0.186 and
0.189, respectively.
It goes wrong when GDB does a bfd_check_format call on
testsuite/outputs/gdb.base/eu-strip-infcall/eu-strip-infcall.debug.
Before you commit it works, and after your commit it returns false. It
happens in this new statement added to elf_object_p, added by the commit:
if ((i_phdr->p_offset + i_phdr->p_filesz) > filesize)
goto got_no_match;
(top-gdb) p i_phdr->p_offset
$1 = 8192
(top-gdb) p i_phdr->p_filesz
$2 = 196
(top-gdb) p filesize
$3 = 5104
(top-gdb) p i
$4 = 4
It would be this program header causing the condition to fail:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
...
LOAD 0x002000 0x0000000000002000 0x0000000000002000 0x0000c4 0x0000c4 R 0x1000
So, the program header of the .debug file describes the segments of the
main binary, not sure if that's expected.
Simon
More information about the Binutils
mailing list