From: "H.J. Lu" <hjl.tools@gmail.com>
To: John Baldwin <jhb@freebsd.org>
Cc: Alan Modra <amodra@gmail.com>,
Ulrich Weigand <Ulrich.Weigand@de.ibm.com>,
Binutils <binutils@sourceware.org>, GDB <gdb@sourceware.org>
Subject: Re: Are ppc*_elf_write_core_note Os-specific?
Date: Tue, 19 Jan 2016 19:08:00 -0000 [thread overview]
Message-ID: <CAMe9rOq-Hsd6d5rpJ0F=cCg-jyFUst7czvXi66=Eh=vfNfLLpA@mail.gmail.com> (raw)
In-Reply-To: <3209137.BFgmUDYLhZ@ralph.baldwin.cx>
On Tue, Jan 19, 2016 at 10:16 AM, John Baldwin <jhb@freebsd.org> wrote:
> On Tuesday, January 19, 2016 08:41:05 AM H.J. Lu wrote:
>> On Mon, Jan 18, 2016 at 7:14 PM, Alan Modra <amodra@gmail.com> wrote:
>> > On Tue, Jan 19, 2016 at 10:48:19AM +1030, Alan Modra wrote:
>> >> PowerPC64 glibc even now doesn't defing prstatus32_t. :-( It seems
>> >> only sparc and s390 do so. So PowerPC would need a
>> >> hosts/powerpc-linux.h to define them for Linux, with some configury
>> >> changes, like hosts/x86-64linux.h does for x86-64 Linux. I'll see
>> >> about making those changes.
>> >>
>> >> Note that elf_backend_write_core_note is defined for x86-64, arm and
>> >> aarch64 too. The ARM and AARCH64 functions look to be completely
>> >> redundant, and I suspect all of them could disappear if we modify the
>> >> generic code to handle prstatusx32_t for x86-64.
>> >
>> > Actually, there is a reason for the ARM and AARCH64 functions.
>> > See https://sourceware.org/ml/binutils/2011-10/msg00202.html
>> > Note the followup emails too..
>> >
>> > So it seems that with the current infrastructure we can either support
>> > core file generation on remote (linux) targets, or core file
>> > generation on more native targets (freebsd). Alternatively, we'd
>> > need to use separate bfd target vectors for linux and freebsd, which
>> > can and will cause multiple target matches.
>> >
>> > Do we really want non-native core file generation?
>> >
>>
>> Any changes shouldn't introduce regressions. I don't see why
>> elf_backend_write_core_note can't handle all targets BFD supports
>> since note_type is unique to each OS. BFD just needs to provide
>> proper types independent of host header files, similar to
>> hosts/x86-64linux.h.
>
> Switching on note_type alone (as the current write_core_note methods do)
> isn't sufficient. Currently bfd writes out notes like NT_PRSTATUS and
> NT_PRPSINFO with the "CORE" name on multiple platforms, so a
> (note_name, note_type) tuple also seems insufficient. Are you suggesting
> to switch on (ELF OSABI, note_type)? That is, supposing you had a
> hosts/x86-64freebsd.h with a 'struct freebsd_amd64_prstatus' and if
> hosts/x86-64linux.h had 'struct linux_x86_64_prstatus' (or whatever names
> are preferred), then the logic in the write_core_note would look something
> like:
>
> switch (get_elf_backend_data (abfd)->elf_osabi)
> {
> case ELFOSABI_FREEBSD:
> {
> switch (note_type)
> {
> case NT_PRSTATUS:
> struct freebsd_amd64_prstatus prstatus;
> ...
> return elfcore_write_note (abfd, ... &prstatus, ...);
> ...
> }
> ...
> }
> case ELFOSABI_LINUX:
> {
> switch (note_type)
> {
> case NT_PRSTATUS:
> struct linux_x86_64_prstatus prstatus;
> ...
> return elfcore_write_note (abfd, ... &prstatus, ...);
> ...
> }
> ...
> }
> ..
> }
>
> If so, checking elf_osabi in the current write_core_note functions and
> falling back to the native "catch-all" if it is not a currently-supported
> elf_osabi would be sufficient to preserve existing functionality (I think)
> while allowing other ABIs to either use the catch-all or implement support
> for desired non-native cores.
How does GDB tell Linux binary from FreeBSD binary?
--
H.J.
next prev parent reply other threads:[~2016-01-19 19:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1736699.V7zq9VJIrx@ralph.baldwin.cx>
[not found] ` <20160119001819.GB17028@bubble.grove.modra.org>
2016-01-19 3:14 ` Alan Modra
2016-01-19 10:26 ` Pedro Alves
2016-01-19 16:41 ` H.J. Lu
2016-01-19 19:01 ` John Baldwin
2016-01-19 19:08 ` H.J. Lu [this message]
2016-01-19 19:32 ` John Baldwin
2016-01-19 19:35 ` H.J. Lu
2016-01-19 20:29 ` John Baldwin
2016-01-19 20:54 ` Pedro Alves
2016-01-19 21:20 ` H.J. Lu
2016-01-19 21:24 ` H.J. Lu
2016-01-19 22:52 ` Pedro Alves
2016-01-20 3:07 ` Alan Modra
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='CAMe9rOq-Hsd6d5rpJ0F=cCg-jyFUst7czvXi66=Eh=vfNfLLpA@mail.gmail.com' \
--to=hjl.tools@gmail.com \
--cc=Ulrich.Weigand@de.ibm.com \
--cc=amodra@gmail.com \
--cc=binutils@sourceware.org \
--cc=gdb@sourceware.org \
--cc=jhb@freebsd.org \
/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).