Breakpoint on a memory range

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
User avatar
Cosmium
Microbot
Posts: 156
Joined: Tue Dec 04, 2018 10:20 pm
Location: USA

Breakpoint on a memory range

Post by Cosmium »

I'm trying to set a debugger breakpoint that triggers on a memory read/write over a memory range rather than a single address. I think it could be a handy, time-saving feature to catch and track down suspected random memory writes caused by bugs in my code :oops:

Couldn't find much information online about setting this type of breakpoint in the capable InkSpector or ZX-Spin debuggers, which I suspect have this ability.

Anyone know how to do it? Thanks
Ralf
Rick Dangerous
Posts: 2289
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: Breakpoint on a memory range

Post by Ralf »

Here is a very old post about breakpoints in Spin, which is probably the best documentation existing about them :lol:

https://worldofspectrum.org/forums/disc ... edirect/p1

You want probably something like this:

Image

Please notice that the field Address must be empty. It is filled by default and means that breakpoint will hit only on this single memory address.
User avatar
Cosmium
Microbot
Posts: 156
Joined: Tue Dec 04, 2018 10:20 pm
Location: USA

Re: Breakpoint on a memory range

Post by Cosmium »

Ralf wrote: Sat Jun 11, 2022 11:56 am Here is a very old post about breakpoints in Spin, which is probably the best documentation existing about them :lol:

https://worldofspectrum.org/forums/disc ... edirect/p1

You want probably something like this:

Image

Please notice that the field Address must be empty. It is filled by default and means that breakpoint will hit only on this single memory address.
Works great.. thanks!
Now to track down those pesky (and spurious.. the worst kind) memory writes
Inky
Dizzy
Posts: 95
Joined: Tue Dec 10, 2019 10:05 pm
Location: Sheffield, UK

Re: Breakpoint on a memory range

Post by Inky »

Cosmium wrote: Sat Jun 11, 2022 2:32 am I'm trying to set a debugger breakpoint that triggers on a memory read/write over a memory range rather than a single address. I think it could be a handy, time-saving feature to catch and track down suspected random memory writes caused by bugs in my code :oops:

Couldn't find much information online about setting this type of breakpoint in the capable InkSpector or ZX-Spin debuggers, which I suspect have this ability.

Anyone know how to do it? Thanks
Hi,

Sorry for the tardy response!

The way to do it with Inkspector (it's easier with the new 2.0.4 release so I'd suggest you upgrade any older version first) is to add a breakpoint with the following settings:

Breakpoint Type: Memory Read
Address: 0 (this value will actually be ignored due to the mask value below being set to 0)
Address Mask: 0 (this causes all memory addresses to be considered, not just Address above)
ROM/RAM Pages: Any
Condition: @addr >16384 && @addr < 32768

The remaining values are OK with their defaults.

In the condition box, @addr is the address being read from or written to, so you can change the breakpoint type to Memory *Write* and it will then break on memory writes of the same range. All symbols and z80 regsiters are available too, so you can include those in the condition expression.

If you change the breakpoint type to Condition, it will break when the specified condition is true regardless of when it occurs.

HTH
Inky.
User avatar
Cosmium
Microbot
Posts: 156
Joined: Tue Dec 04, 2018 10:20 pm
Location: USA

Re: Breakpoint on a memory range

Post by Cosmium »

Inky wrote: Sat Dec 31, 2022 2:33 pm Hi,

Sorry for the tardy response!

The way to do it with Inkspector (it's easier with the new 2.0.4 release so I'd suggest you upgrade any older version first) is to add a breakpoint with the following settings:
...

HTH
Inky.
Thanks Inky - really helps. Expecially coupled with the debugger's inherent awareness of the system variable symbols :)
Post Reply