113 struct type *void_ptr_type
115 struct type *ptr_to_void_fn_type
119 struct type *ptrdiff_type
128 field_list =
xmalloc (
sizeof (
struct field [4]));
129 memset (field_list, 0,
sizeof (
struct field [4]));
130 field = &field_list[0];
134 FIELD_NAME (*field) =
"vcall_and_vbase_offsets";
178 struct type *vtable_type =
gdbarch_data (gdbarch, vtable_type_gdbarch_data);
190 struct type *vtable_type =
gdbarch_data (gdbarch, vtable_type_gdbarch_data);
203 int fieldnum, fieldelem;
246 static struct value *
251 vtable_type_gdbarch_data);
252 struct type *vtable_pointer_type;
253 struct value *vtable_pointer;
275 vtable_pointer =
value_at (vtable_pointer_type, container_addr);
288 int *full_p,
int *top_p,
int *using_enc_p)
292 struct value *vtable;
294 const char *vtable_symbol_name;
295 const char *class_name;
296 struct type *run_time_type;
332 if (vtable_symbol_name == NULL
333 || !
startswith (vtable_symbol_name,
"vtable for "))
335 warning (
_(
"can't find linker symbol for virtual table for `%s' value"),
337 if (vtable_symbol_name)
338 warning (
_(
" found `%s' instead"), vtable_symbol_name);
341 class_name = vtable_symbol_name + 11;
344 atsign = strchr (class_name,
'@');
349 copy = alloca (atsign - class_name + 1);
350 memcpy (copy, class_name, atsign - class_name);
351 copy[atsign - class_name] =
'\0';
358 if (run_time_type == NULL)
371 *top_p = - offset_to_top;
372 return run_time_type;
378 static struct value *
380 struct type *fntype,
int vtable_index)
382 struct value *vtable, *vfn;
410 static struct value *
420 error (
_(
"Only classes can have virtual functions."));
428 if (vfn_base != values_type)
445 const bfd_byte *valaddr,
int embedded_offset,
449 struct type *ptr_type;
450 struct value *vtable;
451 struct value *vbase_array;
452 long int cur_base_offset, base_offset;
471 error (
_(
"Expected a negative vbase offset (old compiler?)"));
474 if ((- cur_base_offset) %
TYPE_LENGTH (ptr_type) != 0)
475 error (
_(
"Misaligned vbase offset."));
476 cur_base_offset = cur_base_offset / ((
int)
TYPE_LENGTH (ptr_type));
501 for (i = 0; i <
len; i++)
510 for (j = 0; j < len2; j++)
521 struct type *basetype;
530 if (adjustment >= pos && adjustment < pos +
TYPE_LENGTH (basetype))
568 voffset = voffset ^ vbit;
572 vbit = adjustment & 1;
573 adjustment = adjustment >> 1;
576 *value_p = vbit? voffset : ptr_value;
577 *adjustment_p = adjustment;
598 if (ptr_value == 0 && vbit == 0)
608 const char *physname;
622 DMGL_ANSI | DMGL_PARAMS);
625 if (demangled_name == NULL)
630 xfree (demangled_name);
635 else if (ptr_value != 0)
707 static struct value *
713 struct type *self_type, *final_type, *method_type;
755 method_type, voffset);
826 VEC (value_and_voffset_p) **offset_vec,
843 slot = htab_find_slot (offset_hash, &search_vo, INSERT);
852 VEC_safe_push (value_and_voffset_p, *offset_vec, current_vo);
888 struct value *vtable;
903 for (i = 0; i <= max_voffset; ++i)
943 struct value *vtable;
947 VEC (value_and_voffset_p) *result_vec = NULL;
977 printf_filtered (
_(
"This object does not have a virtual function table\n"));
991 sizeof (value_and_voffset_p),
995 for (i = 0;
VEC_iterate (value_and_voffset_p, result_vec, i, iter); ++i)
1021 struct type *void_ptr_type
1023 struct type *char_type
1025 struct type *char_ptr_type
1028 field_list =
xmalloc (
sizeof (
struct field [2]));
1029 memset (field_list, 0,
sizeof (
struct field [2]));
1030 field = &field_list[0];
1060 static struct type *
1064 struct type *typeinfo_type;
1067 if (typeinfo == NULL)
1068 typeinfo_type =
gdbarch_data (gdbarch, std_type_info_gdbarch_data);
1072 return typeinfo_type;
1077 static struct value *
1080 struct type *typeinfo_type;
1084 struct value *result;
1085 char *type_name, *canonical;
1105 if (type_name == NULL)
1106 error (
_(
"cannot find typeinfo for unnamed type"));
1114 if (canonical != NULL)
1117 type_name = canonical;
1128 struct value *vtable, *typeinfo_value;
1133 error (
_(
"cannot find typeinfo for object of type '%s'"), type_name);
1143 sym_name = concat (
"typeinfo for ", type_name, (
char *) NULL);
1147 if (minsym.
minsym == NULL)
1148 error (
_(
"could not find typeinfo symbol for '%s'"), type_name);
1165 const char *symname;
1166 const char *class_name;
1171 if (typeinfo_sym.
minsym == NULL)
1172 error (
_(
"could not find minimal symbol for typeinfo address %s"),
1175 #define TYPEINFO_PREFIX "typeinfo for "
1176 #define TYPEINFO_PREFIX_LEN (sizeof (TYPEINFO_PREFIX) - 1)
1180 error (
_(
"typeinfo symbol '%s' has unexpected name"),
1185 atsign = strchr (class_name,
'@');
1187 return savestring (class_name, atsign - class_name);
1188 return xstrdup (class_name);
1193 static struct type *
1198 struct value *type_val;
1200 struct type *result;
1226 CORE_ADDR real_stop_pc, method_stop_pc, func_addr;
1230 const char *thunk_name, *fn_name;
1233 if (real_stop_pc == 0)
1239 if (thunk_sym.
minsym == NULL || section == NULL)
1246 if (thunk_name == NULL || strstr (thunk_name,
" thunk to ") == NULL)
1249 fn_name = strstr (thunk_name,
" thunk to ") + strlen (
" thunk to ");
1251 if (fn_sym.
minsym == NULL)
1263 method_stop_pc = func_addr;
1266 (gdbarch, frame, method_stop_pc);
1267 if (real_stop_pc == 0)
1268 real_stop_pc = method_stop_pc;
1270 return real_stop_pc;
1294 int fieldnum, fieldelem;
1345 struct type *arg_target_type;
1361 for (fieldnum = 0; fieldnum <
TYPE_NFIELDS (type); fieldnum++)
1372 vtable_type_gdbarch_data
1374 std_type_info_gdbarch_data
1381 (
enum dtor_kinds (*) (
const char *))is_gnu_v3_mangled_dtor;
1383 (
enum ctor_kinds (*) (
const char *))is_gnu_v3_mangled_ctor;
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 value * value_addr(struct value *arg1)
initialize_file_ftype _initialize_gnu_v3_abi
static struct gdbarch_data * std_type_info_gdbarch_data
int(* is_vtable_name)(const char *name)
struct type * builtin_func_ptr
struct value * value_subscript(struct value *array, LONGEST index)
#define MSYMBOL_LINKAGE_NAME(symbol)
#define TYPE_N_BASECLASSES(thistype)
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,...)
#define INIT_CPLUS_SPECIFIC(type)
int gdbarch_ptr_bit(struct gdbarch *gdbarch)
struct value * value_at(struct type *type, CORE_ADDR addr)
void * gdbarch_data(struct gdbarch *gdbarch, struct gdbarch_data *data)
struct ui_file * gdb_stdout
const struct type_print_options type_print_raw_options
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
static char * gnuv3_get_typename_from_type_info(struct value *type_info_ptr)
static int gnuv3_dynamic_class(struct type *type)
#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 *)
#define VEC_safe_push(T, V, O)
enum ctor_kinds(* is_constructor_name)(const char *name)
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)
static struct type * gnuv3_rtti_type(struct value *value, int *full_p, int *top_p, int *using_enc_p)
enum dtor_kinds(* is_destructor_name)(const char *name)
void store_unsigned_integer(gdb_byte *, int, enum bfd_endian, ULONGEST)
void printf_filtered(const char *format,...)
const char * paddress(struct gdbarch *gdbarch, CORE_ADDR addr)
enum lval_type value_lval_const(const struct value *value)
DEF_VEC_P(value_and_voffset_p)
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)
#define VEC_iterate(T, V, I, P)
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)
void initialize_file_ftype(void)
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)
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)
struct type * value_enclosing_type(struct value *value)
static int vtable_address_point_offset(struct gdbarch *gdbarch)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
int(* baseclass_offset)(struct type *type, int index, const bfd_byte *valaddr, int 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)
struct type * arch_integer_type(struct gdbarch *gdbarch, int bit, int unsigned_p, char *name)
static struct type * vtable_ptrdiff_type(struct gdbarch *gdbarch)
#define TYPE_FIELDS(thistype)
char * cp_canonicalize_string(const char *string)
static int gnuv3_baseclass_offset(struct type *type, int index, const bfd_byte *valaddr, int embedded_offset, CORE_ADDR address, const struct value *val)
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)
struct expression * parse_expression(const char *)
#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)
const char const char int
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)
static void compute_vtable_size(htab_t offset_hash, VEC(value_and_voffset_p)**offset_vec, struct value *value)
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 *)
struct symbol * lookup_symbol(const char *name, const struct block *block, domain_enum domain, struct field_of_this_result *is_a_field_of_this)
void get_user_print_options(struct value_print_options *opts)
#define TYPE_NFIELDS(thistype)
struct type * make_type_with_address_space(struct type *type, int space_flag)
int print_address_demangle(const struct value_print_options *opts, struct gdbarch *gdbarch, CORE_ADDR addr, struct ui_file *stream, int do_demangle)
#define VEC_address(T, V)
#define CHECK_TYPEDEF(TYPE)
struct cleanup * make_cleanup_htab_delete(htab_t htab)
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)
int value_embedded_offset(struct value *value)
char * savestring(const char *ptr, size_t len)
char *(* get_typename_from_type_info)(struct value *value)
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)
#define TYPE_CPLUS_REALLY_JAVA(thistype)
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)
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)
struct type *(* rtti_type)(struct value *v, int *full, int *top, int *using_enc)
static struct value * gnuv3_get_vtable(struct gdbarch *gdbarch, struct type *container_type, CORE_ADDR container_addr)
struct type * arch_type(struct gdbarch *gdbarch, enum type_code code, int length, char *name)
#define TYPE_FN_FIELD_CONSTRUCTOR(thisfn, n)
LONGEST extract_signed_integer(const gdb_byte *, int, enum bfd_endian)
static int compare_value_and_voffset(const void *a, const void *b)
char * type_to_string(struct type *type)
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)
void do_cleanups(struct cleanup *old_chain)
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)
struct value_and_voffset * value_and_voffset_p
static void gnuv3_print_method_ptr(const gdb_byte *contents, struct type *type, struct ui_file *stream)
const ULONGEST const LONGEST len