mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-analyze: add fallback Kernel symbols
If we fail to load a /proc/kallsyms.gz from the capture file, we can still
provide an "In Kernel+address" symbol. I prefer this to force loading the
kallsyms from the current system because that:
1. Requires privileged access and therefore means potentially an
authorization dialog.
2. May not even be from the same system that the capture was recorded
leading to incorrect symbolization.
This commit is contained in:
@ -251,7 +251,7 @@ sysprof_kallsyms_symbolizer_symbolize (SysprofSymbolizer *symbolizer,
|
||||
return NULL;
|
||||
|
||||
if (address < self->low || address >= self->high)
|
||||
return NULL;
|
||||
goto failure;
|
||||
|
||||
symbols = &g_array_index (self->kallsyms, KernelSymbol, 0);
|
||||
n_symbols = self->kallsyms->len;
|
||||
@ -260,7 +260,7 @@ sysprof_kallsyms_symbolizer_symbolize (SysprofSymbolizer *symbolizer,
|
||||
right = n_symbols;
|
||||
mid = n_symbols / 2;
|
||||
|
||||
for (;;)
|
||||
while (left <= right)
|
||||
{
|
||||
const KernelSymbol *ksym = &symbols[mid];
|
||||
const KernelSymbol *next = &symbols[mid+1];
|
||||
@ -281,7 +281,17 @@ sysprof_kallsyms_symbolizer_symbolize (SysprofSymbolizer *symbolizer,
|
||||
mid = left + ((right-left) / 2);
|
||||
}
|
||||
|
||||
g_assert_not_reached ();
|
||||
failure:
|
||||
{
|
||||
char name[64];
|
||||
|
||||
g_snprintf (name, sizeof name, "In Kernel+0x%"G_GINT64_MODIFIER"x", address);
|
||||
return _sysprof_symbol_new (sysprof_strings_get (strings, name),
|
||||
g_ref_string_acquire (linux_string),
|
||||
NULL,
|
||||
address,
|
||||
address + 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user