Symas OpenLDAP Knowledge Base

Using gdb to get a stacktrace

First run the following command to get all PIDs for processes running


You are looking for the process you need to debug. You can also find its PID using:

     pgrep <process-name> 

Next, run the following command with the PID from step 1

    gdb - <PID> 

Then, at the prompt enter:


Prints out full backtrace information including errors. Next enter:

    info thread  

This displays a summary of all threads currently in your program. Optional argument id… is one or more thread ids separated by spaces, and means to print information only about the specified thread or threads. gdb displays for each thread (in this order):

  1. the thread number assigned by gdb
  2. the target system’s thread identifier (systag)
  3. the thread’s name, if one is known. A thread can either be named by the user (see thread name, below), or, in some cases, by the program itself.
  4. the current stack frame summary for that thread

To exit the debugging session:


Closes gdb.