[compiler-rt] r212872 - [ASan] Collect unmangled names of global variables in Clang to print them in error reports.

Alexey Samsonov vonosmas at gmail.com
Fri Jul 11 17:42:52 PDT 2014


Author: samsonov
Date: Fri Jul 11 19:42:52 2014
New Revision: 212872

URL: http://llvm.org/viewvc/llvm-project?rev=212872&view=rev
Log:
[ASan] Collect unmangled names of global variables in Clang to print them in error reports.

Currently ASan instrumentation pass creates a string with global name
for each instrumented global (to include global names in the error report). Global
name is already mangled at this point, and we may not be able to demangle it
at runtime (e.g. there is no __cxa_demangle on Android).

Instead, create a string with fully qualified global name in Clang, and pass it
to ASan instrumentation pass in llvm.asan.globals metadata. If there is no metadata
for some global, ASan will use the original algorithm.

This fixes https://code.google.com/p/address-sanitizer/issues/detail?id=264.

Modified:
    compiler-rt/trunk/test/asan/TestCases/global-location.cc

Modified: compiler-rt/trunk/test/asan/TestCases/global-location.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/global-location.cc?rev=212872&r1=212871&r2=212872&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/global-location.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/global-location.cc Fri Jul 11 19:42:52 2014
@@ -27,7 +27,7 @@ int main(int argc, char **argv) {
   case 'c': return C::array[one * 11];
   case 'f':
     static int array[10];
-    // FUNC_STATIC: 0x{{.*}} is located 4 bytes to the right of global variable 'main::array' defined in '{{.*}}global-location.cc:[[@LINE-1]]:16' {{.*}} of size 40
+    // FUNC_STATIC: 0x{{.*}} is located 4 bytes to the right of global variable 'array' defined in '{{.*}}global-location.cc:[[@LINE-1]]:16' {{.*}} of size 40
     memset(array, 0, 10);
     return array[one * 11];
   case 'l':





More information about the llvm-commits mailing list