mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
binfile: Use correct prefix for debug files
This commit is contained in:
@ -157,6 +157,8 @@ get_debuglink_file (ElfParser *elf,
|
|||||||
ElfParser *result = NULL;
|
ElfParser *result = NULL;
|
||||||
const char *build_id;
|
const char *build_id;
|
||||||
char *dir;
|
char *dir;
|
||||||
|
const char *files;
|
||||||
|
const char *prefix = "";
|
||||||
|
|
||||||
if (!elf)
|
if (!elf)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -174,13 +176,29 @@ get_debuglink_file (ElfParser *elf,
|
|||||||
|
|
||||||
dir = g_path_get_dirname (filename);
|
dir = g_path_get_dirname (filename);
|
||||||
|
|
||||||
|
/* Flatpak paths have the form of ".../files/bin" or ".../files/lib/x86_64-linux-gnu". */
|
||||||
|
files = g_strrstr (dir, "/files/");
|
||||||
|
if (files)
|
||||||
|
prefix = files + sizeof ("/files/") - 1;
|
||||||
|
|
||||||
for (guint i = 0; debug_dirs[i]; i++)
|
for (guint i = 0; debug_dirs[i]; i++)
|
||||||
{
|
{
|
||||||
char *name = g_build_filename (debug_dirs[i], basename, NULL);
|
/* Most files from Flatpak will be from .Platform, which usually has a prefix like "lib/x86_64-linux-gnu"
|
||||||
|
* but in the debug dir the files are under "usr/lib/x86_64-linux-gnu", so try with "usr" first. */
|
||||||
|
g_autofree char *name = g_build_filename (debug_dirs[i], "usr", prefix, basename, NULL);
|
||||||
ElfParser *parser = elf_parser_new (name, NULL);
|
ElfParser *parser = elf_parser_new (name, NULL);
|
||||||
guint32 file_crc;
|
guint32 file_crc;
|
||||||
const char *file_build_id;
|
const char *file_build_id;
|
||||||
|
|
||||||
|
if (!parser)
|
||||||
|
{
|
||||||
|
/* Files from Flatpak com.example.App.Debug have prefixes like "bin" or "lib",
|
||||||
|
* and they don't need the "usr" for the debug dir, so try without "usr". */
|
||||||
|
g_free (name);
|
||||||
|
name = g_build_filename (debug_dirs[i], prefix, basename, NULL);
|
||||||
|
parser = elf_parser_new (name, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
if (parser)
|
if (parser)
|
||||||
{
|
{
|
||||||
/* If both files have build ids, and they don't match,
|
/* If both files have build ids, and they don't match,
|
||||||
@ -211,8 +229,6 @@ get_debuglink_file (ElfParser *elf,
|
|||||||
skip:
|
skip:
|
||||||
elf_parser_free (parser);
|
elf_parser_free (parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (dir);
|
g_free (dir);
|
||||||
|
|||||||
Reference in New Issue
Block a user