[sysprof/wip/chergert/path-resolver] elf: add helpers for test utilities to verify decoding
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof/wip/chergert/path-resolver] elf: add helpers for test utilities to verify decoding
- Date: Tue, 21 Sep 2021 18:50:43 +0000 (UTC)
commit 4c6912e804f3911efd4a0765bc2731aaf122caa5
Author: Christian Hergert <chergert redhat com>
Date: Tue Sep 21 11:50:03 2021 -0700
elf: add helpers for test utilities to verify decoding
.../sysprof-elf-symbol-resolver-private.h | 33 +++++++++++++++++
src/libsysprof/sysprof-elf-symbol-resolver.c | 41 ++++++++++++++++++++++
2 files changed, 74 insertions(+)
---
diff --git a/src/libsysprof/sysprof-elf-symbol-resolver-private.h
b/src/libsysprof/sysprof-elf-symbol-resolver-private.h
new file mode 100644
index 0000000..77b65ff
--- /dev/null
+++ b/src/libsysprof/sysprof-elf-symbol-resolver-private.h
@@ -0,0 +1,33 @@
+/* sysprof-elf-symbol-resolver-private.h
+ *
+ * Copyright 2021 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include "sysprof-elf-symbol-resolver.h"
+
+G_BEGIN_DECLS
+
+char *_sysprof_elf_symbol_resolver_resolve_path (SysprofElfSymbolResolver *self,
+ GPid pid,
+ const char *path);
+const char *_sysprof_elf_symbol_resolver_get_pid_kind (SysprofElfSymbolResolver *self,
+ GPid pid);
+
+G_END_DECLS
diff --git a/src/libsysprof/sysprof-elf-symbol-resolver.c b/src/libsysprof/sysprof-elf-symbol-resolver.c
index ff05319..c500bbb 100644
--- a/src/libsysprof/sysprof-elf-symbol-resolver.c
+++ b/src/libsysprof/sysprof-elf-symbol-resolver.c
@@ -606,3 +606,44 @@ sysprof_elf_symbol_resolver_add_debug_dir (SysprofElfSymbolResolver *self,
/* Do Nothing */
/* XXX: Mark as deprecated post 41 or remove with Gtk4 port */
}
+
+char *
+_sysprof_elf_symbol_resolver_resolve_path (SysprofElfSymbolResolver *self,
+ GPid pid,
+ const char *path)
+{
+ ProcessInfo *pi;
+
+ g_return_val_if_fail (SYSPROF_IS_ELF_SYMBOL_RESOLVER (self), NULL);
+
+ if (!(pi = g_hash_table_lookup (self->processes, GINT_TO_POINTER (pid))))
+ return NULL;
+
+ if (pi->resolver == NULL)
+ return NULL;
+
+ return _sysprof_path_resolver_resolve (pi->resolver, path);
+}
+
+const char *
+_sysprof_elf_symbol_resolver_get_pid_kind (SysprofElfSymbolResolver *self,
+ GPid pid)
+{
+ ProcessInfo *pi;
+
+ g_return_val_if_fail (SYSPROF_IS_ELF_SYMBOL_RESOLVER (self), NULL);
+
+ if (!(pi = g_hash_table_lookup (self->processes, GINT_TO_POINTER (pid))))
+ return "unknown";
+
+ if (pi->kind == PROCESS_KIND_FLATPAK)
+ return "Flatpak";
+
+ if (pi->kind == PROCESS_KIND_PODMAN)
+ return "Podman";
+
+ if (pi->kind == PROCESS_KIND_STANDARD)
+ return "Standard";
+
+ return "unknown";
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]