Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Jul 2004 11:58:35 +0200 (CEST)
From:      Mark Kettenis <kettenis@gnu.org>
To:        marcel@xcllnt.net
Cc:        cvs-all@freebsd.org
Subject:   Re: cvs commit: src/sys/kern imgact_elf.c
Message-ID:  <200407200958.i6K9wZD4022358@juw15.nfra.nl>
In-Reply-To: <20040719171041.GA22048@ns1.xcllnt.net> (message from Marcel Moolenaar on Mon, 19 Jul 2004 10:10:41 -0700)
References:  <200407182028.i6IKS7Su002490@repoman.freebsd.org> <20040719171041.GA22048@ns1.xcllnt.net>

next in thread | previous in thread | raw e-mail | index | archive | help
   Date: Mon, 19 Jul 2004 10:10:41 -0700
   From: Marcel Moolenaar <marcel@xcllnt.net>

   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).

Defenitely.

   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
future.

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.

Mark



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200407200958.i6K9wZD4022358>