LEFT | RIGHT |
1 // Copyright 2012 The Go Authors. All rights reserved. | 1 // Copyright 2012 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // +build race,linux,amd64 race,darwin,amd64 race,windows,amd64 | 5 // +build race,linux,amd64 race,darwin,amd64 race,windows,amd64 |
6 | 6 |
7 package race | 7 package race |
8 | 8 |
9 /* | 9 // This file merely ensures that we link in runtime/cgo in race build, |
10 void __tsan_init(void **racectx); | 10 // this is turn ensures that runtime uses pthread_create to create threads. |
| 11 // The prebuilt race runtime lives in race_GOOS_GOARCH.syso. |
| 12 // Calls to the runtime are done directly from src/pkg/runtime/race.c. |
| 13 |
| 14 // void __race_unused_func(void); |
11 import "C" | 15 import "C" |
12 | |
13 import ( | |
14 "runtime" | |
15 ) | |
16 | |
17 //export __tsan_symbolize | |
18 func __tsan_symbolize(pc uintptr, fun, file **C.char, line, off *C.int) C.int { | |
19 f := runtime.FuncForPC(pc) | |
20 if f == nil { | |
21 *fun = C.CString("??") | |
22 *file = C.CString("-") | |
23 *line = 0 | |
24 *off = C.int(pc) | |
25 return 1 | |
26 } | |
27 fi, l := f.FileLine(pc) | |
28 *fun = C.CString(f.Name()) | |
29 *file = C.CString(fi) | |
30 *line = C.int(l) | |
31 *off = C.int(pc - f.Entry()) | |
32 return 1 | |
33 } | |
34 */ | |
LEFT | RIGHT |