static void val_print_type_code_flags (struct type *type,
struct value *original_value,
- int embedded_offset,
struct ui_file *stream);
/* Start print_max at this value. */
static void
print_ref_address (struct type *type, const gdb_byte *address_buffer,
- int embedded_offset, struct ui_file *stream)
+ struct ui_file *stream)
{
struct gdbarch *gdbarch = type->arch ();
if (address_buffer != NULL)
{
- CORE_ADDR address
- = extract_typed_address (address_buffer + embedded_offset, type);
+ CORE_ADDR address = extract_typed_address (address_buffer, type);
gdb_printf (stream, "@");
fputs_styled (paddress (gdbarch, address), address_style.style (),
static void
generic_val_print_ref (struct type *type,
- int embedded_offset, struct ui_file *stream, int recurse,
+ struct ui_file *stream, int recurse,
struct value *original_value,
const struct value_print_options *options)
{
struct type *elttype = check_typedef (type->target_type ());
struct value *deref_val = NULL;
const bool value_is_synthetic
- = original_value->bits_synthetic_pointer (TARGET_CHAR_BIT * embedded_offset,
- TARGET_CHAR_BIT * type->length ());
+ = original_value->bits_synthetic_pointer (0, (TARGET_CHAR_BIT
+ * type->length ()));
const bool must_coerce_ref = ((options->addressprint && value_is_synthetic)
|| options->deref_ref);
const bool type_is_defined = elttype->code () != TYPE_CODE_UNDEF;
{
deref_val = coerce_ref_if_computed (original_value);
- if (deref_val != NULL)
- {
- /* More complicated computed references are not supported. */
- gdb_assert (embedded_offset == 0);
- }
- else
+ if (deref_val == nullptr)
deref_val = value_at (type->target_type (),
- unpack_pointer (type, valaddr + embedded_offset));
+ unpack_pointer (type, valaddr));
}
/* Else, original_value isn't a synthetic reference or we don't have to print
the reference's contents.
? get_value_addr_contents (deref_val)
: valaddr);
- print_ref_address (type, address, embedded_offset, stream);
+ print_ref_address (type, address, stream);
if (options->deref_ref)
gdb_puts (": ", stream);
/* generic_val_print helper for TYPE_CODE_ENUM. */
static void
-generic_val_print_enum (struct type *type,
- int embedded_offset, struct ui_file *stream,
+generic_val_print_enum (struct type *type, struct ui_file *stream,
struct value *original_value,
const struct value_print_options *options)
{
- LONGEST val;
- struct gdbarch *gdbarch = type->arch ();
- int unit_size = gdbarch_addressable_memory_unit_size (gdbarch);
-
gdb_assert (!options->format);
const gdb_byte *valaddr = original_value->contents_for_printing ().data ();
- val = unpack_long (type, valaddr + embedded_offset * unit_size);
+ LONGEST val = unpack_long (type, valaddr);
generic_val_print_enum_1 (type, val, stream);
}
/* generic_val_print helper for TYPE_CODE_FUNC and TYPE_CODE_METHOD. */
static void
-generic_val_print_func (struct type *type,
- int embedded_offset, CORE_ADDR address,
+generic_val_print_func (struct type *type, CORE_ADDR address,
struct ui_file *stream,
struct value *original_value,
const struct value_print_options *options)
case TYPE_CODE_REF:
case TYPE_CODE_RVALUE_REF:
- generic_val_print_ref (type, 0, stream, recurse,
+ generic_val_print_ref (type, stream, recurse,
val, options);
break;
if (options->format)
value_print_scalar_formatted (val, options, 0, stream);
else
- generic_val_print_enum (type, 0, stream, val, options);
+ generic_val_print_enum (type, stream, val, options);
break;
case TYPE_CODE_FLAGS:
if (options->format)
value_print_scalar_formatted (val, options, 0, stream);
else
- val_print_type_code_flags (type, val, 0, stream);
+ val_print_type_code_flags (type, val, stream);
break;
case TYPE_CODE_FUNC:
if (options->format)
value_print_scalar_formatted (val, options, 0, stream);
else
- generic_val_print_func (type, 0, val->address (), stream,
+ generic_val_print_func (type, val->address (), stream,
val, options);
break;
static void
val_print_type_code_flags (struct type *type, struct value *original_value,
- int embedded_offset, struct ui_file *stream)
+ struct ui_file *stream)
{
- const gdb_byte *valaddr = (original_value->contents_for_printing ().data ()
- + embedded_offset);
+ const gdb_byte *valaddr = (original_value->contents_for_printing ().data ());
ULONGEST val = unpack_long (type, valaddr);
int field, nfields = type->num_fields ();
struct gdbarch *gdbarch = type->arch ();
store_unsigned_integer (contents, 4, gdbarch_byte_order (arch), 0xaa);
string_file out;
- val_print_type_code_flags (flags_type, val, 0, &out);
+ val_print_type_code_flags (flags_type, val, &out);
SELF_CHECK (out.string () == "[ A=2 B=1 C=5 ]");
}