Commit db44223f authored by Dmitry Vyukov's avatar Dmitry Vyukov

runtime: fix getcallerpc args

Change-Id: I6b14b8eecf125dd74bd40f4e7fff6b49de150e42
Reviewed-on: https://go-review.googlesource.com/19897
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: 's avatarKeith Randall <khr@golang.org>
parent 30f93f09
...@@ -180,4 +180,21 @@ func TestFail(t *testing.T) { ...@@ -180,4 +180,21 @@ func TestFail(t *testing.T) {
PASS PASS
Found 1 data race\(s\) Found 1 data race\(s\)
FAIL`}, FAIL`},
{"slicebytetostring_pc", "run", "atexit_sleep_ms=0", `
package main
func main() {
done := make(chan string)
data := make([]byte, 10)
go func() {
done <- string(data)
}()
data[0] = 1
<-done
}
`, `
runtime\.slicebytetostring\(\)
.*/runtime/string\.go:.*
main\.main\.func1\(\)
.*/main.go:7`},
} }
...@@ -84,7 +84,7 @@ func slicebytetostring(buf *tmpBuf, b []byte) string { ...@@ -84,7 +84,7 @@ func slicebytetostring(buf *tmpBuf, b []byte) string {
if raceenabled && l > 0 { if raceenabled && l > 0 {
racereadrangepc(unsafe.Pointer(&b[0]), racereadrangepc(unsafe.Pointer(&b[0]),
uintptr(l), uintptr(l),
getcallerpc(unsafe.Pointer(&b)), getcallerpc(unsafe.Pointer(&buf)),
funcPC(slicebytetostring)) funcPC(slicebytetostring))
} }
if msanenabled && l > 0 { if msanenabled && l > 0 {
...@@ -189,7 +189,7 @@ func slicerunetostring(buf *tmpBuf, a []rune) string { ...@@ -189,7 +189,7 @@ func slicerunetostring(buf *tmpBuf, a []rune) string {
if raceenabled && len(a) > 0 { if raceenabled && len(a) > 0 {
racereadrangepc(unsafe.Pointer(&a[0]), racereadrangepc(unsafe.Pointer(&a[0]),
uintptr(len(a))*unsafe.Sizeof(a[0]), uintptr(len(a))*unsafe.Sizeof(a[0]),
getcallerpc(unsafe.Pointer(&a)), getcallerpc(unsafe.Pointer(&buf)),
funcPC(slicerunetostring)) funcPC(slicerunetostring))
} }
if msanenabled && len(a) > 0 { if msanenabled && len(a) > 0 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment