aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime-gdb_test.go
diff options
context:
space:
mode:
authorDaniel Martí <mvdan@mvdan.cc>2018-08-09 17:25:13 +0100
committerDaniel Martí <mvdan@mvdan.cc>2018-08-09 22:15:04 +0000
commita0127c1921fdba2b4384d599407a3eedfe547803 (patch)
tree732b1f03ec2a40602af1acb46733cf48ea45ae7c /src/runtime/runtime-gdb_test.go
parentc166ff6838ff8a8b871f6efd265791442242ddad (diff)
downloadgo-a0127c1921fdba2b4384d599407a3eedfe547803.tar.gz
go-a0127c1921fdba2b4384d599407a3eedfe547803.zip
runtime: fix TestGdbPythonCgo failure with ld.gold
See the added comment for the reasoning behind the workaround. Fixes #26868. Change-Id: Idede020ec88a49595dc233d9a1346b12691186f4 Reviewed-on: https://go-review.googlesource.com/128815 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/runtime-gdb_test.go')
-rw-r--r--src/runtime/runtime-gdb_test.go19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/runtime/runtime-gdb_test.go b/src/runtime/runtime-gdb_test.go
index 4733efba6d..d9c6f6d22a 100644
--- a/src/runtime/runtime-gdb_test.go
+++ b/src/runtime/runtime-gdb_test.go
@@ -162,7 +162,22 @@ func testGdbPython(t *testing.T, cgo bool) {
args := []string{"-nx", "-q", "--batch",
"-iex", "add-auto-load-safe-path " + filepath.Join(runtime.GOROOT(), "src", "runtime"),
"-ex", "set startup-with-shell off",
- "-ex", "info auto-load python-scripts",
+ }
+ if cgo {
+ // When we build the cgo version of the program, the system's
+ // linker is used. Some external linkers, like GNU gold,
+ // compress the .debug_gdb_scripts into .zdebug_gdb_scripts.
+ // Until gold and gdb can work together, temporarily load the
+ // python script directly.
+ args = append(args,
+ "-ex", "source "+filepath.Join(runtime.GOROOT(), "src", "runtime", "runtime-gdb.py"),
+ )
+ } else {
+ args = append(args,
+ "-ex", "info auto-load python-scripts",
+ )
+ }
+ args = append(args,
"-ex", "set python print-stack full",
"-ex", "br fmt.Println",
"-ex", "run",
@@ -193,7 +208,7 @@ func testGdbPython(t *testing.T, cgo bool) {
"-ex", "goroutine 1 bt",
"-ex", "echo END\n",
filepath.Join(dir, "a.exe"),
- }
+ )
got, _ := exec.Command("gdb", args...).CombinedOutput()
t.Logf("gdb output: %s\n", got)