GNU Binutils with patches for OS216
修订版 | 9c0b896ee1d4edfe30c783b027ed5c081845a63d (tree) |
---|---|
时间 | 2018-01-23 21:37:43 |
作者 | Philipp Rudo <prudo@linu...> |
Commiter | Andreas Arnez |
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.
@@ -1,5 +1,11 @@ | ||
1 | 1 | 2018-01-23 Philipp Rudo <prudo@linux.vnet.ibm.com> |
2 | 2 | |
3 | + * s390-linux-tdep.c (gdbarch_tdep.s390_syscall_record): New hook. | |
4 | + (s390_process_record, s390_gdbarch_tdep_alloc) | |
5 | + (s390_linux_init_abi_any): Use/set new hook. | |
6 | + | |
7 | +2018-01-23 Philipp Rudo <prudo@linux.vnet.ibm.com> | |
8 | + | |
3 | 9 | * s390-linux-tdep.c (osabi.h): New include. |
4 | 10 | (s390_linux_init_abi_31, s390_linux_init_abi_64) |
5 | 11 | (s390_linux_init_abi_any): New functions. |
@@ -122,6 +122,9 @@ struct gdbarch_tdep | ||
122 | 122 | bool have_tdb; |
123 | 123 | bool have_vx; |
124 | 124 | bool have_gs; |
125 | + | |
126 | + /* Hook to record OS specific systemcall. */ | |
127 | + int (*s390_syscall_record) (struct regcache *regcache, LONGEST svc_number); | |
125 | 128 | }; |
126 | 129 | |
127 | 130 |
@@ -3808,6 +3811,7 @@ static int | ||
3808 | 3811 | s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache, |
3809 | 3812 | CORE_ADDR addr) |
3810 | 3813 | { |
3814 | + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | |
3811 | 3815 | uint16_t insn[3] = {0}; |
3812 | 3816 | /* Instruction as bytes. */ |
3813 | 3817 | uint8_t ibyte[6]; |
@@ -3964,8 +3968,16 @@ ex: | ||
3964 | 3968 | |
3965 | 3969 | case 0x0a: |
3966 | 3970 | /* SVC - supervisor call */ |
3967 | - if (s390_linux_syscall_record (regcache, ibyte[1])) | |
3968 | - return -1; | |
3971 | + if (tdep->s390_syscall_record != NULL) | |
3972 | + { | |
3973 | + if (tdep->s390_syscall_record (regcache, ibyte[1])) | |
3974 | + return -1; | |
3975 | + } | |
3976 | + else | |
3977 | + { | |
3978 | + printf_unfiltered (_("no syscall record support\n")); | |
3979 | + return -1; | |
3980 | + } | |
3969 | 3981 | break; |
3970 | 3982 | |
3971 | 3983 | case 0x0b: /* BSM - branch and set mode */ |
@@ -7997,6 +8009,8 @@ s390_gdbarch_tdep_alloc () | ||
7997 | 8009 | tdep->have_vx = false; |
7998 | 8010 | tdep->have_gs = false; |
7999 | 8011 | |
8012 | + tdep->s390_syscall_record = NULL; | |
8013 | + | |
8000 | 8014 | return tdep; |
8001 | 8015 | } |
8002 | 8016 |
@@ -8195,6 +8209,10 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) | ||
8195 | 8209 | static void |
8196 | 8210 | s390_linux_init_abi_any (struct gdbarch_info info, struct gdbarch *gdbarch) |
8197 | 8211 | { |
8212 | + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | |
8213 | + | |
8214 | + tdep->s390_syscall_record = s390_linux_syscall_record; | |
8215 | + | |
8198 | 8216 | linux_init_abi (info, gdbarch); |
8199 | 8217 | |
8200 | 8218 | /* Register handling. */ |