mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: experiment which clobbers all dead pointer fields
The experiment "clobberdead" clobbers all pointer fields that the compiler thinks are dead, just before and after every safepoint. Useful for debugging the generation of live pointer bitmaps. Helped find the following issues: Update #15936 Update #16026 Update #16095 Update #18860 Change-Id: Id1d12f86845e3d93bae903d968b1eac61fc461f9 Reviewed-on: https://go-review.googlesource.com/23924 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
e516227554
commit
1e72bf6218
22 changed files with 225 additions and 14 deletions
|
|
@ -69,6 +69,7 @@ func checkGdbPython(t *testing.T) {
|
|||
|
||||
const helloSource = `
|
||||
import "fmt"
|
||||
import "runtime"
|
||||
var gslice []string
|
||||
func main() {
|
||||
mapvar := make(map[string]string,5)
|
||||
|
|
@ -78,9 +79,10 @@ func main() {
|
|||
ptrvar := &strvar
|
||||
slicevar := make([]string, 0, 16)
|
||||
slicevar = append(slicevar, mapvar["abc"])
|
||||
fmt.Println("hi") // line 12
|
||||
fmt.Println("hi") // line 13
|
||||
_ = ptrvar
|
||||
gslice = slicevar
|
||||
runtime.KeepAlive(mapvar)
|
||||
}
|
||||
`
|
||||
|
||||
|
|
@ -211,7 +213,7 @@ func testGdbPython(t *testing.T, cgo bool) {
|
|||
t.Fatalf("info locals failed: %s", bl)
|
||||
}
|
||||
|
||||
btGoroutineRe := regexp.MustCompile(`^#0\s+runtime.+at`)
|
||||
btGoroutineRe := regexp.MustCompile(`^#0\s+(0x[0-9a-f]+\s+in\s+)?runtime.+at`)
|
||||
if bl := blocks["goroutine 2 bt"]; !btGoroutineRe.MatchString(bl) {
|
||||
t.Fatalf("goroutine 2 bt failed: %s", bl)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue