diff options
author | Kuba Brecka <kuba.brecka@gmail.com> | 2015-11-12 14:34:17 +0000 |
---|---|---|
committer | Kuba Brecka <kuba.brecka@gmail.com> | 2015-11-12 14:34:17 +0000 |
commit | 3ecce92a5280c6c813469dcbed68d5d9c66cf699 (patch) | |
tree | 4d586ba501807a5bdfe69e3d955fd6db3fd8a7d7 | |
parent | 48e0256ed65be9188232ff5fe54de51ba1eefe1a (diff) | |
download | bcm5719-llvm-3ecce92a5280c6c813469dcbed68d5d9c66cf699.tar.gz bcm5719-llvm-3ecce92a5280c6c813469dcbed68d5d9c66cf699.zip |
[tsan] Allow symbolizers that don't obtain global symbol sizes
The default symbolizer, `llvm-symbolizer` provides sizes for global symbols. On OS X, we want to also allow using `atos` (because it's available everywhere and users don't need to copy/install it) and `dladdr` (it's the only available option when running in a sandbox). However, these symbolizers do not supply the symbol sizes, only names and starting addresses. This patch changes the reporting functions to hide the size of the symbol when this value is unavailable, and modifies tests to make this part of the report "optional".
Differential Revision: http://reviews.llvm.org/D14608
llvm-svn: 252896
-rw-r--r-- | compiler-rt/lib/tsan/rtl/tsan_report.cc | 11 | ||||
-rw-r--r-- | compiler-rt/test/tsan/global_race.cc | 2 | ||||
-rw-r--r-- | compiler-rt/test/tsan/global_race2.cc | 2 | ||||
-rw-r--r-- | compiler-rt/test/tsan/global_race3.cc | 2 |
4 files changed, 11 insertions, 6 deletions
diff --git a/compiler-rt/lib/tsan/rtl/tsan_report.cc b/compiler-rt/lib/tsan/rtl/tsan_report.cc index f54f04b732a..c56abce1dc6 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_report.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_report.cc @@ -171,9 +171,14 @@ static void PrintLocation(const ReportLocation *loc) { Printf("%s", d.Location()); if (loc->type == ReportLocationGlobal) { const DataInfo &global = loc->global; - Printf(" Location is global '%s' of size %zu at %p (%s+%p)\n\n", - global.name, global.size, global.start, - StripModuleName(global.module), global.module_offset); + if (global.size != 0) + Printf(" Location is global '%s' of size %zu at %p (%s+%p)\n\n", + global.name, global.size, global.start, + StripModuleName(global.module), global.module_offset); + else + Printf(" Location is global '%s' at %p (%s+%p)\n\n", global.name, + global.start, StripModuleName(global.module), + global.module_offset); } else if (loc->type == ReportLocationHeap) { char thrbuf[kThreadBufSize]; Printf(" Location is heap block of size %zu at %p allocated by %s:\n", diff --git a/compiler-rt/test/tsan/global_race.cc b/compiler-rt/test/tsan/global_race.cc index 3128ec41174..d1f0e385963 100644 --- a/compiler-rt/test/tsan/global_race.cc +++ b/compiler-rt/test/tsan/global_race.cc @@ -23,5 +23,5 @@ int main() { // CHECK: addr=[[ADDR:0x[0-9,a-f]+]] // CHECK: WARNING: ThreadSanitizer: data race -// CHECK: Location is global 'GlobalData' of size 40 at [[ADDR]] (global_race.cc.exe+0x{{[0-9,a-f]+}}) +// CHECK: Location is global 'GlobalData' {{(of size 40 )?}}at [[ADDR]] (global_race.cc.exe+0x{{[0-9,a-f]+}}) diff --git a/compiler-rt/test/tsan/global_race2.cc b/compiler-rt/test/tsan/global_race2.cc index 4ab2842e7ee..5c29a78c789 100644 --- a/compiler-rt/test/tsan/global_race2.cc +++ b/compiler-rt/test/tsan/global_race2.cc @@ -23,5 +23,5 @@ int main() { // CHECK: addr2=[[ADDR2:0x[0-9,a-f]+]] // CHECK: WARNING: ThreadSanitizer: data race -// CHECK: Location is global 'x' of size 4 at [[ADDR2]] ({{.*}}+0x{{[0-9,a-f]+}}) +// CHECK: Location is global 'x' {{(of size 4 )?}}at [[ADDR2]] ({{.*}}+0x{{[0-9,a-f]+}}) diff --git a/compiler-rt/test/tsan/global_race3.cc b/compiler-rt/test/tsan/global_race3.cc index 1531d7830f7..6361c4339a9 100644 --- a/compiler-rt/test/tsan/global_race3.cc +++ b/compiler-rt/test/tsan/global_race3.cc @@ -28,4 +28,4 @@ int main() { // CHECK: addr3=[[ADDR3:0x[0-9,a-f]+]] // CHECK: WARNING: ThreadSanitizer: data race -// CHECK: Location is global 'XXX::YYY::ZZZ' of size 40 at [[ADDR3]] ({{.*}}+0x{{[0-9,a-f]+}}) +// CHECK: Location is global 'XXX::YYY::ZZZ' {{(of size 40 )?}}at [[ADDR3]] ({{.*}}+0x{{[0-9,a-f]+}}) |