Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] [PR tdep/17379] Fix internal-error when stack pointer is invalid
@ 2014-09-11 23:03 Edjunior Barbosa Machado
  2014-09-11 23:21 ` Sergio Durigan Junior
  0 siblings, 1 reply; 18+ messages in thread
From: Edjunior Barbosa Machado @ 2014-09-11 23:03 UTC (permalink / raw)
  To: gdb-patches; +Cc: Ulrich Weigand

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


^ permalink raw reply	[flat|nested] 18+ messages in thread
[parent not found: <54195D36.2080001@redhat.com>]

end of thread, other threads:[~2014-09-17 13:03 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-11 23:03 [PATCH] [PR tdep/17379] Fix internal-error when stack pointer is invalid Edjunior Barbosa Machado
2014-09-11 23:21 ` Sergio Durigan Junior
2014-09-12  2:47   ` Edjunior Barbosa Machado
2014-09-12  3:20     ` Sergio Durigan Junior
2014-09-12  8:39       ` Ulrich Weigand
2014-09-12  9:59     ` Pedro Alves
2014-09-12 12:31       ` Edjunior Barbosa Machado
2014-09-12 13:00       ` Joel Brobecker
2014-09-12 13:38         ` Pedro Alves
2014-09-12 13:50           ` Joel Brobecker
2014-09-12 14:21             ` Pedro Alves
2014-09-12 15:27               ` [PATCH] after gdb_run_cmd, gdb_expect -> gdb_test_multiple/gdb_test Pedro Alves
2014-09-12 17:10                 ` Joel Brobecker
2014-09-12 21:44                   ` Pedro Alves
2014-09-12 22:45                     ` Pedro Alves
2014-09-15 13:55                     ` Joel Brobecker
     [not found] <54195D36.2080001@redhat.com>
2014-09-17 12:41 ` [PATCH] [PR tdep/17379] Fix internal-error when stack pointer is invalid Ulrich Weigand
2014-09-17 13:03   ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox