gdb调试Go,info goroutines

来源:互联网 发布:转行程序员 编辑:程序博客网 时间:2024/05/17 14:26

问题

(gdb) info goroutinesUndefined info command: "goroutines".  Try "help info".

相关问题的说明和官方文档
运行info goroutines时出现的问题
退出gdb调试,重新启动gdb file,看到如下一大段的输出,

GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1Copyright (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-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 gFile...done.warning: File "/home/gws/go/gosrc/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 /home/gws/go/gosrc/go/src/runtime/runtime-gdb.pyline to your configuration file "/home/gws/.gdbinit".To completely disable this security protection add    set auto-load safe-path /line to your configuration file "/home/gws/.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:---Type <return> to continue, or q <return> to quit---

其中一段

warning: File "/home/gws/go/gosrc/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 /home/gws/go/gosrc/go/src/runtime/runtime-gdb.pyline to your configuration file "/home/gws/.gdbinit".

在.gdbinit文件中添加如下配置,没有文件就创建一个,重启gdb生效
add-auto-load-safe-path /home/gws/go/gosrc/go/src/runtime/runtime-gdb.py