cvs commit: src/sys/kern imgact_elf.c

Mark Kettenis kettenis at
Tue Jul 20 02:59:53 PDT 2004

   Date: Mon, 19 Jul 2004 10:10:41 -0700
   From: Marcel Moolenaar <marcel at>

   On Mon, Jul 19, 2004 at 03:45:39AM -0600, Scott Long wrote:
   > I've seen concern (maybe in private email, can't check at the moment)
   > recently that loosing the PID info is undesirable.  Is there any way that
   > it can be included again, maybe in something other than a PRSTATUS object?

   Ideally you want one note that describes the process as a whole (let's
   call it a P-note for now) and as many notes as there were kernel threads
   for the process (let's call such notes T-notes).


   A P-note would typically hold the PID. T-notes typically hold register
   contents, as well as LWPIDs.

Essentially, yes.

   Creating a core file with P-notes and T-notes is easy enough. getting
   binutils to grok them is non-trivial, not to mention that gdb needs
   to be able to get to the information, which is as non-trivial as
   binutils extracting it from the core file. So, introducing new notes
   is a major effort. Extending existing notes is a major effort. Not
   because it's hard to understand a new note, or read a new field from
   a note, but because it's hard to have binutils save the information
   and gdb use the saved information. You pretty much have to redesign
   interfaces and I'm not touching that...

I think a redesign of the core file format along the lines you said
above would defenitely pay off.  The NetBSD folks have done it, and I
think their approach is pretty elegant.  An improtant benefit of their
approach is that it's (almost) machine independent.  The BFD code is
pretty much localized in elf.c (look for the functions with netbsd in
their names).  Adapting that code for FreeNSD should not be much work.
I don't think any further changes to GDB are needed.

For a description of the format you can look at the NetBSD core(5) man
page.  The T-notes are simply dumps of `struct reg' and `struct
fpreg'.  The LWPIDs are encoded in the name of those notes.

Please realize that the problems you're citing largely stem from the
let's simulate-Linux-which-simulates-SVR4 type notes currently used by
FreeBSD.  Throwing that all overboard will save much trouble in the

I'm certainly willing to do some of the legwork, since it'd make life
for me on the GDB side a lot easier if you'd adapt these NetBSD-style
core file notes.  I certainly have some time the coming weeks to spend
on it.


More information about the cvs-all mailing list