From: Andrew Burgess <aburgess@redhat.com>
To: Tom Tromey <tromey@adacore.com>
Cc: Tom de Vries <tdevries@suse.de>, Tom Tromey <tromey@adacore.com>,
gdb-patches@sourceware.org
Subject: Re: [PATCHv2 3/3] gdb/python: add Corefile.mapped_files method
Date: Fri, 17 Oct 2025 11:02:42 +0100 [thread overview]
Message-ID: <87sefhalrx.fsf@redhat.com> (raw)
In-Reply-To: <87o6q6r514.fsf@tromey.com>
Tom Tromey <tromey@adacore.com> writes:
>>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:
>
> Andrew> + Build-id is not present in the core file, GDB will return None for
> Andrew> the build-id.
>
> Andrew> Of these two I suspect the second; for a period of time the GNU linker
> Andrew> was ... changed ... such that it no longer placed the build-id within
> Andrew> the first page of a generated ELF, as a result, the Linux kernel would
> Andrew> not include the build-id in core dumps.
>
> Andrew> We can check for the second case using:
>
> Andrew> readelf -WS /lib64/libc.so.6 | grep build-id
>
> Andrew> The output will be something like:
>
> Andrew> [ 2] .note.gnu.build-id NOTE 0000000000000370 000370 000024 00 A 0 0 4
>
> Andrew> It's the '000370' column we're interested in. If this value is greater
> Andrew> than a page size, then GDB isn't going to be able to find the build-id.
>
> I have a question about this work.
>
> There's an internal AdaCore test that creates a core file, then uses
> 'file' on a different executable and 'core' to check if a warning is
> issued.
>
> gdb 16 on this test does:
>
> (gdb) core core
> warning: core file may not match specified executable file.
> [...]
>
> However with git master we don't get that.
>
> Now, the executables in question do have build ids:
>
> bapiya. readelf -WS call_crash|grep build-id
> [ 2] .note.gnu.build-id NOTE 0000000000000390 000390 000024 00 A 0 0 4
> bapiya. readelf -WS crash|grep build-id
> [ 2] .note.gnu.build-id NOTE 0000000000000390 000390 000024 00 A 0 0 4
>
> ... and I verified the the IDs are actually different.
>
> I'm not really sure how to find the relevant page size, per your comment
> above.
>
> I can't readily tell if the core file has an ID. gdb thinks there
> isn't, using the command from py-corefile.py.
>
> That by itself seems a little weird but I am wondering if the warning
> should appear anyway, at least in this case, because the core file
> records it was created by 'crash' but the current file has a different
> base name ("call_crash").
>
> IOW, is the lack of a warning in this case now intentional?
No this is not intentional, and I can reproduce this.
But I thought we had a test that covered this specific case already, so
I'm really surprised this wasn't flagged during testing.
I'll investigate what's going on here, I guess I've managed to break
something....
>
> And, how can I understand why the ID isn't in the core?
> I'm having some trouble figuring out which 'ld' the compiler is invoking.
The offsets of those build-ids looks fine (less than 0x1000) so should
be within the first page of the ELF. This will be something I've
managed to break somehow :(
Sorry about that.
Thanks,
Andrew
next prev parent reply other threads:[~2025-10-17 10:03 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-02 16:03 [PATCH 0/3] Core file Python API Andrew Burgess
2025-09-02 16:03 ` [PATCH 1/3] gdb/python: introduce gdb.Corefile API Andrew Burgess
2025-09-02 16:26 ` Eli Zaretskii
2025-09-16 17:25 ` Tom Tromey
2025-09-23 13:50 ` Andrew Burgess
2025-09-02 16:03 ` [PATCH 2/3] gdb: make structured core file mappings processing global Andrew Burgess
2025-09-16 17:28 ` Tom Tromey
2025-09-02 16:03 ` [PATCH 3/3] gdb/python: add Corefile.mapped_files method Andrew Burgess
2025-09-16 17:54 ` Tom Tromey
2025-09-23 13:52 ` Andrew Burgess
2025-09-23 13:44 ` [PATCHv2 0/3] Core file Python API Andrew Burgess
2025-09-23 13:44 ` [PATCHv2 1/3] gdb/python: introduce gdb.Corefile API Andrew Burgess
2025-10-03 18:56 ` Tom Tromey
2025-10-06 8:54 ` Andrew Burgess
2025-10-06 15:39 ` Tom Tromey
2025-10-06 16:13 ` Andrew Burgess
2025-09-23 13:44 ` [PATCHv2 2/3] gdb: make structured core file mappings processing global Andrew Burgess
2025-10-13 13:57 ` Lancelot SIX
2025-10-13 14:37 ` Andrew Burgess
2025-10-13 15:16 ` Six, Lancelot
2025-10-14 9:12 ` Lancelot SIX
2025-09-23 13:44 ` [PATCHv2 3/3] gdb/python: add Corefile.mapped_files method Andrew Burgess
2025-10-03 19:15 ` Tom Tromey
2025-10-07 6:24 ` Tom de Vries
2025-10-07 12:21 ` Andrew Burgess
2025-10-07 13:08 ` Tom de Vries
2025-10-07 13:26 ` Andrew Burgess
2025-10-07 14:38 ` Andrew Burgess
2025-10-07 15:43 ` Tom de Vries
2025-10-07 16:28 ` Andrew Burgess
2025-10-08 9:29 ` Andrew Burgess
2025-10-08 10:36 ` Tom de Vries
2025-10-08 14:14 ` Andrew Burgess
2025-10-08 15:43 ` Tom de Vries
2025-10-08 16:03 ` Andrew Burgess
2025-10-16 20:00 ` Tom Tromey
2025-10-17 10:02 ` Andrew Burgess [this message]
2025-10-17 13:32 ` Andrew Burgess
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=87sefhalrx.fsf@redhat.com \
--to=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
--cc=tromey@adacore.com \
/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