hi everyone, use gdb to debug golang, I find two question
1. cannot use step / s  to step in a function, is this for a wrong source 
code path ?
2.gdb cannot print variable value, is this because compile optimize ? 
Best
Xie

root@ubuntu:~/fabric/build/bin# gdb peer -d $GOROOT
...
Reading symbols from peer...done.
warning: Missing auto-load script at offset 0 in section .debug_gdb_scripts
of file /root/src/go/src/github.com/hyperledger/fabric/build/bin/peer.
Use `info auto-load python-scripts [REGEXP]' to list them.

(gdb)  source /usr/local/go/src/runtime/runtime-gdb.py
Loading Go Runtime support.
(gdb) l
55 return core.CacheConfiguration()
56 },
57 Run: func(cmd *cobra.Command, args []string) {
58 if versionFlag {
59 version.Print()
60 } else {
61 cmd.HelpFunc()(cmd, args)
62 }
63 },
64 }
(gdb) b main.main
Breakpoint 1 at 0xada5a0: file 
/root/src/go/src/github.com/hyperledger/fabric/peer/main.go, line 69.
(gdb) r
Starting program: 
/root/src/go/src/github.com/hyperledger/fabric/build/bin/peer 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff73e2700 (LWP 8448)]
[New Thread 0x7ffff6be1700 (LWP 8449)]
[New Thread 0x7ffff63e0700 (LWP 8450)]
[New Thread 0x7ffff5bdf700 (LWP 8451)]
[New Thread 0x7ffff53de700 (LWP 8452)]

Thread 1 "peer" hit Breakpoint 1, main.main () at 
/root/src/go/src/github.com/hyperledger/fabric/peer/main.go:69
69 func main() {
(gdb) n
71 viper.SetEnvPrefix(cmdRoot)
(gdb) s
72 viper.AutomaticEnv()
(gdb) p cmdRoot
No symbol "cmdRoot" in current context.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to