forked from Imagelibrary/binutils-gdb
libctf: create, lookup: delete DVDs; ctf_lookup_by_kind
Variable handling in BTF and CTFv4 works quite differently from in CTFv3. Rather than a separate section containing sorted, bsearchable variables, they are simply named entities like types, stored in CTF_K_VARs. As a first stage towards migrating to this, delete most references to the ctf_varent_t and ctf_dvdef_t, including the DVD lookup code, all the linking code, and quite a lot of the serialization code. Note: CTF_LINK_OMIT_VARIABLES_SECTION, and the whole "delete variables that already exist in the symtypetabs section" stuff, has yet to be reimplemented. We can implement CTF_LINK_OMIT_VARIABLES_SECTION by simply excising all CTF_K_VARs at deduplication time if requested. (Note: symtypetabs should still point directly at the type, not at the CTF_K_VAR.) (Symtypetabs in general need a bit more thought -- perhaps we can now store them in a separate .ctf.symtypetab section with its own little four-entry header for the symtypetabs and their indexes, making .ctf even more like .BTF; the only difference would then be that .ctf could include prefix types, CTF_K_FLOAT, and external string refs. For later discussion.) We also add ctf_lookup_by_kind() at this stage (because it is hopelessly diff-entangled with ctf_lookup_variable): this looks up a type of a particular kind, without needing a per-kind lookup function for it, nor needing to hack around adding string prefixes (so you can do ctf_lookup_by_kind (fp, CTF_K_STRUCT, "foo") rather than having to do ctf_lookup_by_name (fp, "struct foo"): often this is more convenient, and anything that reduces string buffer manipulation in C is good.)
This commit is contained in:
@@ -2223,8 +2223,6 @@ ctf_bufopen (const ctf_sect_t *ctfsect, const ctf_sect_t *symsect,
|
||||
|
||||
fp->ctf_dthash = ctf_dynhash_create (ctf_hash_integer, ctf_hash_eq_integer,
|
||||
NULL, NULL);
|
||||
fp->ctf_dvhash = ctf_dynhash_create (ctf_hash_string, ctf_hash_eq_string,
|
||||
NULL, NULL);
|
||||
fp->ctf_snapshots = 1;
|
||||
|
||||
fp->ctf_objthash = ctf_dynhash_create (ctf_hash_string, ctf_hash_eq_string,
|
||||
@@ -2232,8 +2230,8 @@ ctf_bufopen (const ctf_sect_t *ctfsect, const ctf_sect_t *symsect,
|
||||
fp->ctf_funchash = ctf_dynhash_create (ctf_hash_string, ctf_hash_eq_string,
|
||||
free, NULL);
|
||||
|
||||
if (!fp->ctf_dthash || !fp->ctf_dvhash || !fp->ctf_snapshots ||
|
||||
!fp->ctf_objthash || !fp->ctf_funchash)
|
||||
if (!fp->ctf_dthash || !fp->ctf_snapshots || !fp->ctf_objthash
|
||||
|| !fp->ctf_funchash)
|
||||
{
|
||||
err = ENOMEM;
|
||||
goto bad;
|
||||
@@ -2334,7 +2332,6 @@ void
|
||||
ctf_dict_close (ctf_dict_t *fp)
|
||||
{
|
||||
ctf_dtdef_t *dtd, *ntd;
|
||||
ctf_dvdef_t *dvd, *nvd;
|
||||
ctf_in_flight_dynsym_t *did, *nid;
|
||||
ctf_err_warning_t *err, *nerr;
|
||||
|
||||
@@ -2375,13 +2372,6 @@ ctf_dict_close (ctf_dict_t *fp)
|
||||
ctf_dynhash_destroy (fp->ctf_datasecs);
|
||||
ctf_dynhash_destroy (fp->ctf_tags);
|
||||
ctf_dynhash_destroy (fp->ctf_names);
|
||||
|
||||
for (dvd = ctf_list_next (&fp->ctf_dvdefs); dvd != NULL; dvd = nvd)
|
||||
{
|
||||
nvd = ctf_list_next (dvd);
|
||||
ctf_dvd_delete (fp, dvd);
|
||||
}
|
||||
ctf_dynhash_destroy (fp->ctf_dvhash);
|
||||
ctf_dynhash_destroy (fp->ctf_var_datasecs);
|
||||
|
||||
ctf_dynhash_destroy (fp->ctf_symhash_func);
|
||||
|
||||
Reference in New Issue
Block a user