This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 2/2] gdb/s390: Fill guess_tracepoint_registers hook.
- From: Marcin KoÅcielnicki <koriakin at 0x04 dot net>
- To: uweigand at de dot ibm dot com
- Cc: arnez at linux dot vnet dot ibm dot com, gdb-patches at sourceware dot org, Marcin KoÅcielnicki <koriakin at 0x04 dot net>
- Date: Thu, 18 Feb 2016 11:35:30 +0100
- Subject: [PATCH 2/2] gdb/s390: Fill guess_tracepoint_registers hook.
- Authentication-results: sourceware.org; auth=none
- References: <20160216182754 dot CE86C6BEA at oc7340732750 dot ibm dot com> <1455791730-28225-1-git-send-email-koriakin at 0x04 dot net>
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 | 24 ++++++++++++++++++++++++
2 files changed, 29 insertions(+)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 95afe29..2823f70 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2016-02-18 Marcin KoÅcielnicki <koriakin@0x04.net>
+ * s390-linux-tdep.c (s390_guess_tracepoint_registers): New function.
+ (s390_gdbarch_init): Fill guess_tracepoint_registers hook.
+
+2016-02-18 Marcin KoÅcielnicki <koriakin@0x04.net>
+
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh: Add guess_tracepoint_registers hook, struct tracepoint
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index e827684..82902e4 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -167,6 +167,29 @@ 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. For s390, we have
+ to supply the PSWA register. For 64-bit inferior, PC maps straight
+ to PSWA. For 31-bit, we additionally set the high bit to 1, since we
+ have to supply the whole register, and it's very unlikely the program
+ is in 24-bit addressing mode. */
+
+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);
+
+ /* 31-bit PSWA needs high bit set. */
+ if (tdep->abi == ABI_LINUX_S390)
+ addr |= 0x80000000;
+
+ store_unsigned_integer (reg, sz, gdbarch_byte_order (gdbarch), addr);
+ regcache_raw_supply (regcache, S390_PSWA_REGNUM, reg);
+}
+
/* DWARF Register Mapping. */
@@ -7857,6 +7880,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.7.0