[compiler-rt] r200766 - tsan: update Go public interface
Dmitry Vyukov
dvyukov at google.com
Tue Feb 4 06:45:54 PST 2014
Author: dvyukov
Date: Tue Feb 4 08:45:54 2014
New Revision: 200766
URL: http://llvm.org/viewvc/llvm-project?rev=200766&view=rev
Log:
tsan: update Go public interface
in preparation for https://codereview.appspot.com/55100044
Modified:
compiler-rt/trunk/lib/tsan/go/test.c
compiler-rt/trunk/lib/tsan/go/tsan_go.cc
Modified: compiler-rt/trunk/lib/tsan/go/test.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/go/test.c?rev=200766&r1=200765&r2=200766&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/go/test.c (original)
+++ compiler-rt/trunk/lib/tsan/go/test.c Tue Feb 4 08:45:54 2014
@@ -13,7 +13,7 @@
#include <stdio.h>
-void __tsan_init(void **thr);
+void __tsan_init(void **thr, void (*cb)(void*));
void __tsan_fini();
void __tsan_map_shadow(void *addr, unsigned long size);
void __tsan_go_start(void *thr, void **chthr, void *pc);
@@ -27,9 +27,7 @@ void __tsan_acquire(void *thr, void *add
void __tsan_release(void *thr, void *addr);
void __tsan_release_merge(void *thr, void *addr);
-int __tsan_symbolize(void *pc, char **img, char **rtn, char **file, int *l) {
- return 0;
-}
+void symbolize_cb(void *ctx) {}
char buf[10];
@@ -38,7 +36,7 @@ void barfoo() {}
int main(void) {
void *thr0 = 0;
- __tsan_init(&thr0);
+ __tsan_init(&thr0, symbolize_cb);
__tsan_map_shadow(buf, sizeof(buf) + 4096);
__tsan_func_enter(thr0, (char*)&main + 1);
__tsan_malloc(thr0, buf, 10, 0);
Modified: compiler-rt/trunk/lib/tsan/go/tsan_go.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/go/tsan_go.cc?rev=200766&r1=200765&r2=200766&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/go/tsan_go.cc (original)
+++ compiler-rt/trunk/lib/tsan/go/tsan_go.cc Tue Feb 4 08:45:54 2014
@@ -61,7 +61,7 @@ struct SymbolizeContext {
};
// Callback into Go.
-extern "C" void __tsan_symbolize(SymbolizeContext *ctx);
+static void (*symbolize_cb)(SymbolizeContext *ctx);
ReportStack *SymbolizeCode(uptr addr) {
ReportStack *s = (ReportStack*)internal_alloc(MBlockReportStack,
@@ -71,7 +71,7 @@ ReportStack *SymbolizeCode(uptr addr) {
SymbolizeContext ctx;
internal_memset(&ctx, 0, sizeof(ctx));
ctx.pc = addr;
- __tsan_symbolize(&ctx);
+ symbolize_cb(&ctx);
if (ctx.res) {
s->offset = ctx.off;
s->func = internal_strdup(ctx.func ? ctx.func : "??");
@@ -93,7 +93,8 @@ static ThreadState *AllocGoroutine() {
return thr;
}
-void __tsan_init(ThreadState **thrp) {
+void __tsan_init(ThreadState **thrp, void (*cb)(SymbolizeContext *cb)) {
+ symbolize_cb = cb;
ThreadState *thr = AllocGoroutine();
main_thr = *thrp = thr;
Initialize(thr);
More information about the llvm-commits
mailing list