Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: tests fail with GDB 8.2 on linux/amd64 #29963

Open
cuboci opened this issue Jan 28, 2019 · 6 comments

Comments

Projects
None yet
4 participants
@cuboci
Copy link

commented Jan 28, 2019

What version of Go are you using (go version)?

n/a

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

linux/amd64

What did you do?

Trying to build Go 1.11 from sources (git checkout release-branch.go1.11). I've tried to build it with my installed Go 1.11.4 version and also with a 1.4 compiler. Seems to be related to something in gdb 8.2.

$ git checkout https://go.googlesource.com/go go1.11
...
$ cd go1.11
$ git checkout release-branch.go1.11
...
$ export GOROOT_FINAL=/usr/local/go GOROOT_BOOTSTRAP=/home/chris/go1.4 GOBIN=/usr/local/bin
$ cd src
$ ./all.bash

I get the same error with 1.4 and 1.11.4 as the build compiler.

What did you expect to see?

All tests pass.

What did you see instead?

Building Go cmd/dist using /home/chris/go1.4.
Building Go toolchain1 using /home/chris/go1.4.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for linux/amd64.

##### Testing packages.
ok  	archive/tar	0.077s
ok  	archive/zip	2.882s
ok  	bufio	0.165s
ok  	bytes	0.411s
ok  	compress/bzip2	0.128s
ok  	compress/flate	0.939s
ok  	compress/gzip	0.056s
ok  	compress/lzw	0.029s
ok  	compress/zlib	0.036s
ok  	container/heap	0.022s
ok  	container/list	0.003s
ok  	container/ring	0.038s
ok  	context	0.986s
ok  	crypto	0.015s
ok  	crypto/aes	0.043s
ok  	crypto/cipher	0.017s
ok  	crypto/des	0.008s
ok  	crypto/dsa	0.017s
ok  	crypto/ecdsa	0.201s
ok  	crypto/elliptic	0.530s
ok  	crypto/hmac	0.021s
ok  	crypto/internal/subtle	0.003s
ok  	crypto/md5	0.003s
ok  	crypto/rand	0.076s
ok  	crypto/rc4	0.078s
ok  	crypto/rsa	0.106s
ok  	crypto/sha1	0.027s
ok  	crypto/sha256	0.012s
ok  	crypto/sha512	0.005s
ok  	crypto/subtle	0.028s
ok  	crypto/tls	0.969s
ok  	crypto/x509	1.186s
ok  	database/sql	0.553s
ok  	database/sql/driver	0.026s
ok  	debug/dwarf	0.015s
ok  	debug/elf	0.043s
ok  	debug/gosym	0.402s
ok  	debug/macho	0.004s
ok  	debug/pe	0.019s
ok  	debug/plan9obj	0.005s
ok  	encoding/ascii85	0.010s
ok  	encoding/asn1	0.009s
ok  	encoding/base32	0.051s
ok  	encoding/base64	0.007s
ok  	encoding/binary	0.018s
ok  	encoding/csv	0.030s
ok  	encoding/gob	0.106s
ok  	encoding/hex	0.017s
ok  	encoding/json	0.515s
ok  	encoding/pem	0.057s
ok  	encoding/xml	0.034s
ok  	errors	0.003s
ok  	expvar	0.027s
ok  	flag	0.016s
ok  	fmt	0.137s
ok  	go/ast	0.011s
ok  	go/build	0.142s
ok  	go/constant	0.005s
ok  	go/doc	0.048s
ok  	go/format	0.026s
ok  	go/importer	0.098s
ok  	go/internal/gccgoimporter	0.044s
ok  	go/internal/gcimporter	0.595s
ok  	go/internal/srcimporter	1.160s
ok  	go/parser	0.037s
ok  	go/printer	0.445s
ok  	go/scanner	0.013s
ok  	go/token	0.035s
ok  	go/types	1.139s
ok  	hash	0.025s
ok  	hash/adler32	0.025s
ok  	hash/crc32	0.011s
ok  	hash/crc64	0.006s
ok  	hash/fnv	0.003s
ok  	html	0.016s
ok  	html/template	0.037s
ok  	image	0.127s
ok  	image/color	0.043s
ok  	image/draw	0.073s
ok  	image/gif	0.485s
ok  	image/jpeg	0.243s
ok  	image/png	0.056s
ok  	index/suffixarray	0.041s
ok  	internal/cpu	0.013s
ok  	internal/poll	0.028s
ok  	internal/singleflight	0.023s
ok  	internal/trace	1.813s
ok  	io	0.038s
ok  	io/ioutil	0.088s
ok  	log	0.005s
ok  	log/syslog	1.258s
ok  	math	0.005s
ok  	math/big	2.675s
ok  	math/bits	0.014s
ok  	math/cmplx	0.016s
ok  	math/rand	0.325s
ok  	mime	0.029s
ok  	mime/multipart	0.587s
ok  	mime/quotedprintable	0.170s
ok  	net	1.986s
ok  	net/http	3.615s
ok  	net/http/cgi	0.741s
ok  	net/http/cookiejar	0.021s
ok  	net/http/fcgi	0.047s
ok  	net/http/httptest	0.020s
ok  	net/http/httptrace	0.036s
ok  	net/http/httputil	0.047s
ok  	net/http/internal	0.003s
ok  	net/http/pprof	2.029s
ok  	net/internal/socktest	0.016s
ok  	net/mail	0.005s
ok  	net/rpc	0.036s
ok  	net/rpc/jsonrpc	0.023s
ok  	net/smtp	0.022s
ok  	net/textproto	0.006s
ok  	net/url	0.011s
ok  	os	0.773s
ok  	os/exec	0.619s
ok  	os/signal	4.985s
ok  	os/user	0.029s
ok  	path	0.006s
ok  	path/filepath	0.028s
ok  	reflect	0.221s
ok  	regexp	0.181s
ok  	regexp/syntax	0.482s
--- FAIL: TestGdbAutotmpTypes (4.42s)
    runtime-gdb_test.go:64: gdb version 8.2
    runtime-gdb_test.go:436: could not find struct []main.astruct; in 'info typrs astruct' output
    runtime-gdb_test.go:437: gdb output:
        Loading Go Runtime support.
        Breakpoint 1 at 0x4548a0: file /tmp/go-build622162027/main.go, line 8.
        [New LWP 25143]
        [New LWP 25144]
        [New LWP 25146]
        [New LWP 25145]
        [New LWP 25147]
        
        Thread 1 "a.exe" hit Breakpoint 1, main.main () at /tmp/go-build622162027/main.go:8
        8	func main() {
        9		var iface interface{} = map[string]astruct{}
        All types matching regular expression "astruct":
        
        File internal/cpu:
        	[]main.astruct;
        	bucket;
        	hash;
        	main.astruct;
        	typedef hash * map[string]main.astruct;
        	typedef noalg.[8]main.astruct noalg.[8]main.astruct;
        	noalg.map.bucket[string]main.astruct;
        	noalg.map.hdr[string]main.astruct;
--- FAIL: TestGdbPython (1.49s)
    runtime-gdb_test.go:64: gdb version 8.2
    runtime-gdb_test.go:213: gdb output: Loading Go Runtime support.
        Loaded  Script                                                                 
        Yes     /home/chris/go1.11/src/runtime/runtime-gdb.py                          
        Breakpoint 1 at 0x47ec20: file /home/chris/go1.11/src/fmt/print.go, line 263.
        [New LWP 25402]
        [New LWP 25404]
        [New LWP 25405]
        [New LWP 25406]
        
        Thread 1 "a.exe" hit Breakpoint 1, fmt.Println (a=..., err=..., n=) at /home/chris/go1.11/src/fmt/print.go:263
        263	func Println(a ...interface{}) (n int, err error) {
        BEGIN info goroutines
        * 1 running  runtime.systemstack_switch
          2 waiting  runtime.gopark
          17 waiting  runtime.gopark
          18 runnable runtime.runfinq
        END
        #1  0x00000000004856a0 in main.main () at /tmp/go-build898877744/main.go:14
        14		fmt.Println("hi")
        BEGIN print mapvar
        $1 = map[string]string = {[0x4b50b6 "ghi"] = 0x4b50bf "jkl", [0x4b509e "abc"] = 0x4b50aa "def"}
        END
        BEGIN print strvar
        $2 = 0x4b509e "abc"
        END
        BEGIN info locals
        mapvar = map[string]string = {[0x4b50b6 "ghi"] = 0x4b50bf "jkl", [0x4b509e "abc"] = 0x4b50aa "def"}
        slicevar = {array = 0xc000092000, len = 1, cap = 16}
        strvar = 0x4b509e "abc"
        END
        #0  fmt.Println (a=..., err=..., n=) at /home/chris/go1.11/src/fmt/print.go:263
        263	func Println(a ...interface{}) (n int, err error) {
        BEGIN goroutine 1 bt
        #0  fmt.Println (a=..., err=..., n=) at /home/chris/go1.11/src/fmt/print.go:263
        #1  0x00000000004856a0 in main.main () at /tmp/go-build898877744/main.go:14
        END
        BEGIN goroutine 2 bt
        #0  runtime.gopark (lock=0x54cc70 , reason=16 '\020', traceEv=20 '\024', traceskip=1, unlockf=) at /home/chris/go1.11/src/runtime/proc.go:303
        #1  0x0000000000429123 in runtime.goparkunlock (lock=, reason=, traceEv=, traceskip=) at /home/chris/go1.11/src/runtime/proc.go:308
        #2  0x0000000000428ef3 in runtime.forcegchelper () at /home/chris/go1.11/src/runtime/proc.go:251
        #3  0x0000000000450d91 in runtime.goexit () at /home/chris/go1.11/src/runtime/asm_amd64.s:1333
        #4  0x0000000000000000 in ?? ()
        END
        Breakpoint 2 at 0x4856cd: file /tmp/go-build898877744/main.go, line 19.
        hi
        
        Thread 1 "a.exe" hit Breakpoint 2, main.main () at /tmp/go-build898877744/main.go:19
        19	}  // END_OF_PROGRAM
        BEGIN goroutine 1 bt at the end
        #0  main.main () at /tmp/go-build898877744/main.go:19
        END
        
    runtime-gdb_test.go:249: print mapvar failed: $1 = map[string]string = {[0x4b50b6 "ghi"] = 0x4b50bf "jkl", [0x4b509e "abc"] = 0x4b50aa "def"}
--- FAIL: TestGdbPythonCgo (4.76s)
    runtime-gdb_test.go:64: gdb version 8.2
    runtime-gdb_test.go:213: gdb output: Loading Go Runtime support.
        Loading Go Runtime support.
        Breakpoint 1 at 0x480680: file /home/chris/go1.11/src/fmt/print.go, line 263.
        [Thread debugging using libthread_db enabled]
        Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
        [New Thread 0x7ffff5b75700 (LWP 25579)]
        [New Thread 0x7ffff5374700 (LWP 25589)]
        [New Thread 0x7fffeffff700 (LWP 25599)]
        [New Thread 0x7ffff4b73700 (LWP 25596)]
        [New Thread 0x7fffef7fe700 (LWP 25606)]
        
        Thread 1 "a.exe" hit Breakpoint 1, fmt.Println (a=..., err=..., n=) at /home/chris/go1.11/src/fmt/print.go:263
        263	func Println(a ...interface{}) (n int, err error) {
        BEGIN info goroutines
        * 1 running  runtime.systemstack_switch
          2 waiting  runtime.gopark
          3 waiting  runtime.gopark
          4 runnable runtime.runfinq
        END
        #1  0x0000000000487100 in main.main () at /tmp/go-build873480149/main.go:15
        15		fmt.Println("hi")
        BEGIN print mapvar
        $1 = map[string]string = {[0x4b70be "abc"] = 0x4b70ca "def", [0x4b70d6 "ghi"] = 0x4b70df "jkl"}
        END
        BEGIN print strvar
        $2 = 0x4b70be "abc"
        END
        BEGIN info locals
        mapvar = map[string]string = {[0x4b70be "abc"] = 0x4b70ca "def", [0x4b70d6 "ghi"] = 0x4b70df "jkl"}
        slicevar = {array = 0xc00008c000, len = 1, cap = 16}
        strvar = 0x4b70be "abc"
        END
        #0  fmt.Println (a=..., err=..., n=) at /home/chris/go1.11/src/fmt/print.go:263
        263	func Println(a ...interface{}) (n int, err error) {
        BEGIN goroutine 1 bt
        #0  fmt.Println (a=..., err=..., n=) at /home/chris/go1.11/src/fmt/print.go:263
        #1  0x0000000000487100 in main.main () at /tmp/go-build873480149/main.go:15
        END
        BEGIN goroutine 2 bt
        #0  runtime.gopark (lock=0x54fda0 , reason=16 '\020', traceEv=20 '\024', traceskip=1, unlockf=) at /home/chris/go1.11/src/runtime/proc.go:303
        #1  0x000000000042a943 in runtime.goparkunlock (lock=, reason=, traceEv=, traceskip=) at /home/chris/go1.11/src/runtime/proc.go:308
        #2  0x000000000042a713 in runtime.forcegchelper () at /home/chris/go1.11/src/runtime/proc.go:251
        #3  0x0000000000452751 in runtime.goexit () at /home/chris/go1.11/src/runtime/asm_amd64.s:1333
        #4  0x0000000000000000 in ?? ()
        END
        Breakpoint 2 at 0x48712d: file /tmp/go-build873480149/main.go, line 20.
        hi
        
        Thread 1 "a.exe" hit Breakpoint 2, main.main () at /tmp/go-build873480149/main.go:20
        20	}  // END_OF_PROGRAM
        BEGIN goroutine 1 bt at the end
        #0  main.main () at /tmp/go-build873480149/main.go:20
        END
        
    runtime-gdb_test.go:249: print mapvar failed: $1 = map[string]string = {[0x4b70be "abc"] = 0x4b70ca "def", [0x4b70d6 "ghi"] = 0x4b70df "jkl"}
FAIL
FAIL	runtime	48.143s
ok  	runtime/debug	0.108s
ok  	runtime/internal/atomic	0.361s
ok  	runtime/internal/sys	0.009s
ok  	runtime/pprof	8.383s
ok  	runtime/pprof/internal/profile	0.005s
ok  	runtime/trace	3.840s
ok  	sort	0.107s
ok  	strconv	0.661s
ok  	strings	0.300s
ok  	sync	0.354s
ok  	sync/atomic	0.096s
ok  	syscall	0.100s
ok  	testing	0.920s
ok  	testing/quick	0.277s
ok  	text/scanner	0.030s
ok  	text/tabwriter	0.027s
ok  	text/template	0.357s
ok  	text/template/parse	0.028s
ok  	time	2.627s
ok  	unicode	0.004s
ok  	unicode/utf16	0.013s
ok  	unicode/utf8	0.012s
ok  	vendor/golang_org/x/crypto/chacha20poly1305	0.041s
ok  	vendor/golang_org/x/crypto/cryptobyte	0.007s
ok  	vendor/golang_org/x/crypto/curve25519	0.030s
ok  	vendor/golang_org/x/crypto/internal/chacha20	0.061s
ok  	vendor/golang_org/x/crypto/poly1305	0.029s
ok  	vendor/golang_org/x/net/dns/dnsmessage	0.075s
ok  	vendor/golang_org/x/net/http/httpguts	0.005s
ok  	vendor/golang_org/x/net/http/httpproxy	0.016s
ok  	vendor/golang_org/x/net/http2/hpack	0.011s
ok  	vendor/golang_org/x/net/idna	0.024s
ok  	vendor/golang_org/x/net/nettest	1.242s
ok  	vendor/golang_org/x/text/transform	0.077s
ok  	vendor/golang_org/x/text/unicode/norm	0.020s
ok  	cmd/addr2line	2.924s
ok  	cmd/api	0.009s
ok  	cmd/asm/internal/asm	1.136s
ok  	cmd/asm/internal/lex	0.009s
ok  	cmd/compile	0.043s
ok  	cmd/compile/internal/gc	11.430s
ok  	cmd/compile/internal/ssa	0.464s
ok  	cmd/compile/internal/syntax	0.020s
ok  	cmd/compile/internal/test	0.032s [no tests to run]
ok  	cmd/compile/internal/types	0.010s
ok  	cmd/cover	6.163s
ok  	cmd/doc	0.136s
ok  	cmd/fix	5.709s
ok  	cmd/go	69.450s
ok  	cmd/go/internal/cache	0.315s
ok  	cmd/go/internal/dirhash	0.007s
ok  	cmd/go/internal/generate	0.032s
ok  	cmd/go/internal/get	0.023s
ok  	cmd/go/internal/imports	0.006s
ok  	cmd/go/internal/load	0.023s
ok  	cmd/go/internal/modconv	0.015s
ok  	cmd/go/internal/modfetch	0.015s
ok  	cmd/go/internal/modfetch/codehost	0.013s
ok  	cmd/go/internal/modfile	0.016s
ok  	cmd/go/internal/modload	0.022s
ok  	cmd/go/internal/module	0.004s
ok  	cmd/go/internal/mvs	0.022s
ok  	cmd/go/internal/par	0.052s
ok  	cmd/go/internal/search	0.010s
ok  	cmd/go/internal/semver	0.012s
ok  	cmd/go/internal/txtar	0.029s
ok  	cmd/go/internal/web2	0.020s
ok  	cmd/go/internal/work	0.023s
ok  	cmd/gofmt	0.039s
ok  	cmd/internal/buildid	0.305s
ok  	cmd/internal/dwarf	0.027s
ok  	cmd/internal/edit	0.009s
ok  	cmd/internal/goobj	0.838s
ok  	cmd/internal/obj	0.019s
ok  	cmd/internal/obj/arm64	0.033s
ok  	cmd/internal/obj/x86	0.479s
ok  	cmd/internal/objabi	0.013s
ok  	cmd/internal/src	0.010s
ok  	cmd/internal/test2json	0.157s
ok  	cmd/link	0.642s
ok  	cmd/link/internal/ld	11.336s
ok  	cmd/link/internal/sym	0.030s
ok  	cmd/nm	4.612s
ok  	cmd/objdump	2.436s
ok  	cmd/pack	2.640s
ok  	cmd/trace	0.061s
ok  	cmd/vendor/github.com/google/pprof/internal/binutils	0.112s
ok  	cmd/vendor/github.com/google/pprof/internal/driver	0.274s
ok  	cmd/vendor/github.com/google/pprof/internal/elfexec	0.013s
ok  	cmd/vendor/github.com/google/pprof/internal/graph	0.010s
ok  	cmd/vendor/github.com/google/pprof/internal/measurement	0.006s
ok  	cmd/vendor/github.com/google/pprof/internal/report	0.107s
ok  	cmd/vendor/github.com/google/pprof/internal/symbolizer	0.007s
ok  	cmd/vendor/github.com/google/pprof/internal/symbolz	0.024s
ok  	cmd/vendor/github.com/google/pprof/profile	0.131s
ok  	cmd/vendor/github.com/ianlancetaylor/demangle	0.028s
ok  	cmd/vendor/golang.org/x/arch/arm/armasm	0.011s
ok  	cmd/vendor/golang.org/x/arch/arm64/arm64asm	0.191s
ok  	cmd/vendor/golang.org/x/arch/ppc64/ppc64asm	0.030s
ok  	cmd/vendor/golang.org/x/arch/x86/x86asm	0.171s
ok  	cmd/vendor/golang.org/x/crypto/ssh/terminal	0.011s
ok  	cmd/vendor/golang.org/x/sys/unix	0.388s
ok  	cmd/vet	2.781s
ok  	cmd/vet/internal/cfg	0.020s
2019/01/28 13:56:51 Failed: exit status 1
@cuboci

This comment has been minimized.

Copy link
Author

commented Jan 28, 2019

Btw, when I remove gdb temporarily from my system all tests pass.

@mvdan

This comment has been minimized.

Copy link
Member

commented Jan 28, 2019

Note that you don't need to run the tests to build Go. You can simply use ./make.bash.

But the test failure seems relevant. There's #28679 for GDB 8.2 as well, but the errors seem different.

@mvdan mvdan changed the title build: tests fail with latest release-branch.go1.11 runtime: tests fail with GDB 8.2 on linux/amd64 Jan 28, 2019

@mvdan

This comment has been minimized.

Copy link
Member

commented Jan 28, 2019

I can reproduce on master:

$ go version
go version devel +447965d4e0 Sun Jan 27 04:18:10 2019 +0000 linux/amd64
$ go test -run TestGdbAutotmpTypes runtime
--- FAIL: TestGdbAutotmpTypes (0.21s)
    runtime-gdb_test.go:68: gdb version 8.2
    runtime-gdb_test.go:442: could not find []main.astruct; in 'info typrs astruct' output
    runtime-gdb_test.go:443: gdb output:
        Breakpoint 1 at 0x455960
        [New LWP 19051]
        [New LWP 19052]
        [New LWP 19053]
        [New LWP 19054]

        Thread 1 "a.exe" hit Breakpoint 1, 0x0000000000455960 in main.main ()
        Single stepping until exit from function main.main,
        which has no line number information.
        0x000000000045001c in runtime.duffzero ()
        All types matching regular expression "astruct":
FAIL
FAIL    runtime 0.207s
@agnivade

This comment has been minimized.

Copy link
Member

commented Jan 28, 2019

Hmm .. this was raised before (#27933) and fixed with https://go-review.googlesource.com/c/go/+/135055. So, a regression ?

/cc @dr2chase @ianlancetaylor

@mvdan

This comment has been minimized.

Copy link
Member

commented Jan 28, 2019

Nice find!

@snmed

This comment has been minimized.

Copy link

commented Feb 9, 2019

F.Y.I
If I check out tag go1.11.5 and cherry pick the commit https://go-review.googlesource.com/c/go/+/135055 as well as fix the regex on line 266 and 268 (runtime-gdb_test.go). Now to compilation of the go binary works. But i'm not sure if the gdb output is correct and if i use the compiled go binary to build my go apps, that those apps haven't any flaws caused by the fix. Can anyone tell me the impact of the fix in case the output format of the gdb was incorrect while building the go binary?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.