diff options
Diffstat (limited to 'runtime/contrib/heap_trace/src/symbol_searcher.cc')
-rw-r--r-- | runtime/contrib/heap_trace/src/symbol_searcher.cc | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/runtime/contrib/heap_trace/src/symbol_searcher.cc b/runtime/contrib/heap_trace/src/symbol_searcher.cc index cf83f2f7b..9aaae6a2a 100644 --- a/runtime/contrib/heap_trace/src/symbol_searcher.cc +++ b/runtime/contrib/heap_trace/src/symbol_searcher.cc @@ -36,13 +36,14 @@ static int checkIfLibraryContainsSymbol(InfoAboutLoadedLib library_description, static bool isSymbolAddressNotInTheSameTranslationUnit(SymbolDescription *symbol); void *findSymbol(const char *name) { + signalizeThatNextAllocationsWillBeForSymbolSearcherInternalUsage(); SymbolDescription symbol(name); tryToFindSymbolInLinkedLibraries(symbol); if (!symbol.address) { tryToFindSymbolInAllLoadedLibraries(symbol); } - + signalizeThatSymbolSearcherEndedOfWork(); return symbol.address; } @@ -80,3 +81,22 @@ static bool isSymbolAddressNotInTheSameTranslationUnit(SymbolDescription *symbol return addressInTheSameTranslationUnit == nullptr || addressInTheSameTranslationUnit != symbol->address; } + +// TODO should be thread_local (or all symbols should be resolved at the start of application as +// alternative) +static volatile bool are_next_allocations_will_be_for_symbol_searcher_internal_usage = false; + +void signalizeThatNextAllocationsWillBeForSymbolSearcherInternalUsage() +{ + are_next_allocations_will_be_for_symbol_searcher_internal_usage = true; +} + +void signalizeThatSymbolSearcherEndedOfWork() +{ + are_next_allocations_will_be_for_symbol_searcher_internal_usage = false; +} + +bool isCurrentAllocationForSymbolSearcherInternalUsage() +{ + return are_next_allocations_will_be_for_symbol_searcher_internal_usage; +} |