static void
print_unpacked_pointer (struct type *type, struct type *elttype,
struct type *unresolved_elttype,
- const gdb_byte *valaddr, int embedded_offset,
+ const gdb_byte *valaddr, bool valtag,
+ int embedded_offset,
CORE_ADDR address, struct ui_file *stream, int recurse,
const struct value_print_options *options)
{
{
/* Try to print what function it points to. */
print_function_pointer_address (options, gdbarch, address, stream);
+ if (TYPE_CAPABILITY (type))
+ gdbarch_print_cap_attributes (type->arch (), valaddr, valtag, stream);
return;
}
want_space = 1;
}
+ if (TYPE_CAPABILITY (type))
+ gdbarch_print_cap_attributes (type->arch (), valaddr, valtag, stream);
+
/* For a pointer to a textual type, also print the string
pointed to, unless pointer is null. */
{
/* Array of unspecified length: treat like pointer to first elt. */
print_unpacked_pointer (type, elttype, unresolved_elttype, valaddr,
+ value_tag (val),
0, address, stream, recurse, options);
}
}
{
struct type *type = check_typedef (value_type (val));
- /* If we have a pointer to a capability, handle it as a capability. */
- if (options->format == 0 && (type->code () == TYPE_CODE_PTR
- && TYPE_CAPABILITY (type)))
- generic_value_print_capability (val, stream, options);
-
if (options->format && options->format != 's')
{
value_print_scalar_formatted (val, options, 0, stream);
CORE_ADDR addr = extract_typed_address (valaddr, type);
print_function_pointer_address (options, type->arch (), addr, stream);
+ if (TYPE_CAPABILITY (type))
+ gdbarch_print_cap_attributes (type->arch (), valaddr,
+ value_tag (val), stream);
}
else
{
CORE_ADDR addr = unpack_pointer (type, valaddr);
print_unpacked_pointer (type, elttype, unresolved_elttype, valaddr,
+ value_tag (val),
0, addr, stream, recurse, options);
}
}
CORE_ADDR addr = extract_typed_address (valaddr + offset, field_type);
print_function_pointer_address (options, type->arch (), addr, stream);
+ if (TYPE_CAPABILITY (type))
+ gdbarch_print_cap_attributes (type->arch (), valaddr,
+ value_tag (val), stream);
}
else
cp_print_value_fields (val, stream, recurse, options, NULL, 0);
#include "gdbsupport/selftest.h"
#include "selftest-arch.h"
-#include "gdbsupport/capability.h"
-
/* Maximum number of wchars returned from wchar_iterate. */
#define MAX_WCHARS 4
/* Array of unspecified length: treat like pointer to first elt. */
print_unpacked_pointer (type, elttype, value_address (val),
stream, options);
+ if (TYPE_CAPABILITY (type))
+ {
+ const gdb_byte *valaddr = value_contents_for_printing (val).data ();
+
+ gdbarch_print_cap_attributes (type->arch (), valaddr,
+ value_tag (val), stream);
+ }
}
}
CORE_ADDR addr = unpack_pointer (type, valaddr);
print_unpacked_pointer (type, elttype, addr, stream, options);
+ if (TYPE_CAPABILITY (type))
+ gdbarch_print_cap_attributes (type->arch (), valaddr, value_tag (val),
+ stream);
}
}
/* Account for the tag bit in the length. */
int length = TYPE_LENGTH (type);
const gdb_byte *contents = value_contents_for_printing (val).data ();
+ bool tag = value_tag (val);
enum bfd_endian byte_order = type_byte_order (type);
- bool tag = false;
-
- switch (VALUE_LVAL (val))
- {
- case not_lval:
- case lval_register:
- case lval_internalvar:
- if (value_tagged (val))
- tag = value_tag (val);
- break;
- case lval_memory:
- {
- if (!value_lazy (val) && value_tagged (val))
- tag = value_tag (val);
- else
- {
- struct gdbarch *gdbarch = type->arch ();
- tag = gdbarch_get_cap_tag_from_address (gdbarch,
- value_address (val));
- }
- }
- break;
- default:
- break;
- }
if (options->format && options->format == 'x')
print_hex_chars (stream, contents, length, byte_order, 0);
else
- {
- uint128_t dummy_cap;
- memcpy (&dummy_cap, contents, length);
- capability cap (dummy_cap, tag);
- fprintf_filtered (stream, "%s ",
- cap.to_str (options->compact_capabilities).c_str ());
- }
-
- return;
+ gdbarch_print_cap (type->arch (), contents, tag,
+ options->compact_capabilities, stream);
}
/* Print '@' followed by the address contained in ADDRESS_BUFFER. */