sysprof: Enable debuginfod option in tests

Signed-off-by: varun-r-mallya <varunrmallya@gmail.com>
This commit is contained in:
2025-02-03 22:25:45 +05:30
parent 333cd719f7
commit 202129e3b5
4 changed files with 16 additions and 10 deletions

View File

@ -32,7 +32,6 @@ static gboolean memprof;
static gboolean tracer; static gboolean tracer;
static gboolean gnome_shell; static gboolean gnome_shell;
static gboolean bundle_symbols; static gboolean bundle_symbols;
// static gboolean debuginfod;
static gboolean session_bus; static gboolean session_bus;
static gboolean system_bus; static gboolean system_bus;
static gboolean gjs; static gboolean gjs;
@ -47,7 +46,6 @@ static const GOptionEntry entries[] = {
{ "session-bus", 0, 0, G_OPTION_ARG_NONE, &session_bus, "Record D-Bus messages on the session bus" }, { "session-bus", 0, 0, G_OPTION_ARG_NONE, &session_bus, "Record D-Bus messages on the session bus" },
{ "system-bus", 0, 0, G_OPTION_ARG_NONE, &system_bus, "Record D-Bus messages on the system bus" }, { "system-bus", 0, 0, G_OPTION_ARG_NONE, &system_bus, "Record D-Bus messages on the system bus" },
{ "bundle-symbols", 'b', 0, G_OPTION_ARG_STRING, &bundle_symbols, "Bundle symbols with the capture" }, { "bundle-symbols", 'b', 0, G_OPTION_ARG_STRING, &bundle_symbols, "Bundle symbols with the capture" },
// { "debuginfod", 'b', 0, G_OPTION_ARG_STRING, &debuginfod, "Enable debuginfod" },
{ 0 } { 0 }
}; };
@ -194,9 +192,6 @@ main (int argc,
if (bundle_symbols) if (bundle_symbols)
sysprof_profiler_add_instrument (profiler, sysprof_symbols_bundle_new ()); sysprof_profiler_add_instrument (profiler, sysprof_symbols_bundle_new ());
// if (debuginfod) /*TODO: this function has not been created anywhere yet*/
// sysprof_profiler_add_instrument (profiler, sysprof_debuginfod_new());
if (power_profile) if (power_profile)
sysprof_profiler_add_instrument (profiler, sysprof_power_profile_new (power_profile)); sysprof_profiler_add_instrument (profiler, sysprof_power_profile_new (power_profile));

View File

@ -7,6 +7,7 @@
static GMainLoop *main_loop; static GMainLoop *main_loop;
static gboolean silent; static gboolean silent;
static gboolean no_bundled; static gboolean no_bundled;
static gboolean debuginfod;
static char **debug_dirs; static char **debug_dirs;
static char *kallsyms_path; static char *kallsyms_path;
static const GOptionEntry entries[] = { static const GOptionEntry entries[] = {
@ -14,10 +15,10 @@ static const GOptionEntry entries[] = {
{ "silent", 's', 0, G_OPTION_ARG_NONE, &silent, "Do not print symbol information" }, { "silent", 's', 0, G_OPTION_ARG_NONE, &silent, "Do not print symbol information" },
{ "debug-dir", 'd', 0, G_OPTION_ARG_FILENAME_ARRAY, &debug_dirs, "Specify external debug directory, may be repeated" }, { "debug-dir", 'd', 0, G_OPTION_ARG_FILENAME_ARRAY, &debug_dirs, "Specify external debug directory, may be repeated" },
{ "kallsyms", 'k', 0, G_OPTION_ARG_FILENAME, &kallsyms_path, "Specify path to kallsyms for kernel symbolizing" }, { "kallsyms", 'k', 0, G_OPTION_ARG_FILENAME, &kallsyms_path, "Specify path to kallsyms for kernel symbolizing" },
{ "debuginfod", 'D', 0, G_OPTION_ARG_NONE, &debuginfod, "Use debuginfod for automatically fetching debug symbols" },
{ 0 } { 0 }
}; };
static void static void
load_cb (GObject *object, load_cb (GObject *object,
GAsyncResult *result, GAsyncResult *result,
@ -163,6 +164,19 @@ main (int argc,
sysprof_multi_symbolizer_take (multi, elf); sysprof_multi_symbolizer_take (multi, elf);
sysprof_multi_symbolizer_take (multi, sysprof_jitmap_symbolizer_new ()); sysprof_multi_symbolizer_take (multi, sysprof_jitmap_symbolizer_new ());
#if HAVE_DEBUGINFOD
if (debuginfod)
{
g_autoptr(SysprofSymbolizer) debuginfod_symbolizer = NULL;
g_autoptr(GError) debuginfod_error = NULL;
if (!(debuginfod_symbolizer = sysprof_debuginfod_symbolizer_new (&debuginfod_error)))
g_warning ("Failed to create debuginfod symbolizer: %s", debuginfod_error->message);
else
sysprof_multi_symbolizer_take (multi, g_steal_pointer (&debuginfod_symbolizer));
}
#endif
sysprof_document_loader_set_symbolizer (loader, SYSPROF_SYMBOLIZER (multi)); sysprof_document_loader_set_symbolizer (loader, SYSPROF_SYMBOLIZER (multi));
} }

View File

@ -625,7 +625,7 @@
<object class="AdwActionRow"> <object class="AdwActionRow">
<property name="activatable-widget">debuginfod</property> <property name="activatable-widget">debuginfod</property>
<property name="title" translatable="yes">Debuginfod</property> <property name="title" translatable="yes">Debuginfod</property>
<property name="subtitle" translatable="yes">Enable Debuginfod</property> <property name="subtitle" translatable="yes">Enable Debuginfod to automatically fetch debug symbols</property>
<child type="suffix"> <child type="suffix">
<object class="GtkSwitch" id="debuginfod"> <object class="GtkSwitch" id="debuginfod">
<property name="active" bind-source="recording_template" bind-flags="bidirectional|sync-create" bind-property="debuginfod"/> <property name="active" bind-source="recording_template" bind-flags="bidirectional|sync-create" bind-property="debuginfod"/>

View File

@ -625,9 +625,6 @@ sysprof_recording_template_apply (SysprofRecordingTemplate *self,
if (self->bundle_symbols) if (self->bundle_symbols)
sysprof_profiler_add_instrument (profiler, sysprof_symbols_bundle_new ()); sysprof_profiler_add_instrument (profiler, sysprof_symbols_bundle_new ());
// if (self->debuginfod) /*TODO: This just uses an a preexisting function.*/
// sysprof_profiler_add_instrument (profiler, this_should_be_a_handler_function());
if (self->cpu_usage) if (self->cpu_usage)
sysprof_profiler_add_instrument (profiler, sysprof_cpu_usage_new ()); sysprof_profiler_add_instrument (profiler, sysprof_cpu_usage_new ());