Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* cross-debugging of userland core files, nat -> tdep
@ 2002-04-10 18:39 Jason R Thorpe
  2002-04-10 18:58 ` Daniel Jacobowitz
  2002-04-10 23:01 ` Andrew Cagney
  0 siblings, 2 replies; 6+ messages in thread
From: Jason R Thorpe @ 2002-04-10 18:39 UTC (permalink / raw)
  To: gdb

Hi folks...

I've been thinking of what needs to happen in order to support
cross-debugging of userland core files in NetBSD.

BFD can already handle NetBSD ELF core files in the appropriate way.  As
far as I can tell, the only stumbling block is getting GDB to play nicely
with them.

The problem is that the functions that supply registers, etc. from the core
file are all in "nat" modules.  This is probably mostly an artifact of the
data being in the same format as the reg structure returned by ptrace(2).

What I'd like to do is move those supply-registers routines into an
appropriate "tdep" file.  They can still be used by the "nat" routines
which use ptrace(2), and all the core file handling goo can then go into
the "tdep" module, as well.

If this sounds reasonable, then I'll start my little project.  Otherwise,
I'd love to hear suggestions :-)

Thanks.

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: cross-debugging of userland core files, nat -> tdep
  2002-04-10 18:39 cross-debugging of userland core files, nat -> tdep Jason R Thorpe
@ 2002-04-10 18:58 ` Daniel Jacobowitz
  2002-04-10 19:12   ` Jason R Thorpe
  2002-04-11 14:39   ` Michael Snyder
  2002-04-10 23:01 ` Andrew Cagney
  1 sibling, 2 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2002-04-10 18:58 UTC (permalink / raw)
  To: Jason R Thorpe, gdb

On Wed, Apr 10, 2002 at 06:39:18PM -0700, Jason R Thorpe wrote:
> Hi folks...
> 
> I've been thinking of what needs to happen in order to support
> cross-debugging of userland core files in NetBSD.
> 
> BFD can already handle NetBSD ELF core files in the appropriate way.  As
> far as I can tell, the only stumbling block is getting GDB to play nicely
> with them.
> 
> The problem is that the functions that supply registers, etc. from the core
> file are all in "nat" modules.  This is probably mostly an artifact of the
> data being in the same format as the reg structure returned by ptrace(2).
> 
> What I'd like to do is move those supply-registers routines into an
> appropriate "tdep" file.  They can still be used by the "nat" routines
> which use ptrace(2), and all the core file handling goo can then go into
> the "tdep" module, as well.
> 
> If this sounds reasonable, then I'll start my little project.  Otherwise,
> I'd love to hear suggestions :-)

Hit the nail on the head.  I believe I've gotten BFD to understand ELF
core files appropriately for a fair number of targets; you may need to
add a platform-specific chunk to all the ones I didn't get to.  Then
move supply_* out of the nat files, and link in the core code.

Now, if you've got time, there's a much better way to do this.  The
"magic" supply_* and fetch_* names need to go; we should instead have a
table of regset types, sizes, and fetch/supply functions.  I just
haven't gotten around to actually doing that.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: cross-debugging of userland core files, nat -> tdep
  2002-04-10 18:58 ` Daniel Jacobowitz
@ 2002-04-10 19:12   ` Jason R Thorpe
  2002-04-10 19:16     ` Daniel Jacobowitz
  2002-04-11 14:39   ` Michael Snyder
  1 sibling, 1 reply; 6+ messages in thread
From: Jason R Thorpe @ 2002-04-10 19:12 UTC (permalink / raw)
  To: gdb

On Wed, Apr 10, 2002 at 09:58:24PM -0400, Daniel Jacobowitz wrote:

 > Hit the nail on the head.  I believe I've gotten BFD to understand ELF
 > core files appropriately for a fair number of targets; you may need to
 > add a platform-specific chunk to all the ones I didn't get to.  Then
 > move supply_* out of the nat files, and link in the core code.

Okay, cool.

BTW, all of NetBSD's ELF core file handling is in bfd/elf.c.  It
doesn't require any platform-specific handling except one small
switch statement to comute the note type number correctly for
various arch's, which is in elfcore_grok_netbsd_note().

 > Now, if you've got time, there's a much better way to do this.  The
 > "magic" supply_* and fetch_* names need to go; we should instead have a
 > table of regset types, sizes, and fetch/supply functions.  I just
 > haven't gotten around to actually doing that.

Heh, you said "time" :-)

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: cross-debugging of userland core files, nat -> tdep
  2002-04-10 19:12   ` Jason R Thorpe
@ 2002-04-10 19:16     ` Daniel Jacobowitz
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2002-04-10 19:16 UTC (permalink / raw)
  To: gdb; +Cc: Jason R Thorpe

On Wed, Apr 10, 2002 at 07:12:29PM -0700, Jason R Thorpe wrote:
> On Wed, Apr 10, 2002 at 09:58:24PM -0400, Daniel Jacobowitz wrote:
> 
>  > Hit the nail on the head.  I believe I've gotten BFD to understand ELF
>  > core files appropriately for a fair number of targets; you may need to
>  > add a platform-specific chunk to all the ones I didn't get to.  Then
>  > move supply_* out of the nat files, and link in the core code.
> 
> Okay, cool.
> 
> BTW, all of NetBSD's ELF core file handling is in bfd/elf.c.  It
> doesn't require any platform-specific handling except one small
> switch statement to comute the note type number correctly for
> various arch's, which is in elfcore_grok_netbsd_note().

Thus the "may" :)

>  > Now, if you've got time, there's a much better way to do this.  The
>  > "magic" supply_* and fetch_* names need to go; we should instead have a
>  > table of regset types, sizes, and fetch/supply functions.  I just
>  > haven't gotten around to actually doing that.
> 
> Heh, you said "time" :-)

Yeah, I know, I know.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: cross-debugging of userland core files, nat -> tdep
  2002-04-10 18:39 cross-debugging of userland core files, nat -> tdep Jason R Thorpe
  2002-04-10 18:58 ` Daniel Jacobowitz
@ 2002-04-10 23:01 ` Andrew Cagney
  1 sibling, 0 replies; 6+ messages in thread
From: Andrew Cagney @ 2002-04-10 23:01 UTC (permalink / raw)
  To: thorpej; +Cc: gdb

> Hi folks...
> 
> I've been thinking of what needs to happen in order to support
> cross-debugging of userland core files in NetBSD.
> 
> BFD can already handle NetBSD ELF core files in the appropriate way.  As
> far as I can tell, the only stumbling block is getting GDB to play nicely
> with them.
> 
> The problem is that the functions that supply registers, etc. from the core
> file are all in "nat" modules.  This is probably mostly an artifact of the
> data being in the same format as the reg structure returned by ptrace(2).
> 
> What I'd like to do is move those supply-registers routines into an
> appropriate "tdep" file.  They can still be used by the "nat" routines
> which use ptrace(2), and all the core file handling goo can then go into
> the "tdep" module, as well.
> 
> If this sounds reasonable, then I'll start my little project.  Otherwise,
> I'd love to hear suggestions :-)
> 
> Thanks.

Have a look at sparc-tdep.c:supply_fpregset().  Depending on how 
``pure'' your elf core files are you could do similar.  If not 
archnbsd-tdep.c sounds promising.

There is a namespace problem here (these methods most likely also need 
to be multi-arched in someway, but that is a separate story).


Andrew




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: cross-debugging of userland core files, nat -> tdep
  2002-04-10 18:58 ` Daniel Jacobowitz
  2002-04-10 19:12   ` Jason R Thorpe
@ 2002-04-11 14:39   ` Michael Snyder
  1 sibling, 0 replies; 6+ messages in thread
From: Michael Snyder @ 2002-04-11 14:39 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Jason R Thorpe, gdb

Daniel Jacobowitz wrote:
> 
> On Wed, Apr 10, 2002 at 06:39:18PM -0700, Jason R Thorpe wrote:
> > Hi folks...
> >
> > I've been thinking of what needs to happen in order to support
> > cross-debugging of userland core files in NetBSD.
> >
> > BFD can already handle NetBSD ELF core files in the appropriate way.  As
> > far as I can tell, the only stumbling block is getting GDB to play nicely
> > with them.
> >
> > The problem is that the functions that supply registers, etc. from the core
> > file are all in "nat" modules.  This is probably mostly an artifact of the
> > data being in the same format as the reg structure returned by ptrace(2).
> >
> > What I'd like to do is move those supply-registers routines into an
> > appropriate "tdep" file.  They can still be used by the "nat" routines
> > which use ptrace(2), and all the core file handling goo can then go into
> > the "tdep" module, as well.
> >
> > If this sounds reasonable, then I'll start my little project.  Otherwise,
> > I'd love to hear suggestions :-)
> 
> Hit the nail on the head.  I believe I've gotten BFD to understand ELF
> core files appropriately for a fair number of targets; you may need to
> add a platform-specific chunk to all the ones I didn't get to.  Then
> move supply_* out of the nat files, and link in the core code.
> 
> Now, if you've got time, there's a much better way to do this.  The
> "magic" supply_* and fetch_* names need to go; we should instead have a
> table of regset types, sizes, and fetch/supply functions.  I just
> haven't gotten around to actually doing that.

Nathaniel, I will kiss your feet if you will do that.  ;-)
That would mean I could pretty easily implement the gcore command
for embedded gdb.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-04-11 21:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-10 18:39 cross-debugging of userland core files, nat -> tdep Jason R Thorpe
2002-04-10 18:58 ` Daniel Jacobowitz
2002-04-10 19:12   ` Jason R Thorpe
2002-04-10 19:16     ` Daniel Jacobowitz
2002-04-11 14:39   ` Michael Snyder
2002-04-10 23:01 ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox