[sysprof] libsysprof: improve decoding a bit from flatpak
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof] libsysprof: improve decoding a bit from flatpak
- Date: Fri, 2 Aug 2019 20:23:06 +0000 (UTC)
commit 0c3f2df42b256587b76cf1149eaa56d88bb6aeed
Author: Christian Hergert <chergert redhat com>
Date: Fri Aug 2 13:22:03 2019 -0700
libsysprof: improve decoding a bit from flatpak
src/libsysprof/binfile.c | 6 +++++-
src/libsysprof/sysprof-elf-symbol-resolver.c | 26 +++++++++++++++++++++++++-
2 files changed, 30 insertions(+), 2 deletions(-)
---
diff --git a/src/libsysprof/binfile.c b/src/libsysprof/binfile.c
index 81f3e49..0f90f9d 100644
--- a/src/libsysprof/binfile.c
+++ b/src/libsysprof/binfile.c
@@ -356,14 +356,18 @@ get_vdso_bytes (size_t *length)
bin_file_t *
bin_file_new (const char *filename)
{
+ const gchar *real_filename = filename;
ElfParser *elf = NULL;
bin_file_t *bf;
+ if (g_str_has_prefix (filename, "/var/run/host"))
+ real_filename = filename + strlen ("/var/run/host");
+
bf = g_new0 (bin_file_t, 1);
bf->inode_check = FALSE;
bf->filename = g_strdup (filename);
- bf->undefined_name = g_strdup_printf ("In file %s", filename);
+ bf->undefined_name = g_strdup_printf ("In file %s", real_filename);
bf->ref_count = 1;
bf->elf_files = NULL;
diff --git a/src/libsysprof/sysprof-elf-symbol-resolver.c b/src/libsysprof/sysprof-elf-symbol-resolver.c
index de1a4b7..d7dbff0 100644
--- a/src/libsysprof/sysprof-elf-symbol-resolver.c
+++ b/src/libsysprof/sysprof-elf-symbol-resolver.c
@@ -126,6 +126,21 @@ sysprof_elf_symbol_resolver_load (SysprofSymbolResolver *resolver,
}
}
+static gboolean
+is_flatpak (void)
+{
+ static gsize did_init = FALSE;
+ static gboolean ret;
+
+ if (g_once_init_enter (&did_init))
+ {
+ ret = g_file_test ("/.flatpak-info", G_FILE_TEST_EXISTS);
+ g_once_init_leave (&did_init, TRUE);
+ }
+
+ return ret;
+}
+
static bin_file_t *
sysprof_elf_symbol_resolver_get_bin_file (SysprofElfSymbolResolver *self,
const gchar *filename)
@@ -151,7 +166,16 @@ sysprof_elf_symbol_resolver_get_bin_file (SysprofElfSymbolResolver *self,
if (g_str_has_prefix (filename, "/newroot/"))
alternate += strlen ("/newroot");
- bin_file = bin_file_new (alternate);
+ if (is_flatpak () && g_str_has_prefix (filename, "/usr/"))
+ {
+ g_autofree gchar *path = g_build_filename ("/var/run/host", alternate, NULL);
+ bin_file = bin_file_new (path);
+ }
+ else
+ {
+ bin_file = bin_file_new (alternate);
+ }
+
g_hash_table_insert (self->bin_files, g_strdup (filename), bin_file);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]