2

I have been trying to debug and step into docker daemon code using gdb or cgdb on a Ubuntu 14.04 container running on host OS (ubuntu 14.04 OS). I have used -O0 -g flags while building the debug binaries within a container.

Version of go used in the container:

# go version
go version go1.4.3 linux/amd64

I am unable to step through the code using cgdb:

<http://www.gnu.org/software/gdb/documentation/>. 
For help, type "help". 
Type "apropos word" to search for commands related to "word"... Reading symbols from bundles/1.9.0-dev/dynbinary/docker...done. (

gdb) b main.handleGlobalDaemonFlag 
Breakpoint 1 at 0x497b30 
(gdb) r daemon -D 
Starting program: /go/src/github.com/docker/docker/bundles/1.9.0-dev/dynbinary/docker daemon -D 
[Thread debugging using libthread_db enabled] 
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". 
[New Thread 0x7ffff5a00700 (LWP 2775)] 
[New Thread 0x7ffff51ff700 (LWP 2776)] 
[New Thread 0x7ffff49fe700 (LWP 2777)]

Breakpoint 1, 0x0000000000497b30 in main.handleGlobalDaemonFlag () 

(gdb) n Single stepping until exit from function main.handleGlobalDaemonFlag, which has no line number information.

Breakpoint 1, 0x0000000000497b30 in main.handleGlobalDaemonFlag () 
(gdb) l 1       in /tmp/go-build212795923/github.com/docker/docker/pkg/term/_obj/_cgo_export.c 

(gdb)

How to confirm that the built binaries are debug ? Can I use a tool readelf to read through the headers to confirm this ?

Should I be setting a GOPATH or GOROOT to a specific directory ?

root@6511af5b06c1:/go/src/github.com/docker/docker# echo $GOROOT

root@6511af5b06c1:/go/src/github.com/docker/docker# echo $GOPATH
/go:/go/src/github.com/docker/docker/vendor

Are there any other dependencies which could be missing on my environment ?

Greg Petr
  • 1,099
  • 2
  • 11
  • 18
  • Are you trying to use gccgo (I don't think `-O0` is a valid option for anything in the go toolchain)?. – JimB Oct 23 '15 at 13:34

0 Answers0