BartmanAbyss / vscode-amiga-debug

One-stop Visual Studio Code Extension to compile, debug and profile Amiga C/C++ programs compiled by the bundled gcc 12.2 with the bundled WinUAE/FS-UAE.
GNU General Public License v3.0
315 stars 39 forks source link

Code debug break points #34

Closed rjobling closed 4 years ago

rjobling commented 4 years ago

Hi Bartman Is there a way to code a debug break point in C or inline asm? I thought maybe calling the exec function Debug(0) would do it. That seems to be an old way to hook into debuggers. How does the framework trigger break points? Maybe I can just emit the correct magic code?

BartmanAbyss commented 4 years ago

Hmm.. GDB needs to set breakpoints. The emulated Amiga knows nothing about breakpoints.

rjobling commented 4 years ago

What about a reliable way of crashing the emulation that the debugger would catch? I'm just trying to put together a useful assert macro.

BartmanAbyss commented 4 years ago

Yeah sure, you can do that. We're just doing an infinite loop and hit the pause button. However, the debugger breaks on address error (unaligned access, needs to be generated via inline asm) and "TRAP#7" opcode. So you could use either method to trigger a crash that the debugger notices.

rjobling commented 4 years ago

Thanks I used an unaligned write and that does the trick.