]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Clean up suppress_new_breakpoint_event
authorTom Tromey <tromey@adacore.com>
Tue, 23 Jan 2024 17:25:33 +0000 (10:25 -0700)
committerTom Tromey <tromey@adacore.com>
Mon, 12 Feb 2024 17:42:21 +0000 (10:42 -0700)
Kévin pointed out that suppress_new_breakpoint_event would do the
wrong thing if it happened to be used reentrantly.  While I don't
think this can happen, it's also easy and clearly better to make it
robust.

gdb/python/lib/gdb/dap/breakpoint.py

index 9cbd7ae0c472376fa7341730e287e2c98d971f74..87e746472fb088d89569faa5cc5f7a8028da9f9a 100644 (file)
@@ -47,11 +47,12 @@ _suppress_bp = False
 def suppress_new_breakpoint_event():
     """Return a new context manager that suppresses new breakpoint events."""
     global _suppress_bp
+    saved = _suppress_bp
     _suppress_bp = True
     try:
         yield None
     finally:
-        _suppress_bp = False
+        _suppress_bp = saved
 
 
 @in_gdb_thread