aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime-gdb_test.go
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2015-02-21 18:18:33 +0100
committerIan Lance Taylor <iant@golang.org>2015-02-25 02:36:41 +0000
commit1c82e236f5eed548ffc889ea4d7035a6ddc7b25c (patch)
tree24940e1b7210f7c563209f8c98a74d53b486d15a /src/runtime/runtime-gdb_test.go
parent9f926e81c262f11e2980a25f06ac17f3bbeb378a (diff)
downloadgo-1c82e236f5eed548ffc889ea4d7035a6ddc7b25c.tar.xz
gdb: fix map prettyprinter
(gdb) p x Python Exception <class 'gdb.error'> There is no member named b.: $2 = map[string]string -> (gdb) p x $1 = map[string]string = {["shane"] = "hansen"} Change-Id: I874d02a029f2ac9afc5ab666afb65760ec2c3177 Reviewed-on: https://go-review.googlesource.com/5522 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 36a0dc9e3c..1668f8b1bb 100644
--- a/src/runtime/runtime-gdb_test.go
+++ b/src/runtime/runtime-gdb_test.go
@@ -27,9 +27,15 @@ func checkGdbPython(t *testing.T) {
const helloSource = `
package main
import "fmt"
-func main() {
+func finish() {
fmt.Println("hi")
}
+func main() {
+ mapvar := make(map[string]string,5)
+ mapvar["abc"] = "def"
+ mapvar["ghi"] = "jkl"
+ finish()
+}
`
func TestGdbPython(t *testing.T) {
@@ -60,11 +66,15 @@ func TestGdbPython(t *testing.T) {
got, _ := exec.Command("gdb", "-nx", "-q", "--batch", "-iex",
fmt.Sprintf("add-auto-load-safe-path %s/src/runtime", runtime.GOROOT()),
- "-ex", "br 'main.main'",
+ "-ex", "br 'main.finish'",
"-ex", "run",
+ "-ex", "up",
"-ex", "echo BEGIN info goroutines\n",
"-ex", "info goroutines",
"-ex", "echo END\n",
+ "-ex", "echo BEGIN print mapvar\n",
+ "-ex", "print mapvar",
+ "-ex", "echo END\n",
filepath.Join(dir, "a.exe")).CombinedOutput()
firstLine := bytes.SplitN(got, []byte("\n"), 2)[0]
@@ -83,4 +93,9 @@ func TestGdbPython(t *testing.T) {
if bl := blocks["info goroutines"]; !infoGoroutinesRe.MatchString(bl) {
t.Fatalf("info goroutines failed: %s", bl)
}
+
+ printMapvarRe := regexp.MustCompile(`\Q = map[string]string = {["abc"] = "def", ["ghi"] = "jkl"}\E$`)
+ if bl := blocks["print mapvar"]; !printMapvarRe.MatchString(bl) {
+ t.Fatalf("print mapvar failed: %s", bl)
+ }
}