]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: make gdb test resilient to line numbering
authorKeith Randall <khr@golang.org>
Mon, 12 Sep 2016 22:19:36 +0000 (15:19 -0700)
committerKeith Randall <khr@golang.org>
Mon, 12 Sep 2016 23:13:12 +0000 (23:13 +0000)
Don't break on line number, instead break on the actual call.
This makes the test more robust to line numbering changes in the backend.

A CL (28950) changed the generated code line numbering slightly.  A MOVW
$0, R0 instruction at the start of the function changed to line
10 (because several constant zero instructions got CSEd, and one gets
picked arbitrarily).  That's too fragile for a test.

Change-Id: I5d6a8ef0603de7d727585004142780a527e70496
Reviewed-on: https://go-review.googlesource.com/29085
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/runtime/runtime-gdb_test.go

index 65161094fee27d7a29158268b139dfb5e66e4741..bb2905cf7c0364b77c1dfc2d031180b491e2c376 100644 (file)
@@ -105,17 +105,20 @@ func TestGdbPython(t *testing.T) {
                "-ex", "set startup-with-shell off",
                "-ex", "info auto-load python-scripts",
                "-ex", "set python print-stack full",
-               "-ex", "br main.go:10",
+               "-ex", "br fmt.Println",
                "-ex", "run",
                "-ex", "echo BEGIN info goroutines\n",
                "-ex", "info goroutines",
                "-ex", "echo END\n",
+               "-ex", "up", // up from fmt.Println to main
                "-ex", "echo BEGIN print mapvar\n",
                "-ex", "print mapvar",
                "-ex", "echo END\n",
                "-ex", "echo BEGIN print strvar\n",
                "-ex", "print strvar",
-               "-ex", "echo END\n"}
+               "-ex", "echo END\n",
+               "-ex", "down", // back to fmt.Println (goroutine 2 below only works at bottom of stack.  TODO: fix that)
+       }
 
        // without framepointer, gdb cannot backtrace our non-standard
        // stack frames on RISC architectures.