Q) How to do Remote Debugging using gdb?
1) On host machine Start a gdbserver and 2) Connect gdb from Host Machine to remote gdbserver
1) Start a gdbserver:
On Host Machine start gdbserver with application to debug on a specified IP and Port i.e.
gdbserver <IP>:<PORT> <APPLICATION>
gdbserver 192.168.1.8:8082 Debug/Dummy
Process Debug/Dummy created; pid = 3523
Listening on port 8082
It will start the gdbserver for application “Dummy” on port 8082 and will wait for a host to connect to this on port 8082.
2.) Connect gdb from Host Machine to remote gdbserver
From the Host Machine start gdb and execute following command on gdb command prompt
target remote <TARGET MACHINE IP>:<GDBSERVER PORT>
(gdb) target remote 192.168.1.8:8082
will connect this gdb from Host Machine to remote gdbserver running on
Target Machine. Now on Host Machine it will show a gdb command prompt.
Remote debugging using 192.168.1.8:8082
warning: Could not load vsyscall page because no executable was specified
try using the "file" command first.
0x00007ffff7dd9cd0 in ?? ()
Now gdb from Host Machine is connected to target Machine’s gdbserver. Press “c” to continue debugging,