libsysprof-analyze: include binary path basename in hash

This helps improve the chances that we get a match on "libfoo.so" and the
symbol name within it.
This commit is contained in:
Christian Hergert
2023-06-12 17:21:28 -07:00
parent 535c7be1e4
commit a3df31c246

View File

@ -146,6 +146,21 @@ _sysprof_symbol_new (GRefString *name,
self->end_address = end_address;
self->hash = g_str_hash (name);
/* If we got a path for the symbol, add that to the hash so that we
* can be sure that we're working with a symbol in the same file when
* there are collisions.
*
* That way, we have a chance of joining symbols from different runtimes
* and/or containers, but only if they are reasonably the same ABI.
*/
if (binary_path != NULL)
{
const char *base = strrchr (binary_path, '/');
if (base != NULL)
self->hash ^= g_str_hash (base);
}
return self;
}