cmd/ld: restore .debug_gdb_script section after runtime reorganization
On some systems, gdb refuses to load Python plugin from arbitrary
paths, so we have to add $GOROOT/src/runtime to auto-load-safe-path
in the gdb script test.
Change-Id: Icc44baab8d04a65bd21ceac2ab8ddb13c8d083e8
Reviewed-on: https://go-review.googlesource.com/2905
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
diff --git a/src/runtime/runtime-gdb_test.go b/src/runtime/runtime-gdb_test.go
index 4a74dd3..7540fbf 100644
--- a/src/runtime/runtime-gdb_test.go
+++ b/src/runtime/runtime-gdb_test.go
@@ -1,21 +1,23 @@
package runtime_test
import (
+ "fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
+ "runtime"
"testing"
)
func checkGdbPython(t *testing.T) {
- cmd := exec.Command("gdb", "-nx", "-q", "--batch", "-ex", "python import sys; print('golang gdb python support')")
+ cmd := exec.Command("gdb", "-nx", "-q", "--batch", "-ex", "python import sys; print('go gdb python support')")
out, err := cmd.CombinedOutput()
if err != nil {
- t.Skipf("skipping due to issue running gdb%v", err)
+ t.Skipf("skipping due to issue running gdb: %v", err)
}
- if string(out) != "golang gdb python support\n" {
+ if string(out) != "go gdb python support\n" {
t.Skipf("skipping due to lack of python gdb support: %s", out)
}
}
@@ -29,7 +31,6 @@
`
func TestGdbLoadRuntimeSupport(t *testing.T) {
-
checkGdbPython(t)
dir, err := ioutil.TempDir("", "go-build")
@@ -51,7 +52,8 @@
t.Fatalf("building source %v\n%s", err, out)
}
- got, _ := exec.Command("gdb", "-nx", "-q", "--batch", "-ex", "source runtime-gdb.py",
+ got, _ := exec.Command("gdb", "-nx", "-q", "--batch", "-iex",
+ fmt.Sprintf("add-auto-load-safe-path %s/src/runtime", runtime.GOROOT()),
filepath.Join(dir, "a.exe")).CombinedOutput()
if string(got) != "Loading Go Runtime support.\n" {
t.Fatalf("%s", got)