debug linux daemon in remote server

Using GNU screen + gdb utility to debug daemon software in remote machine

 

# Launch the daemon service

/etc/init.d/dnsproxy start

 

# Create a screen session, say dns

screen -dmS dns

 

# Attach to the screen session

screen -r dns

 

# Launch gdb with in the session

gdb

attach xxxx

c

 

# Detach the screen session

Ctrl+A+D

 

 

# Debug code with gdb by Attaching to the screen session second time

screen -r dns