Remote debugging:
Connecting to remote target
a) (gdb) target remote /dev/ttyb # serial-device
b) (gdb) target remote host:port
c) (gdb) target remote protocol:host:port
d) (gdb) target remote | middleman-command # gdb talks to a middleman command
Transfer files:
remote put hostfile targetfile
remote get targetfile hostfile
remote delete targetfile
(gdb) load filename # this command is used instead of 'run' in case of remote debugging
(gdb) break
(gdb) step
(gdb) continue
(gdb) detach
(gdb) disconnect
a) Remote gdbserver on target with gdb on host (Need O.S. for this):
target> gdbserver /dev/com1 emacs foo.txt
target> gdbserver host:2345 emacs foo.txt
target> gdbserver --attach /dev/com1 pid
# Run a wrapper for the debugee program on the target-side
target> gdbserver --wrapper env LD_PRELOAD=libtest.so -- :2222 ./testprog
#Connect to the target gdbserver from my host gdb
$ gdb myprogram
(gdb) target remote myhost:9999
0x00007f215893ba60 in ?? () from /lib64/ld-linux-x86-64.so.2
(gdb) b main
(gdb) continue
# Send commands to gdbserver using the monitor command
monitor help # List the available monitor commands.
monitor set debug 0 | 1 # Disable or enable general debugging messages
monitor set remote-debug 0|1 # Disable or enable debugging messages of the remote protocol
monitor exit
See Also: Remote Configuration
More in-depth internal look at Remote Protocol
b) Remote Stub: Used on Embedded devices without an O.S.
Blogs:
1) http://blog.flameeyes.eu/2010/02/20/remote-debugging-with-gdb-part-2-gdb
2) http://www.gentoo.org/proj/en/qa/backtraces.xml
Interesting! :)
ReplyDelete