libsysprof-analyze: give access to SysprofElf filename

This commit is contained in:
Christian Hergert
2023-05-18 13:10:51 -07:00
parent 487e88c8f0
commit da58a52bf3
2 changed files with 21 additions and 0 deletions

View File

@ -30,6 +30,7 @@ G_DECLARE_FINAL_TYPE (SysprofElf, sysprof_elf, SYSPROF, ELF, GObject)
SysprofElf *sysprof_elf_new (const char *filename, SysprofElf *sysprof_elf_new (const char *filename,
GError **error); GError **error);
const char *sysprof_elf_get_file (SysprofElf *self);
const char *sysprof_elf_get_build_id (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_debug_link (SysprofElf *self);
const char *sysprof_elf_get_symbol_at_address (SysprofElf *self, const char *sysprof_elf_get_symbol_at_address (SysprofElf *self,

View File

@ -27,6 +27,7 @@ struct _SysprofElf
GObject parent_instance; GObject parent_instance;
char *build_id; char *build_id;
char *debug_link; char *debug_link;
char *file;
SysprofElf *debug_link_elf; SysprofElf *debug_link_elf;
}; };
@ -35,6 +36,7 @@ enum {
PROP_BUILD_ID, PROP_BUILD_ID,
PROP_DEBUG_LINK, PROP_DEBUG_LINK,
PROP_DEBUG_LINK_ELF, PROP_DEBUG_LINK_ELF,
PROP_FILE,
N_PROPS N_PROPS
}; };
@ -49,6 +51,7 @@ sysprof_elf_finalize (GObject *object)
g_clear_pointer (&self->build_id, g_free); g_clear_pointer (&self->build_id, g_free);
g_clear_pointer (&self->debug_link, 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_clear_object (&self->debug_link_elf);
G_OBJECT_CLASS (sysprof_elf_parent_class)->finalize (object); 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)); g_value_set_object (value, sysprof_elf_get_debug_link_elf (self));
break; break;
case PROP_FILE:
g_value_set_string (value, sysprof_elf_get_file (self));
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
} }
@ -124,6 +131,11 @@ sysprof_elf_class_init (SysprofElfClass *klass)
SYSPROF_TYPE_ELF, SYSPROF_TYPE_ELF,
(G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS)); (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); g_object_class_install_properties (object_class, N_PROPS, properties);
} }
@ -141,6 +153,14 @@ sysprof_elf_new (const char *filename,
return NULL; 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 * const char *
sysprof_elf_get_build_id (SysprofElf *self) sysprof_elf_get_build_id (SysprofElf *self)
{ {