我调试引用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.
然后我不能做下一步。有谁知道如何解决它?