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)
282 opts->deref_ref =
false;
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)
334 opts->deref_ref =
false;
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;
392 struct type **dont_print_vb,
393 int dont_print_statmem)
416 struct type **dont_print_vb)
419 CORE_ADDR address = val->
address ();
420 struct type **last_dont_print
426 if (dont_print_vb == 0)
435 for (i = 0; i < n_baseclasses; i++)
440 const char *basename = baseclass->
name ();
441 struct value *base_val = NULL;
445 struct type **first_dont_print
448 int j = (
struct type **)
452 if (baseclass == first_dont_print[j])
464 catch (
const gdb_exception_error &ex)
466 if (ex.error == NOT_AVAILABLE_ERROR)
480 if (boffset < 0 || boffset >=
type->
length ())
482 gdb::byte_vector buf (baseclass->
length ());
485 baseclass->
length ()) != 0)
490 baseclass = base_val->
type ();
513 gdb_puts (basename ? basename :
"", stream);
529 (baseclass_val, stream, recurse, options,
540 if (dont_print_vb == 0)
575 if (real_type->
code () == TYPE_CODE_STRUCT)
577 CORE_ADDR *first_dont_print;
578 CORE_ADDR addr = val->
address ();
584 /
sizeof (CORE_ADDR);
588 if (addr == first_dont_print[i])
603 if (real_type->
code () == TYPE_CODE_ARRAY)
605 struct type **first_dont_print;
612 /
sizeof (
struct type *);
627 sizeof (
struct type *));
631 opts.deref_ref =
false;
660 if (offset == bitpos)
672 if (offset >= bitpos && offset < bitpos + bitsize)
718 if (self_type != NULL)
754 f->set_loc_bitpos (1);
757 f->set_loc_bitpos (3);
760 f->set_loc_bitpos (7);
769 f->set_loc_bitpos (30);
772 f->set_loc_bitpos (26);
775 f->set_loc_bitpos (24);
788 SELF_CHECK (out.
string () ==
"{A = false, B = 5, C = true}");
793 SELF_CHECK (out.
string () ==
"{A = 0x0, B = 0x5, C = 0x1}");
808 32 *
sizeof (
struct type *));
810 32 *
sizeof (CORE_ADDR));
812 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
static void cp_print_value_fields_pp(struct value *val, struct ui_file *stream, int recurse, const struct value_print_options *options, struct type **dont_print_vb, int dont_print_statmem)
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)
struct type * arch_composite_type(struct gdbarch *gdbarch, const char *name, enum type_code code)
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
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 BASETYPE_VIA_VIRTUAL(thistype, index)
#define TYPE_N_BASECLASSES(thistype)
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
unsigned int bitsize() const
struct type * type() const
enum language la_language
struct type * target_type() const
struct field & field(int idx) const
unsigned int num_fields() const
void set_length(ULONGEST length)
const char * name() const
enum val_prettyformat prettyformat
struct value * primitive_field(LONGEST offset, int fieldno, struct type *arg_type)
gdb::array_view< gdb_byte > contents_writeable()
static struct value * allocate(struct type *type)
struct type * enclosing_type() const
LONGEST embedded_offset() const
struct type * type() const
bool entirely_optimized_out()
bool bits_synthetic_pointer(LONGEST offset, LONGEST length) const
gdb::array_view< const gdb_byte > contents_for_printing()
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 value * value_static_field(struct type *type, int fieldno)
struct value * value_field_bitfield(struct type *type, int fieldno, const gdb_byte *valaddr, LONGEST embedded_offset, const struct value *val)
struct value * value_from_contents_and_address(struct type *type, const gdb_byte *valaddr, CORE_ADDR address, frame_info_ptr frame)