List Info

Thread: GDB stub - connection from 32 bit GDB or 64 bit GDB




GDB stub - connection from 32 bit GDB or 64 bit GDB
user name
2006-09-27 17:34:45
Hi,

  How can the gdb stub know if a 32 bit GDB is connecting to
the stub
or a 64 bit GDB is connecting to the stub?   Is it even
possible?  It
doesn't seem possible to me looking at the current gdb
remote
commands, but hopefully I overlooked something.
  I have tried different combinations with 32-bit and 64-bit
GDBs and
gdbservers and it seems like a 32 bit GDB will not work with
a 64 bit
gdbserver and vice versa.

  Thanks for you help.

Mitchell
GDB stub - connection from 32 bit GDB or 64 bit GDB
user name
2006-09-27 17:51:35
It always amazes me how a problem will be known but quiet
for a couple
of years, and then half a dozen people will look at it at
once 

On Wed, Sep 27, 2006 at 10:34:45AM -0700, Mitchell Fang
wrote:
> Hi,
> 
>  How can the gdb stub know if a 32 bit GDB is
connecting to the stub
> or a 64 bit GDB is connecting to the stub?   Is it even
possible?  It
> doesn't seem possible to me looking at the current gdb
remote
> commands, but hopefully I overlooked something.

It's not possible.

>  I have tried different combinations with 32-bit and
64-bit GDBs and
> gdbservers and it seems like a 32 bit GDB will not work
with a 64 bit
> gdbserver and vice versa.

The stub shouldn't adapt: the GDB client should.  This may
be of
interest:
  http://sourceware.org/ml/gdb-patches/2006-09/msg00187.
html
  http://sourceware.org/ml/gdb-patches/2006-09/msg00188.
html

I'm less optimistic I'll have my code out this week, but I'm
still
trying.  What architecture are you using?

-- 
Daniel Jacobowitz
CodeSourcery
GDB stub - connection from 32 bit GDB or 64 bit GDB
user name
2006-09-27 18:17:27
On 9/27/06, Daniel Jacobowitz <drowfalse.org> wrote:
> It always amazes me how a problem will be known but
quiet for a couple
> of years, and then half a dozen people will look at it
at once 
>
> On Wed, Sep 27, 2006 at 10:34:45AM -0700, Mitchell Fang
wrote:
> > Hi,
> >
> >  How can the gdb stub know if a 32 bit GDB is
connecting to the stub
> > or a 64 bit GDB is connecting to the stub?   Is it
even possible?  It
> > doesn't seem possible to me looking at the current
gdb remote
> > commands, but hopefully I overlooked something.
>
> It's not possible.
>
> >  I have tried different combinations with 32-bit
and 64-bit GDBs and
> > gdbservers and it seems like a 32 bit GDB will not
work with a 64 bit
> > gdbserver and vice versa.
>
> The stub shouldn't adapt: the GDB client should.  This
may be of
> interest:
>   http://sourceware.org/ml/gdb-patches/2006-09/msg00187.
html
>   http://sourceware.org/ml/gdb-patches/2006-09/msg00188.
html
>
> I'm less optimistic I'll have my code out this week,
but I'm still
> trying.  What architecture are you using?

The target architecture is PowerPC and the host architecture
is i686 cygwin.

Thanks for your help and I will await your patch.

Mitchell

>
> --
> Daniel Jacobowitz
> CodeSourcery
>
GDB stub - connection from 32 bit GDB or 64 bit GDB
user name
2006-09-27 18:22:30
Hi,

On Wed, 27 Sep 2006 20:17:27 +0200, Mitchell Fang wrote:
> On 9/27/06, Daniel Jacobowitz <drowfalse.org> wrote:
...
> >   http://sourceware.org/ml/gdb-patches/2006-09/msg00187.
html
> >   http://sourceware.org/ml/gdb-patches/2006-09/msg00188.
html
...
> The target architecture is PowerPC and the host
architecture is i686 cygwin.
> 
> Thanks for your help and I will await your patch.

Did you try the way of
	file (before using `target remote')
or
	set architecture
?  It works for me on x86_64 debugging x86_64 target (as it
expects i386).

set architecture i38686_64
target remote localhost:1234
[ works ]

Still sure some bit-size autodetecting patch by Daniel would
be the best.


Regards,
Lace
GDB stub - connection from 32 bit GDB or 64 bit GDB
user name
2006-09-27 18:27:05
On Wed, 2006-09-27 at 10:34 -0700, Mitchell Fang wrote:
> Hi,
> 
>   How can the gdb stub know if a 32 bit GDB is
connecting to the stub
> or a 64 bit GDB is connecting to the stub?   Is it even
possible?  It
> doesn't seem possible to me looking at the current gdb
remote
> commands, but hopefully I overlooked something.
>   I have tried different combinations with 32-bit and
64-bit GDBs and
> gdbservers and it seems like a 32 bit GDB will not work
with a 64 bit
> gdbserver and vice versa.

In general, a stub is built for a single architecture, while
gdb
may be built to handle several architecture variants (such
as 32 bit
and 64 bit versions of the same processor family). 
Therefore in
practice, to my knowledge, it's never the stub that adapts
to gdb, 
it's gdb that adapts to the stub.

That's not to say that it's prohibited, but there's
currently
no provision for it in the remote protocol.

However, there *is* provision for a general purpose query
(get/set) request.  You could use that to, say, tell your 
(custom) stub which version of the architecture you wanted
to talk to.

See the "Q"/"q" messages.

Michael


GDB stub - connection from 32 bit GDB or 64 bit GDB
user name
2006-09-27 19:59:03
"Mitchell Fang" <mitchell.fanggmail.com> writes:
>  How can the gdb stub know if a 32 bit GDB is
connecting to the stub
> or a 64 bit GDB is connecting to the stub?   Is it even
possible?  It
> doesn't seem possible to me looking at the current gdb
remote
> commands, but hopefully I overlooked something.
>  I have tried different combinations with 32-bit and
64-bit GDBs and
> gdbservers and it seems like a 32 bit GDB will not work
with a 64 bit
> gdbserver and vice versa.

You haven't provided enough information for us to help you.

I assume you're having some troubles connecting a particular
GDB with
a particular stub, but when you wrote your message, you
guessed that
the problem was a 32-bit vs. 64-bit problem, and then wrote
your
message to provide only enough information for us to help
you *if*
your guess was right.

Instead, simply describe to us the problem you're having,
without
guessing about the underlying cause:

- What is the program you're trying to debug running on? 
What
  processor architecture?  Is it an evaluation board?

- What kind of machine is GDB running on?  What operating
system is it
  running?

- How is GDB connecting to the program you're trying to
debug?  The
  remote protocol?  gdbserver?  RedBoot?  A custom stub
built into the
  eval board?

- What happened when you tried to connect?  What was the
exact error
  message?  Can you cut and paste the session from your
terminal?
[1-6]

about | contact  Other archives ( Real Estate discussion Medical topics )