gdbserver, remote serial protocol and endian issues
Daniel Jacobowitz
dmj+@andrew.cmu.edu
Mon Apr 8 08:44:00 GMT 2002
On Mon, Apr 08, 2002 at 04:33:01PM +0100, Paul Bartlett wrote:
> Hi Daniel,
>
> > I don't agree. Target registers are in
> > target-endianness when you read them off
> > the stack; they should be in target endianness
> > in memory. GDB has 'set endian little' and
> > 'set endian big', and the stub should just pass
> > them along however it gets them. gdbserver is
> > also meant to run in a native configuration,
> > where compile-time checks can tell you the
> > endianness.
>
> Well, maybe I'm guilty of not considering the
> general case - haven't thought it through yet.
As soon as you try looking through stack frames, you realize that
keeping registers in target byte order is a lot simpler for the rest of
GDB.
> Our application connects to the H-UDI (JTAG)
> port of the SH4 for high speed (~20 MBits/s)
> access through the back door into the chip.
>
> The physical implementation includes a 32 bit
> shift register. What we notice is that if we
> change endianness then we have to endswap the
> 32 bit quantity that appears in the register
> before transferring it to the target machine
> reg. - it never actually gets into memory.
That's a property of the board, right? It expects this shift register
to be in its own endianness... or is something else going on?
> > My first impression is that gdbserver is the
> > wrong tool for the job. Gdbserver is meant as
> > a remote stub for Unix-like systems. You're
> > not running it on a Unix-like system; you're
> > using it as a proxy, right? Since GDB already
> > has a stub to speak to the hardware monitor
> > on SH4 boards, as far as I'm aware.
> > This sounds like a job for rproxy
> > (http://world.std.com/~qqi) instead.
>
> Maybe we re-invented the wheel, some. Our
> implementation runs on a box equipped with
> cpu/flash/ram and ethernet and jtag interfaces.
> It does implement the remote protocol in much
> the same way that rproxy does, but also adds
> facilities like posix i/o through the debug
> port.
>
> Works well. We've used it for debugging both
> 'bare machine' embedded and rtos based apps.
> (I also brought up a linux kernel with it).
Nice job, although I'm not sure gdbserver is the best base for it; like
I said, it's generally Unix-based. However, with the other
organizational cleanup I've been adding to it lately, I think there's a
clean place to integrate this sort of thing now.
I don't suppose you're thinking of contributing it? The POSIX I/O
stuff especially would be nice to have in gdbserver.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
More information about the Gdb
mailing list