Summary: | event loop deadlocks when using continue in breakpoint command and using gdb.execute in stop event hook written in Python | ||
---|---|---|---|
Product: | gdb | Reporter: | Disconnect3d <dominik.b.czarnota+bugzilla> |
Component: | gdb | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | NEW --- | ||
Severity: | normal | CC: | aburgess, simark |
Priority: | P2 | ||
Version: | HEAD | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Last reconfirmed: | 2023-04-12 00:00:00 | |
Attachments: | Possible patch for this problem. |
Description
Disconnect3d
2022-11-28 09:00:11 UTC
This can be worked around in the following way. However, this is not a good solution since this means one can't script GDB using both its native CLI commands and Python at the same time. ``` import gdb def stop_handler (event): print("Python stop handler started") print("Thread is stopped: " + str(gdb.selected_thread().is_stopped())) print("Thread is running: " + str(gdb.selected_thread().is_running())) (gdb.execute("",to_string=True)) print("Thread is stopped: " + str(gdb.selected_thread().is_stopped())) print("Thread is running: " + str(gdb.selected_thread().is_running())) print("Python Stop handler finished\n") gdb.events.stop.connect (stop_handler) class Bp(gdb.Breakpoint): def stop(self): print("Breakpoint hit!") return True Bp("foo") ``` Created attachment 14819 [details]
Possible patch for this problem.
This patch seems to address the problem reported in this bug. I think there might be other bugs in this area though -- while I was testing this I hit some other strange behaviours that I still need to look into.
Also I need to write some actual tests before this could be posted to the m/l.
|