aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Rudo <prudo@linux.vnet.ibm.com>2018-01-23 13:37:43 +0100
committerAndreas Arnez <arnez@linux.vnet.ibm.com>2018-01-23 13:37:43 +0100
commit9c0b896ee1d4edfe30c783b027ed5c081845a63d (patch)
tree557e3861248505f39fcab0bc5758a3f006a739cd
parent7042632bf7976d29889ba89fe4867654c5f38e2d (diff)
downloadgdb-9c0b896ee1d4edfe30c783b027ed5c081845a63d.zip
gdb-9c0b896ee1d4edfe30c783b027ed5c081845a63d.tar.gz
gdb-9c0b896ee1d4edfe30c783b027ed5c081845a63d.tar.bz2
s390: gdbarch_tdep add hook for syscall record
Most parts of s390_process_record are common for the architecture. Only the system call handling differs between the OSes. In order to be able to move s390_process_record to a common code file add a hook to record syscalls to gdbarch_tdep. So every OS can implement their own handling. gdb/ChangeLog: * s390-linux-tdep.c (gdbarch_tdep.s390_syscall_record): New hook. (s390_process_record, s390_gdbarch_tdep_alloc) (s390_linux_init_abi_any): Use/set new hook.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/s390-linux-tdep.c22
2 files changed, 26 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 636ac81..05cb6de 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2018-01-23 Philipp Rudo <prudo@linux.vnet.ibm.com>
+ * s390-linux-tdep.c (gdbarch_tdep.s390_syscall_record): New hook.
+ (s390_process_record, s390_gdbarch_tdep_alloc)
+ (s390_linux_init_abi_any): Use/set new hook.
+
+2018-01-23 Philipp Rudo <prudo@linux.vnet.ibm.com>
+
* s390-linux-tdep.c (osabi.h): New include.
(s390_linux_init_abi_31, s390_linux_init_abi_64)
(s390_linux_init_abi_any): New functions.
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index 681f665..b61a249 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -122,6 +122,9 @@ struct gdbarch_tdep
bool have_tdb;
bool have_vx;
bool have_gs;
+
+ /* Hook to record OS specific systemcall. */
+ int (*s390_syscall_record) (struct regcache *regcache, LONGEST svc_number);
};
@@ -3808,6 +3811,7 @@ static int
s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
CORE_ADDR addr)
{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
uint16_t insn[3] = {0};
/* Instruction as bytes. */
uint8_t ibyte[6];
@@ -3964,8 +3968,16 @@ ex:
case 0x0a:
/* SVC - supervisor call */
- if (s390_linux_syscall_record (regcache, ibyte[1]))
- return -1;
+ if (tdep->s390_syscall_record != NULL)
+ {
+ if (tdep->s390_syscall_record (regcache, ibyte[1]))
+ return -1;
+ }
+ else
+ {
+ printf_unfiltered (_("no syscall record support\n"));
+ return -1;
+ }
break;
case 0x0b: /* BSM - branch and set mode */
@@ -7997,6 +8009,8 @@ s390_gdbarch_tdep_alloc ()
tdep->have_vx = false;
tdep->have_gs = false;
+ tdep->s390_syscall_record = NULL;
+
return tdep;
}
@@ -8195,6 +8209,10 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
static void
s390_linux_init_abi_any (struct gdbarch_info info, struct gdbarch *gdbarch)
{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ tdep->s390_syscall_record = s390_linux_syscall_record;
+
linux_init_abi (info, gdbarch);
/* Register handling. */