Re: GDB interface with simulator

Theodore A. Roth
2003-11-14T19:07:32Z

On Fri, 14 Nov 2003, Daniel Jacobowitz wrote:

> On Fri, Nov 14, 2003 at 09:07:17AM -0800, Doug Evans wrote:
> > =?iso-8859-1?q?Rama=20Singh?= writes:
> > > I wish to use my simulator as an
> > > independent process running on the same machine or on
> > > other machine.
> >
> > Old versions of gdb had a file in gdb/gdbserver called low-sim.c.
> > IIRC, one would use this file in gdbserver and would link gdbserver
> > with libsim.a. You would then run this program on the host
> > you want to run your simulator on and use "target remote <simhost>:<port>"
> > in gdb to talk to gdbserver+sim.
> >
> > Maybe you could grab that file from an old version of gdb (e.g. 5.3)
> > and try to make it work with the version of gdb you have.
> > [or maybe even just build gdbserver from 5.3 sources]
> >
> > I don't recall why support for gdbserver+sim has been removed.
> > Maybe I'm mistaken and it's still there and I just can't see it.
>
> Because there was no point. The current simulators link directly into
> GDB, and the simulator interface has changed since anyone tried to use
> gdbserver that way. The correct thing is to write a layer in your
> simulator that serves the same purpose (speaks the remote protocol).
> It's not too hard.

I've written an avr simulator that speaks the remote protocol directly.
If you are looking for an example, it's available on savannah:

http://savannah.nongnu.org/projects/simulavr

Another example of the same thing with a different implementation is the
avarice project. It speaks the remote protocol, but instead of talking
to a simulator, it talks to a jtage ice box.

http://sourceforge.net/projects/avarice

Look at the source in cvs for each.

Hope that helps.

Ted Roth