[Lldb-commits] [PATCH] D11384: Improve check for ASAN callbacks

Tamas Berghammer via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 12 04:13:59 PDT 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL244739: Improve check for ASAN callbacks (authored by tberghammer).

Changed prior to commit:
  http://reviews.llvm.org/D11384?vs=30239&id=31923#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11384

Files:
  lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
  lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp

Index: lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
===================================================================
--- lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
+++ lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
@@ -78,14 +78,11 @@
 
 bool ModuleContainsASanRuntime(Module * module)
 {
-    SymbolContextList sc_list;
-    const bool include_symbols = true;
-    const bool append = true;
-    const bool include_inlines = true;
-    
-    size_t num_matches = module->FindFunctions(ConstString("__asan_get_alloc_stack"), NULL, eFunctionNameTypeAuto, include_symbols, include_inlines, append, sc_list);
-    
-    return num_matches > 0;
+    const Symbol* symbol = module->FindFirstSymbolWithNameAndType(
+            ConstString("__asan_get_alloc_stack"),
+            lldb::eSymbolTypeAny);
+
+    return symbol != nullptr;
 }
 
 void
Index: lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
===================================================================
--- lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
+++ lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
@@ -30,36 +30,25 @@
 {
     if (!process_sp.get())
         return NULL;
-    
+
     Target & target = process_sp->GetTarget();
-    
-    bool found_asan_runtime = false;
-    
+
     const ModuleList &target_modules = target.GetImages();
     Mutex::Locker modules_locker(target_modules.GetMutex());
     const size_t num_modules = target_modules.GetSize();
     for (size_t i = 0; i < num_modules; ++i)
     {
         Module *module_pointer = target_modules.GetModulePointerAtIndexUnlocked(i);
-        
-        SymbolContextList sc_list;
-        const bool include_symbols = true;
-        const bool append = true;
-        const bool include_inlines = true;
 
-        size_t num_matches = module_pointer->FindFunctions(ConstString("__asan_get_alloc_stack"), NULL, eFunctionNameTypeAuto, include_symbols, include_inlines, append, sc_list);
-        
-        if (num_matches)
-        {
-            found_asan_runtime = true;
-            break;
-        }
+        const Symbol* symbol = module_pointer->FindFirstSymbolWithNameAndType(
+                ConstString("__asan_get_alloc_stack"),
+                lldb::eSymbolTypeAny);
+
+        if (symbol != nullptr)
+            return MemoryHistorySP(new MemoryHistoryASan(process_sp));        
     }
-    
-    if (! found_asan_runtime)
-        return MemoryHistorySP();
 
-    return MemoryHistorySP(new MemoryHistoryASan(process_sp));
+    return MemoryHistorySP();
 }
 
 void


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11384.31923.patch
Type: text/x-patch
Size: 2720 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150812/7ea94f68/attachment.bin>


More information about the lldb-commits mailing list