简体   繁体   中英

Strange behavior when debugging Go with GDB

I have a Go program that I'm debugging using GDB (also Eclipse/Goclipse, but that uses GDB so it's all the same). Occasionally, when I tell GDB next , it acts like I told it to continue or finish . It's like there's missing stack/frame/etc information in the executable. Help?

gdb -v gives:

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.1.0". For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/ .

go -v gives:

go version go1.2.1 darwin/amd64

Both were installed with MacPorts under OSX.9

It's not just OSX. gdb doesn't really understand, and can't always follow goroutines, since they can be scheduled across OS threads.

You can always try to catch the execution again later with another breakpoint, but I don't think there's much else you can do.

GDB is still useful for stacktraces and breakpoints, but stepping through code just isn't going to work reliably for the foreseeable future. There has been discussion on the golang dev mailing list about continually improving gdb versus abandoning it in favor of something new; but no announcements have been made.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM