0
我需要爲在Golang中編寫的服務器分析一些核心轉儲文件。但是我無法使用GDB展開堆棧信息(甚至是一些有用的信息)。GDB中的goroutine展開爲golang exe文件的核心轉儲
例如,我有一個main.go,它的代碼是:
package main
func main(){
panic("stupid")
}
而且我用的是以下獲得核心文件:
ulimit -c unlimited
GOTRACEBACK=crash ./main
然後我在運行gdb main core
。而gdb,像下面這樣的東西。
[email protected]:/tmp/crash$ gdb main core
GNU gdb (Ubuntu 7.12.50.20170314-0ubuntu1.1) 7.12.50.20170314-git
Copyright (C) 2017 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-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
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 main...done.
[New LWP 5735]
[New LWP 5736]
[New LWP 5738]
[New LWP 5739]
[New LWP 5737]
Core was generated by `./main'.
Program terminated with signal SIGABRT, Aborted.
#0 runtime.raise() at /usr/lib/go-1.7/src/runtime/sys_linux_amd64.s:110
110 RET
[Current thread is 1 (LWP 5735)]
(gdb) source /usr/share/go-1.7/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 1 info r
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.
我發現這裏issue,但它並沒有給我一個解決方案,讓任何人都可以告訴我怎麼可以檢視堆棧跟蹤的夠程信息核心轉儲?感謝任何解決方案,謝謝!