libctf: generalize the ref system

Despite the removal of the separate movable ref list, the ref system as
a whole is more than complex enough to be worth generalizing now that
we are adding different kinds of ref.

Refs now are lists of uint32_t * which can be updated through the
pointer for all entries in the list and moved to new sites for all
pointers in a given range: they are no longer references to string
offsets in particular and can be references to other uint32_t-sized
things instead (note that ctf_id_t is a typedef to a uint32_t).

ctf-string.c has been adjusted accordingly (the adjustments are tiny,
more or less just turning a bunch of references to atom into
&atom->csa_refs).
This commit is contained in:
Nick Alcock
2025-01-13 15:04:17 +00:00
parent 69d4f6d74c
commit 9835747b21
5 changed files with 158 additions and 130 deletions

View File

@@ -1798,7 +1798,7 @@ ctf_bufopen (const ctf_sect_t *ctfsect, const ctf_sect_t *symsect,
fp->ctf_str[CTF_STRTAB_0].cts_strs = (const char *) fp->ctf_buf
+ hp->cth_stroff;
fp->ctf_str[CTF_STRTAB_0].cts_len = hp->cth_strlen;
if (ctf_str_create_atoms (fp) < 0)
if (ctf_init_refs (fp) < 0 || ctf_str_create_atoms (fp) < 0)
{
err = ENOMEM;
goto bad;
@@ -2032,6 +2032,7 @@ ctf_dict_close (ctf_dict_t *fp)
ctf_dynhash_destroy (fp->ctf_link_out_cu_mapping);
ctf_str_free_atoms (fp);
ctf_free_refs (fp);
free (fp->ctf_tmp_typeslice);
if (fp->ctf_data.cts_name != _CTF_NULLSTR)