This is the mail archive of the
mailing list for the binutils project.
Re: Are ppc*_elf_write_core_note Os-specific?
- From: Pedro Alves <palves at redhat dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: John Baldwin <jhb at freebsd dot org>, Alan Modra <amodra at gmail dot com>, Ulrich Weigand <Ulrich dot Weigand at de dot ibm dot com>, Binutils <binutils at sourceware dot org>, GDB <gdb at sourceware dot org>
- Date: Tue, 19 Jan 2016 22:52:33 +0000
- Subject: Re: Are ppc*_elf_write_core_note Os-specific?
- Authentication-results: sourceware.org; auth=none
- References: <1736699 dot V7zq9VJIrx at ralph dot baldwin dot cx> <1866442 dot mSXmZIT7y1 at ralph dot baldwin dot cx> <CAMe9rOo9j=+m+--q8Wzt4+kx0KfvcSfFd3uEq==9HHAfBd9Mnw at mail dot gmail dot com> <1502134 dot K9IMtmAub2 at ralph dot baldwin dot cx> <569EA298 dot 8070303 at redhat dot com> <CAMe9rOqYLnZZXe9wyDDh_aOh1XT-nNBKmrDN+tXu4j9WFw81Fg at mail dot gmail dot com>
On 01/19/2016 09:20 PM, H.J. Lu wrote:
> On Tue, Jan 19, 2016 at 12:54 PM, Pedro Alves <firstname.lastname@example.org> wrote:
>> Can this be made to work along the lines of 70a38d42c5b3 ?
> Probably. See:
The thing is that GDB always knows the target ABI/OS it wants the core note
to be generated for, so there should be no need to go through the bfd target
vector to generate an OS-specific note, or to stuff everything
through a crippling varargs interface such as elf_backend_write_core_note's.
Instead, bfd can export OS-specific variants of the note generation functions,
and GDB can call those directly. By avoiding the varargs-style strangling of
elf_backend_write_core_note, it's also MUCH easier to pass down note-specific
info. The original motivation of 70a38d42c5b3 (elfcore_write_linux_prpsinfo*)
was so that we could fill in all fields of the Linux prpsinfo structure.
(Note how elfcore_write_prpsinfo only takes a few parameters; it's missing a
lot of others bits.)
The gdb-side counterpart of 70a38d42c5b3 is b3ac9c77560a.
All the Linux-specific NT_PRPSINFO handling in the different
elf_backend_write_core_note implementations in bfd are dead code, I think,
since GDB always calls elfcore_write_linux_prpsinfo* directly, and only
GDB calls the elfcore_write_pr* functions.
I think that ideally we'd give the same treatment to
elfcore_write_prstatus; it's just that nobody ever did the leg work.