mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 08:00:53 +00:00
symbol-resolver: check for kernel address context
We only want to resolve a symbol if we're inside the kernel context. Otherwise, it wont be accurate.
This commit is contained in:
@ -27,16 +27,20 @@ struct _SpKernelSymbolResolver
|
|||||||
static GQuark linux_quark;
|
static GQuark linux_quark;
|
||||||
|
|
||||||
static gchar *
|
static gchar *
|
||||||
sp_kernel_symbol_resolver_resolve (SpSymbolResolver *resolver,
|
sp_kernel_symbol_resolver_resolve_with_context (SpSymbolResolver *resolver,
|
||||||
guint64 time,
|
guint64 time,
|
||||||
GPid pid,
|
GPid pid,
|
||||||
SpCaptureAddress address,
|
SpAddressContext context,
|
||||||
GQuark *tag)
|
SpCaptureAddress address,
|
||||||
|
GQuark *tag)
|
||||||
{
|
{
|
||||||
const SpKernelSymbol *sym;
|
const SpKernelSymbol *sym;
|
||||||
|
|
||||||
g_assert (SP_IS_SYMBOL_RESOLVER (resolver));
|
g_assert (SP_IS_SYMBOL_RESOLVER (resolver));
|
||||||
|
|
||||||
|
if (context != SP_ADDRESS_CONTEXT_KERNEL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (NULL != (sym = sp_kernel_symbol_from_address (address)))
|
if (NULL != (sym = sp_kernel_symbol_from_address (address)))
|
||||||
{
|
{
|
||||||
*tag = linux_quark;
|
*tag = linux_quark;
|
||||||
@ -49,7 +53,7 @@ sp_kernel_symbol_resolver_resolve (SpSymbolResolver *resolver,
|
|||||||
static void
|
static void
|
||||||
symbol_resolver_iface_init (SpSymbolResolverInterface *iface)
|
symbol_resolver_iface_init (SpSymbolResolverInterface *iface)
|
||||||
{
|
{
|
||||||
iface->resolve = sp_kernel_symbol_resolver_resolve;
|
iface->resolve_with_context = sp_kernel_symbol_resolver_resolve_with_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (SpKernelSymbolResolver,
|
G_DEFINE_TYPE_WITH_CODE (SpKernelSymbolResolver,
|
||||||
|
|||||||
Reference in New Issue
Block a user