114 struct type *void_ptr_type
116 struct type *ptr_to_void_fn_type
120 struct type *ptrdiff_type
130 field = &field_list[0];
178 struct type *vtable_type
191 struct type *vtable_type
205 int fieldnum, fieldelem;
248 static struct value *
252 struct type *vtable_type
254 struct type *vtable_pointer_type;
255 struct value *vtable_pointer;
277 vtable_pointer =
value_at (vtable_pointer_type, container_addr);
290 int *full_p,
LONGEST *top_p,
int *using_enc_p)
294 struct value *vtable;
296 const char *vtable_symbol_name;
297 const char *class_name;
298 struct type *run_time_type;
330 if (vtable_symbol_name == NULL
331 || !
startswith (vtable_symbol_name,
"vtable for "))
333 warning (
_(
"can't find linker symbol for virtual table for `%s' value"),
335 if (vtable_symbol_name)
336 warning (
_(
" found `%s' instead"), vtable_symbol_name);
339 class_name = vtable_symbol_name + 11;
342 atsign = strchr (class_name,
'@');
347 copy = (
char *) alloca (atsign - class_name + 1);
348 memcpy (copy, class_name, atsign - class_name);
349 copy[atsign - class_name] =
'\0';
356 if (run_time_type == NULL)
369 *top_p = - offset_to_top;
370 return run_time_type;
376 static struct value *
378 struct type *fntype,
int vtable_index)
380 struct value *vtable, *vfn;
408 static struct value *
418 error (
_(
"Only classes can have virtual functions."));
426 if (vfn_base != values_type)
443 const bfd_byte *valaddr,
LONGEST embedded_offset,
447 struct type *ptr_type;
448 struct value *vtable;
449 struct value *vbase_array;
450 long int cur_base_offset, base_offset;
468 error (
_(
"Expected a negative vbase offset (old compiler?)"));
471 if ((- cur_base_offset) %
TYPE_LENGTH (ptr_type) != 0)
472 error (
_(
"Misaligned vbase offset."));
473 cur_base_offset = cur_base_offset / ((int)
TYPE_LENGTH (ptr_type));
498 for (i = 0; i < len; i++)
507 for (j = 0; j < len2; j++)
518 struct type *basetype;
527 if (adjustment >= pos && adjustment < pos +
TYPE_LENGTH (basetype))
565 voffset = voffset ^ vbit;
569 vbit = adjustment & 1;
570 adjustment = adjustment >> 1;
573 *value_p = vbit? voffset : ptr_value;
574 *adjustment_p = adjustment;
595 if (ptr_value == 0 && vbit == 0)
605 const char *physname;
619 DMGL_ANSI | DMGL_PARAMS);
622 if (demangled_name == NULL)
627 xfree (demangled_name);
632 else if (ptr_value != 0)
704 static struct value *
710 struct type *self_type, *final_type, *method_type;
752 method_type, voffset);
804 return addra < addrb;
815 std::vector<value_and_voffset *> *offset_vec,
832 slot = htab_find_slot (offset_hash, &search_vo, INSERT);
841 offset_vec->push_back (current_vo);
877 struct value *vtable;
892 for (i = 0; i <= max_voffset; ++i)
932 struct value *vtable;
962 printf_filtered (
_(
"This object does not have a virtual function table\n"));
969 std::vector<value_and_voffset *> result_vec;
972 std::sort (result_vec.begin (), result_vec.end (),
978 if (iter->max_voffset >= 0)
1000 struct type *void_ptr_type
1002 struct type *char_type
1004 struct type *char_ptr_type
1008 field = &field_list[0];
1038 static struct type *
1042 struct type *typeinfo_type;
1046 if (typeinfo == NULL)
1052 return typeinfo_type;
1057 static struct value *
1060 struct type *typeinfo_type;
1063 struct value *result;
1084 if (type_name.empty ())
1085 error (
_(
"cannot find typeinfo for unnamed type"));
1092 if (!canonical.empty ())
1093 type_name = canonical;
1103 struct value *vtable, *typeinfo_value;
1108 error (
_(
"cannot find typeinfo for object of type '%s'"),
1109 type_name.c_str ());
1120 if (minsym.
minsym == NULL)
1121 error (
_(
"could not find typeinfo symbol for '%s'"), type_name.c_str ());
1137 const char *symname;
1138 const char *class_name;
1143 if (typeinfo_sym.
minsym == NULL)
1144 error (
_(
"could not find minimal symbol for typeinfo address %s"),
1147 #define TYPEINFO_PREFIX "typeinfo for " 1148 #define TYPEINFO_PREFIX_LEN (sizeof (TYPEINFO_PREFIX) - 1) 1152 error (
_(
"typeinfo symbol '%s' has unexpected name"),
1157 atsign = strchr (class_name,
'@');
1159 return std::string (class_name, atsign - class_name);
1165 static struct type *
1184 CORE_ADDR real_stop_pc, method_stop_pc, func_addr;
1188 const char *thunk_name, *fn_name;
1191 if (real_stop_pc == 0)
1197 if (thunk_sym.
minsym == NULL || section == NULL)
1204 if (thunk_name == NULL || strstr (thunk_name,
" thunk to ") == NULL)
1207 fn_name = strstr (thunk_name,
" thunk to ") + strlen (
" thunk to ");
1209 if (fn_sym.
minsym == NULL)
1221 method_stop_pc = func_addr;
1224 (
gdbarch, frame, method_stop_pc);
1225 if (real_stop_pc == 0)
1226 real_stop_pc = method_stop_pc;
1228 return real_stop_pc;
1252 int fieldnum, fieldelem;
1303 struct type *arg_target_type;
1339 (
enum dtor_kinds (*) (
const char *))is_gnu_v3_mangled_dtor;
1341 (
enum ctor_kinds (*) (
const char *))is_gnu_v3_mangled_ctor;
static struct type * gnuv3_rtti_type(struct value *value, int *full_p, LONGEST *top_p, int *using_enc_p)
static bool compare_value_and_voffset(const struct value_and_voffset *va, const struct value_and_voffset *vb)
struct type * lookup_array_range_type(struct type *element_type, LONGEST low_bound, LONGEST high_bound)
CORE_ADDR extract_typed_address(const gdb_byte *buf, struct type *type)
struct type * arch_type(struct gdbarch *gdbarch, enum type_code code, int bit, const char *name)
struct value * value_addr(struct value *arg1)
static struct gdbarch_data * std_type_info_gdbarch_data
int(* is_vtable_name)(const char *name)
static int gnuv3_baseclass_offset(struct type *type, int index, const bfd_byte *valaddr, LONGEST embedded_offset, CORE_ADDR address, const struct value *val)
struct type * builtin_func_ptr
static void compute_vtable_size(htab_t offset_hash, std::vector< value_and_voffset *> *offset_vec, struct value *value)
struct value * value_subscript(struct value *array, LONGEST index)
#define MSYMBOL_LINKAGE_NAME(symbol)
#define TYPE_N_BASECLASSES(thistype)
gdb::unique_xmalloc_ptr< expression > expression_up
static int gnuv3_pass_by_reference(struct type *type)
static int gnuv3_decode_method_ptr(struct gdbarch *gdbarch, const gdb_byte *contents, CORE_ADDR *value_p, LONGEST *adjustment_p)
#define TYPE_NFN_FIELDS(thistype)
LONGEST value_as_long(struct value *val)
#define BMSYMBOL_VALUE_ADDRESS(symbol)
void warning(const char *fmt,...)
LONGEST value_embedded_offset(const struct value *value)
#define INIT_CPLUS_SPECIFIC(type)
int gdbarch_ptr_bit(struct gdbarch *gdbarch)
struct type * value_enclosing_type(const struct value *value)
struct value * value_at(struct type *type, CORE_ADDR addr)
const struct type_print_options type_print_raw_options
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
static int gnuv3_dynamic_class(struct type *type)
static std::string gnuv3_get_typename_from_type_info(struct value *type_info_ptr)
#define BASETYPE_VIA_VIRTUAL(thistype, index)
void set_cp_abi_as_auto_default(const char *short_name)
static void init_gnuv3_ops(void)
struct value * coerce_ref(struct value *arg)
struct type * make_pointer_type(struct type *type, struct type **typeptr)
struct value * value_ind(struct value *arg1)
int(* method_ptr_size)(struct type *)
enum ctor_kinds(* is_constructor_name)(const char *name)
struct block_symbol lookup_symbol(const char *name, const struct block *block, domain_enum domain, struct field_of_this_result *is_a_field_of_this)
void(* print_vtable)(struct value *)
#define MSYMBOL_DEMANGLED_NAME(symbol)
static struct gdbarch_data * vtable_type_gdbarch_data
#define SET_FIELD_BITPOS(thisfld, bitpos)
#define TYPE_FIELD(thistype, n)
int gdbarch_vtable_function_descriptors(struct gdbarch *gdbarch)
#define TYPE_FIELD_TYPE(thistype, n)
enum dtor_kinds(* is_destructor_name)(const char *name)
void printf_filtered(const char *format,...)
const char * paddress(struct gdbarch *gdbarch, CORE_ADDR addr)
struct type * arch_integer_type(struct gdbarch *gdbarch, int bit, int unsigned_p, const char *name)
enum lval_type value_lval_const(const struct value *value)
struct value * value_ptradd(struct value *arg1, LONGEST arg2)
int gdbarch_vbit_in_delta(struct gdbarch *gdbarch)
struct value *(* method_ptr_to_value)(struct value **, struct value *)
char * gdb_demangle(const char *name, int options)
#define TYPE_FN_FIELD_PHYSNAME(thisfn, n)
struct type * check_typedef(struct type *type)
#define TYPE_FN_FIELD_VIRTUAL_P(thisfn, n)
const gdb_byte * value_contents(struct value *value)
#define CATCH(EXCEPTION, MASK)
struct value * value_field(struct value *arg1, int fieldno)
static const char * gnuv3_find_method_in(struct type *domain, CORE_ADDR voffset, LONGEST adjustment)
static void gnuv3_make_method_ptr(struct type *type, gdb_byte *contents, CORE_ADDR value, int is_virtual)
struct type * cp_lookup_rtti_type(const char *name, struct block *block)
struct target_ops current_target
#define TYPE_FN_FIELD_ARTIFICIAL(thisfn, n)
int field_is_static(struct field *f)
int register_cp_abi(struct cp_abi_ops *abi)
void fprintf_filtered(struct ui_file *stream, const char *format,...)
static struct value * gnuv3_method_ptr_to_value(struct value **this_p, struct value *method_ptr)
enum ctor_kinds is_constructor_name(const char *name)
struct type *(* get_type_from_type_info)(struct value *value)
struct value *(* get_typeid)(struct value *value)
static void print_one_vtable(struct gdbarch *gdbarch, struct value *value, int max_voffset, struct value_print_options *opts)
std::unique_ptr< htab, htab_deleter > htab_up
static CORE_ADDR gnuv3_skip_trampoline(struct frame_info *frame, CORE_ADDR stop_pc)
static int gnuv3_is_operator_name(const char *name)
CORE_ADDR gdbarch_convert_from_func_ptr_addr(struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ)
void fputs_filtered(const char *linebuffer, struct ui_file *stream)
#define ALLOCATE_CPLUS_STRUCT_TYPE(type)
static void * build_std_type_info_type(struct gdbarch *arch)
static int vtable_address_point_offset(struct gdbarch *gdbarch)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
int(* baseclass_offset)(struct type *type, int index, const bfd_byte *valaddr, LONGEST embedded_offset, CORE_ADDR address, const struct value *val)
#define TYPE_CPLUS_DYNAMIC(thistype)
struct gdbarch * get_type_arch(const struct type *type)
static int startswith(const char *string, const char *pattern)
struct value * value_at_lazy(struct type *type, CORE_ADDR addr)
struct value * value_cast(struct type *type, struct value *arg2)
#define TYPEINFO_PREFIX_LEN
static hashval_t hash_value_and_voffset(const void *p)
int class_types_same_p(const struct type *a, const struct type *b)
static struct type * vtable_ptrdiff_type(struct gdbarch *gdbarch)
#define TYPE_FIELDS(thistype)
struct obj_section * find_pc_section(CORE_ADDR pc)
struct value * value_full_object(struct value *argp, struct type *rtype, int xfull, int xtop, int xusing_enc)
#define TYPE_FIELD_BITPOS(thistype, n)
void(* print_method_ptr)(const gdb_byte *contents, struct type *type, struct ui_file *stream)
static int eq_value_and_voffset(const void *a, const void *b)
#define TYPE_FN_FIELD_VOFFSET(thisfn, n)
static struct value * gnuv3_get_typeid(struct value *value)
static struct value * gnuv3_get_virtual_fn(struct gdbarch *gdbarch, struct value *container, struct type *fntype, int vtable_index)
static void gnuv3_print_vtable(struct value *value)
#define TYPE_FN_FIELD_TYPE(thisfn, n)
int(* is_operator_name)(const char *name)
struct value * value_from_pointer(struct type *type, CORE_ADDR addr)
static int gnuv3_method_ptr_size(struct type *type)
struct type * make_cv_type(int cnst, int voltl, struct type *type, struct type **typeptr)
struct type * builtin_char
#define TYPE_TARGET_TYPE(thistype)
void print_longest(struct ui_file *stream, int format, int use_c_format, LONGEST val_long)
struct bound_minimal_symbol lookup_minimal_symbol_by_pc(CORE_ADDR pc)
#define TYPE_CODE(thistype)
struct type *(* rtti_type)(struct value *v, int *full, LONGEST *top, int *using_enc)
static struct value * gnuv3_virtual_fn_field(struct value **value_p, struct fn_field *f, int j, struct type *vfn_base, int offset)
struct type * builtin_data_ptr
struct minimal_symbol * minsym
void c_print_type(struct type *, const char *, struct ui_file *, int, int, const struct type_print_options *)
void get_user_print_options(struct value_print_options *opts)
#define TYPE_NFIELDS(thistype)
std::string(* get_typename_from_type_info)(struct value *value)
struct type * make_type_with_address_space(struct type *type, int space_flag)
std::string cp_canonicalize_string(const char *string)
int print_address_demangle(const struct value_print_options *opts, struct gdbarch *gdbarch, CORE_ADDR addr, struct ui_file *stream, int do_demangle)
static LONGEST extract_signed_integer(const gdb_byte *addr, int len, enum bfd_endian byte_order)
void check_stub_method_group(struct type *type, int method_id)
#define TYPE_TAG_NAME(type)
int(* pass_by_reference)(struct type *type)
static struct cp_abi_ops gnu_v3_abi_ops
#define FIELD_NAME(thisfld)
expression_up parse_expression(const char *)
struct type * value_type(const struct value *value)
static struct type * gnuv3_get_type_from_type_info(struct value *type_info_ptr)
#define SYMBOL_TYPE(symbol)
void(* make_method_ptr)(struct type *, gdb_byte *, CORE_ADDR, int)
CORE_ADDR gdbarch_skip_trampoline_code(struct gdbarch *gdbarch, struct frame_info *frame, CORE_ADDR pc)
static void * build_gdb_vtable_type(struct gdbarch *arch)
CORE_ADDR value_as_address(struct value *val)
struct value * evaluate_type(struct expression *exp)
#define TYPE_FN_FIELDLIST_NAME(thistype, n)
#define TYPE_LENGTH(thistype)
#define TYPE_BASECLASS_BITPOS(thistype, index)
static int gnuv3_is_vtable_name(const char *name)
std::string type_to_string(struct type *type)
void print_function_pointer_address(const struct value_print_options *options, struct gdbarch *gdbarch, CORE_ADDR address, struct ui_file *stream)
#define TYPE_FN_FIELDLIST_LENGTH(thistype, n)
static struct value * gnuv3_get_vtable(struct gdbarch *gdbarch, struct type *container_type, CORE_ADDR container_addr)
#define TYPE_FN_FIELD_CONSTRUCTOR(thisfn, n)
CORE_ADDR value_address(const struct value *value)
struct bound_minimal_symbol lookup_minimal_symbol(const char *name, const char *sfile, struct objfile *objf)
PTR xcalloc(size_t number, size_t size)
enum bfd_endian byte_order
#define TYPE_SELF_TYPE(thistype)
void error(const char *fmt,...)
static struct type * gnuv3_get_typeid_type(struct gdbarch *gdbarch)
struct gdbarch_data * gdbarch_data_register_post_init(gdbarch_data_post_init_ftype *post_init)
struct type * lookup_pointer_type(struct type *type)
struct gdbarch * get_frame_arch(struct frame_info *this_frame)
#define TYPE_FN_FIELDLIST1(thistype, n)
struct value *(* virtual_fn_field)(struct value **arg1p, struct fn_field *f, int j, struct type *type, int offset)
CORE_ADDR(* skip_trampoline)(struct frame_info *, CORE_ADDR)
#define FIELD_TYPE(thisfld)
struct type *(* get_typeid_type)(struct gdbarch *gdbarch)
#define TYPE_SAFE_NAME(type)
static void store_unsigned_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, ULONGEST val)
static void gnuv3_print_method_ptr(const gdb_byte *contents, struct type *type, struct ui_file *stream)
void _initialize_gnu_v3_abi(void)