105 ctf_archive_t *arc = ctf_get_arc (
fp);
130 unrelocated_addr addr)
153 std::vector<struct ctf_nextfield>
fields;
195 ctf_id_t btid,
const char *
name);
236 return ids_lhs->
tid == ids_rhs->
tid;
259 if (*slot ==
nullptr)
313 if ((kind == CTF_K_INTEGER || kind == CTF_K_ENUM
314 || kind == CTF_K_FLOAT)
315 && ctf_type_reference (fp, tid) != CTF_ERR
316 && ctf_type_encoding (fp, tid, &cet) != CTF_ERR)
343 int nfields = fip->
fields.size ();
352 for (
int i = 0; i < nfields; ++i)
367 const char *name_hint)
370 const struct floatformat **format;
375 if (format !=
nullptr)
390 unsigned long offset,
400 fp = &new_field.
field;
403 kind = ctf_type_kind (ccp->
fp, tid);
410 complaint (_(
"ctf_add_member_cb: %s has NO type (%ld)"),
name, tid);
416 if (kind == CTF_K_STRUCT || kind == CTF_K_UNION)
423 fip->
fields.emplace_back (new_field);
441 fp->set_type (
nullptr);
442 fp->set_loc_enumval (enum_value);
458 fip->
fields.emplace_back (new_field);
470 ctf_dict_t *fp = ccp->
fp;
471 struct symbol *sym =
nullptr;
473 const char *
name = ctf_type_name_raw (fp, tid);
487 uint32_t kind = ctf_type_kind (fp, tid);
501 if (sym->
type ()->
code () == TYPE_CODE_VOID)
534 ctf_dict_t *fp = ccp->
fp;
540 if (ctf_type_encoding (fp, tid, &cet))
542 complaint (_(
"ctf_type_encoding read_base_type failed - %s"),
543 ctf_errmsg (ctf_errno (fp)));
547 name = ctf_type_name_raw (fp, tid);
548 if (
name ==
nullptr || strlen (
name) == 0)
550 name = ctf_type_aname (fp, tid);
552 complaint (_(
"ctf_type_aname read_base_type failed - %s"),
553 ctf_errmsg (ctf_errno (fp)));
557 kind = ctf_type_kind (fp, tid);
558 if (kind == CTF_K_INTEGER)
560 uint32_t issigned, ischar, isbool;
563 issigned = cet.cte_format & CTF_INT_SIGNED;
564 ischar = cet.cte_format & CTF_INT_CHAR;
565 isbool = cet.cte_format & CTF_INT_BOOL;
574 if (cet.cte_bits && ((cet.cte_bits % TARGET_CHAR_BIT) == 0))
581 else if (kind == CTF_K_FLOAT)
584 isflt = !((cet.cte_format & CTF_FP_IMAGRY) == CTF_FP_IMAGRY
585 || (cet.cte_format & CTF_FP_DIMAGRY) == CTF_FP_DIMAGRY
586 || (cet.cte_format & CTF_FP_LDIMAGRY) == CTF_FP_LDIMAGRY);
598 complaint (_(
"read_base_type: unsupported base kind (%d)"), kind);
602 if (
name !=
nullptr && strcmp (
name,
"char") == 0)
628 ctf_dict_t *fp = ccp->
fp;
634 const char *
name = ctf_type_name_raw (fp, tid);
635 if (
name !=
nullptr && strlen (
name) != 0)
638 kind = ctf_type_kind (fp, tid);
639 if (kind == CTF_K_UNION)
662 complaint (_(
"ctf_member_iter process_struct_members failed - %s"),
663 ctf_errmsg (ctf_errno (ccp->
fp)));
686 ctf_dict_t *fp = ccp->
fp;
687 struct type *
type, *rettype, *atype;
694 if (ctf_func_type_info (fp, tid, &cfi) < 0)
696 const char *fname = ctf_type_name_raw (fp, tid);
697 error (_(
"Error getting function type info: %s"),
698 fname ==
nullptr ?
"noname" : fname);
707 if ((cfi.ctc_flags & CTF_FUNC_VARARG) != 0)
712 std::vector<ctf_id_t> argv (argc);
713 if (ctf_func_type_args (fp, tid, argc, argv.data ()) == CTF_ERR)
719 for (
int iparam = 0; iparam < argc; iparam++)
722 if (atype !=
nullptr)
739 ctf_dict_t *fp = ccp->
fp;
744 const char *
name = ctf_type_name_raw (fp, tid);
745 if (
name !=
nullptr && strlen (
name) != 0)
768 complaint (_(
"ctf_enum_iter process_enum_type failed - %s"),
769 ctf_errmsg (ctf_errno (ccp->
fp)));
782 struct type *base_type,
786 struct type *el_type, *inner_array;
789 inner_array = base_type;
811 ctf_dict_t *fp = ccp->
fp;
812 struct type *element_type, *range_type, *idx_type;
816 if (ctf_array_info (fp, tid, &ar) == CTF_ERR)
818 complaint (_(
"ctf_array_info read_array_type failed - %s"),
819 ctf_errmsg (ctf_errno (fp)));
824 if (element_type ==
nullptr)
828 if (idx_type ==
nullptr)
834 if (ar.ctr_nelems <= 1)
854 struct type *base_type, *cv_type;
857 if (base_type ==
nullptr)
860 if (base_type ==
nullptr)
862 complaint (_(
"read_const_type: NULL base type (%ld)"), btid);
877 ctf_dict_t *fp = ccp->
fp;
878 struct type *base_type, *cv_type;
881 if (base_type ==
nullptr)
884 if (base_type ==
nullptr)
886 complaint (_(
"read_volatile_type: NULL base type (%ld)"), btid);
891 if (ctf_type_kind (fp, btid) == CTF_K_ARRAY)
904 struct type *base_type, *cv_type;
907 if (base_type ==
nullptr)
910 if (base_type ==
nullptr)
912 complaint (_(
"read_restrict_type: NULL base type (%ld)"), btid);
925 ctf_id_t btid,
const char *
name)
959 complaint (_(
"read_pointer_type: NULL target type (%ld)"), btid);
976 ctf_dict_t *fp = ccp->
fp;
982 const char *
name = ctf_type_name_raw (fp, tid);
983 if (
name !=
nullptr && strlen (
name) != 0)
986 kind = ctf_type_kind_forwarded (fp, tid);
987 if (kind == CTF_K_UNION)
1003 ctf_dict_t *fp = ccp->
fp;
1008 kind = ctf_type_kind (fp, tid);
1018 case CTF_K_FUNCTION:
1022 btid = ctf_type_reference (fp, tid);
1027 const char *
name = ctf_type_name_raw (fp, tid);
1028 btid = ctf_type_reference (fp, tid);
1032 case CTF_K_VOLATILE:
1033 btid = ctf_type_reference (fp, tid);
1036 case CTF_K_RESTRICT:
1037 btid = ctf_type_reference (fp, tid);
1041 btid = ctf_type_reference (fp, tid);
1074 if (
type !=
nullptr)
1077 ctf_id_t btid = ctf_type_reference (ccp->
fp, tid);
1078 kind = ctf_type_kind (ccp->
fp, tid);
1088 case CTF_K_FUNCTION:
1103 case CTF_K_VOLATILE:
1107 case CTF_K_RESTRICT:
1134 struct symbol *sym =
nullptr;
1140 kind = ctf_type_kind (ccp->
fp,
id);
1143 case CTF_K_FUNCTION:
1144 if (
name !=
nullptr && strcmp (
name,
"main") == 0)
1149 case CTF_K_VOLATILE:
1150 case CTF_K_RESTRICT:
1155 if (
type !=
nullptr)
1165 if (
type ==
nullptr)
1167 complaint (_(
"ctf_add_var_cb: %s has NO type (%ld)"),
name,
id);
1179 complaint (_(
"ctf_add_var_cb: kind unsupported (%d)"), kind);
1195 ctf_next_t *i =
nullptr;
1198 struct symbol *sym =
nullptr;
1201 while ((tid = ctf_symbol_next (ccp->
fp, &i, &tname, functions)) != CTF_ERR)
1204 if (
type ==
nullptr)
1238 bfd *abfd = of->
obfd.get ();
1239 const asection *codes;
1241 codes = bfd_get_section_by_name (abfd,
".text");
1242 *tsize = codes ? bfd_section_size (codes) : 0;
1250 struct objfile *of, CORE_ADDR text_offset)
1254 ccp = &
pst->context;
1270 ccp = &
pst->context;
1285 ctf_next_t *i =
nullptr;
1287 while ((ename = ctf_enum_next (ccp->
fp, tid, &i, &val)) !=
nullptr)
1292 unrelocated_addr (0),
1295 if (ctf_errno (ccp->
fp) != ECTF_NEXT_END)
1296 complaint (_(
"ctf_enum_next ctf_psymtab_add_enums failed - %s"),
1297 ctf_errmsg (ctf_errno (ccp->
fp)));
1305 struct objfile *of,
int functions)
1307 ctf_next_t *i =
nullptr;
1311 while ((tid = ctf_symbol_next (cfp, &i, &tname, functions)) != CTF_ERR)
1313 uint32_t kind = ctf_type_kind (cfp, tid);
1328 if (kind == CTF_K_FUNCTION)
1330 else if (kind == CTF_K_CONST)
1336 tdomain, aclass, -1,
1338 unrelocated_addr (0),
1374 complaint (_(
"ctf_type_iter psymtab_to_symtab failed - %s"),
1375 ctf_errmsg (ctf_errno (ccp->
fp)));
1380 complaint (_(
"ctf_variable_iter psymtab_to_symtab failed - %s"),
1381 ctf_errmsg (ctf_errno (ccp->
fp)));
1397 warning (_(
"bug: psymtab for %s is already read in."),
filename);
1446 unrelocated_addr (0));
1449 pst->context.fp = cfp;
1453 pst->context.builder =
nullptr;
1471 kind = ctf_type_kind (ccp->
fp, tid);
1482 case CTF_K_FUNCTION:
1494 case CTF_K_VOLATILE:
1495 case CTF_K_RESTRICT:
1509 const char *
name = ctf_type_name_raw (ccp->
fp, tid);
1510 if (
name ==
nullptr || strlen (
name) == 0)
1514 domain, aclass, section,
1516 unrelocated_addr (0),
1532 unrelocated_addr (0),
1545 bool isparent =
false;
1547 if (strcmp (fname,
".ctf") == 0)
1549 fname = bfd_get_filename (of->
obfd.get ());
1554 partial_symtabs, of);
1557 if (isparent ==
false)
1561 complaint (_(
"ctf_type_iter scan_partial_symbols failed - %s"),
1562 ctf_errmsg (ctf_errno (cfp)));
1565 complaint (_(
"ctf_variable_iter scan_partial_symbols failed - %s"),
1566 ctf_errmsg (ctf_errno (cfp)));
1583 ctf_dict_t *parent = tup->
fp;
1585 if (strcmp (
name,
".ctf") != 0)
1586 ctf_import (ctf, parent);
1608 bfd *abfd =
of->
obfd.get ();
1611 ctf_archive_t *
arc = ctf_bfdopen (abfd, &
err);
1613 error (_(
"ctf_bfdopen failed on %s - %s"),
1614 bfd_get_filename (abfd), ctf_errmsg (
err));
1616 ctf_dict_t *
fp = ctf_dict_open (
arc, NULL, &
err);
1618 error (_(
"ctf_dict_open failed on %s - %s"),
1619 bfd_get_filename (abfd), ctf_errmsg (
err));
1631 error (_(
"ctf_archive_iter failed in input file %s: - %s"),
1632 bfd_get_filename (abfd), ctf_errmsg (
err));
#define bits(obj, st, fn)
void * xcalloc(size_t number, size_t size)
static struct buildsym_compunit * buildsym_compunit
void add_symbol_to_list(struct symbol *symbol, struct pending **listhead)
void set(unsigned key, void *datum)
#define complaint(FMT,...)
static int ctf_add_type_cb(ctf_id_t tid, void *arg)
static void ctf_psymtab_add_stt_func(ctf_dict_t *cfp, ctf_psymtab *pst, struct objfile *of)
static int ctf_psymtab_type_cb(ctf_id_t tid, void *arg)
static void scan_partial_symbols(ctf_dict_t *cfp, psymtab_storage *partial_symtabs, struct ctf_per_tu_data *tup, const char *fname)
static int ctf_add_enum_member_cb(const char *name, int enum_value, void *arg)
static int tid_and_type_eq(const void *item_lhs, const void *item_rhs)
static CORE_ADDR get_objfile_text_range(struct objfile *of, size_t *tsize)
static void add_stt_func(struct ctf_context *ccp)
static struct type * add_array_cv_type(struct ctf_context *ccp, ctf_id_t tid, struct type *base_type, int cnst, int voltl)
static int get_bitsize(ctf_dict_t *fp, ctf_id_t tid, uint32_t kind)
static struct type * get_tid_type(struct objfile *of, ctf_id_t tid)
static void ctf_psymtab_add_stt_obj(ctf_dict_t *cfp, ctf_psymtab *pst, struct objfile *of)
static struct type * read_structure_type(struct ctf_context *cp, ctf_id_t tid)
static struct type * read_forward_type(struct ctf_context *cp, ctf_id_t tid)
static hashval_t tid_and_type_hash(const void *item)
static struct type * set_tid_type(struct objfile *of, ctf_id_t tid, struct type *typ)
static void add_stt_entries(struct ctf_context *ccp, int functions)
static struct compunit_symtab * ctf_end_compunit_symtab(ctf_psymtab *pst, CORE_ADDR end_addr)
static struct symbol * new_symbol(struct ctf_context *cp, struct type *type, ctf_id_t tid)
static struct type * read_const_type(struct ctf_context *ccp, ctf_id_t tid, ctf_id_t btid)
static void add_stt_obj(struct ctf_context *ccp)
static void set_symbol_address(struct objfile *of, struct symbol *sym, const char *name)
static struct type * read_pointer_type(struct ctf_context *cp, ctf_id_t tid, ctf_id_t btid)
static const registry< objfile >::key< htab, htab_deleter > ctf_tid_key
static int ctf_add_var_cb(const char *name, ctf_id_t id, void *arg)
static int build_ctf_archive_member(ctf_dict_t *ctf, const char *name, void *arg)
static void process_structure_type(struct ctf_context *cp, ctf_id_t tid)
static struct type * fetch_tid_type(struct ctf_context *ccp, ctf_id_t tid)
static struct type * read_volatile_type(struct ctf_context *ccp, ctf_id_t tid, ctf_id_t btid)
static struct type * read_restrict_type(struct ctf_context *ccp, ctf_id_t tid, ctf_id_t btid)
static const registry< objfile >::key< ctf_fp_info > ctf_dict_key
static void ctf_psymtab_add_enums(struct ctf_context *ccp, ctf_id_t tid)
static struct type * read_array_type(struct ctf_context *cp, ctf_id_t tid)
static struct type * read_func_kind_type(struct ctf_context *ccp, ctf_id_t tid)
static struct type * read_typedef_type(struct ctf_context *cp, ctf_id_t tid, ctf_id_t btid, const char *name)
static int ctf_add_member_cb(const char *name, ctf_id_t tid, unsigned long offset, void *arg)
static struct type * ctf_init_float_type(struct objfile *objfile, int bits, const char *name, const char *name_hint)
static struct type * read_type_record(struct ctf_context *cp, ctf_id_t tid)
static ctf_psymtab * create_partial_symtab(const char *name, ctf_archive_t *arc, ctf_dict_t *cfp, psymtab_storage *partial_symtabs, struct objfile *objfile)
static struct type * read_enum_type(struct ctf_context *cp, ctf_id_t tid)
static void process_enum_type(struct ctf_context *ccp, ctf_id_t tid)
static void ctf_psymtab_add_stt_entries(ctf_dict_t *cfp, ctf_psymtab *pst, struct objfile *of, int functions)
static struct type * read_base_type(struct ctf_context *ccp, ctf_id_t tid)
static void process_struct_members(struct ctf_context *cp, ctf_id_t tid, struct type *type)
static void attach_fields_to_type(struct ctf_field_info *fip, struct type *type)
static void process_base_type(struct ctf_context *ccp, ctf_id_t tid)
static int ctf_psymtab_var_cb(const char *name, ctf_id_t id, void *arg)
void elfctf_build_psymtabs(struct objfile *of)
static void ctf_start_compunit_symtab(ctf_psymtab *pst, struct objfile *of, CORE_ADDR text_offset)
const struct floatformat ** gdbarch_floatformat_for_type(struct gdbarch *gdbarch, const char *name, int length)
int gdbarch_int_bit(struct gdbarch *gdbarch)
struct type * make_restrict_type(struct type *type)
struct type * lookup_pointer_type(struct type *type)
struct type * init_character_type(type_allocator &alloc, int bit, int unsigned_p, const char *name)
struct type * init_integer_type(type_allocator &alloc, int bit, int unsigned_p, const char *name)
struct type * create_static_range_type(type_allocator &alloc, struct type *index_type, LONGEST low_bound, LONGEST high_bound)
bool set_type_align(struct type *type, ULONGEST align)
struct type * make_cv_type(int cnst, int voltl, struct type *type, struct type **typeptr)
struct type * init_float_type(type_allocator &alloc, int bit, const char *name, const struct floatformat **floatformats, enum bfd_endian byte_order)
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
struct type * create_array_type(type_allocator &alloc, struct type *element_type, struct type *range_type)
struct type * init_complex_type(const char *name, struct type *target_type)
struct type * init_boolean_type(type_allocator &alloc, int bit, int unsigned_p, const char *name)
struct type * copy_type(const struct type *type)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t err
struct bound_minimal_symbol lookup_minimal_symbol(const char *name, const char *sfile, struct objfile *objf)
void set_objfile_main_name(struct objfile *objfile, const char *name, enum language lang)
struct type * objfile_int_type(struct objfile *of, int size_in_bytes, bool unsigned_p)
#define SECT_OFF_TEXT(objfile)
#define OBJSTAT(objfile, expr)
CORE_ADDR value_address() const
struct minimal_symbol * minsym
struct pending ** get_file_symbols()
void record_debugformat(const char *format)
struct pending ** get_global_symbols()
struct compunit_symtab * end_compunit_symtab(CORE_ADDR end_addr)
struct type * builtin_error
struct type * builtin_int
struct type * builtin_void
struct buildsym_compunit * builder
psymtab_storage * partial_symtabs
std::vector< struct decl_field > nested_types_list
std::vector< struct ctf_nextfield > fields
struct ctf_context * cur_context
std::vector< struct decl_field > typedef_field_list
ctf_fp_info(ctf_dict_t *cfp)
ctf_psymtab(const char *filename, psymtab_storage *partial_symtabs, objfile_per_bfd_storage *objfile_per_bfd, unrelocated_addr addr)
void read_symtab(struct objfile *) override
void expand_psymtab(struct objfile *) override
struct ctf_context context
void set_type(struct type *type)
void set_loc_bitpos(LONGEST bitpos)
void set_bitsize(unsigned int bitsize)
void set_name(const char *name)
void set_section_index(short idx)
void compute_and_set_names(gdb::string_view linkage_name, bool copy_name, struct objfile_per_bfd_storage *per_bfd, gdb::optional< hashval_t > hash=gdb::optional< hashval_t >())
void set_language(enum language language, struct obstack *obstack)
short section_index() const
const char * linkage_name() const
struct gdbarch * arch() const
struct objfile_per_bfd_storage * per_bfd
CORE_ADDR text_section_offset() const
auto_obstack objfile_obstack
std::forward_list< quick_symbol_functions_up > qf
void set_text_high(unrelocated_addr addr)
void set_text_low(unrelocated_addr addr)
void add_psymbol(gdb::string_view name, bool copy_name, domain_enum domain, enum address_class theclass, short section, psymbol_placement where, unrelocated_addr coreaddr, enum language language, psymtab_storage *partial_symtabs, struct objfile *objfile)
const std::shared_ptr< psymtab_storage > & get_partial_symtabs() const
struct type * type() const
void set_aclass_index(unsigned int aclass_index)
void set_type(struct type *type)
void set_value_address(CORE_ADDR address)
void set_domain(domain_enum domain)
struct type * target_type() const
void set_code(type_code code)
struct field & field(int idx) const
void set_has_no_signedness(bool has_no_signedness)
void set_target_type(struct type *target_type)
void set_is_stub(bool is_stub)
void set_has_varargs(bool has_varargs)
void set_num_fields(unsigned int num_fields)
void set_name(const char *name)
void alloc_fields(unsigned int nfields, bool init=true)
void set_length(ULONGEST length)
range_bounds * bounds() const
void set_target_is_stub(bool target_is_stub)
void gdb_printf(struct ui_file *stream, const char *format,...)
void gdb_flush(struct ui_file *stream)