Fix type of not saved registers.
authorPedro Alves <palves@redhat.com>
Wed, 27 Nov 2013 17:55:38 +0000 (17:55 +0000)
committerPedro Alves <palves@redhat.com>
Wed, 27 Nov 2013 17:55:38 +0000 (17:55 +0000)
value_of_register_lazy uses the type of REGNUM in FRAME, but given
multi-arch, the arch of FRAME might be different from the previous
frame's arch, and therefore the type of register REGNUM should be
retrieved from the unwound arch.  This used to be correct before the
previous change.

Tested on x86_64 Fedora 17.

gdb/
2013-11-27  Pedro Alves  <palves@redhat.com>

* frame-unwind.c (frame_unwind_got_optimized): Use the type of the
register in the previous frame's arch.

gdb/ChangeLog
gdb/frame-unwind.c

index a2da98fed4dba504fef28ef21fdb5c5c7e565a8a..00369e98f20b0dca5411b3dcc2da1fda02869e0d 100644 (file)
@@ -1,3 +1,8 @@
+2013-11-27  Pedro Alves  <palves@redhat.com>
+
+       * frame-unwind.c (frame_unwind_got_optimized): Use the type of the
+       register in the previous frame's arch.
+
 2013-11-27  Pedro Alves  <palves@redhat.com>
 
        * frame-unwind.c (frame_unwind_got_optimized): Return
index 68879f30816dbbdca26e28c3ffc14add779b8060..a731b3387c147ba173317b8b6938114f6cb42e0c 100644 (file)
@@ -161,11 +161,18 @@ default_frame_unwind_stop_reason (struct frame_info *this_frame,
 struct value *
 frame_unwind_got_optimized (struct frame_info *frame, int regnum)
 {
+  struct gdbarch *gdbarch = frame_unwind_arch (frame);
+  struct type *type = register_type (gdbarch, regnum);
   struct value *val;
 
-  val = value_of_register_lazy (frame, regnum);
+  /* Return an lval_register value, so that we print it as
+     "<not saved>".  */
+  val = allocate_value_lazy (type);
   set_value_lazy (val, 0);
   set_value_optimized_out (val, 1);
+  VALUE_LVAL (val) = lval_register;
+  VALUE_REGNUM (val) = regnum;
+  VALUE_FRAME_ID (val) = get_frame_id (frame);
   return val;
 }
 
This page took 0.030885 seconds and 4 git commands to generate.