Open Grazfather opened 5 months ago
Having poked at this a bit with you in Discord, it appears to be an interaction between GEF, GDB and BMD around when GDB's getting details about the newly attached target's threads environment.
Further debugging is required to figure out what exactly and who's bug this is quite (beyond GDB still refusing to properly fix #929 which precipitates the entire problem to begin with)
Easy repro: gdbinit:
source hook_continue.py
target extended-remote /dev/cu.usbmodem72AE15F41
monitor tpwr enable
monitor swdp_scan
attach 1
hook_continue.py:
def f(_):
gdb.selected_frame()
gdb.events.cont.connect(f)
Seems that the continue event is fired out while attaching. While this is happening the current_thread_
is set to nullptr
, so gdb.selected_frame()
cannot be called.
We can confirm with this trivial repro that yep, crashes!
This clearly isn't a BMP bug, but I haven't been able to reproduce when attaching to a local process... It seems that the hooks are not called in that flow, which makes sense since we see attach_command
call extended_remote_target::attach
.
I've filed a bug with gdb: https://sourceware.org/bugzilla/show_bug.cgi?id=31303
GDB 13.2, arm-none-eabi-gdb on MacOS Sonoma (installed with homebrew)
Running gef on
main
at 13a93390123682363e7430cf4531f11cb3fe85ff I also have gef-extras checked out at 700a3f71078dd184c5d57dc7f31c3410d4a97ae0My .gdbinit contains
I can also reproduce when I do scan
And I can reproduce with a freshly plugged-in bmp