mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-10 23:20:54 +00:00
elf: use discovered root when decoding symbols
This commit is contained in:
@ -190,6 +190,7 @@ sysprof_elf_symbol_resolver_load (SysprofSymbolResolver *resolver,
|
|||||||
|
|
||||||
static bin_file_t *
|
static bin_file_t *
|
||||||
sysprof_elf_symbol_resolver_get_bin_file (SysprofElfSymbolResolver *self,
|
sysprof_elf_symbol_resolver_get_bin_file (SysprofElfSymbolResolver *self,
|
||||||
|
const gchar *root,
|
||||||
const gchar *filename)
|
const gchar *filename)
|
||||||
{
|
{
|
||||||
bin_file_t *bin_file;
|
bin_file_t *bin_file;
|
||||||
@ -200,31 +201,18 @@ sysprof_elf_symbol_resolver_get_bin_file (SysprofElfSymbolResolver *self,
|
|||||||
|
|
||||||
if (bin_file == NULL)
|
if (bin_file == NULL)
|
||||||
{
|
{
|
||||||
|
g_autofree gchar *path = NULL;
|
||||||
const gchar *alternate = filename;
|
const gchar *alternate = filename;
|
||||||
const gchar * const *dirs;
|
const gchar * const *dirs;
|
||||||
|
|
||||||
dirs = (const gchar * const *)(gpointer)self->debug_dirs->data;
|
dirs = (const gchar * const *)(gpointer)self->debug_dirs->data;
|
||||||
|
|
||||||
/*
|
if (root && filename[0] != '/' && filename[0] != '[')
|
||||||
* If we are in a new mount namespace, then rely on the sysprof_symbol_dirs
|
alternate = path = g_build_filename (root, filename, NULL);
|
||||||
* to find us a locate to resolve the file where the CRC will match.
|
else if (is_flatpak () && g_str_has_prefix (filename, "/usr/"))
|
||||||
*
|
alternate = path = g_build_filename ("/var/run/host", alternate, NULL);
|
||||||
* TODO: We need to translate the path here so that we can locate the
|
|
||||||
* binary behind it (which then has links to the debug file in
|
|
||||||
* the section header).
|
|
||||||
*/
|
|
||||||
if (g_str_has_prefix (filename, "/newroot/"))
|
|
||||||
alternate += strlen ("/newroot");
|
|
||||||
|
|
||||||
if (is_flatpak () && g_str_has_prefix (filename, "/usr/"))
|
bin_file = bin_file_new (alternate, dirs);
|
||||||
{
|
|
||||||
g_autofree gchar *path = g_build_filename ("/var/run/host", alternate, NULL);
|
|
||||||
bin_file = bin_file_new (path, dirs);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bin_file = bin_file_new (alternate, dirs);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_hash_table_insert (self->bin_files, g_strdup (filename), bin_file);
|
g_hash_table_insert (self->bin_files, g_strdup (filename), bin_file);
|
||||||
}
|
}
|
||||||
@ -379,7 +367,7 @@ sysprof_elf_symbol_resolver_resolve_full (SysprofElfSymbolResolver *self,
|
|||||||
address -= map->start;
|
address -= map->start;
|
||||||
address += map->offset;
|
address += map->offset;
|
||||||
|
|
||||||
bin_file = sysprof_elf_symbol_resolver_get_bin_file (self, map->filename);
|
bin_file = sysprof_elf_symbol_resolver_get_bin_file (self, lookaside->root, map->filename);
|
||||||
|
|
||||||
g_assert (bin_file != NULL);
|
g_assert (bin_file != NULL);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user