From da58a52bf3e5f758ccc29025611d44055ced86ef Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Thu, 18 May 2023 13:10:51 -0700 Subject: [PATCH] libsysprof-analyze: give access to SysprofElf filename --- src/libsysprof-analyze/sysprof-elf-private.h | 1 + src/libsysprof-analyze/sysprof-elf.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/libsysprof-analyze/sysprof-elf-private.h b/src/libsysprof-analyze/sysprof-elf-private.h index eb99edb4..095f039f 100644 --- a/src/libsysprof-analyze/sysprof-elf-private.h +++ b/src/libsysprof-analyze/sysprof-elf-private.h @@ -30,6 +30,7 @@ G_DECLARE_FINAL_TYPE (SysprofElf, sysprof_elf, SYSPROF, ELF, GObject) SysprofElf *sysprof_elf_new (const char *filename, GError **error); +const char *sysprof_elf_get_file (SysprofElf *self); const char *sysprof_elf_get_build_id (SysprofElf *self); const char *sysprof_elf_get_debug_link (SysprofElf *self); const char *sysprof_elf_get_symbol_at_address (SysprofElf *self, diff --git a/src/libsysprof-analyze/sysprof-elf.c b/src/libsysprof-analyze/sysprof-elf.c index c3662479..8b988cda 100644 --- a/src/libsysprof-analyze/sysprof-elf.c +++ b/src/libsysprof-analyze/sysprof-elf.c @@ -27,6 +27,7 @@ struct _SysprofElf GObject parent_instance; char *build_id; char *debug_link; + char *file; SysprofElf *debug_link_elf; }; @@ -35,6 +36,7 @@ enum { PROP_BUILD_ID, PROP_DEBUG_LINK, PROP_DEBUG_LINK_ELF, + PROP_FILE, N_PROPS }; @@ -49,6 +51,7 @@ sysprof_elf_finalize (GObject *object) g_clear_pointer (&self->build_id, g_free); g_clear_pointer (&self->debug_link, g_free); + g_clear_pointer (&self->file, g_free); g_clear_object (&self->debug_link_elf); G_OBJECT_CLASS (sysprof_elf_parent_class)->finalize (object); @@ -76,6 +79,10 @@ sysprof_elf_get_property (GObject *object, g_value_set_object (value, sysprof_elf_get_debug_link_elf (self)); break; + case PROP_FILE: + g_value_set_string (value, sysprof_elf_get_file (self)); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } @@ -124,6 +131,11 @@ sysprof_elf_class_init (SysprofElfClass *klass) SYSPROF_TYPE_ELF, (G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS)); + properties [PROP_FILE] = + g_param_spec_string ("file", NULL, NULL, + NULL, + (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_properties (object_class, N_PROPS, properties); } @@ -141,6 +153,14 @@ sysprof_elf_new (const char *filename, return NULL; } +const char * +sysprof_elf_get_file (SysprofElf *self) +{ + g_return_val_if_fail (SYSPROF_IS_ELF (self), NULL); + + return self->file; +} + const char * sysprof_elf_get_build_id (SysprofElf *self) {