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: Go 1.6.1 TestGDBPython is failing on linux amd64 #15354

Closed
williamh opened this issue Apr 18, 2016 · 10 comments
Closed

runtime: Go 1.6.1 TestGDBPython is failing on linux amd64 #15354

williamh opened this issue Apr 18, 2016 · 10 comments
Milestone

Comments

@williamh
Copy link

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
  2. What operating system and processor architecture are you using (go env)?
  3. What did you do?
    If possible, provide a recipe for reproducing the error.
    A complete runnable program is good.
    A link on play.golang.org is best.
  4. What did you expect to see?
  5. What did you see instead?

I am the maintainer of Go on Gentoo Linux, and I have gotten a couple of reports of this test failing. I checked on my system, and it fails like this:

--- FAIL: TestGdbPython (0.65s)
runtime-gdb_test.go:42: gdb version 7.10
runtime-gdb_test.go:148: info goroutines failed: END
BEGIN print mapvar
No symbol "mapvar" in current context.
FAIL
FAIL runtime 13.576s

Any help would be appreciated.

@ianlancetaylor ianlancetaylor changed the title Go 1.6.1 TestGDBPython is failing on linux amd64 runtime: Go 1.6.1 TestGDBPython is failing on linux amd64 Apr 18, 2016
@ianlancetaylor ianlancetaylor added this to the Go1.7 milestone Apr 18, 2016
@ianlancetaylor
Copy link
Contributor

If you put a trivial "hello, world" in program in hello.go, what is the output of

go build hello.go
gdb hello
start
info goroutines

@williamh
Copy link
Author

On Mon, Apr 18, 2016 at 03:23:00PM -0700, Ian Lance Taylor wrote:

If you put a trivial "hello, world" in program in hello.go, what is the output of

go build hello.go
gdb hello
start
info goroutines

william@linux1 hello $ cat hello.go
package main

import "fmt"
func main() {
fmt.Println("Hello world")
}
william@linux1 hello $ go build hello
william@linux1 hello $ gdb hello
GNU gdb (Gentoo 7.11 vanilla) 7.11
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
https://bugs.gentoo.org/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from hello...done.
warning: File "/usr/lib64/go/src/runtime/runtime-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
add-auto-load-safe-path /usr/lib64/go/src/runtime/runtime-gdb.py
line to your configuration file "/home/william/.gdbinit".
To completely disable this security protection add
set auto-load safe-path /
line to your configuration file "/home/william/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual. E.g., run from the shell:
info "(gdb)Auto-loading safe path"
(gdb) start
Temporary breakpoint 1 at 0x401000: file /home/william/go/src/hello/hello.go, line 4.
Starting program: /home/william/go/src/hello/hello
[New LWP 5764]
[New LWP 5765]
[New LWP 5766]
[New LWP 5767]

Thread 1 "hello" hit Temporary breakpoint 1, main.main ()
at /home/william/go/src/hello/hello.go:4
4 func main() {
(gdb) info goroutines
Undefined info command: "goroutines". Try "help info".
(gdb) quit
A debugging session is active.

Inferior 1 [process 5760] will be killed.

Quit anyway? (y or n) y
william@linux1 hello $ exit
exit

@ianlancetaylor
Copy link
Contributor

Well, that didn't work, because of this:

warning: File "/usr/lib64/go/src/runtime/runtime-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".

Try the same thing, but this time run

gdb -iex 'add-auto-load-safe-path /usr/lib64/go/src/runtime' hello

@williamh
Copy link
Author

william@linux1 hello $ gdb -iex 'add-auto-load-safe-path /usr/lib64/go/src/runti me' hello
GNU gdb (Gentoo 7.11 vanilla) 7.11
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
https://bugs.gentoo.org/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from hello...done.
Loading Go Runtime support.
(gdb) start
Temporary breakpoint 1 at 0x401000: file /home/william/go/src/hello/hello.go, line 4.
Starting program: /home/william/go/src/hello/hello
[New LWP 10142]
[New LWP 10143]
[New LWP 10144]
[New LWP 10145]

Thread 1 "hello" hit Temporary breakpoint 1, main.main ()
at /home/william/go/src/hello/hello.go:4
4 func main() {
(gdb) info goroutines

  • 1 running runtime.systemstack_switch
    2 waiting runtime.gopark
    3 waiting runtime.gopark
    4 waiting runtime.gopark
    (gdb) quit
    A debugging session is active.

    Inferior 1 [process 10138] will be killed.

Quit anyway? (y or n) y
william@linux1 hello $ exit

@ianlancetaylor
Copy link
Contributor

Thanks. Unfortunately I have no idea why the test is failing. Someone with access to the failing system is going to have to debug this.

@williamh
Copy link
Author

Hi,

Now there is more information about what is going on in the Gentoo bug, see
https://bugs.gentoo.org/show_bug.cgi?id=581072#C1

@cuihtlauac
Copy link
Contributor

cuihtlauac commented May 17, 2016

I experienced the same issue on my amd64 Ubuntu 14.04 machine. I was able to get around it using the following patch:

--- a/src/runtime/runtime-gdb_test.go
+++ b/src/runtime/runtime-gdb_test.go
@@ -98,6 +98,7 @@ func TestGdbPython(t *testing.T) {

        args := []string{"-nx", "-q", "--batch", "-iex",
               fmt.Sprintf("add-auto-load-safe-path %s/src/runtime", runtime.GO
+              "-ex", "set startup-with-shell off",
               "-ex", "info auto-load python-scripts",
               "-ex", "br main.go:10",
               "-ex", "run",

I must admit I don't understand why "startup-with-shell" is set to "on" by default on my machine.

@cuihtlauac
Copy link
Contributor

cuihtlauac commented May 17, 2016

Actually, I had to add the same line twice to pass all the tests:

--- a/src/runtime/runtime-gdb_test.go
+++ b/src/runtime/runtime-gdb_test.go
@@ -98,6 +98,7 @@ func TestGdbPython(t *testing.T) {

        args := []string{"-nx", "-q", "--batch", "-iex",
                fmt.Sprintf("add-auto-load-safe-path %s/src/runtime", runtime.GO
+               "-ex", "set startup-with-shell off",
                "-ex", "info auto-load python-scripts",
                "-ex", "br main.go:10",
                "-ex", "run",
@@ -226,6 +227,7 @@ func TestGdbBacktrace(t *testing.T) {

        // Execute gdb commands.
        args := []string{"-nx", "-batch",
+               "-ex", "set startup-with-shell off",
                "-ex", "break main.eee",
                "-ex", "run",
                "-ex", "backtrace",

@cuihtlauac
Copy link
Contributor

Submitted the patch for review: https://go-review.googlesource.com/#/c/23142/

@gopherbot
Copy link

CL https://golang.org/cl/23142 mentions this issue.

@golang golang locked and limited conversation to collaborators May 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants