/* Low level packing and unpacking of values for GDB, the GNU Debugger.
- Copyright (C) 1986-2019 Free Software Foundation, Inc.
+ Copyright (C) 1986-2020 Free Software Foundation, Inc.
This file is part of GDB.
LONGEST bitsize = 0;
/* Only used for bitfields; position of start of field. For
- gdbarch_bits_big_endian=0 targets, it is the position of the LSB. For
- gdbarch_bits_big_endian=1 targets, it is the position of the MSB. */
+ little-endian targets, it is the position of the LSB. For
+ big-endian targets, it is the position of the MSB. */
LONGEST bitpos = 0;
/* The number of references to this value. When a value is created,
/* Extract bits. See comment above. */
- if (gdbarch_bits_big_endian (get_type_arch (field_type)))
+ if (byte_order == BFD_ENDIAN_BIG)
lsbcount = (bytes_read * 8 - bitpos % 8 - bitsize);
else
lsbcount = (bitpos % 8);
oword = extract_unsigned_integer (addr, bytesize, byte_order);
/* Shifting for bit field depends on endianness of the target machine. */
- if (gdbarch_bits_big_endian (get_type_arch (type)))
+ if (byte_order == BFD_ENDIAN_BIG)
bitpos = bytesize * 8 - bitpos - bitsize;
oword &= ~(mask << bitpos);
return value_from_longest (builtin_type (gdbarch)->builtin_int, ret);
}
-/* Implementation of the convenience function $_cimag. Extracts the
+/* Implementation of the convenience function $_creal. Extracts the
real part from a complex number. */
static struct value *
type *ctype = check_typedef (value_type (cval));
if (TYPE_CODE (ctype) != TYPE_CODE_COMPLEX)
error (_("expected a complex number"));
- return value_from_component (cval, TYPE_TARGET_TYPE (ctype), 0);
+ return value_real_part (cval);
}
/* Implementation of the convenience function $_cimag. Extracts the
type *ctype = check_typedef (value_type (cval));
if (TYPE_CODE (ctype) != TYPE_CODE_COMPLEX)
error (_("expected a complex number"));
- return value_from_component (cval, TYPE_TARGET_TYPE (ctype),
- TYPE_LENGTH (TYPE_TARGET_TYPE (ctype)));
+ return value_imaginary_part (cval);
}
#if GDB_SELF_TEST
} /* namespace selftests */
#endif /* GDB_SELF_TEST */
+void _initialize_values ();
void
-_initialize_values (void)
+_initialize_values ()
{
add_cmd ("convenience", no_class, show_convenience, _("\
Debugger convenience (\"$foo\") variables and functions.\n\