From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH v5 2/6] [gdb/python] Make python selftest more robust
Date: Tue, 24 Oct 2023 11:49:29 +0200 [thread overview]
Message-ID: <20231024094933.12009-3-tdevries@suse.de> (raw)
In-Reply-To: <20231024094933.12009-1-tdevries@suse.de>
When running the python selftest, we call raise directly:
...
scoped_restore save_hook
= make_scoped_restore (&hook_set_active_ext_lang,
[]() { raise (SIGINT); });
...
While this tests the signal handling in its natural form, it runs the risk of
interference from other signals.
Instead:
- use signal_handler_selftest to isolate the selftest from user signals, and
- use "handle_sigint (SIGINT)" to deliver the signal.
Tested on x86_64-linux.
---
gdb/python/python.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/gdb/python/python.c b/gdb/python/python.c
index d569fb5a3e4..00e8968d3ed 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -39,6 +39,7 @@
#if GDB_SELF_TEST
#include "gdbsupport/selftest.h"
+#include "event-top.h"
#endif
/* Declared constants and enum for python stack printing. */
@@ -2246,11 +2247,15 @@ test_python ()
SELF_CHECK (output.empty ());
}
+ signal_handler_selftest a_signal_handler_selftest;
+ if (!a_signal_handler_selftest.valid ())
+ return;
+
saw_exception = false;
{
scoped_restore save_hook
= make_scoped_restore (&hook_set_active_ext_lang,
- []() { raise (SIGINT); });
+ []() { handle_sigint (SIGINT); });
try
{
CMD (output);
--
2.35.3
next prev parent reply other threads:[~2023-10-24 9:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-24 9:49 [PATCH v5 0/6] [gdb/cli] Allow source highlighting to be interrupted Tom de Vries
2023-10-24 9:49 ` [PATCH v5 1/6] [gdb/cli] Add signal_handler_selftest Tom de Vries
2023-11-22 16:26 ` Tom de Vries
2023-10-24 9:49 ` Tom de Vries [this message]
2023-10-24 9:49 ` [PATCH v5 3/6] [gdb/cli] Add gnu-source-highlight selftest Tom de Vries
2023-10-24 12:33 ` Tom de Vries
2023-10-24 9:49 ` [PATCH v5 4/6] [gdb/cli] Allow source highlighting to be interrupted Tom de Vries
2023-10-24 9:49 ` [PATCH v5 5/6] [gdb/cli] Ask if source highlighting should " Tom de Vries
2023-10-24 9:49 ` [PATCH v5 6/6] [gdb/cli] Simplify gdb_highlight_event_listener::notify 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=20231024094933.12009-3-tdevries@suse.de \
--to=tdevries@suse.de \
--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).