libctf: do not deduplicate strings in the header

It is unreasonable to expect users to ctf_import the parent before being
able to understand the header -- doubly so because the only string in the
header which is likely to be deduplicable is the parent name, which is the
same in every child, yet without the parent name being *available* in the
child's strtab you cannot call ctf_parent_name to figure out which parent
to import!

libctf/
	* ctf-serialize.c (ctf_preserialize): Prevent deduplication of header string
        fields.
	* ctf-open.c (ctf_set_base): Note this.
	* ctf-string.c (ctf_str_free_atom): Likewise.
This commit is contained in:
Nick Alcock
2024-07-15 22:08:10 +01:00
parent 3bec4f1f3c
commit ba66e0cc32
3 changed files with 11 additions and 4 deletions

View File

@@ -364,7 +364,12 @@ ctf_set_base (ctf_dict_t *fp, const ctf_header_t *hp, unsigned char *base)
/* Note: before conversion, these will be set to values that will be
immediately invalidated by the conversion process, but the conversion
process will call ctf_set_base() again to fix things up. */
process will call ctf_set_base() again to fix things up.
These labels are explicitly constrained from being deduplicated (even though
.ctf is usually a duplicated name), because they are the key to identifying
the parent dict (and determining that this dict is a child) in the first
place. */
if (hp->cth_parlabel != 0)
fp->ctf_parlabel = ctf_strptr (fp, hp->cth_parlabel);