]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: invoke gdb more carefully in ssa/debug_test.go
authorDavid Chase <drchase@google.com>
Mon, 26 Mar 2018 17:37:00 +0000 (13:37 -0400)
committerDavid Chase <drchase@google.com>
Mon, 26 Mar 2018 18:44:52 +0000 (18:44 +0000)
Gdb can be sensitive to contents of .gdbinit, and to run
this test properly needs to have runtime/runtime-gdb.py
on the auto load safe path.  Therefore, turn off .gdbinit
loading and explicitly add $GOROOT/runtime to the safe
load path.

This should make ssa/debug_test.go run more consistently.

Updates #24464.

Change-Id: I63ed17c032cb3773048713ce51fca3a3f86e79b6
Reviewed-on: https://go-review.googlesource.com/102598
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/compile/internal/ssa/debug_test.go

index ff9f17525be0df7fc7db1800262a36fcab45ee17..d0a7a69db9ad789dd6267e3d555c98d549c01bbc 100644 (file)
@@ -551,7 +551,9 @@ type gdbState struct {
 
 func newGdb(tag, executable string, args ...string) dbgr {
        // Turn off shell, necessary for Darwin apparently
-       cmd := exec.Command(gdb, "-ex", "set startup-with-shell off", executable)
+       cmd := exec.Command(gdb, "-nx",
+               "-iex", fmt.Sprintf("add-auto-load-safe-path %s/src/runtime", runtime.GOROOT()),
+               "-ex", "set startup-with-shell off", executable)
        cmd.Env = replaceEnv(cmd.Env, "TERM", "dumb")
        s := &gdbState{tagg: tag, cmd: cmd, args: args}
        s.atLineRe = regexp.MustCompile("(^|\n)([0-9]+)(.*)")