aboutsummaryrefslogtreecommitdiff
path: root/gdb/s390-linux-tdep.c
diff options
context:
space:
mode:
authorAndreas Arnez <arnez@linux.vnet.ibm.com>2016-03-01 12:43:55 +0100
committerAndreas Arnez <arnez@linux.vnet.ibm.com>2016-03-01 12:43:55 +0100
commitf24894771e384b1bc60dc0f2c104d7e7fad3c865 (patch)
tree53ec5760eda5c41e2f78f16b1130b59f5fea2f0a /gdb/s390-linux-tdep.c
parent020efce52a569bde99f64b20cedbec2b2a5b5fe9 (diff)
downloadgdb-f24894771e384b1bc60dc0f2c104d7e7fad3c865.zip
gdb-f24894771e384b1bc60dc0f2c104d7e7fad3c865.tar.gz
gdb-f24894771e384b1bc60dc0f2c104d7e7fad3c865.tar.bz2
S390: Fix internal error with stackless inferior
This fixes a GDB internal error that may occur when the inferior has no valid stack pointer in r15. gdb/testsuite/ChangeLog: * gdb.arch/s390-stackless.S: New. * gdb.arch/s390-stackless.exp: New. gdb/ChangeLog: * s390-linux-tdep.c (s390_backchain_frame_unwind_cache): Avoid exception when attempting to access the inferior's backchain.
Diffstat (limited to 'gdb/s390-linux-tdep.c')
-rw-r--r--gdb/s390-linux-tdep.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index 57e25b4..7f860b6 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -2180,7 +2180,7 @@ s390_backchain_frame_unwind_cache (struct frame_info *this_frame,
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR backchain;
ULONGEST reg;
- LONGEST sp;
+ LONGEST sp, tmp;
int i;
/* Set up ABI call-saved/call-clobbered registers. */
@@ -2193,7 +2193,9 @@ s390_backchain_frame_unwind_cache (struct frame_info *this_frame,
/* Get the backchain. */
reg = get_frame_register_unsigned (this_frame, S390_SP_REGNUM);
- backchain = read_memory_unsigned_integer (reg, word_size, byte_order);
+ if (!safe_read_memory_integer (reg, word_size, byte_order, &tmp))
+ tmp = 0;
+ backchain = (CORE_ADDR) tmp;
/* A zero backchain terminates the frame chain. As additional
sanity check, let's verify that the spill slot for SP in the