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 00000000..77b65ff9 --- /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 + * + * 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 . + * + * 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 ff053198..c500bbb4 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"; +}