aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-breakpoint.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python/py-breakpoint.c')
-rw-r--r--gdb/python/py-breakpoint.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index fc9543e..88cd7de 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -1003,7 +1003,6 @@ static void
gdbpy_breakpoint_created (struct breakpoint *bp)
{
gdbpy_breakpoint_object *newbp;
- PyGILState_STATE state;
if (!user_breakpoint_p (bp) && bppy_pending_object == NULL)
return;
@@ -1015,7 +1014,8 @@ gdbpy_breakpoint_created (struct breakpoint *bp)
&& bp->type != bp_access_watchpoint)
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)
{
@@ -1046,8 +1046,6 @@ gdbpy_breakpoint_created (struct breakpoint *bp)
gdb_py_events.breakpoint_created) < 0)
gdbpy_print_stack ();
}
-
- PyGILState_Release (state);
}
/* Callback that is used when a breakpoint is deleted. This will
@@ -1056,13 +1054,14 @@ static void
gdbpy_breakpoint_deleted (struct breakpoint *b)
{
int num = b->number;
- PyGILState_STATE state;
struct breakpoint *bp = NULL;
- state = PyGILState_Ensure ();
bp = get_breakpoint (num);
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);
if (bp_obj != NULL)
{
@@ -1077,7 +1076,6 @@ gdbpy_breakpoint_deleted (struct breakpoint *b)
--bppy_live;
}
}
- PyGILState_Release (state);
}
/* Callback that is used when a breakpoint is modified. */
@@ -1086,13 +1084,14 @@ static void
gdbpy_breakpoint_modified (struct breakpoint *b)
{
int num = b->number;
- PyGILState_STATE state;
struct breakpoint *bp = NULL;
- state = PyGILState_Ensure ();
bp = get_breakpoint (num);
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;
if (bp_obj)
{
@@ -1104,7 +1103,6 @@ gdbpy_breakpoint_modified (struct breakpoint *b)
}
}
}
- PyGILState_Release (state);
}