]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
libctf: strings: don't check for non-deduplicable atoms in the parent
authorNick Alcock <nick.alcock@oracle.com>
Fri, 25 Apr 2025 17:17:33 +0000 (18:17 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Fri, 25 Apr 2025 17:17:33 +0000 (18:17 +0100)
Callers of ctf_str_add_no_dedup_ref are indicating that they would like the
string they have added a reference to to appear in the current dict and not
be deduplicated into the parent.  This is true even if the string already
exists in the parent, so we should not check for strings in the parent and
reuse them in this case.

libctf/ctf-string.c

index 56257d91f9a1dbcea438057d96563766be003c52..a4c24ccc2f9bbc8696d25ecd28775abce69ee533 100644 (file)
@@ -313,11 +313,12 @@ ctf_str_add_ref_internal (ctf_dict_t *fp, const char *str,
   int added = 0;
   ctf_dict_t *lookup_fp = fp;
 
-  /* Check for existing atoms in the parent as well.  */
+  /* Check for existing atoms in the parent as well, unless they are marked
+     non-deduplicable.  */
 
   atom = ctf_dynhash_lookup (fp->ctf_str_atoms, str);
 
-  if (!atom && fp->ctf_parent)
+  if (!atom && fp->ctf_parent && !(flags & CTF_STR_NO_DEDUP))
     {
       lookup_fp = fp->ctf_parent;
       atom = ctf_dynhash_lookup (lookup_fp->ctf_str_atoms, str);