From d8e07dda92366be0f6fc2e7128620d3dd53494e3 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Wed, 24 May 2017 22:15:23 +0100 Subject: [PATCH] Get register contents by register_size instead of TYPE_LENGTH We should use register_size to get register contents instead of TYPE_LENGTH. gdb: 2017-05-24 Yao Qi * i387-tdep.c (i387_register_to_value): Use register_size instead of TYPE_LENGTH. * m68k-tdep.c (m68k_register_to_value): Likewise. --- gdb/ChangeLog | 6 ++++++ gdb/i387-tdep.c | 3 ++- gdb/m68k-tdep.c | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 29cd3061a32..ea75f0795ea 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2017-05-24 Yao Qi + + * 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 * i387-tdep.c (i387_convert_register_p): Return false if type diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c index 925f4e54778..574914cab78 100644 --- a/gdb/i387-tdep.c +++ b/gdb/i387-tdep.c @@ -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; diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index f0934465543..619a40b9a9f 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -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; -- 2.30.2