mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-11 15:40:53 +00:00
kernel-symbol: fix result parsing from sysprofd
We need to add an additional () around our result type from sysprofd.
This commit is contained in:
@ -76,6 +76,14 @@ sp_kernel_symbol_compare (gconstpointer a,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline gboolean
|
||||||
|
is_ignored (GHashTable *skip,
|
||||||
|
const gchar *name,
|
||||||
|
guint8 type)
|
||||||
|
{
|
||||||
|
return g_hash_table_contains (skip, name);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
authorize_proxy (GDBusConnection *conn)
|
authorize_proxy (GDBusConnection *conn)
|
||||||
{
|
{
|
||||||
@ -114,6 +122,7 @@ sp_kernel_symbol_load_from_sysprofd (GHashTable *skip)
|
|||||||
{
|
{
|
||||||
g_autoptr(GDBusConnection) conn = NULL;
|
g_autoptr(GDBusConnection) conn = NULL;
|
||||||
g_autoptr(GVariant) ret = NULL;
|
g_autoptr(GVariant) ret = NULL;
|
||||||
|
g_autoptr(GVariant) results = NULL;
|
||||||
g_autoptr(GArray) ar = NULL;
|
g_autoptr(GArray) ar = NULL;
|
||||||
g_autoptr(GError) error = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
GVariantIter iter;
|
GVariantIter iter;
|
||||||
@ -138,7 +147,7 @@ sp_kernel_symbol_load_from_sysprofd (GHashTable *skip)
|
|||||||
"org.gnome.Sysprof2",
|
"org.gnome.Sysprof2",
|
||||||
"GetKernelSymbols",
|
"GetKernelSymbols",
|
||||||
NULL,
|
NULL,
|
||||||
G_VARIANT_TYPE ("a(tys)"),
|
G_VARIANT_TYPE ("(a(tys))"),
|
||||||
G_DBUS_CALL_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
@ -152,12 +161,13 @@ sp_kernel_symbol_load_from_sysprofd (GHashTable *skip)
|
|||||||
|
|
||||||
ar = g_array_new (FALSE, TRUE, sizeof (SpKernelSymbol));
|
ar = g_array_new (FALSE, TRUE, sizeof (SpKernelSymbol));
|
||||||
|
|
||||||
g_variant_iter_init (&iter, ret);
|
results = g_variant_get_child_value (ret, 0);
|
||||||
|
g_variant_iter_init (&iter, results);
|
||||||
while (g_variant_iter_loop (&iter, "(ty&s)", &addr, &type, &name))
|
while (g_variant_iter_loop (&iter, "(ty&s)", &addr, &type, &name))
|
||||||
{
|
{
|
||||||
SpKernelSymbol sym;
|
SpKernelSymbol sym;
|
||||||
|
|
||||||
if (g_hash_table_contains (skip, name))
|
if (is_ignored (skip, name, type))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
sym.address = addr;
|
sym.address = addr;
|
||||||
@ -167,6 +177,13 @@ sp_kernel_symbol_load_from_sysprofd (GHashTable *skip)
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_array_sort (ar, sp_kernel_symbol_compare);
|
g_array_sort (ar, sp_kernel_symbol_compare);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
g_print ("First: 0x%lx Last: 0x%lx\n",
|
||||||
|
g_array_index (ar, SpKernelSymbol, 0).address,
|
||||||
|
g_array_index (ar, SpKernelSymbol, ar->len - 1).address);
|
||||||
|
#endif
|
||||||
|
|
||||||
kernel_symbols = g_steal_pointer (&ar);
|
kernel_symbols = g_steal_pointer (&ar);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -196,7 +213,7 @@ sp_kernel_symbol_load (void)
|
|||||||
{
|
{
|
||||||
SpKernelSymbol sym;
|
SpKernelSymbol sym;
|
||||||
|
|
||||||
if (g_hash_table_contains (skip, name))
|
if (is_ignored (skip, name, type))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
sym.address = addr;
|
sym.address = addr;
|
||||||
@ -268,7 +285,7 @@ sp_kernel_symbol_from_address (SpCaptureAddress address)
|
|||||||
{
|
{
|
||||||
const SpKernelSymbol *first;
|
const SpKernelSymbol *first;
|
||||||
|
|
||||||
if (G_UNLIKELY (kernel_symbols == NULL))
|
if G_UNLIKELY (kernel_symbols == NULL)
|
||||||
{
|
{
|
||||||
static gboolean failed;
|
static gboolean failed;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user