This is the mail archive of the
mailing list for the binutils project.
Re: [PATCH 1/2] New entry points for writing Linux NT_PRPSINFO notes.
- From: Sergio Durigan Junior <sergiodj at redhat dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: binutils at sourceware dot org, jan dot kratochvil at redhat dot com, hongjiu dot lu at intel dot com, gdb-patches at sourceware dot org
- Date: Sun, 03 Feb 2013 00:51:00 -0200
- Subject: Re: [PATCH 1/2] New entry points for writing Linux NT_PRPSINFO notes.
- References: <510AA7A3.firstname.lastname@example.org> <email@example.com> <20130201063725.GC30945@bubble.grove.modra.org>
On Friday, February 01 2013, Alan Modra wrote:
> On Thu, Jan 31, 2013 at 11:04:38PM +0000, Pedro Alves wrote:
>> * Makefile.in (SOURCE_HFILES): Add `elf-linux-psinfo.h'.
>> * elf-bfd.h (elf_internal_linux_prpsinfo): New structure
>> (elfcore_write_linux_prpsinfo32, elfcore_write_linux_prpsinfo64)
>> (elfcore_write_ppc32_linux_prpsinfo32): New declarations.
>> * elf-linux-psinfo.h: New file.
>> * elf.c: Include elf-linux-psinfo.h.
>> (elfcore_write_linux_prpsinfo32, elfcore_write_linux_prpsinfo64):
>> New functions.
>> * elf32-ppc.c: Include `elf-linux-psinfo.h'.
>> (elf_external_ppc_linux_prpsinfo32): New structure declaration.
>> (PPC_LINUX_PRPSINFO32_SWAP_FIELDS): New macro.
>> (elfcore_write_ppc_linux_prpsinfo32): New function.
> Looks good to me.
Thanks Pedro for the patch, and Alan for the review.
I know the patch has been approved, but just for the record I would like
to emit my opinion about it. As I said to Pedro offlist, I would take
his suggestion of "getting rid of the middle man" a little bit further:
I would have created those Linux-specific functions for handling the
PRPSINFO note inside GDB, and not inside BFD. I think this is a little
1) It does not contribute to the mess that is going on inside this area
of BFD, by just leaving things as-is, without introducing more
specialized functions that will have to be maintained later, and
2) As Pedro said in the message, it could make use of the already
existing GDB target sniffer, which would allow us to extend this later
to other targets without having to worry about making more and more
functions on bfd/elf-bfd.h.
I know that this approach has the drawback of putting some low level
logic that should be in BFD inside GDB, but IMO it's a small price to
pay. Those functions inside GDB would still call `elfcore_write_note'
and make the byte swapping just as the `elf_write_linux_prpsinfo*' in
this patch, so the writing mechanism would still be inside BFD.
Anyway, I just would like to keep my opinion registered, in case we
choose to tackle this problem again in the future.
BTW, I plan to commit this patch as soon as the GDB side of it gets
approved, but I don't have write permission to the binutils repository
yet. Alan (or some other binutils maintainer reading this), is it OK if
I send a message to overseers Ccing you asking for write permission?