Debug using gdb for Apache


pstack is this quite an interesting tool for debugging in case you don’t want to trace the server.  Basically this command command shows a stack trace for each process!! Similar to gstack but for RHEL.

pstack <pid>

Example stolen from Oracle to demonstrate nfsd

243:    /usr/lib/nfs/nfsd -a 16
 ef675c04 poll     (24d50, 2, ffffffff)
 000115dc ???????? (24000, 132c4, 276d8, 1329c, 276d8, 0)
 00011390 main     (3, efffff14, 0, 0, ffffffff, 400) + 3c8
 00010fb0 _start   (0, 0, 0, 0, 0, 0) + 5c


On this case we can see that last function is pool, called from ??? – without ELF info – which was called by main.


The reading follows the simple rule:

 The bottom is the start –> the top is the last call 



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s