In most cases, developers debug their programs locally. They run their code with debugger on the same machine. What if there is no mouse and keyboard on the target machine, such as a device, a POS terminal with a touch screen? You also want to see what happened behind the scene right? Remote debugging can give you the capability to do such a thing. I have an example which I have used for almost half a year and willing to share with you all.
This example is based on Linux ( Embedded Linux for the target machine, any Linux distribution for the debugger )
System requirement:
Target machine: gdbserver and the target application on Linux
Debugger machine: ddd with any Linux distribution
Steps to do:
Target machine: ( You need to have your app on this machine )
ssh to the target machine
gdbserver TARGET_IP:PORT TARGET_APP
Debugger machine: ( You need to have both source code and executable on this machine )
ddd TARGET_APP
In ddd command line, connect to the target:
target remote TARGET_IP:PORT
Turn off the following signals:
handle SIG32 noprint nostop
handle SIGPIPE noprint nostop
handle SIGTRAP noprint nostopOn the tool box of ddd, press CONT button to start the program
No comments:
Post a Comment