bitcoincore development – Debugging bitcoind


How do you attach a gdb to a bitcoind daemon. I wish to step through the functions. Here is what i have tried.

gdb --args bitcoind -regtest -daemon

This however exists when the daemon starts. So i tried attaching via the pid after the fork.

gdb -p 841
(gdb) file /usr/local/bin/bitcoind
Reading symbols from /usr/local/bin/bitcoind...done.
(gdb) b sendtoaddress
Breakpoint 1 at 0x4b4d34: file wallet/rpcwallet.cpp, line 379.    
r
starting program...    

This however does not work , when i invoke a transaction using the bitcoin-cli client. Is there anything i am missing. I have used –enable debug on configure.

Thanks.