From: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: binutils@sourceware.org, Alan Modra <amodra@gmail.com>,
Florian Weimer <fweimer@redhat.com>,
Kaylee Blake <klkblake@gmail.com>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH v4 3/7] bfd: Improve nm and objdump without section header
Date: Sun, 9 Jul 2023 23:30:01 -0400 [thread overview]
Message-ID: <a1d473cf-cd4d-e71b-ff99-60eb6a786962@polymtl.ca> (raw)
In-Reply-To: <CAMe9rOr0fyuyBSscQ0jE05oJ5-q16dx1MBF5ib0neN4Z9VzAKw@mail.gmail.com>
> 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
next prev parent reply other threads:[~2023-07-10 3:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230606175846.399377-1-hjl.tools@gmail.com>
[not found] ` <20230606175846.399377-4-hjl.tools@gmail.com>
2023-07-01 2:12 ` Simon Marchi via Gdb-patches
2023-07-07 15:26 ` H.J. Lu via Gdb-patches
2023-07-10 3:30 ` Simon Marchi via Gdb-patches [this message]
2023-07-13 5:02 ` Alan Modra via Gdb-patches
2023-07-13 5:34 ` Fangrui Song
2023-07-13 21:58 ` Mark Wielaard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a1d473cf-cd4d-e71b-ff99-60eb6a786962@polymtl.ca \
--to=gdb-patches@sourceware.org \
--cc=amodra@gmail.com \
--cc=binutils@sourceware.org \
--cc=fweimer@redhat.com \
--cc=hjl.tools@gmail.com \
--cc=klkblake@gmail.com \
--cc=simon.marchi@polymtl.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox