summaryrefslogtreecommitdiff
path: root/gdbserver/linux-low.h
diff options
context:
space:
mode:
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2020-06-22 14:13:48 +0200
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2020-06-22 14:13:48 +0200
commit013e3554b269aa1da0fcd478969f0df65341e50e (patch)
treeb7ef9feb80297403a78f0ab0bd582d7b764f1b1d /gdbserver/linux-low.h
parentbd920864f3dc2cad376989a642ab774aef6b2fce (diff)
downloadbinutils-gdb-013e3554b269aa1da0fcd478969f0df65341e50e.tar.gz
gdbserver/linux-low: use std::list to store pending signals
Use std::list to store pending signals instead of a manually-managed linked list. This is a refactoring. In the existing code, pending signals are kept in a manually-created linked list with "prev" pointers. A new pending signal is thus inserted to the beginning of the list. When consuming, GDB goes until the end of the list, following the "prev" pointers, and processes the final item. With this patch, a new item is added to the end of the list and the item at the front of the list is consumed. In other words, the list elements used to be stored in reverse order; with this patch, they are stored in their order of arrival. This causes a change in the debug messages that print the pending signals. Otherwise, no behavioral change is expected. gdbserver/ChangeLog: 2020-06-22 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Use std::list to stop pending signal instead of manually-created linked list. * linux-low.h: Include <list>. (struct pending_signal): Move here from linux-low.cc. (struct lwp_info) <pending_signals> <pending_signals_to_report>: Update the type. * linux-low.cc (struct pending_signals): Remove. (linux_process_target::delete_lwp) (linux_process_target::add_lwp) (enqueue_one_deferred_signal) (dequeue_one_deferred_signal) (enqueue_pending_signal) (linux_process_target::resume_one_lwp_throw) (linux_process_target::thread_needs_step_over) (linux_process_target::resume_one_thread) (linux_process_target::proceed_one_lwp): Update the use of pending signal list.
Diffstat (limited to 'gdbserver/linux-low.h')
-rw-r--r--gdbserver/linux-low.h27
1 files changed, 20 insertions, 7 deletions
diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h
index 5fed2ee2ca2..0ef659fb0f0 100644
--- a/gdbserver/linux-low.h
+++ b/gdbserver/linux-low.h
@@ -31,6 +31,8 @@
#include "target/waitstatus.h" /* For enum target_stop_reason. */
#include "tracepoint.h"
+#include <list>
+
#define PTRACE_XFER_TYPE long
#ifdef HAVE_LINUX_REGSETS
@@ -695,6 +697,18 @@ extern linux_process_target *the_linux_target;
#define get_thread_lwp(thr) ((struct lwp_info *) (thread_target_data (thr)))
#define get_lwp_thread(lwp) ((lwp)->thread)
+/* Information about a signal that is to be delivered to a thread. */
+
+struct pending_signal
+{
+ pending_signal (int signal)
+ : signal {signal}
+ {};
+
+ int signal;
+ siginfo_t info;
+};
+
/* This struct is recorded in the target_data field of struct thread_info.
On linux ``all_threads'' is keyed by the LWP ID, which we use as the
@@ -786,9 +800,8 @@ struct lwp_info
next time we see this LWP stop. */
int must_set_ptrace_flags;
- /* If this is non-zero, it points to a chain of signals which need to
- be delivered to this process. */
- struct pending_signals *pending_signals;
+ /* A chain of signals that need to be delivered to this process. */
+ std::list<pending_signal> pending_signals;
/* A link used when resuming. It is initialized from the resume request,
and then processed and cleared in linux_resume_one_lwp. */
@@ -800,10 +813,10 @@ struct lwp_info
if a signal arrives to this lwp while it is collecting. */
fast_tpoint_collect_result collecting_fast_tracepoint;
- /* If this is non-zero, it points to a chain of signals which need
- to be reported to GDB. These were deferred because the thread
- was doing a fast tracepoint collect when they arrived. */
- struct pending_signals *pending_signals_to_report;
+ /* A chain of signals that need to be reported to GDB. These were
+ deferred because the thread was doing a fast tracepoint collect
+ when they arrived. */
+ std::list<pending_signal> pending_signals_to_report;
/* When collecting_fast_tracepoint is first found to be 1, we insert
a exit-jump-pad-quickly breakpoint. This is it. */