aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.go/hello.go
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2020-02-20 17:46:17 +0100
committerTom de Vries <tdevries@suse.de>2020-02-20 17:46:17 +0100
commita9c798035de33ccc3bc3e494449bbe931e900372 (patch)
tree282bd4d976cf45a29095bfb65be48091c58e20ad /gdb/testsuite/gdb.go/hello.go
parent52405d85ec748e4566b7893fa3cb9ff21c8a1bc4 (diff)
downloadgdb-a9c798035de33ccc3bc3e494449bbe931e900372.zip
gdb-a9c798035de33ccc3bc3e494449bbe931e900372.tar.gz
gdb-a9c798035de33ccc3bc3e494449bbe931e900372.tar.bz2
[gdb/testsuite] Fix hello.go xpass
With gdb.go/hello.go, we run into an xpass: ... Thread 1 "hello" hit Breakpoint 1, main.main () at hello.go:7^M 7 func main () {^M (gdb) print st^M $1 = 0x0 ""^M (gdb) XPASS: gdb.go/hello.exp: starting string check ... The xfail is setup as follows: ... \# This used to print "", i.e., the local "st" initialized as "". setup_xfail "*-*-*" gdb_test "print st" \ ".* = $hex \"\"" \ "starting string check" ... It's not clear what gccgo/gc PR this xfail refers to. It's also not clear why the empty string is both: - listed as reason for xfail, and - used in the pass pattern. Furthermore, there's a comment in the hello.go testcase: ... st := "Hello, world!" // this intentionally shadows the global "st" ... while there's no global st variable present, only a variable myst: ... var myst = "Shall we?" ... Fix this by splitting up the test-case in two test-cases, hello.{go,exp} and global-local-var-shadow.{go,exp}. In hello.exp we no longer attempt to print st before its declaration. In hello.go we remove the myst variable as well the comment related to shadowing. In global-local-var-shadow.go, we rename myst to st, such that the comment related to shadowing is correct. In global-local-var-shadow.exp we attempt to print the value of st before the local definition, which should print the value of the global definition, and xfail this with reference to GCC PR93844. Tested on x86_64-linux, with gccgo 10. gdb/testsuite/ChangeLog: 2020-02-20 Tom de Vries <tdevries@suse.de> PR go/17018 * gdb.go/hello.exp: Copy ... * gdb.go/global-local-var-shadow.exp: ... here. New file. Expect print of st to print value of global definition. Add xfail for GCC PR93844. * gdb.go/hello.exp: Remove printing of st before definition. * gdb.go/hello.go: Copy ... * gdb.go/global-local-var-shadow.go: ... here. New test. Rename myst to st. * gdb.go/hello.go: Remove myst. Remove comment about shadowing.
Diffstat (limited to 'gdb/testsuite/gdb.go/hello.go')
-rw-r--r--gdb/testsuite/gdb.go/hello.go5
1 files changed, 1 insertions, 4 deletions
diff --git a/gdb/testsuite/gdb.go/hello.go b/gdb/testsuite/gdb.go/hello.go
index 17b1d4a..67114dd 100644
--- a/gdb/testsuite/gdb.go/hello.go
+++ b/gdb/testsuite/gdb.go/hello.go
@@ -2,11 +2,8 @@ package main
import "fmt"
-var myst = "Shall we?"
-
func main () {
fmt.Println ("Before assignment")
- st := "Hello, world!" // this intentionally shadows the global "st"
+ st := "Hello, world!"
fmt.Println (st) // set breakpoint 1 here
- fmt.Println (myst)
}