raspberrypi / debugprobe

791 stars 212 forks source link

GDB automatic breakpoints do not count as hardware breakpoints #144

Closed recursivenomad closed 1 week ago

recursivenomad commented 5 months ago

I am not sure if this is a bug with GDB, or something to do with debugprobe not relaying the appropriate information back to GDB.

From the GDB issue:

I am debugging a Raspberry Pi Pico (RP2040, ARM Cortex-M0+) via a Picoprobe (a second Pico used as the debug probe), from GDB through OpenOCD. I have encountered this bug on Windows 10 with arm-none-eabi-gdb, and on Debian 12 with gdb-multiarch.

I send GDB set remote hardware-breakpoint-limit 4 at launch. If I manually request hbreak four times, the limit is successfully reached, and a fifth hbreak request gracefully returns "Hardware breakpoints used exceeds limit".

If I instead request break (noting that GDB reports "Note: automatically using hardware breakpoints for read-only addresses." at launch), I can see that GDB is successfully sending Z1 packets; however, these automatic hardware breakpoints do not appear to count towards the gracefully monitored hardware-breakpoint-limit. Listing these breakpoints with info break reports they are of Type "breakpoint" (not "hw breakpoint").

The result of this bug is that requesting more breakpoints than the hardware supports will result in a fatal error, requiring GDB to restart.

For my development environment, manually submitting hbreak is not a graceful workaround, as my debugging interface (VSCodium/VSCode) automatically submits break when creating breakpoints through the UI.

P33M commented 1 week ago

This is out of scope for this repo - most certainly a gdb bug, or openocd not gracefully handling the resource exhaustion.