Debugging on a tiny target system may be impossible, because there are no room for the gdb and all the source and binary files on the target system. Luckily remote debugging is available.
There are two options: DDD or Eclipse.
DDD is a gui for gdb, the GNU debugger. DDD might be available in Cygwin, I don't know. But it is available in all decent Linux distributions.
There are some prerequisites:
- There shall be opened a port for connecting on the target, if a firewall is installed on it
- The source shall be available on the debugging host
- The gdbserver shall be included on the target system (use make menuconfig)
When the code has been compiled and transferred to the target host start the remote gdbserver on the target:
]$ gdbserver <host-to-expect-connection-from>:<port-number> <programme>
]$ gdbserver 10.1.18.73:11000 myprogram
Now on the debugging host start DDD. In the command window below type in:
target extended-remote <target-host>:<port-number> <programme>
(gdb) target 10.1.18.210:11000 myprogram
In the console where you've started the gdbserver you should now see that a remote debugger has connected.
Remote debugging from host 10.1.18.73
Next open the executable in the DDD using the file command:
The source shall open in the upper window.
Set a breakpoint either by continuously right-click on the line you want the breakpoint or by typing
Now run the program using the small window with the Run, Interrupt, Step,... buttons or typing run in the lower window.
You can single step by clicking on the Step button or by typing step in the lower window.
Try the different possibilities - its almost like using the built-in debugger in Eclipse (which by the way is also gdb :-) ).
In order to setup Eclipse as a debug station follow these instructions:
First setup the debug configuration as shown.
In the debugger tab choose gdbserver debugger.
Finally set-up the communication in the Connection tab.