[compiler-rt] r177036 - [ASan] make ASan assume ASAN_OPTIONS=symbolize=1 if ASAN_EXTERNAL_SYMBOLIZER is defined

Alexey Samsonov samsonov at google.com
Thu Mar 14 03:07:40 PDT 2013


Author: samsonov
Date: Thu Mar 14 05:07:40 2013
New Revision: 177036

URL: http://llvm.org/viewvc/llvm-project?rev=177036&view=rev
Log:
[ASan] make ASan assume ASAN_OPTIONS=symbolize=1 if ASAN_EXTERNAL_SYMBOLIZER is defined

Modified:
    compiler-rt/trunk/lib/asan/asan_rtl.cc

Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=177036&r1=177035&r2=177036&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_rtl.cc Thu Mar 14 05:07:40 2013
@@ -130,11 +130,13 @@ static void ParseFlagsFromString(Flags *
   ParseFlag(str, &f->strict_memcmp, "strict_memcmp");
 }
 
+static const char *asan_external_symbolizer;
+
 void InitializeFlags(Flags *f, const char *env) {
   internal_memset(f, 0, sizeof(*f));
 
   f->quarantine_size = (ASAN_LOW_MEMORY) ? 1UL << 26 : 1UL << 28;
-  f->symbolize = false;
+  f->symbolize = (asan_external_symbolizer != 0);
   f->verbosity = 0;
   f->redzone = ASAN_ALLOCATOR_VERSION == 2 ? 16 : (ASAN_LOW_MEMORY) ? 64 : 128;
   f->debug = false;
@@ -426,6 +428,8 @@ void __asan_init() {
   SetCheckFailedCallback(AsanCheckFailed);
   SetPrintfAndReportCallback(AppendToErrorMessageBuffer);
 
+  // Check if external symbolizer is defined before parsing the flags.
+  asan_external_symbolizer = GetEnv("ASAN_SYMBOLIZER_PATH");
   // Initialize flags. This must be done early, because most of the
   // initialization steps look at flags().
   const char *options = GetEnv("ASAN_OPTIONS");
@@ -503,11 +507,9 @@ void __asan_init() {
 
   InstallSignalHandlers();
   // Start symbolizer process if necessary.
-  if (flags()->symbolize) {
-    const char *external_symbolizer = GetEnv("ASAN_SYMBOLIZER_PATH");
-    if (external_symbolizer) {
-      InitializeExternalSymbolizer(external_symbolizer);
-    }
+  if (flags()->symbolize && asan_external_symbolizer &&
+      asan_external_symbolizer[0]) {
+    InitializeExternalSymbolizer(asan_external_symbolizer);
   }
 
   // On Linux AsanThread::ThreadStart() calls malloc() that's why asan_inited





More information about the llvm-commits mailing list