From: Simon Marchi <simon.marchi@polymtl.ca>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@polymtl.ca>
Subject: [PATCH 1/7] gdb: move declarations of check_quit_flag and set_quit_flag to extension.h
Date: Tue, 23 Apr 2024 09:22:56 -0400 [thread overview]
Message-ID: <20240423132517.2625632-2-simon.marchi@polymtl.ca> (raw)
In-Reply-To: <20240423132517.2625632-1-simon.marchi@polymtl.ca>
Move them out of defs.h, to extension.h, since the implementations are
in extension.c.
Change-Id: Ie7321468bd7fecc684d70b09f72c3ee8ac75d8f4
---
gdb/defs.h | 19 -------------------
gdb/extension.c | 17 ++++-------------
gdb/extension.h | 30 ++++++++++++++++++++++++++++++
3 files changed, 34 insertions(+), 32 deletions(-)
diff --git a/gdb/defs.h b/gdb/defs.h
index 91724d30195f..6f9c0d1f781a 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -94,25 +94,6 @@ extern std::string python_libdir;
/* * Search path for separate debug files. */
extern std::string debug_file_directory;
-/* GDB's SIGINT handler basically sets a flag; code that might take a
- long time before it gets back to the event loop, and which ought to
- be interruptible, checks this flag using the QUIT macro, which, if
- GDB has the terminal, throws a quit exception.
-
- In addition to setting a flag, the SIGINT handler also marks a
- select/poll-able file descriptor as read-ready. That is used by
- interruptible_select in order to support interrupting blocking I/O
- in a race-free manner.
-
- These functions use the extension_language_ops API to allow extension
- language(s) and GDB SIGINT handling to coexist seamlessly. */
-
-/* * Evaluate to non-zero if the quit flag is set, zero otherwise. This
- will clear the quit flag as a side effect. */
-extern int check_quit_flag (void);
-/* * Set the quit flag. */
-extern void set_quit_flag (void);
-
/* The current quit handler (and its type). This is called from the
QUIT macro. See default_quit_handler below for default behavior.
Parts of GDB temporarily override this to e.g., completely suppress
diff --git a/gdb/extension.c b/gdb/extension.c
index f4bdcc1f6110..2d692d054315 100644
--- a/gdb/extension.c
+++ b/gdb/extension.c
@@ -863,16 +863,10 @@ restore_active_ext_lang (struct active_ext_lang_state *previous)
xfree (previous);
}
-/* Set the quit flag.
- This only sets the flag in the currently active extension language.
- If the currently active extension language does not have cooperative
- SIGINT handling, then GDB's global flag is set, and it is up to the
- extension language to call check_quit_flag. The extension language
- is free to install its own SIGINT handler, but we still need to handle
- the transition. */
+/* See extension.h. */
void
-set_quit_flag (void)
+set_quit_flag ()
{
#if CXX_STD_THREAD
std::lock_guard guard (ext_lang_mutex);
@@ -894,13 +888,10 @@ set_quit_flag (void)
}
}
-/* Return true if the quit flag has been set, false otherwise.
- Note: The flag is cleared as a side-effect.
- The flag is checked in all extension languages that support cooperative
- SIGINT handling, not just the current one. This simplifies transitions. */
+/* See extension.h. */
int
-check_quit_flag (void)
+check_quit_flag ()
{
#if CXX_STD_THREAD
std::lock_guard guard (ext_lang_mutex);
diff --git a/gdb/extension.h b/gdb/extension.h
index 9ba1299f95e1..94a500d74586 100644
--- a/gdb/extension.h
+++ b/gdb/extension.h
@@ -429,4 +429,34 @@ class scoped_disable_cooperative_sigint_handling
bool m_prev_cooperative_sigint_handling_disabled;
};
+/* GDB's SIGINT handler basically sets a flag; code that might take a
+ long time before it gets back to the event loop, and which ought to
+ be interruptible, checks this flag using the QUIT macro, which, if
+ GDB has the terminal, throws a quit exception.
+
+ In addition to setting a flag, the SIGINT handler also marks a
+ select/poll-able file descriptor as read-ready. That is used by
+ interruptible_select in order to support interrupting blocking I/O
+ in a race-free manner.
+
+ These functions use the extension_language_ops API to allow extension
+ language(s) and GDB SIGINT handling to coexist seamlessly. */
+
+/* Return true if the quit flag has been set, false otherwise.
+ Note: The flag is cleared as a side-effect.
+ The flag is checked in all extension languages that support cooperative
+ SIGINT handling, not just the current one. This simplifies transitions. */
+
+extern int check_quit_flag ();
+
+/* Set the quit flag.
+ This only sets the flag in the currently active extension language.
+ If the currently active extension language does not have cooperative
+ SIGINT handling, then GDB's global flag is set, and it is up to the
+ extension language to call check_quit_flag. The extension language
+ is free to install its own SIGINT handler, but we still need to handle
+ the transition. */
+
+extern void set_quit_flag ();
+
#endif /* EXTENSION_H */
--
2.44.0
next prev parent reply other threads:[~2024-04-23 13:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-23 13:22 [PATCH 0/7] More cleanup of defs.h Simon Marchi
2024-04-23 13:22 ` Simon Marchi [this message]
2024-04-25 8:52 ` [PATCH 1/7] gdb: move declarations of check_quit_flag and set_quit_flag to extension.h Alexandra Petlanova Hajkova
2024-04-29 14:46 ` Simon Marchi
2024-04-23 13:22 ` [PATCH 2/7] gdb: change return type of check_quit_flag to bool Simon Marchi
2024-04-27 9:01 ` Alexandra Petlanova Hajkova
2024-04-23 13:22 ` [PATCH 3/7] gdb: change type of quit_flag " Simon Marchi
2024-04-23 13:22 ` [PATCH 4/7] gdb: move a bunch of quit-related things to event-top.{c,h} Simon Marchi
2024-04-23 13:23 ` [PATCH 5/7] gdb: move annotation_level declaration/definition to annotate.{h,c} Simon Marchi
2024-04-23 13:23 ` [PATCH 6/7] gdb: remove enum precision_type Simon Marchi
2024-04-23 13:23 ` [PATCH 7/7] gdb: move symbol_file_command declaration to symfile.h Simon Marchi
2024-04-23 15:00 ` [PATCH 0/7] More cleanup of defs.h Tom Tromey
2024-04-23 15:30 ` Simon Marchi
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=20240423132517.2625632-2-simon.marchi@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--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).