aboutsummaryrefslogtreecommitdiff
path: root/gdb/s390-nat.c
diff options
context:
space:
mode:
authorJim Blandy <jimb@codesourcery.com>2004-02-18 04:17:35 +0000
committerJim Blandy <jimb@codesourcery.com>2004-02-18 04:17:35 +0000
commit9cbd5950d6314c1447900d98b6f1d157c1e33942 (patch)
tree56b085b36ab480dd29a369cd06c4322597f0e265 /gdb/s390-nat.c
parent2db536a1ff952dcffc87b777ed57bfc6f2cb9114 (diff)
downloadgdb-9cbd5950d6314c1447900d98b6f1d157c1e33942.zip
gdb-9cbd5950d6314c1447900d98b6f1d157c1e33942.tar.gz
gdb-9cbd5950d6314c1447900d98b6f1d157c1e33942.tar.bz2
2004-02-17 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Committed by Jim Blandy <jimb@redhat.com>. * s390-nat.c (SUBOFF): New macro. (supply_gregset, fill_gregset): Use it to handle debugging of 32-bit exectuables running under a 64-bit kernel. * s390-tdep.c: Include "solib-svr4.h". (s390_svr4_fetch_link_map_offset): New function. (s390x_svr_fetch_link_map_offset): Likewise. (s390_gdbarch_init): Call set_solib_svr4_fetch_link_map_offsets. * Makefile.in (s390-tdep.o): Update dependencies.
Diffstat (limited to 'gdb/s390-nat.c')
-rw-r--r--gdb/s390-nat.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/gdb/s390-nat.c b/gdb/s390-nat.c
index a2a7759..b8da548 100644
--- a/gdb/s390-nat.c
+++ b/gdb/s390-nat.c
@@ -47,6 +47,18 @@
#define regmap_fpregset s390_regmap_fpregset
+/* When debugging a 32-bit executable running under a 64-bit kernel,
+ we have to fix up the 64-bit registers we get from the kernel
+ to make them look like 32-bit registers. */
+#ifdef __s390x__
+#define SUBOFF(i) \
+ ((TARGET_PTR_BIT == 32 \
+ && ((i) == S390_PSWA_REGNUM \
+ || ((i) >= S390_R0_REGNUM && (i) <= S390_R15_REGNUM)))? 4 : 0)
+#else
+#define SUBOFF(i) 0
+#endif
+
/* Fill GDB's register array with the general-purpose register values
in *REGP. */
@@ -57,7 +69,7 @@ supply_gregset (gregset_t *regp)
for (i = 0; i < S390_NUM_REGS; i++)
if (regmap_gregset[i] != -1)
regcache_raw_supply (current_regcache, i,
- (char *)regp + regmap_gregset[i]);
+ (char *)regp + regmap_gregset[i] + SUBOFF (i));
}
/* Fill register REGNO (if it is a general-purpose register) in
@@ -71,7 +83,7 @@ fill_gregset (gregset_t *regp, int regno)
if (regmap_gregset[i] != -1)
if (regno == -1 || regno == i)
regcache_raw_collect (current_regcache, i,
- (char *)regp + regmap_gregset[i]);
+ (char *)regp + regmap_gregset[i] + SUBOFF (i));
}
/* Fill GDB's register array with the floating-point register values