mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-13 03:48:49 +08:00
gdb: trivial changes to use array_view
Change a few relatively obvious spots using value contents to propagate the use array_view a bit more. Change-Id: I5338a60986f06d5969fec803d04f8423c9288a15
This commit is contained in:
@ -1261,7 +1261,7 @@ frame_unwind_register_value (frame_info *next_frame, int regnum)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
const gdb_byte *buf = value_contents (value).data ();
|
gdb::array_view<const gdb_byte> buf = value_contents (value);
|
||||||
|
|
||||||
fprintf_unfiltered (&debug_file, " bytes=");
|
fprintf_unfiltered (&debug_file, " bytes=");
|
||||||
fprintf_unfiltered (&debug_file, "[");
|
fprintf_unfiltered (&debug_file, "[");
|
||||||
|
@ -1317,9 +1317,8 @@ eval_op_rust_struct_anon (struct type *expect_type, struct expression *exp,
|
|||||||
|
|
||||||
if (rust_enum_p (type))
|
if (rust_enum_p (type))
|
||||||
{
|
{
|
||||||
gdb::array_view<const gdb_byte> view (value_contents (lhs).data (),
|
type = resolve_dynamic_type (type, value_contents (lhs),
|
||||||
TYPE_LENGTH (type));
|
value_address (lhs));
|
||||||
type = resolve_dynamic_type (type, view, value_address (lhs));
|
|
||||||
|
|
||||||
if (rust_empty_enum_p (type))
|
if (rust_empty_enum_p (type))
|
||||||
error (_("Cannot access field %d of empty enum %s"),
|
error (_("Cannot access field %d of empty enum %s"),
|
||||||
@ -1380,9 +1379,8 @@ eval_op_rust_structop (struct type *expect_type, struct expression *exp,
|
|||||||
struct type *type = value_type (lhs);
|
struct type *type = value_type (lhs);
|
||||||
if (type->code () == TYPE_CODE_STRUCT && rust_enum_p (type))
|
if (type->code () == TYPE_CODE_STRUCT && rust_enum_p (type))
|
||||||
{
|
{
|
||||||
gdb::array_view<const gdb_byte> view (value_contents (lhs).data (),
|
type = resolve_dynamic_type (type, value_contents (lhs),
|
||||||
TYPE_LENGTH (type));
|
value_address (lhs));
|
||||||
type = resolve_dynamic_type (type, view, value_address (lhs));
|
|
||||||
|
|
||||||
if (rust_empty_enum_p (type))
|
if (rust_empty_enum_p (type))
|
||||||
error (_("Cannot access field %s of empty enum %s"),
|
error (_("Cannot access field %s of empty enum %s"),
|
||||||
|
@ -933,12 +933,10 @@ fixed_point_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
|
|||||||
type2 = type1;
|
type2 = type1;
|
||||||
}
|
}
|
||||||
|
|
||||||
v1.read_fixed_point (gdb::make_array_view (value_contents (arg1).data (),
|
v1.read_fixed_point (value_contents (arg1),
|
||||||
TYPE_LENGTH (type1)),
|
|
||||||
type_byte_order (type1), type1->is_unsigned (),
|
type_byte_order (type1), type1->is_unsigned (),
|
||||||
type1->fixed_point_scaling_factor ());
|
type1->fixed_point_scaling_factor ());
|
||||||
v2.read_fixed_point (gdb::make_array_view (value_contents (arg2).data (),
|
v2.read_fixed_point (value_contents (arg2),
|
||||||
TYPE_LENGTH (type2)),
|
|
||||||
type_byte_order (type2), type2->is_unsigned (),
|
type_byte_order (type2), type2->is_unsigned (),
|
||||||
type2->fixed_point_scaling_factor ());
|
type2->fixed_point_scaling_factor ());
|
||||||
}
|
}
|
||||||
@ -948,8 +946,7 @@ fixed_point_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
|
|||||||
value *fp_val = allocate_value (type1);
|
value *fp_val = allocate_value (type1);
|
||||||
|
|
||||||
fp.write_fixed_point
|
fp.write_fixed_point
|
||||||
(gdb::make_array_view (value_contents_raw (fp_val).data (),
|
(value_contents_raw (fp_val),
|
||||||
TYPE_LENGTH (type1)),
|
|
||||||
type_byte_order (type1),
|
type_byte_order (type1),
|
||||||
type1->is_unsigned (),
|
type1->is_unsigned (),
|
||||||
type1->fixed_point_scaling_factor ());
|
type1->fixed_point_scaling_factor ());
|
||||||
|
28
gdb/valops.c
28
gdb/valops.c
@ -351,9 +351,8 @@ value_to_gdb_mpq (struct value *value)
|
|||||||
|| is_fixed_point_type (type));
|
|| is_fixed_point_type (type));
|
||||||
|
|
||||||
gdb_mpz vz;
|
gdb_mpz vz;
|
||||||
vz.read (gdb::make_array_view (value_contents (value).data (),
|
vz.read (value_contents (value), type_byte_order (type),
|
||||||
TYPE_LENGTH (type)),
|
type->is_unsigned ());
|
||||||
type_byte_order (type), type->is_unsigned ());
|
|
||||||
mpq_set_z (result.val, vz.val);
|
mpq_set_z (result.val, vz.val);
|
||||||
|
|
||||||
if (is_fixed_point_type (type))
|
if (is_fixed_point_type (type))
|
||||||
@ -392,8 +391,7 @@ value_cast_to_fixed_point (struct type *to_type, struct value *from_val)
|
|||||||
/* Finally, create the result value, and pack the unscaled value
|
/* Finally, create the result value, and pack the unscaled value
|
||||||
in it. */
|
in it. */
|
||||||
struct value *result = allocate_value (to_type);
|
struct value *result = allocate_value (to_type);
|
||||||
unscaled.write (gdb::make_array_view (value_contents_raw (result).data (),
|
unscaled.write (value_contents_raw (result),
|
||||||
TYPE_LENGTH (to_type)),
|
|
||||||
type_byte_order (to_type),
|
type_byte_order (to_type),
|
||||||
to_type->is_unsigned ());
|
to_type->is_unsigned ());
|
||||||
|
|
||||||
@ -554,11 +552,10 @@ value_cast (struct type *type, struct value *arg2)
|
|||||||
{
|
{
|
||||||
gdb_mpq fp_val;
|
gdb_mpq fp_val;
|
||||||
|
|
||||||
fp_val.read_fixed_point
|
fp_val.read_fixed_point (value_contents (arg2),
|
||||||
(gdb::make_array_view (value_contents (arg2).data (),
|
type_byte_order (type2),
|
||||||
TYPE_LENGTH (type2)),
|
type2->is_unsigned (),
|
||||||
type_byte_order (type2), type2->is_unsigned (),
|
type2->fixed_point_scaling_factor ());
|
||||||
type2->fixed_point_scaling_factor ());
|
|
||||||
|
|
||||||
struct value *v = allocate_value (to_type);
|
struct value *v = allocate_value (to_type);
|
||||||
target_float_from_host_double (value_contents_raw (v).data (),
|
target_float_from_host_double (value_contents_raw (v).data (),
|
||||||
@ -1255,14 +1252,9 @@ value_assign (struct value *toval, struct value *fromval)
|
|||||||
value_contents (fromval).data ());
|
value_contents (fromval).data ());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
put_frame_register_bytes (frame, value_reg,
|
||||||
gdb::array_view<const gdb_byte> contents
|
value_offset (toval),
|
||||||
= gdb::make_array_view (value_contents (fromval).data (),
|
value_contents (fromval));
|
||||||
TYPE_LENGTH (type));
|
|
||||||
put_frame_register_bytes (frame, value_reg,
|
|
||||||
value_offset (toval),
|
|
||||||
contents);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gdb::observers::register_changed.notify (frame, value_reg);
|
gdb::observers::register_changed.notify (frame, value_reg);
|
||||||
|
@ -4011,7 +4011,7 @@ value_fetch_lazy_register (struct value *val)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
const gdb_byte *buf = value_contents (new_val).data ();
|
gdb::array_view<const gdb_byte> buf = value_contents (new_val);
|
||||||
|
|
||||||
if (VALUE_LVAL (new_val) == lval_register)
|
if (VALUE_LVAL (new_val) == lval_register)
|
||||||
fprintf_unfiltered (&debug_file, " register=%d",
|
fprintf_unfiltered (&debug_file, " register=%d",
|
||||||
|
Reference in New Issue
Block a user