aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/race.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2015-02-14 15:54:25 +0300
committerDmitry Vyukov <dvyukov@google.com>2015-02-20 18:04:16 +0000
commit3fc529eabe4f26939959dd3b98aae314271e0a08 (patch)
tree8501a688c265bf38d7d5b41df1c3911608887519 /src/runtime/race.go
parent89a091de2405d0b03c015a322ac27bc749aaca8a (diff)
downloadgo-3fc529eabe4f26939959dd3b98aae314271e0a08.tar.gz
go-3fc529eabe4f26939959dd3b98aae314271e0a08.zip
runtime: adjust program counters in race detector
In most cases we pass return PC to race detector, and race runtime subtracts one from them. However, in manual instrumentation in runtime we pass function start PC to race runtime. Race runtime can't distinguish these cases and so it does not subtract one from top PC. This leads to bogus line numbers in some cases. Make it consistent and always pass what looks like a return PC, so that race runtime can subtract one and still get PC in the same function. Also delete two unused functions. Update #8053 Change-Id: I4242dec5e055e460c9a8990eaca1d085ae240ed2 Reviewed-on: https://go-review.googlesource.com/4902 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/race.go')
-rw-r--r--src/runtime/race.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/runtime/race.go b/src/runtime/race.go
index e7703ba770..923d6113f6 100644
--- a/src/runtime/race.go
+++ b/src/runtime/race.go
@@ -23,6 +23,9 @@ func RaceSemrelease(s *uint32)
// private interface for the runtime
const raceenabled = true
+// For all functions accepting callerpc and pc,
+// callerpc is a return PC of the function that calls this function,
+// pc is start PC of the function that calls this function.
func raceReadObjectPC(t *_type, addr unsafe.Pointer, callerpc, pc uintptr) {
kind := t.kind & kindMask
if kind == kindArray || kind == kindStruct {