FYI: release GIL along all paths

Tom Tromey tromey@redhat.com
Thu Oct 13 14:54:00 GMT 2011


I'm checking this in.

I noticed that gdbpy_breakpoint_deleted can return early while still
holding the GIL.  This is a bug.  The fix is to ensure that the GIL is
released along all paths.

Tom

2011-10-13  Tom Tromey  <tromey@redhat.com>

	* python/py-breakpoint.c (gdbpy_breakpoint_deleted): Ensure GIL is
	always released.

Index: python/py-breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-breakpoint.c,v
retrieving revision 1.25
diff -u -r1.25 py-breakpoint.c
--- python/py-breakpoint.c	5 Aug 2011 14:24:10 -0000	1.25
+++ python/py-breakpoint.c	13 Oct 2011 14:52:37 -0000
@@ -841,15 +841,15 @@
 
   state = PyGILState_Ensure ();
   bp = get_breakpoint (num);
-  if (! bp)
-    return;
-
-  bp_obj = bp->py_bp_object;
-  if (bp_obj)
+  if (bp)
     {
-      bp_obj->bp = NULL;
-      --bppy_live;
-      Py_DECREF (bp_obj);
+      bp_obj = bp->py_bp_object;
+      if (bp_obj)
+	{
+	  bp_obj->bp = NULL;
+	  --bppy_live;
+	  Py_DECREF (bp_obj);
+	}
     }
   PyGILState_Release (state);
 }



More information about the Gdb-patches mailing list