Get register contents by register_size instead of TYPE_LENGTH
authorYao Qi <yao.qi@linaro.org>
Wed, 24 May 2017 21:15:23 +0000 (22:15 +0100)
committerYao Qi <yao.qi@linaro.org>
Wed, 24 May 2017 21:15:23 +0000 (22:15 +0100)
We should use register_size to get register contents instead of
TYPE_LENGTH.

gdb:

2017-05-24  Yao Qi  <yao.qi@linaro.org>

* i387-tdep.c (i387_register_to_value): Use register_size
instead of TYPE_LENGTH.
* m68k-tdep.c (m68k_register_to_value): Likewise.

gdb/ChangeLog
gdb/i387-tdep.c
gdb/m68k-tdep.c

index 29cd3061a3235d3744b2da58af316e00e9640562..ea75f0795ea8200d43888db96dd5c2e961162239 100644 (file)
@@ -1,3 +1,9 @@
+2017-05-24  Yao Qi  <yao.qi@linaro.org>
+
+       * i387-tdep.c (i387_register_to_value): Use register_size
+       instead of TYPE_LENGTH.
+       * m68k-tdep.c (m68k_register_to_value): Likewise.
+
 2017-05-24  Yao Qi  <yao.qi@linaro.org>
 
        * i387-tdep.c (i387_convert_register_p): Return false if type
index 925f4e547785367b62cd018927f40afda7b7627e..574914cab78f6b62a720a08e6a70de5b171d92ef 100644 (file)
@@ -375,7 +375,8 @@ i387_register_to_value (struct frame_info *frame, int regnum,
     }
 
   /* Convert to TYPE.  */
-  if (!get_frame_register_bytes (frame, regnum, 0, TYPE_LENGTH (type),
+  if (!get_frame_register_bytes (frame, regnum, 0,
+                                register_size (gdbarch, regnum),
                                 from, optimizedp, unavailablep))
     return 0;
 
index f0934465543a074f8e40115134446cd91054a1f7..619a40b9a9fc5a83fa3c1c5f4b7aacb58b697840 100644 (file)
@@ -201,13 +201,15 @@ m68k_register_to_value (struct frame_info *frame, int regnum,
                        struct type *type, gdb_byte *to,
                        int *optimizedp, int *unavailablep)
 {
+  struct gdbarch *gdbarch = get_frame_arch (frame);
   gdb_byte from[M68K_MAX_REGISTER_SIZE];
   struct type *fpreg_type = register_type (gdbarch, M68K_FP0_REGNUM);
 
   gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
 
   /* Convert to TYPE.  */
-  if (!get_frame_register_bytes (frame, regnum, 0, TYPE_LENGTH (type),
+  if (!get_frame_register_bytes (frame, regnum, 0,
+                                register_size (gdbarch, regnum),
                                 from, optimizedp, unavailablep))
     return 0;