summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTamas Berghammer <tberghammer@google.com>2015-08-12 11:13:11 +0000
committerTamas Berghammer <tberghammer@google.com>2015-08-12 11:13:11 +0000
commit94f2bb55351621fee2d7caa8a5233e564e3a58ff (patch)
tree0f561a55a2e7fc7ffb41449db7e551fc9fcb0321
parentec3f92a5e26d5c72820c81a10eda51e4a83cb3c0 (diff)
downloadbcm5719-llvm-94f2bb55351621fee2d7caa8a5233e564e3a58ff.tar.gz
bcm5719-llvm-94f2bb55351621fee2d7caa8a5233e564e3a58ff.zip
Improve check for ASAN callbacks
The ASAN callbacks are public symbols so we can search for them with reading only the symbol table (not the debug info). Whit this change the attach time for big executables with debug symbols decreased by a factor of ~4. Differential revision: http://reviews.llvm.org/D11384 llvm-svn: 244739
-rw-r--r--lldb/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp13
-rw-r--r--lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp29
2 files changed, 14 insertions, 28 deletions
diff --git a/lldb/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp b/lldb/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
index 9b72ceb71bd..c6fb95c105f 100644
--- a/lldb/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
+++ b/lldb/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
@@ -78,14 +78,11 @@ AddressSanitizerRuntime::~AddressSanitizerRuntime()
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
diff --git a/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp b/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
index c607de69538..da24ed5381f 100644
--- a/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
+++ b/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
@@ -30,36 +30,25 @@ MemoryHistoryASan::CreateInstance (const ProcessSP &process_sp)
{
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
OpenPOWER on IntegriCloud