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

gdb: Stack pointer is 0 for goroutine 1 #10468

dwbuiten opened this issue Apr 15, 2015 · 0 comments


Copy link

commented Apr 15, 2015

I noted this while writing 53840ad, so here is a proper bug report.

This only occurs for goroutine #1, and causes a Python exception. As far as I can tell, it is because for goroutine 1, pc is valid but sp is 0x0, in runtime.allgs.sched. I am not familiar enough with the runtime to discern more currently - i.e. whether it should be fixed in the runtime, or the Python script. I have reproduced on both Linux and FreeBSD. Details are below.

Operating System:

FreeBSD 10.1-RELEASE-p9 FreeBSD 10.1-RELEASE-p9 #0: Tue Apr  7 01:09:46 UTC 2015  amd64`

But it is reproducible on Debian Unstable with vanilla packages as well.

GDB Version: GNU gdb (GDB) 7.8.2 [GDB v7.8.2 for FreeBSD]
Go version: go version devel +888d44d Wed Apr 15 12:26:24 2015 +0000 freebsd/amd64

How to reproduce:

daemon404@bb-nas:~/test$ cat test.go
package main
import "fmt"
func main() {
        mapvar := make(map[string]string,5)
        mapvar["abc"] = "def"
        mapvar["ghi"] = "jkl"
        strvar := "abc"
        ptrvar := &strvar
        fmt.Println("hi") // line 10
        _ = ptrvar
daemon404@bb-nas:~/test$ gdb782 ./test
GNU gdb (GDB) 7.8.2 [GDB v7.8.2 for FreeBSD]
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
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-portbld-freebsd10.1".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
Find the GDB manual and other documentation resources online at:
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./test...done.
Loading Go Runtime support.
(gdb) br test.go:9
Breakpoint 1 at 0x400d5c: file /home/daemon404/test/test.go, line 9.
(gdb) r
Starting program: /usr/home/daemon404/test/test

Breakpoint 1, main.main () at /home/daemon404/test/test.go:9
9               fmt.Println("hi") // line 10
(gdb) info goroutine
* 1 running  runtime.systemstack_switch
  2 waiting  runtime.gopark
  3 waiting  runtime.gopark
  4 runnable runtime.runfinq
(gdb) goroutine 1 bt
#0  runtime.systemstack_switch () at /home/daemon404/go/src/runtime/asm_amd64.s:216
Backtrace stopped: Cannot access memory at address 0x0

@ianlancetaylor ianlancetaylor changed the title [runtime/gdb] Stack pointer is 0 for goroutine 1 gdb: Stack pointer is 0 for goroutine 1 Jun 3, 2015

@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Jun 3, 2015

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