[Coco] xroar host debugger project?

Ciaran Anscomb cocomalt at 6809.org.uk
Sun Sep 18 13:33:45 EDT 2022


Joel Rees via Coco wrote:
> [...]
> >
> > Can I just be sure you're not talking about attaching GDB to an XRoar
> > process here?  I'm talking about the port XRoar can listen on (with the
> > -gdb option) that GDB can connect to.
> 
> Without the patches, I don't think I have anything to attach to but
> the SRoar process.

So with the "-gdb" option, XRoar listens on a TCP port for GDB to
connect to.  That's just built in.  At the time, any GDB could connect,
it's just way more helpful if GDB knows about 6809 - which is what my
patched branch of ye olde GDB does.

> > (And if you yourself want to attempt similar, GDB supports custom
> > protocol additions - the 'q' commands - so we should be able to allow
> > inspecting/changing other bits of hardware than the RAM, too).
> 
> I've been thinking that direction, as well.

If you start to look into it, the general GDB remote protocol descriptions
are useful:

https://sourceware.org/gdb/onlinedocs/gdb/Remote-Protocol.html

And there are some comments at the top of "gdb.c" in the XRoar source
suggesting some of the current extensions...  well, actually it's just
inspecting the SAM register so far.  If you get to the point where you
want more information out of the emulated machine through more protocol
extensions, I'm quite happy to discuss.  Clearly adding GIME state to
that would be required too...

(Oh and another caveat: the GDB support in XRoar only covers the
6809-based machines so far).

> > > Building the patched version of gdb -- will that require messing
> > > around in /dev or such? Or can the patched debugger run in userland?
> >
> > No, userland: http://www.6809.org.uk/dragon/m6809-gdb.shtml
> 
> That page shows the command
> 
>    git clone -b m6809-7.6 https://www.6809.org.uk/git/binutils-gdb.git
> 
> So I tried the clone, exactly as written, and the clone just never
> starts. I have to ctl-C to get my terminal back after waiting two or
> three minutes, and there's nothing in the directory I'm cloning to.

Hm I tried it and it does complete, just takes a long time.  It's quite
a big repo...

If you periodically "du" inside the "binutils-gdb" it creates for the
checkout you should see it growing.  It gets there eventually - 372M
and 9716 files ;)

> You have this note:
> 
>     2016-05-30: This repository has changed because the source
> repository for GDB changed. It is now based on
> git://sourceware.org/git/binutils-gdb.git ,
> 
> But I nosed around in there and didn't see patches for the 6809, and
> trying to clone that, the branch m6809-7.6 is not found.

No indeed, that's the upstream repo, my branch is just based on that.

> > I did write a quick & dirty getting started note here:
> >
> > http://www.6809.org.uk/tmp/xroar/m6809-gdb.txt
> 
> That does look good, if I can get the repository.
> 
> Thanks for walking me through this.

No worries - hope you get it built.  It's an old version of GDB now, so
it's going to get more and more difficult I suspect.  I had to rebuild my
local copy today to test all this due to some python libraries changing
underneath it...

..ciaran


More information about the Coco mailing list