aboutsummaryrefslogtreecommitdiff
path: root/gdbserver/linux-low.cc
diff options
context:
space:
mode:
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2020-04-02 15:11:31 +0200
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2020-04-02 15:11:31 +0200
commit9eedd27d42ceeb6f3765c24972a5c97ce20727cd (patch)
tree5a404f9e0dc938bd6a5cf6563bd385606afa48f6 /gdbserver/linux-low.cc
parentb31cdfa69f4adfc4760da1480c900f5c27421d43 (diff)
downloadgdb-9eedd27d42ceeb6f3765c24972a5c97ce20727cd.zip
gdb-9eedd27d42ceeb6f3765c24972a5c97ce20727cd.tar.gz
gdb-9eedd27d42ceeb6f3765c24972a5c97ce20727cd.tar.bz2
gdbserver/linux-low: turn 'get_syscall_trapinfo' into a method
gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn the 'get_syscall_trapinfo' linux target op into a method of process_stratum_target. * linux-low.h (struct linux_target_ops): Remove the op. (class linux_process_target) <get_syscall_trapinfo> <gdb_catch_this_syscall> <low_supports_catch_syscall> <low_get_syscall_trapinfo>: Declare. * linux-low.cc (get_syscall_trapinfo): Turn into... (linux_process_target::get_syscall_trapinfo): ...this. (linux_process_target::low_get_syscall_trapinfo): Define. (gdb_catch_this_syscall_p): Turn into... (linux_process_target::gdb_catch_this_syscall): ...this. (linux_process_target::low_supports_catch_syscall): Define. Update the callers below. (linux_process_target::wait_1) (linux_process_target::supports_catch_syscall) * linux-x86-low.cc (class x86_target) <low_supports_catch_syscall> <low_get_syscall_trapinfo>: Declare. (x86_target::low_supports_catch_syscall): Define. (x86_get_syscall_trapinfo): Turn into... (x86_target::low_get_syscall_trapinfo): ...this. (the_low_target): Remove the op field. * linux-aarch64-low.cc (class aarch64_target) <low_supports_catch_syscall> <low_get_syscall_trapinfo>: Declare. (aarch64_target::low_supports_catch_syscall): Define. (aarch64_get_syscall_trapinfo): Turn into... (aarch64_target::low_get_syscall_trapinfo): ...this. (the_low_target): Remove the op field. * linux-arm-low.cc (class arm_target) <low_supports_catch_syscall> <low_get_syscall_trapinfo>: Declare. (arm_target::low_supports_catch_syscall): Define. (arm_get_syscall_trapinfo): Turn into... (arm_target::low_get_syscall_trapinfo): ...this. (the_low_target): Remove the op field. * linux-ppc-low.cc (the_low_target): Remove the op field. * linux-s390-low.cc (the_low_target): Remove the op field.
Diffstat (limited to 'gdbserver/linux-low.cc')
-rw-r--r--gdbserver/linux-low.cc49
1 files changed, 24 insertions, 25 deletions
diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index 5661543..cd04160 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -754,28 +754,17 @@ linux_process_target::get_pc (lwp_info *lwp)
return pc;
}
-/* This function should only be called if LWP got a SYSCALL_SIGTRAP.
- Fill *SYSNO with the syscall nr trapped. */
-
-static void
-get_syscall_trapinfo (struct lwp_info *lwp, int *sysno)
+void
+linux_process_target::get_syscall_trapinfo (lwp_info *lwp, int *sysno)
{
struct thread_info *saved_thread;
struct regcache *regcache;
- if (the_low_target.get_syscall_trapinfo == NULL)
- {
- /* If we cannot get the syscall trapinfo, report an unknown
- system call number. */
- *sysno = UNKNOWN_SYSCALL;
- return;
- }
-
saved_thread = current_thread;
current_thread = get_lwp_thread (lwp);
regcache = get_thread_regcache (current_thread, 1);
- (*the_low_target.get_syscall_trapinfo) (regcache, sysno);
+ low_get_syscall_trapinfo (regcache, sysno);
if (debug_threads)
debug_printf ("get_syscall_trapinfo sysno %d\n", *sysno);
@@ -783,6 +772,13 @@ get_syscall_trapinfo (struct lwp_info *lwp, int *sysno)
current_thread = saved_thread;
}
+void
+linux_process_target::low_get_syscall_trapinfo (regcache *regcache, int *sysno)
+{
+ /* By default, report an unknown system call number. */
+ *sysno = UNKNOWN_SYSCALL;
+}
+
bool
linux_process_target::save_stop_reason (lwp_info *lwp)
{
@@ -2961,29 +2957,26 @@ gdb_catching_syscalls_p (struct lwp_info *event_child)
return !proc->syscalls_to_catch.empty ();
}
-/* Returns 1 if GDB is interested in the event_child syscall.
- Only to be called when stopped reason is SYSCALL_SIGTRAP. */
-
-static int
-gdb_catch_this_syscall_p (struct lwp_info *event_child)
+bool
+linux_process_target::gdb_catch_this_syscall (lwp_info *event_child)
{
int sysno;
struct thread_info *thread = get_lwp_thread (event_child);
struct process_info *proc = get_thread_process (thread);
if (proc->syscalls_to_catch.empty ())
- return 0;
+ return false;
if (proc->syscalls_to_catch[0] == ANY_SYSCALL)
- return 1;
+ return true;
get_syscall_trapinfo (event_child, &sysno);
for (int iter : proc->syscalls_to_catch)
if (iter == sysno)
- return 1;
+ return true;
- return 0;
+ return false;
}
ptid_t
@@ -3326,7 +3319,7 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
/* Check if GDB is interested in this syscall. */
if (WIFSTOPPED (w)
&& WSTOPSIG (w) == SYSCALL_SIGTRAP
- && !gdb_catch_this_syscall_p (event_child))
+ && !gdb_catch_this_syscall (event_child))
{
if (debug_threads)
{
@@ -6404,10 +6397,16 @@ linux_process_target::read_loadmap (const char *annex, CORE_ADDR offset,
bool
linux_process_target::supports_catch_syscall ()
{
- return (the_low_target.get_syscall_trapinfo != NULL
+ return (low_supports_catch_syscall ()
&& linux_supports_tracesysgood ());
}
+bool
+linux_process_target::low_supports_catch_syscall ()
+{
+ return false;
+}
+
int
linux_process_target::get_ipa_tdesc_idx ()
{