diff mbox

GDB tests for Go language support: remove unnecessary first breakpoint

Message ID 87twwyshi2.fsf@br87z6lw.de.ibm.com
State New
Headers show

Commit Message

Andreas Arnez April 2, 2015, 2:59 p.m. UTC
On s390x targets some of the Go test cases fail because the first
breakpoint happens to be at the same spot as the breakpoint at
main.main.  When such a test case tries to continue to the first
breakpoint, the program runs until the end instead, and the test fails
like this:

FAIL: gdb.go/handcall.exp: Going to first breakpoint (the program exited)

This patch removes all the handling related to the first breakpoint in
those cases.  After applying the patch, the tests run successfully on
s390x.

gdb/testsuite/ChangeLog:

	* gdb.go/handcall.exp: Remove all logic related to the first
	breakpoint and rely on go_runto_main instead.
	* gdb.go/hello.exp: Likewise.
	* gdb.go/strings.exp: Likewise.
	* gdb.go/unsafe.exp: Likewise.
	* gdb.go/handcall.go: Remove comment "set breakpoint 1 here".
	* gdb.go/hello.go: Likewise.
	* gdb.go/strings.go: Likewise.
	* gdb.go/unsafe.go: Likewise.
---
 gdb/testsuite/gdb.go/handcall.exp | 8 --------
 gdb/testsuite/gdb.go/handcall.go  | 2 +-
 gdb/testsuite/gdb.go/hello.exp    | 7 -------
 gdb/testsuite/gdb.go/hello.go     | 2 +-
 gdb/testsuite/gdb.go/strings.exp  | 8 --------
 gdb/testsuite/gdb.go/strings.go   | 2 +-
 gdb/testsuite/gdb.go/unsafe.exp   | 8 --------
 gdb/testsuite/gdb.go/unsafe.go    | 2 +-
 8 files changed, 4 insertions(+), 35 deletions(-)

Comments

Doug Evans April 13, 2015, 8:19 p.m. UTC | #1
Andreas Arnez writes:
 > On s390x targets some of the Go test cases fail because the first
 > breakpoint happens to be at the same spot as the breakpoint at
 > main.main.  When such a test case tries to continue to the first
 > breakpoint, the program runs until the end instead, and the test fails
 > like this:
 > 
 > FAIL: gdb.go/handcall.exp: Going to first breakpoint (the program exited)
 > 
 > This patch removes all the handling related to the first breakpoint in
 > those cases.  After applying the patch, the tests run successfully on
 > s390x.
 > 
 > gdb/testsuite/ChangeLog:
 > 
 > 	* gdb.go/handcall.exp: Remove all logic related to the first
 > 	breakpoint and rely on go_runto_main instead.
 > 	* gdb.go/hello.exp: Likewise.
 > 	* gdb.go/strings.exp: Likewise.
 > 	* gdb.go/unsafe.exp: Likewise.
 > 	* gdb.go/handcall.go: Remove comment "set breakpoint 1 here".
 > 	* gdb.go/hello.go: Likewise.
 > 	* gdb.go/strings.go: Likewise.
 > 	* gdb.go/unsafe.go: Likewise.

Hi.
Ok with one nit fixed.

 > diff --git a/gdb/testsuite/gdb.go/hello.exp b/gdb/testsuite/gdb.go/hello.exp
 > index 577d9a0..898a04a 100644
 > --- a/gdb/testsuite/gdb.go/hello.exp
 > +++ b/gdb/testsuite/gdb.go/hello.exp
 > @@ -27,7 +27,6 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug go}] } {
 >      return -1
 >  }
 >  
 > -set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
 >  set bp_location2 [gdb_get_line_number "set breakpoint 2 here"]

Can you rename breakpoint 2 to 1?
I see there's two appearances of "set breakpoint 2 here" in hello.go.
Just delete the second copy.

Thanks.
diff mbox

Patch

diff --git a/gdb/testsuite/gdb.go/handcall.exp b/gdb/testsuite/gdb.go/handcall.exp
index 44c03c4..b57535a 100644
--- a/gdb/testsuite/gdb.go/handcall.exp
+++ b/gdb/testsuite/gdb.go/handcall.exp
@@ -27,18 +27,10 @@  if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug go}] } {
     return -1
 }
 
-set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
-
 if { [go_runto_main] < 0 } {
     untested $testfile
     return -1
 }
 
-if { [gdb_breakpoint ${srcfile}:${bp_location1}] } {
-    pass "setting breakpoint 1"
-}
-
-gdb_test "cont" "Breakpoint .*:${bp_location1}.*" "Going to first breakpoint"
-
 gdb_test "print add (1, 2)" " = 3"
 gdb_test "print main.add (1, 2)" " = 3"
diff --git a/gdb/testsuite/gdb.go/handcall.go b/gdb/testsuite/gdb.go/handcall.go
index f32b5e9..c09d997 100644
--- a/gdb/testsuite/gdb.go/handcall.go
+++ b/gdb/testsuite/gdb.go/handcall.go
@@ -11,5 +11,5 @@  func sub (a,b int) (int) {
 var v_int int
 
 func main () {
-  v_int = 42 // set breakpoint 1 here
+  v_int = 42
 }
diff --git a/gdb/testsuite/gdb.go/hello.exp b/gdb/testsuite/gdb.go/hello.exp
index 577d9a0..898a04a 100644
--- a/gdb/testsuite/gdb.go/hello.exp
+++ b/gdb/testsuite/gdb.go/hello.exp
@@ -27,7 +27,6 @@  if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug go}] } {
     return -1
 }
 
-set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
 set bp_location2 [gdb_get_line_number "set breakpoint 2 here"]
 
 if { [go_runto_main] < 0 } {
@@ -35,12 +34,6 @@  if { [go_runto_main] < 0 } {
     return -1
 }
 
-if { [gdb_breakpoint ${srcfile}:${bp_location1}] } {
-    pass "setting breakpoint 1"
-}
-
-gdb_test "cont" "Breakpoint .*:${bp_location1}.*" "Going to first breakpoint"
-
 # This used to print "", i.e., the local "st" initialized as "".
 setup_xfail "*-*-*"
 
diff --git a/gdb/testsuite/gdb.go/hello.go b/gdb/testsuite/gdb.go/hello.go
index 6e56112..6dd1b22 100644
--- a/gdb/testsuite/gdb.go/hello.go
+++ b/gdb/testsuite/gdb.go/hello.go
@@ -5,7 +5,7 @@  import "fmt"
 var myst = "Shall we?"
 
 func main () {
-  fmt.Println ("Before assignment") // set breakpoint 1 here
+  fmt.Println ("Before assignment")
   st := "Hello, world!" // this intentionally shadows the global "st"
   fmt.Println (st) // set breakpoint 2 here
   fmt.Println (myst) // set breakpoint 2 here
diff --git a/gdb/testsuite/gdb.go/strings.exp b/gdb/testsuite/gdb.go/strings.exp
index 9274a54..246d7eb 100644
--- a/gdb/testsuite/gdb.go/strings.exp
+++ b/gdb/testsuite/gdb.go/strings.exp
@@ -25,17 +25,9 @@  if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug go}] } {
     return -1
 }
 
-set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
-
 if { [go_runto_main] < 0 } {
     untested $testfile
     return -1
 }
 
-if { [gdb_breakpoint ${srcfile}:${bp_location1}] } {
-    pass "setting breakpoint 1"
-}
-
-gdb_test "cont" "Breakpoint .*:${bp_location1}.*" "Going to first breakpoint"
-
 gdb_test {print "abc" + "def"} {.* = "abcdef"}
diff --git a/gdb/testsuite/gdb.go/strings.go b/gdb/testsuite/gdb.go/strings.go
index fc62e39..c80f081 100644
--- a/gdb/testsuite/gdb.go/strings.go
+++ b/gdb/testsuite/gdb.go/strings.go
@@ -5,6 +5,6 @@  import "fmt"
 var v_string string = "foo"
 
 func main () {
-  fmt.Println ("hello") // set breakpoint 1 here
+  fmt.Println ("hello")
   fmt.Printf ("%s\n", v_string)
 }
diff --git a/gdb/testsuite/gdb.go/unsafe.exp b/gdb/testsuite/gdb.go/unsafe.exp
index 6017dcb..a631f85 100644
--- a/gdb/testsuite/gdb.go/unsafe.exp
+++ b/gdb/testsuite/gdb.go/unsafe.exp
@@ -27,17 +27,9 @@  if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug go}] } {
     return -1
 }
 
-set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
-
 if { [go_runto_main] < 0 } {
     untested $testfile
     return -1
 }
 
-if { [gdb_breakpoint ${srcfile}:${bp_location1}] } {
-    pass "setting breakpoint 1"
-}
-
-gdb_test "cont" "Breakpoint .*:${bp_location1}.*" "Going to first breakpoint"
-
 gdb_test "print unsafe.Sizeof(42)" ".* = 4"
diff --git a/gdb/testsuite/gdb.go/unsafe.go b/gdb/testsuite/gdb.go/unsafe.go
index 95318bd..ac8a6f6 100644
--- a/gdb/testsuite/gdb.go/unsafe.go
+++ b/gdb/testsuite/gdb.go/unsafe.go
@@ -6,6 +6,6 @@  import ("fmt"
 var mystring = "Shall we?"
 
 func main () {
-  fmt.Printf ("%d\n", unsafe.Sizeof (42)) // set breakpoint 1 here
+  fmt.Printf ("%d\n", unsafe.Sizeof (42))
   fmt.Printf ("%d\n", unsafe.Sizeof (mystring))
 }