问题描述
平台是Mac OSX Mavericks,我从端口安装了gdb,并。对于简单的程序,它工作得很好,但是一旦我尝试使用C库的程序,它就无法加载符号。例如,如果我从Go GLFW绑定中尝试FSAA示例,我得到以下输出: 〜/ g / s / g / g / e / g / fsaa> ggdb main
GNU gdb(GDB)7.6
版权所有(C)2013免费软件基金会,
许可证GPLv3 +:GNU GPL版本3或更高版本< http://gnu.org/ licenses / gpl.html>
这是免费软件:您可以自由更改并重新分发。
在法律允许的范围内,没有任何保证。输入显示复制
和显示保修的详细信息。
这个GDB被配置为x86_64-apple-darwin13.0.0。
有关错误报告说明,请参阅:
< http://www.gnu.org/software/gdb/bugs/> ...
从/ Users / nils读取符号/gocode/src/github.com/go-gl/examples/glfw/fsaa/main ...
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go -gl / gl / _obj / attriblocation.cgo2.o':无法打开读取符号:没有这样的文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/buffer.cgo2.o':无法打开读符号:没有这样的文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/color.cgo2.o':无法打开读符号:没有这样的文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/framebuffer.cgo2.o':无法打开读符号:没有这样的文件或目录。
warning:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/gl.cgo2.o':无法打开读符号:没有这样的文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/matrix.cgo2.o':无法打开读符号:没有这样的文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/object.cgo2.o':无法打开读符号:没有这样的文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/program.cgo2.o':无法打开读符号:没有这样的文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/renderbuffer.cgo2.o':无法打开读符号:没有这样的文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/shader.cgo2.o':无法打开读符号:没有这样的文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/texture.cgo2.o':无法打开读符号:没有这样的文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/transformfeedback.cgo2.o':无法打开读符号:没有这样的文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/uniformlocation.cgo2.o':无法打开读符号:没有这样的文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/vertex.cgo2.o':无法打开读符号:没有这样的文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/vertexarray.cgo2.o':无法打开读符号:没有这样的文件或目录。
warning:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/glu/_obj/_cgo_export.o':无法打开读取符号: 无此文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/glu/_obj/callback.cgo2.o':无法打开读符号:没有这样的文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/glu/_obj/callback.o':无法打开读取符号: 无此文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/glu/_obj/glu.cgo2.o':无法打开读符号:没有这样的文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/glu/_obj/tesselator.cgo2.o':无法打开读符号:没有这样的文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build432883021/runtime/cgo/_obj/gcc_amd64.o':无法打开读取符号:没有这样的文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build432883021/runtime/cgo/_obj/gcc_darwin_amd64.o':无法打开读取符号:没有这样的文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build432883021/runtime/cgo/_obj/gcc_setenv.o':无法打开读取符号:没有这样的文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build432883021/runtime/cgo/_obj/gcc_util.o':无法打开读取符号:没有这样的文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build883630526/github.com/go-gl/glfw/_obj/_cgo_export.o':无法打开读取符号: 无此文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build883630526/github.com/go-gl/glfw/_obj/callback.cgo2.o':无法打开读符号:没有这样的文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build883630526/github.com/go-gl/glfw/_obj/callback.o':无法打开读取符号: 无此文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build883630526/github.com/go-gl/glfw/_obj/glfw.cgo2.o':无法打开读符号:没有这样的文件或目录。
警告:`/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build883630526/github.com/go-gl/glfw/_obj/image.cgo2.o':无法打开读符号:没有这样的文件或目录。
(找不到调试符号)...完成。
(gdb)list
没有加载符号表。使用文件命令。
(gdb)
我从中继上取得了我的去版本,
go version devel + f9af8b83c78c Fri Oct 25 23:00:22 2013 +0300 darwin / amd64
GDB版本为7.6。我不想进入C库,我只想调试我的Go代码。任何想法?
您正在体验。相关问题是。
ELF文件的这个问题已部分修复,但是您正在使用的Mach格式
保持打开状态。所以我想你必须等待去1.3或从$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $编译的 .c
文件不会从对象( .o
)文件中提取
调试信息,但指他们。在
构建过程之后删除它们,gdb无法读取它们。
作为解决方法,您可以尝试运行 go build -work
for go-glfw
,以便build
目录不被删除,目标文件保持可访问。
Platform is Mac OSX Mavericks, I installed gdb from ports and signed it. For simple programs it works perfectly fine, but as soon as I try a program which uses a C library it fails to load symbols. For example if I try the FSAA example from the Go GLFW bindings I get the following output:
~/g/s/g/g/e/g/fsaa > ggdb main
GNU gdb (GDB) 7.6
Copyright (C) 2013 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-apple-darwin13.0.0".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /Users/nils/gocode/src/github.com/go-gl/examples/glfw/fsaa/main...
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/attriblocation.cgo2.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/buffer.cgo2.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/color.cgo2.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/framebuffer.cgo2.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/gl.cgo2.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/matrix.cgo2.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/object.cgo2.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/program.cgo2.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/renderbuffer.cgo2.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/shader.cgo2.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/texture.cgo2.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/transformfeedback.cgo2.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/uniformlocation.cgo2.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/vertex.cgo2.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/gl/_obj/vertexarray.cgo2.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/glu/_obj/_cgo_export.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/glu/_obj/callback.cgo2.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/glu/_obj/callback.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/glu/_obj/glu.cgo2.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build184019101/github.com/go-gl/glu/_obj/tesselator.cgo2.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build432883021/runtime/cgo/_obj/gcc_amd64.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build432883021/runtime/cgo/_obj/gcc_darwin_amd64.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build432883021/runtime/cgo/_obj/gcc_setenv.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build432883021/runtime/cgo/_obj/gcc_util.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build883630526/github.com/go-gl/glfw/_obj/_cgo_export.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build883630526/github.com/go-gl/glfw/_obj/callback.cgo2.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build883630526/github.com/go-gl/glfw/_obj/callback.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build883630526/github.com/go-gl/glfw/_obj/glfw.cgo2.o': can't open to read symbols: No such file or directory.
warning: `/var/folders/rp/jyw8rd7j4hn10vyk5yjyfvw80000gn/T/go-build883630526/github.com/go-gl/glfw/_obj/image.cgo2.o': can't open to read symbols: No such file or directory.
(no debugging symbols found)...done.
(gdb) list
No symbol table is loaded. Use the "file" command.
(gdb)
I got my go version from the trunk, go version
says:
go version devel +f9af8b83c78c Fri Oct 25 23:00:22 2013 +0300 darwin/amd64
GDB version is 7.6. I don't want to step in the C libraries, I just want to debug my Go code. Any ideas?
You're experiencing issue 5221. A related question is this one.
This problem has been partially fixed for ELF files but remains open for the Mach formatwhich you are using. So I guess you have to wait for go 1.3 or the appropriate fix from tipto have this resolved.
Basically the problem is that the linker you use for the compiled .c
files does not extractthe debug info from the object (.o
) files but refers to them. As they're deleted after thebuild process, gdb can't read them.
As a workaround, you might try to run go build -work
for go-glfw
so that the builddirectory is not removed and the object files remain accessible.
这篇关于Golang:使用C库无法让gdb工作在Go程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!