public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Clean up suppress_new_breakpoint_event
@ 2024-02-12 17:50 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2024-02-12 17:50 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=95fc420a40ebcbd510b41df77b93b11ec819f0a1

commit 95fc420a40ebcbd510b41df77b93b11ec819f0a1
Author: Tom Tromey <tromey@adacore.com>
Date:   Tue Jan 23 10:25:33 2024 -0700

    Clean up suppress_new_breakpoint_event
    
    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.

Diff:
---
 gdb/python/lib/gdb/dap/breakpoint.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdb/python/lib/gdb/dap/breakpoint.py b/gdb/python/lib/gdb/dap/breakpoint.py
index 9cbd7ae0c47..87e746472fb 100644
--- a/gdb/python/lib/gdb/dap/breakpoint.py
+++ b/gdb/python/lib/gdb/dap/breakpoint.py
@@ -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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-12 17:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-12 17:50 [binutils-gdb] Clean up suppress_new_breakpoint_event Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).