21#include "gdbsupport/gdb_obstack.h"
38#include "gdbsupport/byte-vector.h"
41#include "gdbsupport/selftest.h"
66 const char *type_name =
type->
name ();
68 return (type_name != NULL && !strcmp (type_name,
vtbl_ptr_name));
82 if (
type->
code () == TYPE_CODE_ARRAY)
85 if (
type->
code () == TYPE_CODE_STRUCT
93 else if (
type->
code () == TYPE_CODE_STRUCT)
97 else if (
type->
code () == TYPE_CODE_PTR)
125 struct type **dont_print_vb,
126 int dont_print_statmem)
128 int i, len, n_baseclasses;
130 static int last_set_recurse = -1;
143 32 *
sizeof (CORE_ADDR));
149 32 *
sizeof (
struct type *));
160 if (n_baseclasses > 0)
161 cp_print_value (val, stream, recurse + 1, options, dont_print_vb);
166 if (len == n_baseclasses || !len)
170 size_t statmem_obstack_initial_size = 0;
171 size_t stat_array_obstack_initial_size = 0;
172 struct type *vptr_basetype = NULL;
175 if (dont_print_statmem == 0)
177 statmem_obstack_initial_size =
180 if (last_set_recurse != recurse)
182 stat_array_obstack_initial_size =
185 last_set_recurse = recurse;
190 for (i = n_baseclasses; i < len; i++)
205 else if (n_baseclasses > 0)
236 DMGL_PARAMS | DMGL_ANSI);
256 if (opts->max_depth != -1 && opts->max_depth <
INT_MAX)
305 v, stream, recurse + 1,
308 catch (
const gdb_exception_error &ex)
311 _(
"<error reading variable: %s>"),
315 else if (i == vptr_fieldno &&
type == vptr_basetype)
342 if (dont_print_statmem == 0)
344 size_t obstack_final_size =
347 if (obstack_final_size > statmem_obstack_initial_size)
351 = statmem_obstack_initial_size - obstack_final_size;
355 if (last_set_recurse != recurse)
360 if (obstack_final_size > stat_array_obstack_initial_size)
364 - (obstack_final_size
365 - stat_array_obstack_initial_size);
370 last_set_recurse = -1;
390 struct type **dont_print_vb)
394 struct type **last_dont_print
400 if (dont_print_vb == 0)
409 for (i = 0; i < n_baseclasses; i++)
414 const char *basename = baseclass->
name ();
415 struct value *base_val = NULL;
419 struct type **first_dont_print
422 int j = (
struct type **)
426 if (baseclass == first_dont_print[j])
438 catch (
const gdb_exception_error &ex)
440 if (ex.error == NOT_AVAILABLE_ERROR)
454 if (boffset < 0 || boffset >=
type->
length ())
456 gdb::byte_vector buf (baseclass->
length ());
459 baseclass->
length ()) != 0)
487 gdb_puts (basename ? basename :
"", stream);
525 if (dont_print_vb == 0)
560 if (real_type->
code () == TYPE_CODE_STRUCT)
562 CORE_ADDR *first_dont_print;
569 /
sizeof (CORE_ADDR);
573 if (addr == first_dont_print[i])
588 if (real_type->
code () == TYPE_CODE_ARRAY)
590 struct type **first_dont_print;
597 /
sizeof (
struct type *);
612 sizeof (
struct type *));
642 LONGEST bitpos =
f.loc_bitpos ();
645 if (offset == bitpos)
657 if (offset >= bitpos && offset < bitpos + bitsize)
703 if (self_type != NULL)
739 f->set_loc_bitpos (1);
742 f->set_loc_bitpos (3);
745 f->set_loc_bitpos (7);
754 f->set_loc_bitpos (30);
757 f->set_loc_bitpos (26);
760 f->set_loc_bitpos (24);
773 SELF_CHECK (out.
string () ==
"{A = false, B = 5, C = true}");
778 SELF_CHECK (out.
string () ==
"{A = 0x0, B = 0x5, C = 0x1}");
793 32 *
sizeof (
struct type *));
795 32 *
sizeof (CORE_ADDR));
797 32 *
sizeof (
struct type *));
void annotate_field_value(void)
void annotate_field_begin(struct type *type)
void annotate_field_name_end(void)
void annotate_field_end(void)
void c_type_print_base(struct type *, struct ui_file *, int, int, const struct type_print_options *)
ui_file_style style() const
const std::string & string()
virtual void wrap_here(int indent)
cli_style_option variable_name_style
cli_style_option metadata_style
int baseclass_offset(struct type *type, int index, const gdb_byte *valaddr, LONGEST embedded_offset, CORE_ADDR address, const struct value *val)
static void cp_find_class_member(struct type **self_p, int *fieldno, LONGEST offset)
static struct obstack dont_print_vb_obstack
static void cp_print_value(struct value *, struct ui_file *, int, const struct value_print_options *, struct type **)
static struct obstack dont_print_statmem_obstack
void _initialize_cp_valprint()
int cp_is_vtbl_ptr_type(struct type *type)
static void cp_print_static_field(struct type *, struct value *, struct ui_file *, int, const struct value_print_options *)
int cp_is_vtbl_member(struct type *type)
void cp_print_class_member(const gdb_byte *valaddr, struct type *type, struct ui_file *stream, const char *prefix)
static struct obstack dont_print_stat_array_obstack
const char vtbl_ptr_name[]
void cp_print_value_fields(struct value *val, struct ui_file *stream, int recurse, const struct value_print_options *options, struct type **dont_print_vb, int dont_print_statmem)
static void store_unsigned_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, ULONGEST val)
CORE_ADDR extract_typed_address(const gdb_byte *buf, struct type *type)
static LONGEST extract_signed_integer(gdb::array_view< const gdb_byte > buf, enum bfd_endian byte_order)
int apply_ext_lang_val_pretty_printer(struct value *val, struct ui_file *stream, int recurse, const struct value_print_options *options, const struct language_defn *language)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
enum bfd_endian type_byte_order(const struct type *type)
int field_is_static(struct field *f)
struct type * arch_composite_type(struct gdbarch *gdbarch, const char *name, enum type_code code)
struct field * append_composite_type_field_raw(struct type *t, const char *name, struct type *field)
int get_vptr_fieldno(struct type *type, struct type **basetypep)
struct type * check_typedef(struct type *type)
#define TYPE_SELF_TYPE(thistype)
#define TYPE_BASECLASS(thistype, index)
#define TYPE_FIELD_IGNORE(thistype, n)
#define TYPE_FIELD_BITSIZE(thistype, n)
#define TYPE_FIELD_PACKED(thistype, n)
#define BASETYPE_VIA_VIRTUAL(thistype, index)
#define TYPE_N_BASECLASSES(thistype)
#define FIELD_BITSIZE(thisfld)
const struct language_defn * current_language
void register_test_foreach_arch(const std::string &name, self_test_foreach_arch_function *function)
#define prefix(a, b, R, do)
struct type * builtin_bool
struct type * builtin_uint8
LONGEST loc_bitpos() const
const char * name() const
struct type * type() const
enum language la_language
struct type * target_type() const
struct field & field(int idx) const
void set_length(ULONGEST length)
const char * name() const
enum val_prettyformat prettyformat
int target_read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
const struct type_print_options type_print_raw_options
void print_spaces(int n, struct ui_file *stream)
void fprintf_styled(struct ui_file *stream, const ui_file_style &style, const char *format,...)
void gdb_printf(struct ui_file *stream, const char *format,...)
void fputs_styled(const char *linebuffer, const ui_file_style &style, struct ui_file *stream)
void fprintf_symbol(struct ui_file *stream, const char *name, enum language lang, int arg_mode)
void gdb_puts(const char *linebuffer, struct ui_file *stream)
void get_no_prettyformat_print_options(struct value_print_options *opts)
void val_print_unavailable(struct ui_file *stream)
int valprint_check_validity(struct ui_file *stream, struct type *type, LONGEST embedded_offset, const struct value *val)
void val_print_optimized_out(const struct value *val, struct ui_file *stream)
bool val_print_check_max_depth(struct ui_file *stream, int recurse, const struct value_print_options *options, const struct language_defn *language)
void val_print_invalid_address(struct ui_file *stream)
void common_val_print(struct value *value, struct ui_file *stream, int recurse, const struct value_print_options *options, const struct language_defn *language)
void print_function_pointer_address(const struct value_print_options *options, struct gdbarch *gdbarch, CORE_ADDR address, struct ui_file *stream)
struct type * value_type(const struct value *value)
int value_entirely_optimized_out(struct value *value)
LONGEST value_embedded_offset(const struct value *value)
struct value * allocate_value(struct type *type)
struct value * value_primitive_field(struct value *arg1, LONGEST offset, int fieldno, struct type *arg_type)
struct value * value_static_field(struct type *type, int fieldno)
CORE_ADDR value_address(const struct value *value)
gdb::array_view< gdb_byte > value_contents_writeable(struct value *value)
gdb::array_view< const gdb_byte > value_contents_for_printing(struct value *value)
struct value * value_field_bitfield(struct type *type, int fieldno, const gdb_byte *valaddr, LONGEST embedded_offset, const struct value *val)
struct type * value_enclosing_type(const struct value *value)
int value_bits_synthetic_pointer(const struct value *value, LONGEST offset, LONGEST length)
struct value * value_from_contents_and_address(struct type *type, const gdb_byte *valaddr, CORE_ADDR address)