This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] [PR tdep/17379] Fix internal-error when stack pointer is invalid
- From: Edjunior Barbosa Machado <emachado at linux dot vnet dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Cc: Ulrich Weigand <uweigand at de dot ibm dot com>
- Date: Thu, 11 Sep 2014 20:03:05 -0300
- Subject: [PATCH] [PR tdep/17379] Fix internal-error when stack pointer is invalid
- Authentication-results: sourceware.org; auth=none
Hi,
this patch intends to fix PR tdep/17379:
https://sourceware.org/bugzilla/show_bug.cgi?id=17379
The problem is that rs6000_frame_cache attempts to read the stack backchain via
read_memory_unsigned_integer, which throws an exception if the stack pointer is
invalid. With this path, it calls safe_read_memory_integer instead, which
doesn't throw an exception and allows for safe handling of that situation.
Regression tested on ppc64{,le}. Ok?
Thanks and regards,
--
Edjunior
gdb/
2014-09-11 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
Ulrich Weigand <uweigand@de.ibm.com>
PR tdep/17379
* rs6000-tdep.c (rs6000_frame_cache): Use safe_read_memory_integer
instead of read_memory_unsigned_integer.
---
gdb/rs6000-tdep.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 730afe7..dabf448 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -3190,9 +3190,14 @@ rs6000_frame_cache (struct frame_info *this_frame, void **this_cache)
}
if (!fdata.frameless)
- /* Frameless really means stackless. */
- cache->base
- = read_memory_unsigned_integer (cache->base, wordsize, byte_order);
+ {
+ /* Frameless really means stackless. */
+ LONGEST backchain;
+
+ if (safe_read_memory_integer (cache->base, wordsize,
+ byte_order, &backchain))
+ cache->base = (CORE_ADDR) backchain;
+ }
trad_frame_set_value (cache->saved_regs,
gdbarch_sp_regnum (gdbarch), cache->base);
--
1.7.9.5