So, I'm trying to watch a variable from gdb (pico-sdk 2.1.1 build on Ubuntu 22.04, gdb-multiarch over openocd over Picoprobe), so I try this:
... and then I try to set up a watch of a mutex variable:OK, looks reasonable so far, but then I try to continue:
Too many? Let's delete the first one:
I hate this so much - so, how can I watch this variable in gdb?
Code:
(gdb) b platform_entryBreakpoint 1 at 0x1000021e: file /src/pico-sdk/src/rp2_common/pico_crt0/crt0.S, line 452.Note: automatically using hardware breakpoints for read-only addresses.(gdb) rThe program being debugged has been started already.Start it from the beginning? (y or n) yStarting program: /src/pico-examples/build/blink_simple/blink_simple.elf target halted due to debug-request, current mode: Thread xPSR: 0x01000000 pc: 0x00000178 msp: 0x20041f00[New Thread 2]Thread 1 hit Breakpoint 1, platform_entry () at /src/pico-sdk/src/rp2_common/pico_crt0/crt0.S:452452 ldr r1, =runtime_init(gdb) Code:
(gdb) p malloc_mutex $1 = {core = {spin_lock = 0x0}, owner = 0 '\000'}(gdb) p &malloc_mutex $2 = (mutex_t *) 0x200096bc <malloc_mutex>(gdb) watch *(mutex_t*)0x200096bcHardware watchpoint 2: *(mutex_t*)0x200096bc(gdb) info brNum Type Disp Enb Address What1 breakpoint keep y 0x1000021e /src/pico-sdk/src/rp2_common/pico_crt0/crt0.S:452breakpoint already hit 1 time2 hw watchpoint keep y *(mutex_t*)0x200096bcCode:
(gdb) cContinuing.Warning:Could not insert hardware watchpoint 2.Could not insert hardware breakpoints:You may have requested too many hardware breakpoints/watchpoints.Command aborted.Code:
(gdb) del br 1(gdb) info brNum Type Disp Enb Address What2 hw watchpoint keep y *(mutex_t*)0x200096bc(gdb) cContinuing.Warning:Could not insert hardware watchpoint 2.Could not insert hardware breakpoints:You may have requested too many hardware breakpoints/watchpoints.Command aborted.Statistics: Posted by sdbbs — Sun May 04, 2025 6:23 pm