Open zrhoffman opened 4 years ago
To clarify, this error occurs when the GOPATH
used for compiling is not the same GOPATH
that you are using for debugging. Absolute paths are used in both cases, so the dlv
server does not recognize the file that GoDebug tells it to set a breakpoint in.
I think this bug is because GoDebug is calling CreateBreakpoint
directly to create breakpoints, when really it should call FindLocation
and pass the target address that it returns to CreateBreakpoint
. From the Delve JSON-RPC documentation:
Your client wants to set a breakpoint on the function main.main
.
The first step will be calling the method FindLocation
with Scope = api.EvalScope{ GoroutineID: -1, Frame: 0}
and Loc = "main.main"
. The JSON-RPC request packet should look like this:
{"method":"RPCServer.FindLocation","params":[{"Scope":{"GoroutineID":-1,"Frame":0},"Loc":"main.main"}],"id":2}
the response packet will look like this:
{"id":2,"result":{"Locations":[{"pc":4199019,"file":"/home/a/temp/callme/callme.go","line":31,"function":{"name":"main.main","value":4198992,"type":84,"goType":0}}]},"error":null}
Now your client should call the method CreateBreakpoint
and specify 4199019
(the pc
field in the response object) as the target address:
{"method":"RPCServer.CreateBreakpoint","params":[{"Breakpoint":{"addr":4199019}}],"id":3}
if this request is successful your client will receive the following response:
{"id":3,"result":{"Breakpoint":{"id":1,"name":"","addr":4199019,"file":"/home/a/temp/callme/callme.go","line":31,"functionName":"main.main","Cond":"","continue":false,"goroutine":false,"stacktrace":0,"LoadArgs":null,"LoadLocals":null,"hitCount":{},"totalHitCount":0}},"error":null}
I am not having success using GoDebug to remote debug Apache Traffic Control ("Traffic Ops" component). When I press F5 and Enter to debug, I get this exception and stack trace:
Steps to reproduce:
Clone zrhoffman/trafficcontrol@debug_cdn-in-a-box in your GOPATH and navigate to
infrastructure/cdn-in-a-box
within the repoRun
make debug
(requires Docker and Docker Compose)Start the Docker environment with
In Sublime (using 3.3211, dev build) with GoDebug 0.3.9 on Arch Linux 5.4.18, set a breakpoint at traffic_ops/traffic_ops_golang/ping/ping.go:30
Press F5, select the debug executable, and press Enter to start debugging.
After step 5 (but not before), the error and stack trace pasted above appears in the Sublime console.
Make this HTTPS request, which should hit the breakpoint:
Notice execution does not stop at the breakpoint.
Other information: