In this article we will discuss how to debug a running application.

Many time we need to debug a running application by attching debugger with process at runtime.

 

To attach the gdb with a running process, use the following command

To search the process information like Process Id etc, use following command,

For example,

we have a ruuning process “sample” and we need to attach the gdb debugger with it. SO, let’s serach the process info i.e.

It will give the process info i.e. process id etc i.e.

Here Process id is “2007” and Process name is “sample”.

Now attach the gdb debugger with process using following command ,

It will give gdb command prompt i.e.

PS: Sometimes it requires root permission. So use “sudo” to run this command i.e.

 

Click Here to Subscribe for more Articles / Tutorials like this.