From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: binutils@sources.redhat.com
Cc: Roland McGrath <roland@redhat.com>
Subject: [patch] bfd: Core files with p_filesz < p_memsz (build-id)
Date: Sun, 29 Jul 2007 12:30:00 -0000 [thread overview]
Message-ID: <20070728191354.GA14892@host0.dyn.jankratochvil.net> (raw)
Message-ID: <20070729123000.TpYsBuod6kkfUIGCQmuLW_uI0g35iz_hhN_ntOEZ1YQ@z> (raw)
[-- Attachment #1: Type: text/plain, Size: 2217 bytes --]
Hi,
there is now a pending patch for Linux kernels producing core files with the
first page of the ELF file for the build-id note identification.
So far BFD handled either p_filesz == 0 or p_filesz == p_memsz. Patch handles
the case 0 < p_filesz < p_memsz (p_filesz == PAGE_SIZE for the build-id case).
`0 < p_filesz < p_memsz' meaning was so far undefined for the ET_CORE files.
Regards,
Jan
New build-id enhanced Linux kernels produce core files:
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
NOTE 0x000660 0x0000000000000000 0x0000000000000000 0x000324 0x000000 0x0
LOAD 0x001000 0x0000000000400000 0x0000000000000000 0x001000 0x0b1000 R E 0x1000
^^^^^^^^ ^^^^^^^^
LOAD 0x002000 0x00000000006b1000 0x0000000000000000 0x00a000 0x00a000 RW 0x1000
BFD-patched gdb `info files'
0x0000000000400000 - 0x0000000000401000 is load1
0x00000000006b1000 - 0x00000000006bb000 is load2
0x0000000000419f00 <main+0>: push %r15
0x0000000000419f02 <main+2>: push %r14
BROKEN: original gdb `info files' (it sees the code sections zeroed)
0x0000000000400000 - 0x0000000000401000 is load1a
0x0000000000401000 - 0x00000000004b1000 is load1b
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0x00000000006b1000 - 0x00000000006bb000 is load2
0x0000000000419f00 <main+0>: add %al,(%rax)
0x0000000000419f02 <main+2>: add %al,(%rax)
(as 0x419f00 >= 0x401000)
Legacy kernel core files:
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
NOTE 0x000660 0x0000000000000000 0x0000000000000000 0x000324 0x000000 0x0
LOAD 0x001000 0x0000000000400000 0x0000000000000000 0x000000 0x0b1000 R E 0x1000
^^^^^^^^ ^^^^^^^^
LOAD 0x001000 0x00000000006b1000 0x0000000000000000 0x00a000 0x00a000 RW 0x1000
original gdb `info files'
0x00000000006b1000 - 0x00000000006bb000 is load2
0x0000000000419f00 <main+0>: push %r15
0x0000000000419f02 <main+2>: push %r14
[-- Attachment #2: bfd-dump_elf_headers.patch --]
[-- Type: text/plain, Size: 1055 bytes --]
2007-07-28 Jan Kratochvil <jan.kratochvil@redhat.com>
* bfd/elf.c (_bfd_elf_new_section_hook): New comment for ET_CORE files
with p_filesz shorter than p_memsz. The data/bss split case has been
restricted only for non-ET_CORE files.
--- bfd/elf.c 26 Jul 2007 18:15:46 -0000 1.401
+++ bfd/elf.c 28 Jul 2007 19:00:08 -0000
@@ -2225,6 +2225,9 @@ _bfd_elf_new_section_hook (bfd *abfd, as
by the difference between the two sizes. In effect, the segment is split
into it's initialized and uninitialized parts.
+ This notion does not apply in ET_CORE files, where a shorter p_filesz means
+ that the data is not available in the dump.
+
*/
bfd_boolean
@@ -2239,8 +2242,8 @@ _bfd_elf_make_section_from_phdr (bfd *ab
size_t len;
int split;
- split = ((hdr->p_memsz > 0)
- && (hdr->p_filesz > 0)
+ split = (abfd->format != bfd_core
+ && (hdr->p_memsz > 0) && (hdr->p_filesz > 0)
&& (hdr->p_memsz > hdr->p_filesz));
sprintf (namebuf, "%s%d%s", typename, index, split ? "a" : "");
len = strlen (namebuf) + 1;
next reply other threads:[~2007-07-28 19:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-28 20:16 Jan Kratochvil [this message]
2007-07-29 12:30 ` Jan Kratochvil
2007-07-29 15:29 ` Roland McGrath
2007-07-29 18:32 ` Jan Kratochvil
2007-08-01 13:05 ` Alan Modra
2007-08-02 20:03 ` Daniel Jacobowitz
2007-08-03 0:13 ` Alan Modra
2007-08-03 0:21 ` Daniel Jacobowitz
2007-08-03 2:50 ` Alan Modra
2007-08-06 19:32 ` Daniel Jacobowitz
2007-08-09 16:04 ` Jan Kratochvil
2007-07-30 14:07 ` [resent] " Jan Kratochvil
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=20070728191354.GA14892@host0.dyn.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=binutils@sources.redhat.com \
--cc=roland@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).