gdb.execute blocks all the threads in python scripts gdb.execute blocks all the threads in python scripts multithreading multithreading

gdb.execute blocks all the threads in python scripts


However, gdb.execute is pausing my thread

What is happening here is that gdb.execute does not release Python's global lock when calling into gdb. So, while the gdb command executes, other Python threads are stuck.

This is just an oversight in gdb. I've filed a bug for it.

Is there another way to kill the debugged process if it is idling?

There is one other technique you can try -- I am not certain it will work. Unfortunately this part of gdb is not fully fleshed out (at the present moment); so also feel free to file bug reports.

The main idea is to run gdb commands on the main thread -- but not from Python. So, try writing your stepping loop using the gdb CLI, maybe like:

(gdb) while 1> stepi> end

Then your thread should be able to kill the inferior. Another approach might be for your thread to inject a gdb command into the main loop using gdb.post_event.