[sysprof] libsysprof: allow disabling the kernel symbol resolver
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof] libsysprof: allow disabling the kernel symbol resolver
- Date: Wed, 26 Feb 2020 18:24:57 +0000 (UTC)
commit f01298ead5b17292b5ad0921629fa6e5dce347c6
Author: Christian Hergert <chergert redhat com>
Date: Wed Feb 26 10:24:40 2020 -0800
libsysprof: allow disabling the kernel symbol resolver
The kernel symbol resolver requires access to sysprofd, which might not
be available in some contexts (such as when no polkit agent is available).
This allows that to continue working by disabling the kernel with the
user-only setting.
src/libsysprof/sysprof-symbols-source.c | 31 +++++++++++++++++++++++++++----
src/libsysprof/sysprof-symbols-source.h | 7 ++++++-
2 files changed, 33 insertions(+), 5 deletions(-)
---
diff --git a/src/libsysprof/sysprof-symbols-source.c b/src/libsysprof/sysprof-symbols-source.c
index ed6d06f..b4d7d49 100644
--- a/src/libsysprof/sysprof-symbols-source.c
+++ b/src/libsysprof/sysprof-symbols-source.c
@@ -33,6 +33,7 @@ struct _SysprofSymbolsSource
{
GObject parent_instance;
SysprofCaptureWriter *writer;
+ guint user_only : 1;
};
static void source_iface_init (SysprofSourceInterface *iface);
@@ -93,12 +94,17 @@ sysprof_symbols_source_supplement (SysprofSource *source,
if (-1 == (fd = sysprof_memfd_create ("[sysprof-decode]")))
return;
- kernel = sysprof_kernel_symbol_resolver_new ();
- native = sysprof_elf_symbol_resolver_new ();
-
map = sysprof_symbol_map_new ();
- sysprof_symbol_map_add_resolver (map, kernel);
+
+ native = sysprof_elf_symbol_resolver_new ();
sysprof_symbol_map_add_resolver (map, native);
+
+ if (!self->user_only)
+ {
+ kernel = sysprof_kernel_symbol_resolver_new ();
+ sysprof_symbol_map_add_resolver (map, kernel);
+ }
+
sysprof_symbol_map_resolve (map, reader);
sysprof_symbol_map_serialize (map, fd);
sysprof_symbol_map_free (map);
@@ -143,3 +149,20 @@ sysprof_symbols_source_new (void)
{
return g_object_new (SYSPROF_TYPE_SYMBOLS_SOURCE, NULL);
}
+
+void
+sysprof_symbols_source_set_user_only (SysprofSymbolsSource *self,
+ gboolean user_only)
+{
+ g_return_if_fail (SYSPROF_IS_SYMBOLS_SOURCE (self));
+
+ self->user_only = !!user_only;
+}
+
+gboolean
+sysprof_symbols_source_get_user_only (SysprofSymbolsSource *self)
+{
+ g_return_val_if_fail (SYSPROF_IS_SYMBOLS_SOURCE (self), FALSE);
+
+ return self->user_only;
+}
diff --git a/src/libsysprof/sysprof-symbols-source.h b/src/libsysprof/sysprof-symbols-source.h
index 22359f9..c78bb3c 100644
--- a/src/libsysprof/sysprof-symbols-source.h
+++ b/src/libsysprof/sysprof-symbols-source.h
@@ -30,6 +30,11 @@ SYSPROF_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (SysprofSymbolsSource, sysprof_symbols_source, SYSPROF, SYMBOLS_SOURCE, GObject)
SYSPROF_AVAILABLE_IN_ALL
-SysprofSource *sysprof_symbols_source_new (void);
+SysprofSource *sysprof_symbols_source_new (void);
+SYSPROF_AVAILABLE_IN_3_36
+void sysprof_symbols_source_set_user_only (SysprofSymbolsSource *self,
+ gboolean user_only);
+SYSPROF_AVAILABLE_IN_3_36
+gboolean sysprof_symbols_source_get_user_only (SysprofSymbolsSource *self);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]