mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
libsysprof-analyze: cleanup some helper code for symbolize
This commit is contained in:
@ -91,10 +91,7 @@ sysprof_document_symbols_add_traceable (SysprofDocumentSymbols *self,
|
|||||||
SysprofAddress address = addresses[i];
|
SysprofAddress address = addresses[i];
|
||||||
SysprofAddressContext context;
|
SysprofAddressContext context;
|
||||||
|
|
||||||
if (sysprof_address_is_context_switch (address, &context))
|
/* TODO: */
|
||||||
g_print ("%d: %s\n", i, sysprof_address_context_to_string (context));
|
|
||||||
else
|
|
||||||
g_print ("%d: %p\n", i, (gpointer)address);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,9 @@ symbolize_cb (GObject *object,
|
|||||||
{
|
{
|
||||||
SysprofDocument *document = (SysprofDocument *)object;
|
SysprofDocument *document = (SysprofDocument *)object;
|
||||||
g_autoptr(SysprofDocumentSymbols) symbols = NULL;
|
g_autoptr(SysprofDocumentSymbols) symbols = NULL;
|
||||||
|
g_autoptr(GListModel) traceables = NULL;
|
||||||
g_autoptr(GError) error = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
|
guint n_items;
|
||||||
|
|
||||||
g_assert (SYSPROF_IS_DOCUMENT (document));
|
g_assert (SYSPROF_IS_DOCUMENT (document));
|
||||||
g_assert (G_IS_ASYNC_RESULT (result));
|
g_assert (G_IS_ASYNC_RESULT (result));
|
||||||
@ -19,6 +21,33 @@ symbolize_cb (GObject *object,
|
|||||||
if (!(symbols = sysprof_document_symbolize_finish (document, result, &error)))
|
if (!(symbols = sysprof_document_symbolize_finish (document, result, &error)))
|
||||||
g_error ("Failed to symbolize: %s", error->message);
|
g_error ("Failed to symbolize: %s", error->message);
|
||||||
|
|
||||||
|
traceables = sysprof_document_list_traceables (document);
|
||||||
|
n_items = g_list_model_get_n_items (traceables);
|
||||||
|
|
||||||
|
for (guint i = 0; i < n_items; i++)
|
||||||
|
{
|
||||||
|
g_autoptr(SysprofDocumentTraceable) traceable = g_list_model_get_item (traceables, i);
|
||||||
|
guint depth;
|
||||||
|
|
||||||
|
g_assert (traceable != NULL);
|
||||||
|
g_assert (SYSPROF_IS_DOCUMENT_TRACEABLE (traceable));
|
||||||
|
|
||||||
|
depth = sysprof_document_traceable_get_stack_depth (traceable);
|
||||||
|
|
||||||
|
g_print ("%s depth=%u\n", G_OBJECT_TYPE_NAME (traceable), depth);
|
||||||
|
|
||||||
|
for (guint j = 0; j < depth; j++)
|
||||||
|
{
|
||||||
|
SysprofAddress address = sysprof_document_traceable_get_stack_address (traceable, j);
|
||||||
|
|
||||||
|
g_print (" %02d: %p\n", j, GSIZE_TO_POINTER (address));
|
||||||
|
|
||||||
|
/* TODO: get symbol name from document symbols */
|
||||||
|
}
|
||||||
|
|
||||||
|
g_print (" ================\n");
|
||||||
|
}
|
||||||
|
|
||||||
g_print ("Document symbolized\n");
|
g_print ("Document symbolized\n");
|
||||||
|
|
||||||
g_main_loop_quit (main_loop);
|
g_main_loop_quit (main_loop);
|
||||||
|
|||||||
Reference in New Issue
Block a user