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: TestGdbPython fails on tip at fde4b9ed14 using gdb v8.2 #28499

Closed
shuLhan opened this issue Oct 31, 2018 · 4 comments
Closed

runtime: TestGdbPython fails on tip at fde4b9ed14 using gdb v8.2 #28499

shuLhan opened this issue Oct 31, 2018 · 4 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@shuLhan
Copy link
Contributor

shuLhan commented Oct 31, 2018

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

go version devel +6e2a13535f Wed Oct 31 11:36:39 2018 +0700 linux/amd64

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

GOARCH="amd64"
GOBIN="/home/ms/bin"
GOCACHE="/home/ms/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/ms/go"
GOPROXY=""
GORACE="history_size=7"
GOROOT="/home/ms/Programs/go"
GOTMPDIR=""
GOTOOLDIR="/home/ms/Programs/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build877907951=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Build the Go compiler from source.

What did you expect to see?

New Go compiler successfully build.

What did you see instead?

ok      regexp/syntax   0.618s
--- FAIL: TestGdbPython (1.71s)
    runtime-gdb_test.go:64: gdb version 8.2
    runtime-gdb_test.go:213: gdb output: Loading Go Runtime support.
        Loaded  Script
        Yes     /home/ms/git/go/src/runtime/runtime-gdb.py
        Breakpoint 1 at 0x47f770: file /home/ms/git/go/src/fmt/print.go, line 274.
        [New LWP 1749]
        [New LWP 1750]
        [New LWP 1751]
        [New LWP 1752]

        Thread 1 "a.exe" hit Breakpoint 1, fmt.Println (a=..., n=<optimized out>, err=...) at /home/ms/git/go/src/fmt/print.go:274
        274     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 waiting  runtime.gopark
        END
        #1  0x0000000000485c47 in main.main () at /tmp/go-build133295970/main.go:14
        14              fmt.Println("hi")
        BEGIN print mapvar
        $1 = map[string]string = {[0x4b658d "abc"] = 0x4b6599 "def", [0x4b65a5 "ghi"] = 0x4b65ae "jkl"}
        END
        BEGIN print strvar
        $2 = 0x4b658d "abc"
        END
        BEGIN info locals
        mapvar = map[string]string = {[0x4b658d "abc"] = 0x4b6599 "def", [0x4b65a5 "ghi"] = 0x4b65ae "jkl"}
        strvar = 0x4b658d "abc"
        slicevar = {array = 0xc000096000, len = 4941197, cap = 3}
        END
        #0  fmt.Println (a=..., n=<optimized out>, err=...) at /home/ms/git/go/src/fmt/print.go:274
        274     func Println(a ...interface{}) (n int, err error) {
        BEGIN goroutine 1 bt
        #0  fmt.Println (a=..., n=<optimized out>, err=...) at /home/ms/git/go/src/fmt/print.go:274
        #1  0x0000000000485c47 in main.main () at /tmp/go-build133295970/main.go:14
        END
        BEGIN goroutine 2 bt
        #0  runtime.gopark (unlockf=<optimized out>, lock=0x551b50 <runtime.forcegc>, reason=16 '\020', traceEv=20 '\024', traceskip=1) at /home/ms/git/go/src/runtime/proc.go:303
        #1  0x0000000000428f03 in runtime.goparkunlock (lock=0x551b50 <runtime.forcegc>, reason=16 '\020', traceEv=20 '\024', traceskip=1) at /home/ms/git/go/src/runtime/proc.go:308
        #2  0x0000000000428cca in runtime.forcegchelper () at /home/ms/git/go/src/runtime/proc.go:251
        #3  0x000000000044fd41 in runtime.goexit () at /home/ms/git/go/src/runtime/asm_amd64.s:1340
        #4  0x0000000000000000 in ?? ()
        END
        Breakpoint 2 at 0x485c72: file /tmp/go-build133295970/main.go, line 19.
        hi

        Thread 1 "a.exe" hit Breakpoint 2, main.main () at /tmp/go-build133295970/main.go:19
        19      }  // END_OF_PROGRAM
        BEGIN goroutine 1 bt at the end
        #0  main.main () at /tmp/go-build133295970/main.go:19
        END

    runtime-gdb_test.go:274: info locals failed: mapvar = map[string]string = {[0x4b658d "abc"] = 0x4b6599 "def", [0x4b65a5 "ghi"] = 0x4b65ae "jkl"}
        strvar = 0x4b658d "abc"
        slicevar = {array = 0xc000096000, len = 4941197, cap = 3}
--- FAIL: TestGdbPythonCgo (2.25s)
    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 0x481180: file /home/ms/git/go/src/fmt/print.go, line 274.
        [Thread debugging using libthread_db enabled]
        Using host libthread_db library "/usr/lib/libthread_db.so.1".
        [New Thread 0x7ffff5b62700 (LWP 1959)]
        [New Thread 0x7fffeffff700 (LWP 1962)]
        [New Thread 0x7ffff5361700 (LWP 1964)]
        [New Thread 0x7ffff4b60700 (LWP 1965)]
        [New Thread 0x7fffef7fe700 (LWP 1966)]

        Thread 1 "a.exe" hit Breakpoint 1, fmt.Println (a=..., n=<optimized out>, err=...) at /home/ms/git/go/src/fmt/print.go:274
        274     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 waiting  runtime.gopark
        END
        #1  0x0000000000487657 in main.main () at /tmp/go-build772824409/main.go:15
        15              fmt.Println("hi")
        BEGIN print mapvar
        $1 = map[string]string = {[0x4b95ad "abc"] = 0x4b95b9 "def", [0x4b95c5 "ghi"] = 0x4b95ce "jkl"}
        END
        BEGIN print strvar
        $2 = 0x4b95ad "abc"
        END
        BEGIN info locals
        mapvar = map[string]string = {[0x4b95ad "abc"] = 0x4b95b9 "def", [0x4b95c5 "ghi"] = 0x4b95ce "jkl"}
        strvar = 0x4b95ad "abc"
        slicevar = {array = 0xc0000a4000, len = 4953517, cap = 3}
        END
        #0  fmt.Println (a=..., n=<optimized out>, err=...) at /home/ms/git/go/src/fmt/print.go:274
        274     func Println(a ...interface{}) (n int, err error) {
        BEGIN goroutine 1 bt
        #0  fmt.Println (a=..., n=<optimized out>, err=...) at /home/ms/git/go/src/fmt/print.go:274
        #1  0x0000000000487657 in main.main () at /tmp/go-build772824409/main.go:15
        END
        BEGIN goroutine 2 bt
        #0  runtime.gopark (unlockf=<optimized out>, lock=0x556ca0 <runtime.forcegc>, reason=16 '\020', traceEv=20 '\024', traceskip=1) at /home/ms/git/go/src/runtime/proc.go:303
        #1  0x000000000042a843 in runtime.goparkunlock (lock=0x556ca0 <runtime.forcegc>, reason=16 '\020', traceEv=20 '\024', traceskip=1) at /home/ms/git/go/src/runtime/proc.go:308
        #2  0x000000000042a60a in runtime.forcegchelper () at /home/ms/git/go/src/runtime/proc.go:251
        #3  0x0000000000451811 in runtime.goexit () at /home/ms/git/go/src/runtime/asm_amd64.s:1340
        #4  0x0000000000000000 in ?? ()
        END
        Breakpoint 2 at 0x487682: file /tmp/go-build772824409/main.go, line 20.
        hi

        Thread 1 "a.exe" hit Breakpoint 2, main.main () at /tmp/go-build772824409/main.go:20
        20      }  // END_OF_PROGRAM
        BEGIN goroutine 1 bt at the end
        #0  main.main () at /tmp/go-build772824409/main.go:20
        END

    runtime-gdb_test.go:274: info locals failed: mapvar = map[string]string = {[0x4b95ad "abc"] = 0x4b95b9 "def", [0x4b95c5 "ghi"] = 0x4b95ce "jkl"}
        strvar = 0x4b95ad "abc"
        slicevar = {array = 0xc0000a4000, len = 4953517, cap = 3}
FAIL
FAIL    runtime 39.656s
@shuLhan shuLhan changed the title Building Go from source tip at fde4b9ed14 failed on runtime TestGdbPython Building Go from source tip at fde4b9ed14 failed on runtime TestGdbPython using gdb v8.2 Oct 31, 2018
@martisch
Copy link
Contributor

likely a result of http://golang.org/cl/141822. Different gdb versions give different output (e.g. order and with and without slice content). As discussed in the CL we should test each variable individually
to also cover:

mapvar = map[string]string = {[0x4b95ad "abc"] = 0x4b95b9 "def", [0x4b95c5 "ghi"] = 0x4b95ce "jkl"}
strvar = 0x4b95ad "abc"
slicevar = {array = 0xc0000a4000, len = 4953517, cap = 3}

@martisch martisch self-assigned this Oct 31, 2018
@martisch martisch added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 31, 2018
@martisch martisch added this to the Go1.12 milestone Oct 31, 2018
@agnivade agnivade changed the title Building Go from source tip at fde4b9ed14 failed on runtime TestGdbPython using gdb v8.2 runtime: TestGdbPython fails on tip at fde4b9ed14 failed using gdb v8.2 Oct 31, 2018
@agnivade
Copy link
Contributor

Renamed the issue appropriately. The compiler does not fail to build, just the test fails.

@shuLhan shuLhan changed the title runtime: TestGdbPython fails on tip at fde4b9ed14 failed using gdb v8.2 runtime: TestGdbPython fails on tip at fde4b9ed14 using gdb v8.2 Oct 31, 2018
@shuLhan
Copy link
Contributor Author

shuLhan commented Oct 31, 2018

@martisch seems like the generated output is different since the last fix with gdb v8.2 [1].
The following patch has been tested work on my environment,

@@ -264,9 +264,9 @@ func testGdbPython(t *testing.T, cgo bool) {
 	// back to its original form.
 
 	infoLocalsRe1 := regexp.MustCompile(`slicevar *= *\[\]string *= *{"def"}`)
 	// Format output from gdb v8.2
-	infoLocalsRe2 := regexp.MustCompile(`^slicevar = .*\nmapvar = .*\nstrvar = 0x[0-9a-f]+ "abc"`)
+	infoLocalsRe2 := regexp.MustCompile(`^mapvar = .*\nstrvar = 0x[0-9a-f]+ "abc"\nslicevar = .*`)
 	// Format output from gdb v7.7
 	infoLocalsRe3 := regexp.MustCompile(`^mapvar = .*\nstrvar = "abc"\nslicevar *= *\[\]string`)
 	if bl := blocks["info locals"]; !infoLocalsRe1.MatchString(bl) &&
 		!infoLocalsRe2.MatchString(bl) &&

[1] https://go-review.googlesource.com/c/go/+/135055

@gopherbot
Copy link

Change https://golang.org/cl/146598 mentions this issue: runtime: only check existance of variables in gdb info locals test

@golang golang locked and limited conversation to collaborators Nov 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants