From f79a3bae8725dfe0e11b04ddfc6e6bc8f23e4e4e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marcin=20Ko=C5=9Bcielnicki?= Date: Sat, 23 Jan 2016 23:53:41 +0100 Subject: [PATCH] gdb/s390: Fill guess_tracepoint_registers hook. gdb/ChangeLog: * s390-linux-tdep.c (s390_guess_tracepoint_registers): New function. (s390_gdbarch_init): Fill guess_tracepoint_registers hook. --- gdb/ChangeLog | 5 +++++ gdb/s390-linux-tdep.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6fee07b4beb..274d98b0f0f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2016-02-18 Marcin Kościelnicki + + * s390-linux-tdep.c (s390_guess_tracepoint_registers): New function. + (s390_gdbarch_init): Fill guess_tracepoint_registers hook. + 2016-02-18 Walfred Tedeschi * NEWS: Add entry for bound violation. diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c index e827684cdd5..57e25b43177 100644 --- a/gdb/s390-linux-tdep.c +++ b/gdb/s390-linux-tdep.c @@ -167,6 +167,40 @@ s390_write_pc (struct regcache *regcache, CORE_ADDR pc) regcache_cooked_write_unsigned (regcache, S390_SYSTEM_CALL_REGNUM, 0); } +/* The "guess_tracepoint_registers" gdbarch method. */ + +static void +s390_guess_tracepoint_registers (struct gdbarch *gdbarch, + struct regcache *regcache, + CORE_ADDR addr) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + int sz = register_size (gdbarch, S390_PSWA_REGNUM); + gdb_byte *reg = (gdb_byte *) alloca (sz); + ULONGEST pswm, pswa; + + /* Set PSWA from the location and a default PSWM (the only part we're + unlikely to get right is the CC). */ + if (tdep->abi == ABI_LINUX_S390) + { + /* 31-bit PSWA needs high bit set (it's very unlikely the target + was in 24-bit mode). */ + pswa = addr | 0x80000000UL; + pswm = 0x070d0000UL; + } + else + { + pswa = addr; + pswm = 0x0705000180000000ULL; + } + + store_unsigned_integer (reg, sz, gdbarch_byte_order (gdbarch), pswa); + regcache_raw_supply (regcache, S390_PSWA_REGNUM, reg); + + store_unsigned_integer (reg, sz, gdbarch_byte_order (gdbarch), pswm); + regcache_raw_supply (regcache, S390_PSWM_REGNUM, reg); +} + /* DWARF Register Mapping. */ @@ -7857,6 +7891,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) s390_iterate_over_regset_sections); set_gdbarch_cannot_store_register (gdbarch, s390_cannot_store_register); set_gdbarch_write_pc (gdbarch, s390_write_pc); + set_gdbarch_guess_tracepoint_registers (gdbarch, s390_guess_tracepoint_registers); set_gdbarch_pseudo_register_read (gdbarch, s390_pseudo_register_read); set_gdbarch_pseudo_register_write (gdbarch, s390_pseudo_register_write); set_tdesc_pseudo_register_name (gdbarch, s390_pseudo_register_name); -- 2.30.2