[compiler-rt] r215203 - [ASan/Win] Print out a big warning and continue without checking for success if SymInitialize() fails

Timur Iskhodzhanov timurrrr at google.com
Fri Aug 8 06:25:55 PDT 2014


Author: timurrrr
Date: Fri Aug  8 08:25:55 2014
New Revision: 215203

URL: http://llvm.org/viewvc/llvm-project?rev=215203&view=rev
Log:
[ASan/Win] Print out a big warning and continue without checking for success if SymInitialize() fails

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_win.cc
    compiler-rt/trunk/test/asan/TestCases/Windows/report_after_syminitialize.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_win.cc?rev=215203&r1=215202&r2=215203&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_win.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_win.cc Fri Aug  8 08:25:55 2014
@@ -40,8 +40,13 @@ class WinSymbolizer : public Symbolizer
         // Anyways, we have to reconfigure stuff to make sure that SymInitialize
         // has all the appropriate options set.
         // Cross our fingers and reinitialize DbgHelp.
-        CHECK(SymCleanup(GetCurrentProcess()));
-        CHECK(TrySymInitialize());
+        Report("*** WARNING: Failed to initialize DbgHelp!              ***\n");
+        Report("*** Most likely this means that the app is already      ***\n");
+        Report("*** using DbgHelp, possibly with incompatible flags.    ***\n");
+        Report("*** Due to technical reasons, symbolization might crash ***\n");
+        Report("*** or produce wrong results.                           ***\n");
+        SymCleanup(GetCurrentProcess());
+        TrySymInitialize();
       }
       initialized_ = true;
     }

Modified: compiler-rt/trunk/test/asan/TestCases/Windows/report_after_syminitialize.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/report_after_syminitialize.cc?rev=215203&r1=215202&r2=215203&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Windows/report_after_syminitialize.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Windows/report_after_syminitialize.cc Fri Aug  8 08:25:55 2014
@@ -11,8 +11,9 @@ int main() {
   if (!SymInitialize(GetCurrentProcess(), 0, FALSE))
     return 42;
 
-  *(int*)0 = 42;
+  *(volatile int*)0 = 42;
   // CHECK: ERROR: AddressSanitizer: access-violation on unknown address
-  // CHECK-NEXT: {{#0 0x.* in main.*report_after_syminitialize.cc:}}[[@LINE-2]]
+  // CHECK-NEXT: {{WARNING: .*DbgHelp}}
+  // CHECK: {{#0 0x.* in main.*report_after_syminitialize.cc:}}[[@LINE-3]]
   // CHECK: AddressSanitizer can not provide additional info.
 }





More information about the llvm-commits mailing list