Chris,
I'm having the same problems you experienced. I'm glad to hear that it's not just my own incompetence getting in the way here.
I'm relatively new to gdb, especially using it with go binaries. I've been reading through the gdb manual to make sure that I wasn't just experiencing some subtle nuance of the 'next' command, but none of my RTFM-ing so far has turned up anything useful.
My setup:- uname -a
- Linux ajvb 3.2.0-52-generic #78-Ubuntu SMP Fri Jul 26 16:21:44 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
- go -version
- go version go1.1 linux/amd64
- gnu --version
- GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
I have a function that uses the Get method of a net/http Client to get several URLs. Apparently Get creates a new thread (or two, or three; I don't know when/why they are created.) When I 'next' over the function that makes the calls to Get, I experience the same unintended 'continue' effect that you described and I lose control over execution. The program works its merry way through to the very end.
Did you ever find a way to solve this? As you suggested, I've been working around this with some defensive breakpointing. It works, but it's fairly tedious sometimes.
For anyone else that might be interested, here's a small demo program that reproduces the behavior. Build it with -gcflags "-N -l", and set a breakpoint at main.main. 'next' your way over the first getUrl, and you will (hopefully) lose control of execution.
--------------------------------------------------------------------------
package main
import (
"log"
"net/http"
)
var client http.Client
func main() {
getUrl("
http://www.google.com")
getUrl("
http://en.wikipedia.org")
getUrl("
http://www.msn.com")
getUrl("
http://www.yahoo.com")
getUrl("
http://ruprecht.com")
getUrl("
http://www.about.com")
}
func getUrl(url string) {
log.Printf("Getting %v ...\n", url)
resp, err := client.Get(url)
if err != nil {
log.Printf("Get => %v\n", err.Error())
}
defer resp.Body.Close()
}
---------------------------------------------------------------------------
Output from this program on my machine is the following:
Breakpoint 1, main.main ()
at /home/aaron/.../test.go:10
10 func main() {
(gdb) n
11 makeCall("
http://www.google.com")
(gdb) n
2013/09/03 13:45:25 Getting
http://www.google.com ...
[New Thread 0x7fffe6ff1700 (LWP 20630)]
[New Thread 0x7fffe67f0700 (LWP 20631)]
2013/09/03 13:45:26 Getting
http://en.wikipedia.org ...
2013/09/03 13:45:27 Getting
http://www.msn.com ...
[New Thread 0x7fffe57bb700 (LWP 20632)]
2013/09/03 13:45:27 Getting
http://www.yahoo.com ...
2013/09/03 13:45:28 Getting
http://ruprecht.com ...
2013/09/03 13:45:30 Getting
http://www.about.com ...
[Thread 0x7fffe57bb700 (LWP 20632) exited]
[Thread 0x7fffe67f0700 (LWP 20631) exited]
[Thread 0x7fffe6ff1700 (LWP 20630) exited]
[Thread 0x7ffff7fdd700 (LWP 20626) exited]
warning: Error removing breakpoint 0
warning: Error removing breakpoint 0
warning: Error removing breakpoint 0
warning: Error removing breakpoint 0
warning: Error removing breakpoint 0
warning: Error removing breakpoint 0
warning: Error removing breakpoint 0
warning: Error removing breakpoint 0
warning: Error removing breakpoint 0
warning: Error removing breakpoint 0
[Inferior 1 (process 20626) exited normally]
(gdb)