+2020-10-09 Tom Tromey <tromey@adacore.com>
+
+ * dwarf2/read.c (dwarf2_add_field): Handle signed offsets.
+
2020-10-09 Tom Tromey <tromey@adacore.com>
* ada-lang.h (ada_encode): Return std::string.
/* Get bit offset of field. */
handle_data_member_location (die, cu, fp);
attr = dwarf2_attr (die, DW_AT_bit_offset, cu);
- if (attr != nullptr && attr->form_is_unsigned ())
+ if (attr != nullptr && attr->form_is_constant ())
{
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
{
have to do anything special since we don't need to
know the size of the anonymous object. */
SET_FIELD_BITPOS (*fp, (FIELD_BITPOS (*fp)
- + attr->as_unsigned ()));
+ + attr->constant_value (0)));
}
else
{
the field itself. The result is the bit offset of
the LSB of the field. */
int anonymous_size;
- int bit_offset = attr->as_unsigned ();
+ int bit_offset = attr->constant_value (0);
attr = dwarf2_attr (die, DW_AT_byte_size, cu);
- if (attr != nullptr && attr->form_is_unsigned ())
+ if (attr != nullptr && attr->form_is_constant ())
{
/* The size of the anonymous object containing
the bit field is explicit, so use the
indicated size (in bytes). */
- anonymous_size = attr->as_unsigned ();
+ anonymous_size = attr->constant_value (0);
}
else
{
+2020-10-09 Tom Tromey <tromey@adacore.com>
+
+ * gdb.ada/scalar_storage/storage.adb (Another_Range): New type.
+ (Rec): Add field. Fix range.
+ * gdb.ada/scalar_storage.exp: Update.
+
2020-10-09 Hannes Domani <ssbssa@yahoo.de>
PR exp/26714
return
}
-gdb_test "print V_LE" "= \\(value => 126\\)"
-gdb_test "print V_BE" "= \\(value => 126\\)"
+gdb_test "print V_LE" "= \\(value => 126, another_value => 12\\)"
+gdb_test "print V_BE" "= \\(value => 126, another_value => 12\\)"
procedure Storage is
subtype Some_Range is Natural range 0..127;
+ subtype Another_Range is Natural range 0..15;
type Rec is record
Value : Some_Range;
+ Another_Value : Another_Range;
end record;
for Rec use record
- Value at 0 range 0..127;
+ Value at 0 range 0..6;
+ Another_Value at 0 range 7..10;
end record;
type Rec_LE is new Rec;
V_BE : Rec_BE;
begin
- V_LE.Value := 126;
- V_BE.Value := 126;
+ V_LE := (126, 12);
+ V_BE := (126, 12);
Do_Nothing (V_LE'Address); -- START
Do_Nothing (V_BE'Address);