+/* Add all members of an enum with type TID to partial symbol table. */
+
+static void
+ctf_psymtab_add_enums (struct ctf_context *ccp, ctf_id_t tid)
+{
+ int val;
+ const char *ename;
+ ctf_next_t *i = nullptr;
+
+ while ((ename = ctf_enum_next (ccp->fp, tid, &i, &val)) != nullptr)
+ {
+ ccp->pst->add_psymbol (ename, true,
+ VAR_DOMAIN, LOC_CONST, -1,
+ psymbol_placement::GLOBAL,
+ unrelocated_addr (0),
+ language_c, ccp->partial_symtabs, ccp->of);
+ }
+ if (ctf_errno (ccp->fp) != ECTF_NEXT_END)
+ complaint (_("ctf_enum_next ctf_psymtab_add_enums failed - %s"),
+ ctf_errmsg (ctf_errno (ccp->fp)));
+}
+
+/* Add entries in either data objects or function info section, controlled
+ by FUNCTIONS, to psymtab. */
+
+static void
+ctf_psymtab_add_stt_entries (ctf_dict_t *cfp, ctf_psymtab *pst,
+ struct objfile *of, int functions)
+{
+ ctf_next_t *i = nullptr;
+ ctf_id_t tid;
+ const char *tname;
+
+ while ((tid = ctf_symbol_next (cfp, &i, &tname, functions)) != CTF_ERR)
+ {
+ uint32_t kind = ctf_type_kind (cfp, tid);
+ address_class aclass;
+ domain_enum tdomain;
+ switch (kind)
+ {
+ case CTF_K_STRUCT:
+ case CTF_K_UNION:
+ case CTF_K_ENUM:
+ tdomain = STRUCT_DOMAIN;
+ break;
+ default:
+ tdomain = VAR_DOMAIN;
+ break;
+ }
+
+ if (kind == CTF_K_FUNCTION)
+ aclass = LOC_STATIC;
+ else if (kind == CTF_K_CONST)
+ aclass = LOC_CONST;
+ else
+ aclass = LOC_TYPEDEF;
+
+ pst->add_psymbol (tname, true,
+ tdomain, aclass, -1,
+ psymbol_placement::GLOBAL,
+ unrelocated_addr (0),
+ language_c, pst->context.partial_symtabs, of);
+ }
+}
+
+/* Add entries in data objects section to psymtab. */