mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-05-25 03:06:11 +08:00
Release the GIL while running a gdb command or expression
PR python/23615 points out that gdb.execute_gdb_command does not release the Python GIL. This means that, while the gdb command is running, other Python threads do not run. This patch solves the problem by introducing a new RAII class that can be used to temporarily release and then re-acquire the GIL, then puts this into the appropriate places in execute_gdb_command and gdbpy_parse_and_eval. This does not include a test case, because after some research I could not find a way to write one that was not racy. gdb/ChangeLog 2019-01-30 Tom Tromey <tom@tromey.com> PR python/23615: * python/python.c (execute_gdb_command): Use gdbpy_allow_threads. (gdbpy_parse_and_eval): Likewise. * python/python-internal.h (gdbpy_allow_threads): New class.
This commit is contained in:
@ -576,6 +576,8 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
|
||||
|
||||
TRY
|
||||
{
|
||||
gdbpy_allow_threads allow_threads;
|
||||
|
||||
struct interp *interp;
|
||||
|
||||
std::string arg_copy = arg;
|
||||
@ -898,6 +900,7 @@ gdbpy_parse_and_eval (PyObject *self, PyObject *args)
|
||||
|
||||
TRY
|
||||
{
|
||||
gdbpy_allow_threads allow_threads;
|
||||
result = parse_and_eval (expr_str);
|
||||
}
|
||||
CATCH (except, RETURN_MASK_ALL)
|
||||
|
Reference in New Issue
Block a user