aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog13
-rw-r--r--gdb/linux-nat.c26
-rw-r--r--gdb/linux-nat.h7
-rw-r--r--gdb/linux-thread-db.c21
4 files changed, 40 insertions, 27 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c71d779..e79b953 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,16 @@
+2021-02-12 Tom de Vries <tdevries@suse.de>
+
+ PR threads/26228
+ * linux-nat.c (lin_thread_get_thread_signals): Remove.
+ (lin_thread_signals): New static var.
+ (lin_thread_get_thread_signal_num, lin_thread_get_thread_signal):
+ New function.
+ * linux-nat.h (lin_thread_get_thread_signals): Remove.
+ (lin_thread_get_thread_signal_num, lin_thread_get_thread_signal):
+ Declare.
+ * linux-thread-db.c (check_thread_signals): Use
+ lin_thread_get_thread_signal_num and lin_thread_get_thread_signal.
+
2021-02-12 Andrew Burgess <andrew.burgess@embecosm.com>
* f-exp.y (f77_keywords): Add allocated.
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 10419dc..42dcd77 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -4411,16 +4411,24 @@ Enables printf debugging output."),
the GNU/Linux Threads library and therefore doesn't really belong
here. */
-/* Return the set of signals used by the threads library in *SET. */
+/* NPTL reserves the first two RT signals, but does not provide any
+ way for the debugger to query the signal numbers - fortunately
+ they don't change. */
+static int lin_thread_signals[] = { __SIGRTMIN, __SIGRTMIN + 1 };
-void
-lin_thread_get_thread_signals (sigset_t *set)
+/* See linux-nat.h. */
+
+unsigned int
+lin_thread_get_thread_signal_num (void)
{
- sigemptyset (set);
+ return sizeof (lin_thread_signals) / sizeof (lin_thread_signals[0]);
+}
- /* NPTL reserves the first two RT signals, but does not provide any
- way for the debugger to query the signal numbers - fortunately
- they don't change. */
- sigaddset (set, __SIGRTMIN);
- sigaddset (set, __SIGRTMIN + 1);
+/* See linux-nat.h. */
+
+int
+lin_thread_get_thread_signal (unsigned int i)
+{
+ gdb_assert (i < lin_thread_get_thread_signal_num ());
+ return lin_thread_signals[i];
}
diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h
index a5547f2..ff4d753 100644
--- a/gdb/linux-nat.h
+++ b/gdb/linux-nat.h
@@ -304,8 +304,11 @@ void check_for_thread_db (void);
true on success, false if the process isn't using libpthread. */
extern int thread_db_notice_clone (ptid_t parent, ptid_t child);
-/* Return the set of signals used by the threads library. */
-extern void lin_thread_get_thread_signals (sigset_t *mask);
+/* Return the number of signals used by the threads library. */
+extern unsigned int lin_thread_get_thread_signal_num (void);
+
+/* Return the i-th signal used by the threads library. */
+extern int lin_thread_get_thread_signal (unsigned int i);
/* Find process PID's pending signal set from /proc/pid/status. */
void linux_proc_pending_signals (int pid, sigset_t *pending,
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index dce4bd2..4dab64a 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -161,8 +161,6 @@ static thread_db_target the_thread_db_target;
/* Non-zero if we have determined the signals used by the threads
library. */
static int thread_signals;
-static sigset_t thread_stop_set;
-static sigset_t thread_print_set;
struct thread_db_info
{
@@ -1225,23 +1223,14 @@ check_thread_signals (void)
{
if (!thread_signals)
{
- sigset_t mask;
int i;
- lin_thread_get_thread_signals (&mask);
- sigemptyset (&thread_stop_set);
- sigemptyset (&thread_print_set);
-
- for (i = 1; i < NSIG; i++)
+ for (i = 0; i < lin_thread_get_thread_signal_num (); i++)
{
- if (sigismember (&mask, i))
- {
- if (signal_stop_update (gdb_signal_from_host (i), 0))
- sigaddset (&thread_stop_set, i);
- if (signal_print_update (gdb_signal_from_host (i), 0))
- sigaddset (&thread_print_set, i);
- thread_signals = 1;
- }
+ int sig = lin_thread_get_thread_signal (i);
+ signal_stop_update (gdb_signal_from_host (sig), 0);
+ signal_print_update (gdb_signal_from_host (sig), 0);
+ thread_signals = 1;
}
}
}