Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Can't get cross debugging to work
@ 2012-03-13 19:47 Marc Khouzam
  2012-03-13 19:57 ` Pedro Alves
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Khouzam @ 2012-03-13 19:47 UTC (permalink / raw)
  To: 'gdb@sourceware.org'

Hi,

I've been breaking my head trying to figure out the recipe
to cross debug from a Linux 32bit to a Linux 64bit.  Can't do it.
Could someone be kind enough to confirm the steps?
Do I need to 'set architecture'?
Do I need to 'set osabi'?

Target:
> uname -a
Linux toside-linux64 2.6.16.54-0.2.5-smp #1 SMP Mon Jan 21 13:29:51 UTC 2008 x86_64 x86_64 x86_64 GNU/Linux

Compile gdbserver like this:
> cd gdb/build;../configure && make

Run:
> ./gdb/gdbserver/gdbserver :9999 ~/myBin.64

Host:
> uname -a
Linux toside-linux32 2.6.16.60-0.27-smp #1 SMP Mon Jul 28 13:07:19 UTC 2008 i686 i686 i386 GNU/Linux

Compile gdb like this:
> cd gdb/build; ../configure --enable-targets=x86_64-unknown-linux-gnu && make

Run:
> ./gdb/gdb ~/myBin.32

GNU gdb (GDB) 7.4
This GDB was configured as "i686-pc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /project/lmimtdesign/lmckhou/myBin.32...done.
(gdb) tar remote toside-linux64:9998
Remote debugging using toside-linux64:9998

warning: Selected architecture i386 is not compatible with reported target architecture i386:x86-64
warning: Architecture rejected target-supplied description
Remote register badly formatted: T0506:0000000000000000;07:90cbffffff7f0000;10:80baaaaaaa2a0000;thread:66c7;core:0;
here: 00000000;07:90cbffffff7f0000;10:80baaaaaaa2a0000;thread:66c7;core:0;

==

I've tried setting the architecture, I've tried building with --target instead of --enable-targets,
I've tried different names for the target (where are those defined anyway?), I've tried using
--enable-targets=all.  Nothing works. Sigh.

Thanks in advance

Marc


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

* Re: Can't get cross debugging to work
  2012-03-13 19:47 Can't get cross debugging to work Marc Khouzam
@ 2012-03-13 19:57 ` Pedro Alves
  2012-03-13 20:03   ` Marc Khouzam
  0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2012-03-13 19:57 UTC (permalink / raw)
  To: Marc Khouzam; +Cc: 'gdb@sourceware.org'

On 03/13/2012 07:47 PM, Marc Khouzam wrote:

> Run:
>> > ./gdb/gdbserver/gdbserver :9999 ~/myBin.64


> Run:
>> > ./gdb/gdb ~/myBin.32


Here's the problem.  You should be doing:

./gdb/gdb ~/myBin.64

> warning: Selected architecture i386 is not compatible with reported target architecture i386:x86-64
> warning: Architecture rejected target-supplied description

This means that GDB thinks the architecture is i386 (because you've gave it a 32-bit
executable to debug), while gdbserver claims it is debugging a x86-64 program.

-- 
Pedro Alves


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

* RE: Can't get cross debugging to work
  2012-03-13 19:57 ` Pedro Alves
@ 2012-03-13 20:03   ` Marc Khouzam
  0 siblings, 0 replies; 3+ messages in thread
From: Marc Khouzam @ 2012-03-13 20:03 UTC (permalink / raw)
  To: 'Pedro Alves'; +Cc: 'gdb@sourceware.org'

> -----Original Message-----
> From: Pedro Alves [mailto:palves@redhat.com] 
> Sent: Tuesday, March 13, 2012 3:57 PM
> To: Marc Khouzam
> Cc: 'gdb@sourceware.org'
> Subject: Re: Can't get cross debugging to work
> 
> On 03/13/2012 07:47 PM, Marc Khouzam wrote:
> 
> > Run:
> >> > ./gdb/gdbserver/gdbserver :9999 ~/myBin.64
> 
> 
> > Run:
> >> > ./gdb/gdb ~/myBin.32
> 
> 
> Here's the problem.  You should be doing:
> 
> ./gdb/gdb ~/myBin.64
> 
> > warning: Selected architecture i386 is not compatible with 
> reported target architecture i386:x86-64
> > warning: Architecture rejected target-supplied description
> 
> This means that GDB thinks the architecture is i386 (because 
> you've gave it a 32-bit
> executable to debug), while gdbserver claims it is debugging 
> a x86-64 program.

And it works!  Thanks for the quick answer.

I'd like to see the --enable-targets feature explained better
in the documentation.  I'll try to find time and write a patch,
but I don't understand much of it, so it will be to get the ball 
rolling.

Thanks again!

Marc


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

end of thread, other threads:[~2012-03-13 20:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-13 19:47 Can't get cross debugging to work Marc Khouzam
2012-03-13 19:57 ` Pedro Alves
2012-03-13 20:03   ` Marc Khouzam

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