]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: xtensa: fix frame initialization when PC is invalid
authorMax Filippov <jcmvbkbc@gmail.com>
Sun, 27 Mar 2016 17:45:54 +0000 (20:45 +0300)
committerMax Filippov <jcmvbkbc@gmail.com>
Tue, 29 Mar 2016 23:17:24 +0000 (02:17 +0300)
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.

gdb/ChangeLog
gdb/xtensa-tdep.c

index 25afbef99dfc7e576fad67452d1fa3fe5043dad0..0c76434ccf4ea1efd3ccb92a1f80e3b3c81af9c1 100644 (file)
@@ -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.
index 9e87fa5ce985ada517a9cf7c005b28c1012cb069..3a3badab1970642a91a92f0cc5680aa4b6c0fc07 100644 (file)
@@ -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