105 ctf_archive_t *arc = ctf_get_arc (
fp);
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 ();
354 for (
int i = 0; i < nfields; ++i)
369 const char *name_hint)
372 const struct floatformat **format;
376 if (format !=
nullptr)
391 unsigned long offset,
401 fp = &new_field.
field;
404 kind = ctf_type_kind (ccp->
fp, tid);
411 complaint (_(
"ctf_add_member_cb: %s has NO type (%ld)"),
name, tid);
417 if (kind == CTF_K_STRUCT || kind == CTF_K_UNION)
424 fip->
fields.emplace_back (new_field);
442 fp->set_type (
nullptr);
443 fp->set_loc_enumval (enum_value);
459 fip->
fields.emplace_back (new_field);
471 ctf_dict_t *fp = ccp->
fp;
472 struct symbol *sym =
nullptr;
474 const char *
name = ctf_type_name_raw (fp, tid);
488 uint32_t kind = ctf_type_kind (fp, tid);
502 if (sym->
type ()->
code () == TYPE_CODE_VOID)
535 ctf_dict_t *fp = ccp->
fp;
541 if (ctf_type_encoding (fp, tid, &cet))
543 complaint (_(
"ctf_type_encoding read_base_type failed - %s"),
544 ctf_errmsg (ctf_errno (fp)));
548 name = ctf_type_name_raw (fp, tid);
549 if (
name ==
nullptr || strlen (
name) == 0)
551 name = ctf_type_aname (fp, tid);
553 complaint (_(
"ctf_type_aname read_base_type failed - %s"),
554 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)
720 for (
int iparam = 0; iparam < argc; iparam++)
723 if (atype !=
nullptr)
740 ctf_dict_t *fp = ccp->
fp;
745 const char *
name = ctf_type_name_raw (fp, tid);
746 if (
name !=
nullptr && strlen (
name) != 0)
769 complaint (_(
"ctf_enum_iter process_enum_type failed - %s"),
770 ctf_errmsg (ctf_errno (ccp->
fp)));
783 struct type *base_type,
787 struct type *el_type, *inner_array;
790 inner_array = base_type;
812 ctf_dict_t *fp = ccp->
fp;
813 struct type *element_type, *range_type, *idx_type;
817 if (ctf_array_info (fp, tid, &ar) == CTF_ERR)
819 complaint (_(
"ctf_array_info read_array_type failed - %s"),
820 ctf_errmsg (ctf_errno (fp)));
825 if (element_type ==
nullptr)
829 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)
958 complaint (_(
"read_pointer_type: NULL target type (%ld)"), btid);
975 ctf_dict_t *fp = ccp->
fp;
981 const char *
name = ctf_type_name_raw (fp, tid);
982 if (
name !=
nullptr && strlen (
name) != 0)
985 kind = ctf_type_kind_forwarded (fp, tid);
986 if (kind == CTF_K_UNION)
1002 ctf_dict_t *fp = ccp->
fp;
1007 kind = ctf_type_kind (fp, tid);
1017 case CTF_K_FUNCTION:
1021 btid = ctf_type_reference (fp, tid);
1026 const char *
name = ctf_type_name_raw (fp, tid);
1027 btid = ctf_type_reference (fp, tid);
1031 case CTF_K_VOLATILE:
1032 btid = ctf_type_reference (fp, tid);
1035 case CTF_K_RESTRICT:
1036 btid = ctf_type_reference (fp, tid);
1040 btid = ctf_type_reference (fp, tid);
1073 if (
type !=
nullptr)
1076 ctf_id_t btid = ctf_type_reference (ccp->
fp, tid);
1077 kind = ctf_type_kind (ccp->
fp, tid);
1087 case CTF_K_FUNCTION:
1102 case CTF_K_VOLATILE:
1106 case CTF_K_RESTRICT:
1133 struct symbol *sym =
nullptr;
1139 kind = ctf_type_kind (ccp->
fp,
id);
1142 case CTF_K_FUNCTION:
1143 if (
name !=
nullptr && strcmp (
name,
"main") == 0)
1148 case CTF_K_VOLATILE:
1149 case CTF_K_RESTRICT:
1154 if (
type !=
nullptr)
1164 if (
type ==
nullptr)
1166 complaint (_(
"ctf_add_var_cb: %s has NO type (%ld)"),
name,
id);
1178 complaint (_(
"ctf_add_var_cb: kind unsupported (%d)"), kind);
1194 ctf_next_t *i =
nullptr;
1197 struct symbol *sym =
nullptr;
1200 while ((tid = ctf_symbol_next (ccp->
fp, &i, &tname, functions)) != CTF_ERR)
1203 if (
type ==
nullptr)
1237 bfd *abfd = of->
obfd.get ();
1238 const asection *codes;
1240 codes = bfd_get_section_by_name (abfd,
".text");
1241 *tsize = codes ? bfd_section_size (codes) : 0;
1249 struct objfile *of, CORE_ADDR text_offset)
1253 ccp = &
pst->context;
1266 CORE_ADDR end_addr,
int section)
1270 ccp = &
pst->context;
1285 ctf_next_t *i =
nullptr;
1287 while ((ename = ctf_enum_next (ccp->
fp, tid, &i, &val)) !=
nullptr)
1294 if (ctf_errno (ccp->
fp) != ECTF_NEXT_END)
1295 complaint (_(
"ctf_enum_next ctf_psymtab_add_enums failed - %s"),
1296 ctf_errmsg (ctf_errno (ccp->
fp)));
1304 struct objfile *of,
int functions)
1306 ctf_next_t *i =
nullptr;
1310 while ((tid = ctf_symbol_next (cfp, &i, &tname, functions)) != CTF_ERR)
1312 uint32_t kind = ctf_type_kind (cfp, tid);
1327 if (kind == CTF_K_FUNCTION)
1329 else if (kind == CTF_K_CONST)
1335 tdomain, aclass, -1,
1372 complaint (_(
"ctf_type_iter psymtab_to_symtab failed - %s"),
1373 ctf_errmsg (ctf_errno (ccp->
fp)));
1378 complaint (_(
"ctf_variable_iter psymtab_to_symtab failed - %s"),
1379 ctf_errmsg (ctf_errno (ccp->
fp)));
1395 warning (_(
"bug: psymtab for %s is already read in."),
filename);
1447 pst->context.fp = cfp;
1451 pst->context.builder =
nullptr;
1469 kind = ctf_type_kind (ccp->
fp, tid);
1480 case CTF_K_FUNCTION:
1492 case CTF_K_VOLATILE:
1493 case CTF_K_RESTRICT:
1507 const char *
name = ctf_type_name_raw (ccp->
fp, tid);
1508 if (
name ==
nullptr || strlen (
name) == 0)
1512 domain, aclass, section,
1541 bool isparent =
false;
1543 if (strcmp (fname,
".ctf") == 0)
1545 fname = bfd_get_filename (of->
obfd.get ());
1550 partial_symtabs, of);
1553 if (isparent ==
false)
1557 complaint (_(
"ctf_type_iter scan_partial_symbols failed - %s"),
1558 ctf_errmsg (ctf_errno (cfp)));
1561 complaint (_(
"ctf_variable_iter scan_partial_symbols failed - %s"),
1562 ctf_errmsg (ctf_errno (cfp)));
1579 ctf_dict_t *parent = tup->
fp;
1581 if (strcmp (
name,
".ctf") != 0)
1582 ctf_import (ctf, parent);
1604 bfd *abfd =
of->
obfd.get ();
1607 ctf_archive_t *
arc = ctf_bfdopen (abfd, &
err);
1609 error (_(
"ctf_bfdopen failed on %s - %s"),
1610 bfd_get_filename (abfd), ctf_errmsg (
err));
1612 ctf_dict_t *
fp = ctf_dict_open (
arc, NULL, &
err);
1614 error (_(
"ctf_dict_open failed on %s - %s"),
1615 bfd_get_filename (abfd), ctf_errmsg (
err));
1627 error (_(
"ctf_archive_iter failed in input file %s: - %s"),
1628 bfd_get_filename (abfd), ctf_errmsg (
err));
#define bits(obj, st, fn)
void * xcalloc(size_t number, size_t size)
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 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, int section)
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 CORE_ADDR get_objfile_text_range(struct objfile *of, int *tsize)
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)
bool set_type_align(struct type *type, ULONGEST align)
struct type * init_type(struct objfile *objfile, enum type_code code, int bit, const char *name)
struct type * make_cv_type(int cnst, int voltl, struct type *type, struct type **typeptr)
struct type * create_array_type(struct type *result_type, struct type *element_type, struct type *range_type)
struct type * alloc_type(struct objfile *objfile)
struct type * init_complex_type(const char *name, struct type *target_type)
struct type * init_float_type(struct objfile *objfile, int bit, const char *name, const struct floatformat **floatformats, enum bfd_endian byte_order)
struct type * create_static_range_type(struct type *result_type, struct type *index_type, LONGEST low_bound, LONGEST high_bound)
struct type * init_character_type(struct objfile *objfile, int bit, int unsigned_p, const char *name)
struct type * init_boolean_type(struct objfile *objfile, int bit, int unsigned_p, const char *name)
struct type * init_integer_type(struct objfile *objfile, int bit, int unsigned_p, const char *name)
struct type * copy_type(const struct type *type)
#define TYPE_ZALLOC(t, size)
#define FIELD_BITSIZE(thisfld)
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 compunit_symtab * end_compunit_symtab(CORE_ADDR end_addr, int section)
struct pending ** get_file_symbols()
void record_debugformat(const char *format)
struct pending ** get_global_symbols()
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, CORE_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_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 type * builtin_error
struct type * builtin_int
struct type * builtin_void
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_low(CORE_ADDR addr)
void add_psymbol(gdb::string_view name, bool copy_name, domain_enum domain, enum address_class theclass, short section, psymbol_placement where, CORE_ADDR coreaddr, enum language language, psymtab_storage *partial_symtabs, struct objfile *objfile)
void set_text_high(CORE_ADDR addr)
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(int num_fields)
void set_name(const char *name)
void set_length(ULONGEST length)
range_bounds * bounds() const
void set_fields(struct field *fields)
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)