[compiler-rt] r173796 - tsan: remember when we are inside of symbolizer code (required for inprocess symbolizer)
Dmitry Vyukov
dvyukov at google.com
Tue Jan 29 05:03:08 PST 2013
Author: dvyukov
Date: Tue Jan 29 07:03:07 2013
New Revision: 173796
URL: http://llvm.org/viewvc/llvm-project?rev=173796&view=rev
Log:
tsan: remember when we are inside of symbolizer code (required for inprocess symbolizer)
Modified:
compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h
compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.cc
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h?rev=173796&r1=173795&r2=173796&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h Tue Jan 29 07:03:07 2013
@@ -326,6 +326,7 @@ struct ThreadState {
const int tid;
const int unique_id;
int in_rtl;
+ bool in_symbolizer;
bool is_alive;
const uptr stk_addr;
const uptr stk_size;
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.cc?rev=173796&r1=173795&r2=173796&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.cc Tue Jan 29 07:03:07 2013
@@ -18,9 +18,24 @@
#include "sanitizer_common/sanitizer_symbolizer.h"
#include "tsan_flags.h"
#include "tsan_report.h"
+#include "tsan_rtl.h"
namespace __tsan {
+struct ScopedInSymbolizer {
+ ScopedInSymbolizer() {
+ ThreadState *thr = cur_thread();
+ CHECK(!thr->in_symbolizer);
+ thr->in_symbolizer = true;
+ }
+
+ ~ScopedInSymbolizer() {
+ ThreadState *thr = cur_thread();
+ CHECK(thr->in_symbolizer);
+ thr->in_symbolizer = false;
+ }
+};
+
ReportStack *NewReportStackEntry(uptr addr) {
ReportStack *ent = (ReportStack*)internal_alloc(MBlockReportStack,
sizeof(ReportStack));
@@ -57,6 +72,7 @@ static ReportStack *NewReportStackEntry(
ReportStack *SymbolizeCode(uptr addr) {
if (!IsSymbolizerAvailable())
return SymbolizeCodeAddr2Line(addr);
+ ScopedInSymbolizer in_symbolizer;
static const uptr kMaxAddrFrames = 16;
InternalScopedBuffer<AddressInfo> addr_frames(kMaxAddrFrames);
for (uptr i = 0; i < kMaxAddrFrames; i++)
@@ -83,6 +99,7 @@ ReportStack *SymbolizeCode(uptr addr) {
ReportLocation *SymbolizeData(uptr addr) {
if (!IsSymbolizerAvailable())
return 0;
+ ScopedInSymbolizer in_symbolizer;
DataInfo info;
if (!__sanitizer::SymbolizeData(addr, &info))
return 0;
More information about the llvm-commits
mailing list