From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom de Vries <tdevries@suse.de>, Tom Tromey <tromey@adacore.com>
Subject: [PATCH] Restore previous sigmask in gdb.block_signals
Date: Fri, 28 Jul 2023 12:10:11 -0600 [thread overview]
Message-ID: <20230728181011.2651060-1-tromey@adacore.com> (raw)
Tom de Vries found a bug where, sometimes, a SIGCHLD would be
delivered to a non-main thread, wreaking havoc.
The problem is that gdb.block_signals was unblocking the signals it
blocked -- but it was being called from the DAP thread, leading to
SIGCHLD being unblocked there.
This patch fixes the problem by restoring the previous set of signals
instead.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30680
---
gdb/python/lib/gdb/__init__.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/python/lib/gdb/__init__.py b/gdb/python/lib/gdb/__init__.py
index 98aadb1dfea..b3124369fe8 100644
--- a/gdb/python/lib/gdb/__init__.py
+++ b/gdb/python/lib/gdb/__init__.py
@@ -271,11 +271,11 @@ def blocked_signals():
return
to_block = {signal.SIGCHLD, signal.SIGINT, signal.SIGALRM, signal.SIGWINCH}
- signal.pthread_sigmask(signal.SIG_BLOCK, to_block)
+ old_mask = signal.pthread_sigmask(signal.SIG_BLOCK, to_block)
try:
yield None
finally:
- signal.pthread_sigmask(signal.SIG_UNBLOCK, to_block)
+ signal.pthread_sigmask(signal.SIG_SETMASK, old_mask)
class Thread(threading.Thread):
--
2.40.1
next reply other threads:[~2023-07-28 18:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-28 18:10 Tom Tromey [this message]
2023-07-29 6:25 ` Tom de Vries
2023-07-29 6:37 ` Tom de Vries
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=20230728181011.2651060-1-tromey@adacore.com \
--to=tromey@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
/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).