This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] gdb: xtensa: fix frame initialization when PC is invalid


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a08b52b5c45195c0b095215f19422d2ab67a3a8d

commit a08b52b5c45195c0b095215f19422d2ab67a3a8d
Author: Max Filippov <jcmvbkbc@gmail.com>
Date:   Sun Mar 27 20:45:54 2016 +0300

    gdb: xtensa: fix frame initialization when PC is invalid
    
    When gdb is used on core dump and PC is not pointing to a readable
    memory read_memory_integer call in the xtensa_frame_cache throws an
    error, making register inspection/backtracing impossible in that thread.
    
    Use safe_read_memory_integer instead.
    
    2016-03-29  Max Filippov  <jcmvbkbc@gmail.com>
    gdb/
    	* xtensa-tdep.c (xtensa_frame_cache): Change op1 type to LONGEST.
    	Use safe_read_memory_integer instead of read_memory_integer.

Diff:
---
 gdb/ChangeLog     | 5 +++++
 gdb/xtensa-tdep.c | 6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 25afbef..0c76434 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2016-03-29  Max Filippov  <jcmvbkbc@gmail.com>
+
+	* xtensa-tdep.c (xtensa_frame_cache): Change op1 type to LONGEST.
+	Use safe_read_memory_integer instead of read_memory_integer.
+
 2016-03-29  Marcin KoÅ?cielnicki  <koriakin@0x04.net>
 
 	* NEWS: Mention support for tracepoints on s390*-linux.
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 9e87fa5..3a3bada 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -1285,7 +1285,7 @@ xtensa_frame_cache (struct frame_info *this_frame, void **this_cache)
 
   if (windowed)
     {
-      char op1;
+      LONGEST op1;
 
       /* Get WINDOWBASE, WINDOWSTART, and PS registers.  */
       wb = get_frame_register_unsigned (this_frame, 
@@ -1293,8 +1293,8 @@ xtensa_frame_cache (struct frame_info *this_frame, void **this_cache)
       ws = get_frame_register_unsigned (this_frame,
 					gdbarch_tdep (gdbarch)->ws_regnum);
 
-      op1 = read_memory_integer (pc, 1, byte_order);
-      if (XTENSA_IS_ENTRY (gdbarch, op1))
+      if (safe_read_memory_integer (pc, 1, byte_order, &op1)
+	  && XTENSA_IS_ENTRY (gdbarch, op1))
 	{
 	  int callinc = CALLINC (ps);
 	  ra = get_frame_register_unsigned


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]