[PATCH] D14613: [tsan] Add global symbolication support into DlAddrSymbolizer
Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 12 07:22:15 PST 2015
This revision was automatically updated to reflect the committed changes.
Closed by commit rL252899: [tsan] Add global symbolication support into DlAddrSymbolizer (authored by kuba.brecka).
Changed prior to commit:
http://reviews.llvm.org/D14613?vs=40038&id=40046#toc
Repository:
rL LLVM
http://reviews.llvm.org/D14613
Files:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_mac.cc
compiler-rt/trunk/test/tsan/Darwin/symbolizer-dladdr.cc
Index: compiler-rt/trunk/test/tsan/Darwin/symbolizer-dladdr.cc
===================================================================
--- compiler-rt/trunk/test/tsan/Darwin/symbolizer-dladdr.cc
+++ compiler-rt/trunk/test/tsan/Darwin/symbolizer-dladdr.cc
@@ -0,0 +1,29 @@
+// RUN: %clangxx_tsan %s -o %t
+// RUN: TSAN_OPTIONS=$TSAN_OPTIONS:verbosity=2:external_symbolizer_path= %deflake %run %t | FileCheck %s
+#include "../test.h"
+
+int GlobalData[10];
+
+void *Thread(void *a) {
+ barrier_wait(&barrier);
+ GlobalData[2] = 42;
+ return 0;
+}
+
+int main() {
+ barrier_init(&barrier, 2);
+ fprintf(stderr, "addr=");
+ print_address(GlobalData);
+ fprintf(stderr, "\n");
+ pthread_t t;
+ pthread_create(&t, 0, Thread, 0);
+ GlobalData[2] = 43;
+ barrier_wait(&barrier);
+ pthread_join(t, 0);
+}
+
+// CHECK: External symbolizer is explicitly disabled.
+// CHECK: Using dladdr symbolizer.
+// CHECK: addr=[[ADDR:0x[0-9,a-f]+]]
+// CHECK: WARNING: ThreadSanitizer: data race
+// CHECK: Location is global 'GlobalData' at [[ADDR]] ({{.*}}+0x{{[0-9,a-f]+}})
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_mac.cc
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_mac.cc
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_mac.cc
@@ -37,8 +37,14 @@
return true;
}
-bool DlAddrSymbolizer::SymbolizeData(uptr addr, DataInfo *info) {
- return false;
+bool DlAddrSymbolizer::SymbolizeData(uptr addr, DataInfo *datainfo) {
+ Dl_info info;
+ int result = dladdr((const void *)addr, &info);
+ if (!result) return false;
+ const char *demangled = DemangleCXXABI(info.dli_sname);
+ datainfo->name = internal_strdup(demangled);
+ datainfo->start = (uptr)info.dli_saddr;
+ return true;
}
class AtosSymbolizerProcess : public SymbolizerProcess {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14613.40046.patch
Type: text/x-patch
Size: 1869 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151112/de5fd889/attachment.bin>
More information about the llvm-commits
mailing list