Use gdbpy_enter in py-breakpoint.c
A few spots in py-breakpoint.c acquire the GIL manually. However, because these spots generate events, and because events are expected to be arbitrary gdb-flavored Python code, it's important to use gdbpy_enter instead, in order to ensure that the other gdb-related Python globals are set correctly. This patch makes this change. Tested on x86-64 Fedora 29. gdb/ChangeLog 2019-06-10 Tom Tromey <tom@tromey.com> * python/py-breakpoint.c (gdbpy_breakpoint_created) (gdbpy_breakpoint_deleted, gdbpy_breakpoint_modified): Use gdbpy_enter.
This commit is contained in:
parent
caa429d81a
commit
25ce02ee7b
2 changed files with 14 additions and 10 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2019-06-10 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* python/py-breakpoint.c (gdbpy_breakpoint_created)
|
||||||
|
(gdbpy_breakpoint_deleted, gdbpy_breakpoint_modified): Use
|
||||||
|
gdbpy_enter.
|
||||||
|
|
||||||
2019-06-10 Tom Tromey <tromey@adacore.com>
|
2019-06-10 Tom Tromey <tromey@adacore.com>
|
||||||
|
|
||||||
* elfread.c (elf_read_minimal_symbols): Don't set the dbx objfile
|
* elfread.c (elf_read_minimal_symbols): Don't set the dbx objfile
|
||||||
|
|
|
@ -1003,7 +1003,6 @@ static void
|
||||||
gdbpy_breakpoint_created (struct breakpoint *bp)
|
gdbpy_breakpoint_created (struct breakpoint *bp)
|
||||||
{
|
{
|
||||||
gdbpy_breakpoint_object *newbp;
|
gdbpy_breakpoint_object *newbp;
|
||||||
PyGILState_STATE state;
|
|
||||||
|
|
||||||
if (!user_breakpoint_p (bp) && bppy_pending_object == NULL)
|
if (!user_breakpoint_p (bp) && bppy_pending_object == NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -1015,7 +1014,8 @@ gdbpy_breakpoint_created (struct breakpoint *bp)
|
||||||
&& bp->type != bp_access_watchpoint)
|
&& bp->type != bp_access_watchpoint)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
state = PyGILState_Ensure ();
|
struct gdbarch *garch = bp->gdbarch ? bp->gdbarch : get_current_arch ();
|
||||||
|
gdbpy_enter enter_py (garch, current_language);
|
||||||
|
|
||||||
if (bppy_pending_object)
|
if (bppy_pending_object)
|
||||||
{
|
{
|
||||||
|
@ -1046,8 +1046,6 @@ gdbpy_breakpoint_created (struct breakpoint *bp)
|
||||||
gdb_py_events.breakpoint_created) < 0)
|
gdb_py_events.breakpoint_created) < 0)
|
||||||
gdbpy_print_stack ();
|
gdbpy_print_stack ();
|
||||||
}
|
}
|
||||||
|
|
||||||
PyGILState_Release (state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Callback that is used when a breakpoint is deleted. This will
|
/* Callback that is used when a breakpoint is deleted. This will
|
||||||
|
@ -1056,13 +1054,14 @@ static void
|
||||||
gdbpy_breakpoint_deleted (struct breakpoint *b)
|
gdbpy_breakpoint_deleted (struct breakpoint *b)
|
||||||
{
|
{
|
||||||
int num = b->number;
|
int num = b->number;
|
||||||
PyGILState_STATE state;
|
|
||||||
struct breakpoint *bp = NULL;
|
struct breakpoint *bp = NULL;
|
||||||
|
|
||||||
state = PyGILState_Ensure ();
|
|
||||||
bp = get_breakpoint (num);
|
bp = get_breakpoint (num);
|
||||||
if (bp)
|
if (bp)
|
||||||
{
|
{
|
||||||
|
struct gdbarch *garch = bp->gdbarch ? bp->gdbarch : get_current_arch ();
|
||||||
|
gdbpy_enter enter_py (garch, current_language);
|
||||||
|
|
||||||
gdbpy_ref<gdbpy_breakpoint_object> bp_obj (bp->py_bp_object);
|
gdbpy_ref<gdbpy_breakpoint_object> bp_obj (bp->py_bp_object);
|
||||||
if (bp_obj != NULL)
|
if (bp_obj != NULL)
|
||||||
{
|
{
|
||||||
|
@ -1077,7 +1076,6 @@ gdbpy_breakpoint_deleted (struct breakpoint *b)
|
||||||
--bppy_live;
|
--bppy_live;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PyGILState_Release (state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Callback that is used when a breakpoint is modified. */
|
/* Callback that is used when a breakpoint is modified. */
|
||||||
|
@ -1086,13 +1084,14 @@ static void
|
||||||
gdbpy_breakpoint_modified (struct breakpoint *b)
|
gdbpy_breakpoint_modified (struct breakpoint *b)
|
||||||
{
|
{
|
||||||
int num = b->number;
|
int num = b->number;
|
||||||
PyGILState_STATE state;
|
|
||||||
struct breakpoint *bp = NULL;
|
struct breakpoint *bp = NULL;
|
||||||
|
|
||||||
state = PyGILState_Ensure ();
|
|
||||||
bp = get_breakpoint (num);
|
bp = get_breakpoint (num);
|
||||||
if (bp)
|
if (bp)
|
||||||
{
|
{
|
||||||
|
struct gdbarch *garch = bp->gdbarch ? bp->gdbarch : get_current_arch ();
|
||||||
|
gdbpy_enter enter_py (garch, current_language);
|
||||||
|
|
||||||
PyObject *bp_obj = (PyObject *) bp->py_bp_object;
|
PyObject *bp_obj = (PyObject *) bp->py_bp_object;
|
||||||
if (bp_obj)
|
if (bp_obj)
|
||||||
{
|
{
|
||||||
|
@ -1104,7 +1103,6 @@ gdbpy_breakpoint_modified (struct breakpoint *b)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PyGILState_Release (state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue