caprice32 icon indicating copy to clipboard operation
caprice32 copied to clipboard

Embedded debugger

Open ColinPitrat opened this issue 9 years ago • 5 comments

Provide a tool allowing to:

  • examine registers
  • disassemble code
  • modify code and memory.

ColinPitrat avatar May 09 '16 20:05 ColinPitrat

Perhaps a gdb remote would be great https://sourceware.org/gdb/onlinedocs/gdb/Remote-Stub.html

bignaux avatar Feb 17 '18 09:02 bignaux

There is a Visual-Studio Code Z80 debugger for Spectrum called DeZog. It is interfaced via a simple IP socket connection (typically on localhost), via a documented protocol. Some hints to add a new remote are given too, and there is an implementation as a DLL.

Originally the Debugger was made for the ZX Next and can manage sprite information, in addition to classical Z80 data.

bfxdev avatar May 29 '20 16:05 bfxdev

The Visual-Studio Code option sounds interesting.

Some thoughts on how to implement it in Caprice32 directly (some applies to an external debugger too):

  • CPC.break_points provide an address at which z80_execute will stop and return EC_BREAKPOINT
  • showGui, userConfirmsQuitWithoutSaving and showVKeyboard are 3 examples of GUI display - the difference here is that we would want to be able to update the back_surface. We may also want a way to see it without the GUI in front of it (or have the GUI next to it and force a higher resolution when using it).
  • when stepping, set the break_point to the next address. If we want to be able to step-in, some logic is needed to identify jumps. Another option is to add a support in the code to break at the next instruction no matter what.

ColinPitrat avatar Aug 04 '20 20:08 ColinPitrat

The protocol approach, on network or unix socket, is interesting as it could allow to support multiple debuggers (e.g DeZog + custom one running as a separate process but that can be launched from the UI)

ColinPitrat avatar Aug 05 '20 08:08 ColinPitrat

Development of the debugger has started. It can be invoked with F2 and already supports showing z80 registers, memory content, disassembly. It supports setting breakpoints and watchpoints. Missing features:

  • step instruction
  • read or write watch points (as opposed to read&write)
  • load symbol files
  • display stack
  • have multiple windows opened at the same time

ColinPitrat avatar May 15 '21 18:05 ColinPitrat

I'll call it done at this point although I still have some ideas of features that could be added.

ColinPitrat avatar Oct 09 '22 18:10 ColinPitrat