使用gbd进行Golang调试是否可以打开以读取符号?

时间:2015-04-30 10:03:45

标签: macos debugging go gdb

我调试引用Debugging Go Code

的代码

但是当我运行gdb xxx.test时,我会得到一个列表警告:

Reading symbols from markdown.test...
warning: `/var/folders/00/0sdwh000h01000cxqpysvccm0035qk/T/go-build765783040/runtime/cgo/_obj/gcc_amd64.o': can't open to read symbols: No such file or directory.

warning: `/var/folders/00/0sdwh000h01000cxqpysvccm0035qk/T/go-build765783040/runtime/cgo/_obj/gcc_darwin_amd64.o': can't open to read symbols: No such file or directory.

warning: `/var/folders/00/0sdwh000h01000cxqpysvccm0035qk/T/go-build765783040/runtime/cgo/_obj/gcc_setenv.o': can't open to read symbols: No such file or directory.

warning: `/var/folders/00/0sdwh000h01000cxqpysvccm0035qk/T/go-build765783040/runtime/cgo/_obj/gcc_util.o': can't open to read symbols: No such file or directory.

warning: `/var/folders/rn/ff65_68n0kg4_ml_v420yg5m0000gn/T/go-build619623895/github.com/glenn-brown/golang-pkg-pcre/src/pkg/pcre/_obj/pcre.cgo2.o': can't open to read symbols: No such file or directory.
(no debugging symbols found)...done.

使用go test -c -work代替go test -c

warning: `/var/folders/00/0sdwh000h01000cxqpysvccm0035qk/T/go-build765783040/runtime/cgo/_obj/gcc_amd64.o': can't open to read symbols: No such file or directory.

warning: `/var/folders/00/0sdwh000h01000cxqpysvccm0035qk/T/go-build765783040/runtime/cgo/_obj/gcc_darwin_amd64.o': can't open to read symbols: No such file or directory.

warning: `/var/folders/00/0sdwh000h01000cxqpysvccm0035qk/T/go-build765783040/runtime/cgo/_obj/gcc_setenv.o': can't open to read symbols: No such file or directory.

warning: `/var/folders/00/0sdwh000h01000cxqpysvccm0035qk/T/go-build765783040/runtime/cgo/_obj/gcc_util.o': can't open to read symbols: No such file or directory.
gdb中的

source /usr/local/go/src/runtime/runtime-gdb.py

Loading Go Runtime support.
Traceback (most recent call last):
  File "/usr/local/go/src/runtime/runtime-gdb.py", line 205, in <module>
    _rctp_type = gdb.lookup_type("struct runtime.rtype").pointer()
gdb.error: No struct type named runtime.rtype.

编辑 runtime-gdb.py

line 205: `#_rctp_type = gdb.lookup_type("struct runtime._type").pointer()`
line 216: `return go_type_ptr.cast(gdb.lookup_type("struct reflect.rtype").pointer()).dereference()`

gdb中的source runtime-gdb.py

(gdb) source /usr/local/go/src/runtime/runtime-gdb.py
Loading Go Runtime support.

然后我不能做下一步。有谁知道如何解决它?

  • go go go.4.4.2 darwin / amd64
  • GDB:7.9(使用自制软件安装)
  • 操作系统:Mac OS X 10.10.3

0 个答案:

没有答案