diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2013-09-13 14:17:31 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2013-09-13 14:17:31 +0000 |
commit | 4ac33720d6022079e8b038e795e40f0e06a4012c (patch) | |
tree | d8f025080163d46f3730e61fae2a14b59654f68e /gdb/s390-nat.c | |
parent | 2ccd146855365598ad2644ef8139f2f2a6747b90 (diff) | |
download | gdb-4ac33720d6022079e8b038e795e40f0e06a4012c.zip gdb-4ac33720d6022079e8b038e795e40f0e06a4012c.tar.gz gdb-4ac33720d6022079e8b038e795e40f0e06a4012c.tar.bz2 |
gdb/ChangeLog:
2013-09-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
* NEWS: Mention TDB support.
* features/s390-tdb.xml: New file.
* features/s390-te-linux64.xml: New file.
* features/s390x-te-linux64.xml: New file.
* features/Makefile (WHICH): Add new tdescs above.
(s390-te-linux64-expedite): Set.
(s390x-te-linux64-expedite): Set.
* features/s390-te-linux64.c: New file (generated).
* features/s390x-te-linux64.c: New file (generated).
* regformats/s390-te-linux64.dat: New file (generated).
* regformats/s390x-te-linux64.dat: New file (generated).
* s390-tdep.h (HWCAP_S390_HIGH_GPRS): Define.
(HWCAP_S390_TE): Likewise.
(S390_TDB_DWORD0_REGNUM): Likewise.
(S390_TDB_DWORD0_REGNUM): Likewise.
(S390_TDB_ABORT_CODE_REGNUM): Likewise.
(S390_TDB_CONFLICT_TOKEN_REGNUM): Likewise.
(S390_TDB_ATIA_REGNUM): Likewise.
(S390_TDB_R0_REGNUM): Likewise.
(S390_TDB_R1_REGNUM): Likewise.
(S390_TDB_R2_REGNUM): Likewise.
(S390_TDB_R3_REGNUM): Likewise.
(S390_TDB_R4_REGNUM): Likewise.
(S390_TDB_R5_REGNUM): Likewise.
(S390_TDB_R6_REGNUM): Likewise.
(S390_TDB_R7_REGNUM): Likewise.
(S390_TDB_R8_REGNUM): Likewise.
(S390_TDB_R9_REGNUM): Likewise.
(S390_TDB_R10_REGNUM): Likewise.
(S390_TDB_R11_REGNUM): Likewise.
(S390_TDB_R12_REGNUM): Likewise.
(S390_TDB_R13_REGNUM): Likewise.
(S390_TDB_R14_REGNUM): Likewise.
(S390_TDB_R15_REGNUM): Likewise.
(S390_NUM_REGS): Increase.
(S390_IS_TDBREGSET_REGNUM): New macro.
(s390_regmap_tdb): Declare.
(s390_sizeof_tdbregset): Define.
(tdesc_s390_te_linux64): Declare.
(tdesc_s390x_te_linux64): Likewise.
* s390-tdep.c: Add includes for "auxv.h", <elf.h>,
"features/s390-te-linux64.c", and "features/s390x-te-linux64.c".
(s390_regmap_tdb): New regmap.
(s390_supply_tdb_regset): New function.
(s390_tdb_regset): New regset.
(s390_linux64v2_regset_sections): Add TDB regset to list.
(s390x_linux64v2_regset_sections): Likewise.
(s390_regset_from_core_section): Recognize TDB core note section.
(s390_core_read_description): If HWCAP indicates TE support,
select tdesc_s390_te_linux64 or tdesc_s390_s390x_te_linux64.
(s390_gdbarch_init): Handle TDB regset.
(_initialize_s390_tdep): Initialize new tdescs.
* s390-nat.c (HWCAP_S390_HIGH_GPRS): Remove define.
(have_regset_tdb): New variable.
(s390_native_supply): Support register invalidation.
(fetch_regset): Invalidate registers if ptrace yields ENODATA.
(check_regset): Treat ENODATA as "regset exists".
(s390_linux_fetch_inferior_registers): Add TDB.
(s390_read_description): Check for TDB existence and select
appropriate tdesc.
* gdbserver/Makefile.in (clean): Add removal of new makefile
targets.
(s390-te-linux64.c): New makefile target.
(s390x-te-linux64.c): Likewise.
* gdbserver/configure.srv (srv_regobj): Append new objects
s390-te-linux64.o and s390x-te-linux64.o.
(srv_xmlfiles): Append new files s390-te-linux64.xml,
s390x-te-linux64.xml, and s390-tdb.xml.
* gdbserver/linux-s390-low.c (init_registers_s390_te_linux64): New
declaration.
(tdesc_s390_te_linux64): Likewise.
(init_registers_s390x_te_linux64): Likewise.
(tdesc_s390x_te_linux64): Likewise.
(s390_check_regset): Treat ENODATA as "regset exists".
(s390_arch_setup): Add TDB regset support.
(initialize_low_arch): Initialize registers for new tdescs.
gdb/doc/ChangeLog:
2013-09-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
* gdb.texinfo (Decimal Floating Point format): Mention S/390.
(Standard Target Features): Add new node to menu.
(S/390 and System z Features): New node.
gdb/testsuite/ChangeLog:
2013-09-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
* gdb.arch/s390-tdbregs.c: New file.
* gdb.arch/s390-tdbregs.exp: New file.
Diffstat (limited to 'gdb/s390-nat.c')
-rw-r--r-- | gdb/s390-nat.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/gdb/s390-nat.c b/gdb/s390-nat.c index 5f4d0b4..d16ae0c 100644 --- a/gdb/s390-nat.c +++ b/gdb/s390-nat.c @@ -37,10 +37,6 @@ #include <sys/ucontext.h> #include <elf.h> -#ifndef HWCAP_S390_HIGH_GPRS -#define HWCAP_S390_HIGH_GPRS 512 -#endif - #ifndef PTRACE_GETREGSET #define PTRACE_GETREGSET 0x4204 #endif @@ -51,6 +47,7 @@ static int have_regset_last_break = 0; static int have_regset_system_call = 0; +static int have_regset_tdb = 0; /* Map registers to gregset/ptrace offsets. These arrays are defined in s390-tdep.c. */ @@ -72,7 +69,7 @@ s390_native_supply (struct regcache *regcache, const short *map, const gdb_byte *regp) { for (; map[0] >= 0; map += 2) - regcache_raw_supply (regcache, map[1], regp + map[0]); + regcache_raw_supply (regcache, map[1], regp ? regp + map[0] : NULL); } /* Collect the register REGNO out of the regset described by MAP from @@ -315,9 +312,14 @@ fetch_regset (struct regcache *regcache, int tid, iov.iov_len = regsize; if (ptrace (PTRACE_GETREGSET, tid, (long) regset, (long) &iov) < 0) - perror_with_name (_("Couldn't get register set")); - - s390_native_supply (regcache, regmap, buf); + { + if (errno == ENODATA) + s390_native_supply (regcache, regmap, NULL); + else + perror_with_name (_("Couldn't get register set")); + } + else + s390_native_supply (regcache, regmap, buf); } /* Store all registers in the kernel's register set whose number is REGSET, @@ -353,10 +355,10 @@ check_regset (int tid, int regset, int regsize) iov.iov_base = buf; iov.iov_len = regsize; - if (ptrace (PTRACE_GETREGSET, tid, (long) regset, (long) &iov) < 0) - return 0; - else + if (ptrace (PTRACE_GETREGSET, tid, (long) regset, (long) &iov) >= 0 + || errno == ENODATA) return 1; + return 0; } /* Fetch register REGNUM from the child process. If REGNUM is -1, do @@ -383,6 +385,11 @@ s390_linux_fetch_inferior_registers (struct target_ops *ops, if (regnum == -1 || regnum == S390_SYSTEM_CALL_REGNUM) fetch_regset (regcache, tid, NT_S390_SYSTEM_CALL, 4, s390_regmap_system_call); + + if (have_regset_tdb) + if (regnum == -1 || S390_IS_TDBREGSET_REGNUM (regnum)) + fetch_regset (regcache, tid, NT_S390_TDB, s390_sizeof_tdbregset, + s390_regmap_tdb); } /* Store register REGNUM back into the child process. If REGNUM is @@ -625,6 +632,8 @@ s390_read_description (struct target_ops *ops) = check_regset (tid, NT_S390_LAST_BREAK, 8); have_regset_system_call = check_regset (tid, NT_S390_SYSTEM_CALL, 4); + have_regset_tdb + = check_regset (tid, NT_S390_TDB, s390_sizeof_tdbregset); #ifdef __s390x__ /* If GDB itself is compiled as 64-bit, we are running on a machine in @@ -634,12 +643,14 @@ s390_read_description (struct target_ops *ops) that mode, report s390 architecture with 64-bit GPRs. */ if (s390_target_wordsize () == 8) - return (have_regset_system_call? tdesc_s390x_linux64v2 : + return (have_regset_tdb ? tdesc_s390x_te_linux64 : + have_regset_system_call? tdesc_s390x_linux64v2 : have_regset_last_break? tdesc_s390x_linux64v1 : tdesc_s390x_linux64); if (s390_get_hwcap () & HWCAP_S390_HIGH_GPRS) - return (have_regset_system_call? tdesc_s390_linux64v2 : + return (have_regset_tdb ? tdesc_s390_te_linux64 : + have_regset_system_call? tdesc_s390_linux64v2 : have_regset_last_break? tdesc_s390_linux64v1 : tdesc_s390_linux64); #endif |