[sysprof] elf: only resolve addresses in none/user address context



commit bb78a1c165c3e114c50e45508096de1522047993
Author: Christian Hergert <chergert redhat com>
Date:   Sun Jan 28 22:14:32 2018 -0800

    elf: only resolve addresses in none/user address context
    
    This ensures that we only try to resolve addresses for ELFs when we know
    we're inside of the userspace address context.

 lib/symbols/sp-elf-symbol-resolver.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/lib/symbols/sp-elf-symbol-resolver.c b/lib/symbols/sp-elf-symbol-resolver.c
index 7896a50..d2f2800 100644
--- a/lib/symbols/sp-elf-symbol-resolver.c
+++ b/lib/symbols/sp-elf-symbol-resolver.c
@@ -250,11 +250,12 @@ guess_tag (SpElfSymbolResolver *self,
 }
 
 static gchar *
-sp_elf_symbol_resolver_resolve (SpSymbolResolver *resolver,
-                                guint64           time,
-                                GPid              pid,
-                                SpCaptureAddress  address,
-                                GQuark           *tag)
+sp_elf_symbol_resolver_resolve_with_context (SpSymbolResolver *resolver,
+                                             guint64           time,
+                                             GPid              pid,
+                                             SpAddressContext  context,
+                                             SpCaptureAddress  address,
+                                             GQuark           *tag)
 {
   SpElfSymbolResolver *self = (SpElfSymbolResolver *)resolver;
   const bin_symbol_t *bin_sym;
@@ -265,6 +266,9 @@ sp_elf_symbol_resolver_resolve (SpSymbolResolver *resolver,
 
   g_assert (SP_IS_ELF_SYMBOL_RESOLVER (self));
 
+  if (context != SP_ADDRESS_CONTEXT_USER && context != SP_ADDRESS_CONTEXT_NONE)
+    return NULL;
+
   lookaside = g_hash_table_lookup (self->lookasides, GINT_TO_POINTER (pid));
   if (lookaside == NULL)
     return NULL;
@@ -296,7 +300,7 @@ static void
 symbol_resolver_iface_init (SpSymbolResolverInterface *iface)
 {
   iface->load = sp_elf_symbol_resolver_load;
-  iface->resolve = sp_elf_symbol_resolver_resolve;
+  iface->resolve_with_context = sp_elf_symbol_resolver_resolve_with_context;
 }
 
 SpSymbolResolver *


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]