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

Michael Snyder
2006-09-27T18:27:11Z

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