This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 7/9] Restrict alpha_convert_register_p
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 13 Apr 2017 08:26:11 +0100
- Subject: [PATCH 7/9] Restrict alpha_convert_register_p
- Authentication-results: sourceware.org; auth=none
- References: <1492068373-4916-1-git-send-email-yao.qi@linaro.org>
This patch restricts alpha_convert_register_p from
"TYPE_LENGTH (type) != 8" to "TYPE_LENGTH (type) == 4", because,
- we have check "TYPE_LENGTH (valtype) == 4" in alpha_register_to_value
and alpha_value_to_register,
- alpha lds and sts instruction access 4 bytes,
- comments "It might need to convert the [float] register into the
corresponding [integer] type (see Alpha)" and integer is 4-byte on
alpha,
I think it is the right restrict condition to "TYPE_LENGTH (valtype) == 4".
gdb:
2017-04-12 Yao Qi <yao.qi@linaro.org>
* alpha-tdep.c (alpha_convert_register_p): Return true if type
length is 4.
(alpha_register_to_value): Remove type length check.
(alpha_value_to_register): Likewise.
---
gdb/alpha-tdep.c | 25 +++++++------------------
1 file changed, 7 insertions(+), 18 deletions(-)
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index 89f9676..d736cab 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -227,7 +227,7 @@ alpha_sts (struct gdbarch *gdbarch, void *out, const void *in)
/* The alpha needs a conversion between register and memory format if the
register is a floating point register and memory format is float, as the
register format must be double or memory format is an integer with 4
- bytes or less, as the representation of integers in floating point
+ bytes, as the representation of integers in floating point
registers is different. */
static int
@@ -235,7 +235,7 @@ alpha_convert_register_p (struct gdbarch *gdbarch, int regno,
struct type *type)
{
return (regno >= ALPHA_FP0_REGNUM && regno < ALPHA_FP0_REGNUM + 31
- && TYPE_LENGTH (type) != 8);
+ && TYPE_LENGTH (type) == 4);
}
static int
@@ -252,14 +252,9 @@ alpha_register_to_value (struct frame_info *frame, int regnum,
in, optimizedp, unavailablep))
return 0;
- if (TYPE_LENGTH (valtype) == 4)
- {
- alpha_sts (gdbarch, out, in);
- *optimizedp = *unavailablep = 0;
- return 1;
- }
-
- error (_("Cannot retrieve value from floating point register"));
+ alpha_sts (gdbarch, out, in);
+ *optimizedp = *unavailablep = 0;
+ return 1;
}
static void
@@ -268,14 +263,8 @@ alpha_value_to_register (struct frame_info *frame, int regnum,
{
gdb_byte out[MAX_REGISTER_SIZE];
- switch (TYPE_LENGTH (valtype))
- {
- case 4:
- alpha_lds (get_frame_arch (frame), out, in);
- break;
- default:
- error (_("Cannot store value in floating point register"));
- }
+ alpha_lds (get_frame_arch (frame), out, in);
+
put_frame_register (frame, regnum, out);
}
--
1.9.1