[v2,3/3,gdb/tdep] Use ptrace events to get current syscall
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Testing passed
|
Commit Message
Add a powerpc implementation of gdbarch_extended_event_to_syscall, for the
moment only mapping PTRACE_EVENT_EXEC to execve.
Use gdbarch_extended_event_to_syscall in linux_handle_extended_wait to
update the cached syscall number.
---
gdb/linux-nat.c | 5 +++++
gdb/ppc-linux-tdep.c | 17 +++++++++++++++++
2 files changed, 22 insertions(+)
@@ -1977,6 +1977,11 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
you have to be using PTRACE_SEIZE to get that. */
lp->syscall_state = TARGET_WAITKIND_SYSCALL_ENTRY;
+ struct gdbarch *gdbarch = target_thread_architecture (lp->ptid);
+ int syscall_number = gdbarch_extended_event_to_syscall (gdbarch, event);
+ if (syscall_number != -1)
+ lp->syscall_number = syscall_number;
+
if (event == PTRACE_EVENT_FORK || event == PTRACE_EVENT_VFORK
|| event == PTRACE_EVENT_CLONE)
{
@@ -64,6 +64,7 @@
#include "elf-bfd.h"
#include "producer.h"
#include "target-float.h"
+#include "nat/linux-ptrace.h"
#include "features/rs6000/powerpc-32l.c"
#include "features/rs6000/powerpc-altivec32l.c"
@@ -1373,6 +1374,19 @@ ppc_linux_get_syscall_number (struct gdbarch *gdbarch,
static struct linux_record_tdep ppc_linux_record_tdep;
static struct linux_record_tdep ppc64_linux_record_tdep;
+static int
+ppc_linux_extended_event_to_syscall (struct gdbarch *gdbarch, int event)
+{
+ switch (event)
+ {
+ case PTRACE_EVENT_EXEC:
+ /* Execve syscall. */
+ return 11;
+ }
+
+ return -1;
+}
+
/* ppc_canonicalize_syscall maps from the native PowerPC Linux set of
syscall ids into a canonical set of syscall ids used by process
record. (See arch/powerpc/include/uapi/asm/unistd.h in kernel tree.)
@@ -2173,6 +2187,9 @@ ppc_linux_init_abi (struct gdbarch_info info,
/* Get the syscall number from the arch's register. */
set_gdbarch_get_syscall_number (gdbarch, ppc_linux_get_syscall_number);
+ set_gdbarch_extended_event_to_syscall (gdbarch,
+ ppc_linux_extended_event_to_syscall);
+
/* SystemTap functions. */
set_gdbarch_stap_integer_prefixes (gdbarch, stap_integer_prefixes);
set_gdbarch_stap_register_indirection_prefixes (gdbarch,