Remote debugging technique is usually used for program that runs on tiny machine (arm devices) because these resource lacking devices( mobile,smart tv,arm borad etc) does not have  desktop like environment. remote debugging is achieved through a small program called gdbserver.  gdbserver is a program that allows you to run GDB on a different machine than the one which is running the program being debugged. Here is the step by step instruction for setting up remote debugging environment along with how to debug a program remotely with c example.

  •  First, you need to have a copy of the program you want to debug put onto the target system.
  •  To use the server, you log on to the target system, and run the gdbserver program.

                #gdbserver host:2345 ( here host is ip address )

  • Now find the process id of running program ( or if not running execute it) . by issuing ps  command we can find the process id of running program.
  • Now attach the process with gdbserver using below command