Remote Debugging using gdb

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 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
(gdb) target remote
It 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
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,
(gdb) c

CMakeLists.txt and cmake interview questions

No comments:

Post a Comment