GDB support for goroutines in core files

298 views
Skip to first unread message

Aaron Jacobs

unread,
Jan 19, 2016, 12:32:49 AM1/19/16
to golang-nuts
Hi Go folks,

Is it expected that GDB commands like `goroutine 1 bt` don't work from core
files (as opposed to with a live process attached)? If it's a known limitation,
is there any chance it will be lifted at some point?

When I attempt to use such a command from a core file, I often get this:

Python Exception <class 'gdb.error'> You can't do that without a
process to debug.:

and sometimes this:

Python Exception <class 'gdb.MemoryError'> Cannot access memory at
address 0x7f0395b97bc0:

Transcript below.

Thanks,
Aaron

================================================

% go version
go version go1.5.2 linux/amd64

% gdb --version
GNU gdb (GDB) 7.9-gg17
[...]

% cat /tmp/foo.go
package main

func main() {
panic(0)
}

% go build -o /tmp/foo /tmp/foo.go && GOTRACEBACK=crash /tmp/foo
panic: 0
[...]

% gdb /tmp/foo ./core
[...]
(gdb) source ~/clients/go/src/runtime/runtime-gdb.py
Loading Go Runtime support.
(gdb) info goroutines
* 1 running runtime.systemstack_switch
2 waiting runtime.gopark
3 waiting runtime.gopark
(gdb) goroutine 1 bt
Python Exception <class 'gdb.error'> You can't do that without a
process to debug.:
Error occurred in Python command: You can't do that without a process to debug.
(gdb) goroutine 2 bt
Python Exception <class 'gdb.error'> You can't do that without a
process to debug.:
Error occurred in Python command: You can't do that without a process to debug.

Ian Lance Taylor

unread,
Jan 19, 2016, 1:08:59 AM1/19/16
to Aaron Jacobs, golang-nuts
On Mon, Jan 18, 2016 at 8:03 PM, 'Aaron Jacobs' via golang-nuts
<golan...@googlegroups.com> wrote:
>
> Is it expected that GDB commands like `goroutine 1 bt` don't work from core
> files (as opposed to with a live process attached)?

I don't know, but it sounds like it doesn't work.

> If it's a known limitation,
> is there any chance it will be lifted at some point?

I'm not aware of anybody working on the gdb runtime support. If
someone wants to figure this out, that would be great.

Ian

huangba...@sina.cn

unread,
Dec 2, 2016, 9:57:46 AM12/2/16
to golang-nuts, jac...@google.com
Hello Aaron, have you figure it out yet?  

Aaron Jacobs

unread,
Dec 5, 2016, 5:36:11 AM12/5/16
to huangba...@sina.cn, golang-nuts
On Fri, Dec 2, 2016 at 7:32 PM, <huangba...@sina.cn> wrote:
> Hello Aaron, have you figure it out yet?

Sorry, I haven't done anything further here.
Reply all
Reply to author
Forward
0 new messages