public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 2/3] Clean up suppress_new_breakpoint_event
Date: Wed, 24 Jan 2024 08:48:54 -0700	[thread overview]
Message-ID: <20240124-dap-launch-fix-v1-2-0d47f87fa9f0@adacore.com> (raw)
In-Reply-To: <20240124-dap-launch-fix-v1-0-0d47f87fa9f0@adacore.com>

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 | 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

-- 
2.43.0


  parent reply	other threads:[~2024-01-24 15:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-24 15:48 [PATCH 0/3] Fix ordering of configurationDone and launch Tom Tromey
2024-01-24 15:48 ` [PATCH 1/3] Export dap_initialize Tom Tromey
2024-01-24 15:48 ` Tom Tromey [this message]
2024-01-24 15:48 ` [PATCH 3/3] Fix DAP launch and configurationDone requests Tom Tromey
2024-02-12 17:41 ` [PATCH 0/3] Fix ordering of configurationDone and launch Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240124-dap-launch-fix-v1-2-0d47f87fa9f0@adacore.com \
    --to=tromey@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).