Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* RE: cross targeted gdb and corefiles
@ 2002-05-16 15:56 Kevin "Squail" Endres
  0 siblings, 0 replies; 20+ messages in thread
From: Kevin "Squail" Endres @ 2002-05-16 15:56 UTC (permalink / raw)
  To: Kevin "Squail" Endres, 'Kevin Buettner',
	'Daniel Jacobowitz', 'Richard.Earnshaw@arm.com'
  Cc: 'gdb@sources.redhat.com'

sorry - for the record - asm/elf.h and asm/proc/ptrace.h



-----Original Message-----
From: Kevin "Squail" Endres 
Sent: Thursday, May 16, 2002 3:55 PM
To: 'Kevin Buettner'; Kevin "Squail" Endres; 'Daniel Jacobowitz';
Richard.Earnshaw@arm.com
Cc: gdb@sources.redhat.com
Subject: RE: cross targeted gdb and corefiles


I dug through my headers - I stole the definitions from asm/proc.h and
asm/ptrace/proc.h

we will see if it works!

:]k

-----Original Message-----
From: Kevin Buettner [mailto:kevinb@redhat.com]
Sent: Thursday, May 16, 2002 3:54 PM
To: Kevin "Squail" Endres; 'Kevin Buettner'; 'Daniel Jacobowitz';
Richard.Earnshaw@arm.com
Cc: gdb@sources.redhat.com
Subject: Re: cross targeted gdb and corefiles


On May 16,  3:43pm, Kevin \Squail\ Endres wrote:

> ahh - so i need to find out what gregset_t and fpregset_t should be....
any
> hits where to look??

Look in <sys/ucontext.h> in your target's header files.  (That's a
place to start; it may actually drag in some definitions from the
kernel headers.)


^ permalink raw reply	[flat|nested] 20+ messages in thread
* RE: cross targeted gdb and corefiles
@ 2002-05-16 17:18 Kevin "Squail" Endres
  0 siblings, 0 replies; 20+ messages in thread
From: Kevin "Squail" Endres @ 2002-05-16 17:18 UTC (permalink / raw)
  To: 'Kevin Buettner', 'Daniel Jacobowitz',
	'Richard.Earnshaw@arm.com '
  Cc: 'gdb@sources.redhat.com'

addendums:
4) the original configured source had no system headers here - i had added
them trying to get my original changes to build.

-----Original Message-----
From: Kevin "Squail" Endres [mailto:kevine@wildseed.com]
Sent: Thursday, May 16, 2002 4:29 PM
To: 'Kevin Buettner'; Kevin "Squail" Endres; 'Daniel Jacobowitz';
'Richard.Earnshaw@arm.com '
Cc: 'gdb@sources.redhat.com'
Subject: RE: cross targeted gdb and corefiles


Yep - shot the last mail off before thinking it all through (sorries!!) -
Thanks for the help! (Got it all working!!)

TO RECAP: 
My environment - i386 host - ARM target (both running linux)

goal - read target core files with cross targeted debugger in host
environment.

SOLUTION:
1) configure cross gdb
2) add corelow.o and core-regset.o to TDEPFILES in gdb's Makefile
3) copy supply_* and nwfpe* functions and relevant structures (F11A etc)
from arm-linux-nat.c to arm-linux-tdep.c
4) remove system headers from arm-linux-tdep.c and core-regset.h (so not
using system register defs in gregset.h)
5) edit gregset.h - add the following (at the top): (i just copied and
synthisized from appt headers)

typedef  unsigned long elf_greg_t;
typedef  elf_greg_t gregset[18];
typedef struct {void *null } fpregset_t;

6) make

After getting environment set up same as required for remote debugging.

7) gdb app
8) (gdb) set solib-absolute-prefix /targetloc
9) (gdb) target core core

and all works as expected!!!

Help is much appreciated - you guys rule!

:]k
-----Original Message-----
From: Kevin Buettner [mailto:kevinb@redhat.com]
Sent: Thursday, May 16, 2002 4:17 PM
To: Kevin "Squail" Endres; 'Kevin Buettner'; 'Daniel Jacobowitz';
'Richard.Earnshaw@arm.com '
Cc: 'gdb@sources.redhat.com'
Subject: Re: cross targeted gdb and corefiles


On May 16,  4:05pm, Kevin \Squail\ Endres wrote:

> I know i have to set so-absolute-prefix to my libs to get everything to
live
> correctly... How do i do that and read in a core???

Can't you do...

    (gdb) set solib-absolute-prefix /my/prefix/to/the/sys-root
    (gdb) target core core

?

Kevin


^ permalink raw reply	[flat|nested] 20+ messages in thread
* RE: cross targeted gdb and corefiles
@ 2002-05-16 16:28 Kevin "Squail" Endres
  2002-05-17  8:06 ` Daniel Jacobowitz
  0 siblings, 1 reply; 20+ messages in thread
From: Kevin "Squail" Endres @ 2002-05-16 16:28 UTC (permalink / raw)
  To: 'Kevin Buettner',
	Kevin "Squail" Endres, 'Daniel Jacobowitz',
	'Richard.Earnshaw@arm.com '
  Cc: 'gdb@sources.redhat.com'

Yep - shot the last mail off before thinking it all through (sorries!!) -
Thanks for the help! (Got it all working!!)

TO RECAP: 
My environment - i386 host - ARM target (both running linux)

goal - read target core files with cross targeted debugger in host
environment.

SOLUTION:
1) configure cross gdb
2) add corelow.o and core-regset.o to TDEPFILES in gdb's Makefile
3) copy supply_* and nwfpe* functions and relevant structures (F11A etc)
from arm-linux-nat.c to arm-linux-tdep.c
4) remove system headers from arm-linux-tdep.c and core-regset.h (so not
using system register defs in gregset.h)
5) edit gregset.h - add the following (at the top): (i just copied and
synthisized from appt headers)

typedef  unsigned long elf_greg_t;
typedef  elf_greg_t gregset[18];
typedef struct {void *null } fpregset_t;

6) make

After getting environment set up same as required for remote debugging.

7) gdb app
8) (gdb) set solib-absolute-prefix /targetloc
9) (gdb) target core core

and all works as expected!!!

Help is much appreciated - you guys rule!

:]k
-----Original Message-----
From: Kevin Buettner [mailto:kevinb@redhat.com]
Sent: Thursday, May 16, 2002 4:17 PM
To: Kevin "Squail" Endres; 'Kevin Buettner'; 'Daniel Jacobowitz';
'Richard.Earnshaw@arm.com '
Cc: 'gdb@sources.redhat.com'
Subject: Re: cross targeted gdb and corefiles


On May 16,  4:05pm, Kevin \Squail\ Endres wrote:

> I know i have to set so-absolute-prefix to my libs to get everything to
live
> correctly... How do i do that and read in a core???

Can't you do...

    (gdb) set solib-absolute-prefix /my/prefix/to/the/sys-root
    (gdb) target core core

?

Kevin


^ permalink raw reply	[flat|nested] 20+ messages in thread
* RE: cross targeted gdb and corefiles
@ 2002-05-16 16:05 Kevin "Squail" Endres
  2002-05-16 16:17 ` Kevin Buettner
  0 siblings, 1 reply; 20+ messages in thread
From: Kevin "Squail" Endres @ 2002-05-16 16:05 UTC (permalink / raw)
  To: Kevin "Squail" Endres, 'Kevin Buettner',
	'Daniel Jacobowitz', 'Richard.Earnshaw@arm.com'
  Cc: 'gdb@sources.redhat.com'

Ok - it looks like it "may" be working - now for a very basic question.

I know i have to set so-absolute-prefix to my libs to get everything to live
correctly... How do i do that and read in a core???

:]k

-----Original Message-----
From: Kevin "Squail" Endres [mailto:kevine@wildseed.com]
Sent: Thursday, May 16, 2002 3:56 PM
To: Kevin "Squail" Endres; 'Kevin Buettner'; 'Daniel Jacobowitz';
'Richard.Earnshaw@arm.com'
Cc: 'gdb@sources.redhat.com'
Subject: RE: cross targeted gdb and corefiles


sorry - for the record - asm/elf.h and asm/proc/ptrace.h



-----Original Message-----
From: Kevin "Squail" Endres 
Sent: Thursday, May 16, 2002 3:55 PM
To: 'Kevin Buettner'; Kevin "Squail" Endres; 'Daniel Jacobowitz';
Richard.Earnshaw@arm.com
Cc: gdb@sources.redhat.com
Subject: RE: cross targeted gdb and corefiles


I dug through my headers - I stole the definitions from asm/proc.h and
asm/ptrace/proc.h

we will see if it works!

:]k

-----Original Message-----
From: Kevin Buettner [mailto:kevinb@redhat.com]
Sent: Thursday, May 16, 2002 3:54 PM
To: Kevin "Squail" Endres; 'Kevin Buettner'; 'Daniel Jacobowitz';
Richard.Earnshaw@arm.com
Cc: gdb@sources.redhat.com
Subject: Re: cross targeted gdb and corefiles


On May 16,  3:43pm, Kevin \Squail\ Endres wrote:

> ahh - so i need to find out what gregset_t and fpregset_t should be....
any
> hits where to look??

Look in <sys/ucontext.h> in your target's header files.  (That's a
place to start; it may actually drag in some definitions from the
kernel headers.)


^ permalink raw reply	[flat|nested] 20+ messages in thread
* RE: cross targeted gdb and corefiles
@ 2002-05-16 15:55 Kevin "Squail" Endres
  0 siblings, 0 replies; 20+ messages in thread
From: Kevin "Squail" Endres @ 2002-05-16 15:55 UTC (permalink / raw)
  To: 'Kevin Buettner',
	Kevin "Squail" Endres, 'Daniel Jacobowitz',
	Richard.Earnshaw
  Cc: gdb

I dug through my headers - I stole the definitions from asm/proc.h and
asm/ptrace/proc.h

we will see if it works!

:]k

-----Original Message-----
From: Kevin Buettner [mailto:kevinb@redhat.com]
Sent: Thursday, May 16, 2002 3:54 PM
To: Kevin "Squail" Endres; 'Kevin Buettner'; 'Daniel Jacobowitz';
Richard.Earnshaw@arm.com
Cc: gdb@sources.redhat.com
Subject: Re: cross targeted gdb and corefiles


On May 16,  3:43pm, Kevin \Squail\ Endres wrote:

> ahh - so i need to find out what gregset_t and fpregset_t should be....
any
> hits where to look??

Look in <sys/ucontext.h> in your target's header files.  (That's a
place to start; it may actually drag in some definitions from the
kernel headers.)


^ permalink raw reply	[flat|nested] 20+ messages in thread
* RE: cross targeted gdb and corefiles
@ 2002-05-16 15:43 Kevin "Squail" Endres
  2002-05-16 15:53 ` Kevin Buettner
  0 siblings, 1 reply; 20+ messages in thread
From: Kevin "Squail" Endres @ 2002-05-16 15:43 UTC (permalink / raw)
  To: 'Kevin Buettner',
	Kevin "Squail" Endres, 'Daniel Jacobowitz',
	Richard.Earnshaw
  Cc: gdb

ahh - so i need to find out what gregset_t and fpregset_t should be.... any
hits where to look??

:]k

-----Original Message-----
From: Kevin Buettner [mailto:kevinb@redhat.com]
Sent: Thursday, May 16, 2002 3:33 PM
To: Kevin "Squail" Endres; 'Kevin Buettner'; 'Daniel Jacobowitz';
Richard.Earnshaw@arm.com
Cc: gdb@sources.redhat.com
Subject: Re: cross targeted gdb and corefiles


On May 16,  3:27pm, Kevin \Squail\ Endres wrote:

> Yep had just figured out to move the supply_* (and the nwfpe*) functions
> from arm-linux-nat.c to arm-linux-tdep.c. I did assume that the kernel
> headers needed to be from an arm configured kernel so i set the prefix to
> the root of my cross toolchain whemn i configured. 
> 
> everything builds but when i try to read an arm core i get a warning about
> the size of the gregset struct in the core (so possibly i am truly not
> including the correct headers??)

The trick is to not depend on the headers at all.

One way to do this is to define (in the tdep.c file) the necessary
structs entirely in terms of chars.  (This includes adding in any ABI
mandated padding between fields.)

Kevin


^ permalink raw reply	[flat|nested] 20+ messages in thread
* RE: cross targeted gdb and corefiles
@ 2002-05-16 15:28 Kevin "Squail" Endres
  2002-05-16 15:33 ` Kevin Buettner
  0 siblings, 1 reply; 20+ messages in thread
From: Kevin "Squail" Endres @ 2002-05-16 15:28 UTC (permalink / raw)
  To: 'Kevin Buettner',
	Kevin "Squail" Endres, 'Daniel Jacobowitz',
	Richard.Earnshaw
  Cc: gdb

Yep had just figured out to move the supply_* (and the nwfpe*) functions
from arm-linux-nat.c to arm-linux-tdep.c. I did assume that the kernel
headers needed to be from an arm configured kernel so i set the prefix to
the root of my cross toolchain whemn i configured. 

everything builds but when i try to read an arm core i get a warning about
the size of the gregset struct in the core (so possibly i am truly not
including the correct headers??)

trying a few more things...

sany help is GREATLY appreciated....

:]k

-----Original Message-----
From: Kevin Buettner [mailto:kevinb@redhat.com]
Sent: Thursday, May 16, 2002 3:24 PM
To: Kevin "Squail" Endres; 'Daniel Jacobowitz'; Richard.Earnshaw@arm.com
Cc: gdb@sources.redhat.com
Subject: Re: cross targeted gdb and corefiles


On May 16,  3:01pm, Kevin \Squail\ Endres wrote:

> i moved the supply_* functions from i386-nat (only ones i could find in
the
> gdb source)to arm-linux-tdep.c.
> (given that there is no fp on arm - is the supply_fpregset really
> necessary???)

I haven't been following this closely, but I think you need to move the
supply_* functions from the arm version of the nat.c file to the arm
tdep.c file.

You have to make sure that there aren't any host dependencies though.
I.e, you can't make use of system header files.

Kevin


^ permalink raw reply	[flat|nested] 20+ messages in thread
* RE: cross targeted gdb and corefiles
@ 2002-05-16 15:01 Kevin "Squail" Endres
  2002-05-16 15:23 ` Kevin Buettner
  2002-05-17  8:20 ` Richard Earnshaw
  0 siblings, 2 replies; 20+ messages in thread
From: Kevin "Squail" Endres @ 2002-05-16 15:01 UTC (permalink / raw)
  To: 'Daniel Jacobowitz', Richard.Earnshaw; +Cc: gdb

after looking at this a bit deeper i am still confused.

i added the below .o's to TDEPFILES in the Makefile.

i moved the supply_* functions from i386-nat (only ones i could find in the
gdb source)to arm-linux-tdep.c.
(given that there is no fp on arm - is the supply_fpregset really
necessary???)

in the function supply_gregset i have an extern 'regmap[]' - I see in the
source where this is defined for i386 - but where is it defined for the arm
target???

:]k

-----Original Message-----
From: Kevin "Squail" Endres [mailto:kevine@wildseed.com]
Sent: Thursday, May 16, 2002 11:35 AM
To: 'Daniel Jacobowitz'; Richard.Earnshaw@arm.com
Cc: gdb@sources.redhat.com
Subject: RE: cross targeted gdb and corefiles


getting todays source and configuring... keep on timing out- will this
change work with the released 5.2?

as to the change I am not that familure with gdb source and structures. 

I am assuming that by "link in corelow/core-regset as target instead of nat
objects" you are directing me to alter the NATDEPLIST list in gdb's Makefile
- removing all *nat*.o references and add reference to corelow.o and
core-regset.o. I am puzzled why post config the first line of NATDEPLIST is
commented out...

as for "move supply_gregset and supply_fpregset to the tdep file" - move
from where(assumed a nat file) to which tdep file(arm-linux-tdep.c or
arm-tdep.c??)

I appreciate your help and apologize for the "newbie" questions....

:]k



-----Original Message-----
From: Daniel Jacobowitz [mailto:drow@mvista.com]
Sent: Thursday, May 16, 2002 10:42 AM
To: Richard.Earnshaw@arm.com
Cc: Kevin Squail Endres; gdb@sources.redhat.com
Subject: Re: cross targeted gdb and corefiles


On Thu, May 16, 2002 at 06:24:53PM +0100, Richard Earnshaw wrote:
> > I am using a gdb built from a cvs snapshot from 4-29 that is i386 hosted
and
> > ARM targeted.
> > 
> > this gdb does not support reading arm cores. I would like to get a
backtrace
> > for an arm failure (indeterminant - cannot set a breakpoint) without
running
> > an arm native gdb (or running my application under gdbserver). Is that
> > possible??
> 
> Not at present.
> 
> > 
> > if not - is it a feature slated to be added to cross targeted gdb soon?
I
> > know i run my application under gdbserver...
> 
> Maybe.  Some targets can now do this.  Precisely which target OS are you 
> using?

He's on GNU/Linux, IIRC...

Doing cross coredumps is trivial; I put all the BFD machinery in place
for a number of GNU/Linux targets, and others did it for the various
BSDs.  I'd post my ARM patches for this but I doubt even a line of them
applies any more after your extensive ARM cleanups.

The only thing you have to do is move supply_gregset and
supply_fpregset to the tdep file, and then link in corelow/core-regset
as target instead of nat objects.  This means a little bit of grubbing
about in target header files to copy out definitions for regsets, but
only a little.


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


^ permalink raw reply	[flat|nested] 20+ messages in thread
* RE: cross targeted gdb and corefiles
@ 2002-05-16 11:35 Kevin "Squail" Endres
  0 siblings, 0 replies; 20+ messages in thread
From: Kevin "Squail" Endres @ 2002-05-16 11:35 UTC (permalink / raw)
  To: 'Daniel Jacobowitz', Richard.Earnshaw; +Cc: gdb

getting todays source and configuring... keep on timing out- will this
change work with the released 5.2?

as to the change I am not that familure with gdb source and structures. 

I am assuming that by "link in corelow/core-regset as target instead of nat
objects" you are directing me to alter the NATDEPLIST list in gdb's Makefile
- removing all *nat*.o references and add reference to corelow.o and
core-regset.o. I am puzzled why post config the first line of NATDEPLIST is
commented out...

as for "move supply_gregset and supply_fpregset to the tdep file" - move
from where(assumed a nat file) to which tdep file(arm-linux-tdep.c or
arm-tdep.c??)

I appreciate your help and apologize for the "newbie" questions....

:]k



-----Original Message-----
From: Daniel Jacobowitz [mailto:drow@mvista.com]
Sent: Thursday, May 16, 2002 10:42 AM
To: Richard.Earnshaw@arm.com
Cc: Kevin Squail Endres; gdb@sources.redhat.com
Subject: Re: cross targeted gdb and corefiles


On Thu, May 16, 2002 at 06:24:53PM +0100, Richard Earnshaw wrote:
> > I am using a gdb built from a cvs snapshot from 4-29 that is i386 hosted
and
> > ARM targeted.
> > 
> > this gdb does not support reading arm cores. I would like to get a
backtrace
> > for an arm failure (indeterminant - cannot set a breakpoint) without
running
> > an arm native gdb (or running my application under gdbserver). Is that
> > possible??
> 
> Not at present.
> 
> > 
> > if not - is it a feature slated to be added to cross targeted gdb soon?
I
> > know i run my application under gdbserver...
> 
> Maybe.  Some targets can now do this.  Precisely which target OS are you 
> using?

He's on GNU/Linux, IIRC...

Doing cross coredumps is trivial; I put all the BFD machinery in place
for a number of GNU/Linux targets, and others did it for the various
BSDs.  I'd post my ARM patches for this but I doubt even a line of them
applies any more after your extensive ARM cleanups.

The only thing you have to do is move supply_gregset and
supply_fpregset to the tdep file, and then link in corelow/core-regset
as target instead of nat objects.  This means a little bit of grubbing
about in target header files to copy out definitions for regsets, but
only a little.


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


^ permalink raw reply	[flat|nested] 20+ messages in thread
* RE: cross targeted gdb and corefiles
@ 2002-05-16 10:28 Kevin "Squail" Endres
  0 siblings, 0 replies; 20+ messages in thread
From: Kevin "Squail" Endres @ 2002-05-16 10:28 UTC (permalink / raw)
  To: 'Richard.Earnshaw@arm.com'; +Cc: gdb

target OS is linux (kernel is 2.4.18).

:]k

-----Original Message-----
From: Richard Earnshaw [mailto:rearnsha@arm.com]
Sent: Thursday, May 16, 2002 10:25 AM
To: Kevin "Squail" Endres
Cc: gdb@sources.redhat.com; Richard.Earnshaw@arm.com
Subject: Re: cross targeted gdb and corefiles 


> I am using a gdb built from a cvs snapshot from 4-29 that is i386 hosted
and
> ARM targeted.
> 
> this gdb does not support reading arm cores. I would like to get a
backtrace
> for an arm failure (indeterminant - cannot set a breakpoint) without
running
> an arm native gdb (or running my application under gdbserver). Is that
> possible??

Not at present.

> 
> if not - is it a feature slated to be added to cross targeted gdb soon? I
> know i run my application under gdbserver...

Maybe.  Some targets can now do this.  Precisely which target OS are you 
using?

R.


^ permalink raw reply	[flat|nested] 20+ messages in thread
* cross targeted gdb and corefiles
@ 2002-05-16 10:10 Kevin "Squail" Endres
  2002-05-16 10:25 ` Richard Earnshaw
  0 siblings, 1 reply; 20+ messages in thread
From: Kevin "Squail" Endres @ 2002-05-16 10:10 UTC (permalink / raw)
  To: gdb

I am using a gdb built from a cvs snapshot from 4-29 that is i386 hosted and
ARM targeted.

this gdb does not support reading arm cores. I would like to get a backtrace
for an arm failure (indeterminant - cannot set a breakpoint) without running
an arm native gdb (or running my application under gdbserver). Is that
possible??

if not - is it a feature slated to be added to cross targeted gdb soon? I
know i run my application under gdbserver...

Thanks in advance!

:]k


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

end of thread, other threads:[~2002-05-17 15:20 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-16 15:56 cross targeted gdb and corefiles Kevin "Squail" Endres
  -- strict thread matches above, loose matches on Subject: below --
2002-05-16 17:18 Kevin "Squail" Endres
2002-05-16 16:28 Kevin "Squail" Endres
2002-05-17  8:06 ` Daniel Jacobowitz
2002-05-16 16:05 Kevin "Squail" Endres
2002-05-16 16:17 ` Kevin Buettner
2002-05-16 15:55 Kevin "Squail" Endres
2002-05-16 15:43 Kevin "Squail" Endres
2002-05-16 15:53 ` Kevin Buettner
2002-05-16 15:28 Kevin "Squail" Endres
2002-05-16 15:33 ` Kevin Buettner
2002-05-16 15:01 Kevin "Squail" Endres
2002-05-16 15:23 ` Kevin Buettner
2002-05-16 16:18   ` Jason R Thorpe
2002-05-17  8:20 ` Richard Earnshaw
2002-05-16 11:35 Kevin "Squail" Endres
2002-05-16 10:28 Kevin "Squail" Endres
2002-05-16 10:10 Kevin "Squail" Endres
2002-05-16 10:25 ` Richard Earnshaw
2002-05-16 11:07   ` Daniel Jacobowitz

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