Not able to do this easily with the MAME debugger, and wondering if Xroar can help me....
So I want to watch the BASIC array space for changes, but a simple breakpoint won't cut it as when a program adds a new simple variable it makes the array space move in memory. So I want to monitor the value in the array pointer at $1D/$1E, and then take an offset from what it points to. But again a simple watch point won't cut it as any time that $1D/$1E was updated it would become invalid.
So can Xroar/gdb do this?
Cheers.
Phill.
Can XRoar do this?
Re: Can XRoar do this?
So I guess what you want is an indirect watchpoint - certainly not _directly_ supported by the protocol, but you could imagine how it would be implemented: a watchpoint on the pointer address that removes any previous then adds a replacement watchpoint on the pointed-to area.
Sadly I don't know of any way in base GDB. Maybe with Python support? I just tried to build with Python support and hit this issue, but maybe forward porting the 6809 patches could side-step that.
XRoar has nothing to help here. I figured at first some extra trap syntax to set and use variables so you could do the above, but maybe this could be simpler - annotating traps with names? Making up some syntax on the fly (ie this does not exist yet), maybe something like:
Imagining there that [address] means contents of, and borrowing the /h annotation from GDB to specify 16-bits.
I'll have a think about all that and see what I can do, but afraid I've got nothing for your immediate problem.
Sadly I don't know of any way in base GDB. Maybe with Python support? I just tried to build with Python support and hit this issue, but maybe forward porting the 6809 patches could side-step that.
XRoar has nothing to help here. I figured at first some extra trap syntax to set and use variables so you could do the above, but maybe this could be simpler - annotating traps with names? Making up some syntax on the fly (ie this does not exist yet), maybe something like:
Code: Select all
# Trap that fires every time the array space pointer is written to
# It would modify the condition of the named trap below
trap write=0x1d-0x1e
trap-modify ARRAYS:access=[0x1d]/h-[0x23]/h
# Named trap that just emits one trace line
# Wouldn't be configured to fire until the above trap sets up its condition
trap ARRAYS:
trap-trace-n 1
I'll have a think about all that and see what I can do, but afraid I've got nothing for your immediate problem.
Re: Can XRoar do this?
In MAME's debugger, how about using a watchpoint that catches all memory accesses, but with a condition that limits it to the range you want by reading the pointer? e.g.
Code: Select all
wp 0,10000,w,wpaddr >= w@1d && wpaddr < w@1d + 100,{ printf "wrote %04x = %02x\n",wpaddr,wpdata }