Backtracing another thread within the same process

Backtracing a different thread in the current process is similar to backtracing a thread in a different process (see above). The only difference is how you initialize the accessor structure. The flags passed to bt_init_accessor() define which process to backtrace. If you specify BT_THREAD, a different thread within the same process is set up for backtracing:

bt_init_accessor(&acc, BT_THREAD, tid);

To debug a thread within a different process, set the BT_PROCESS flag and supply the pid and tid to be backtraced:

bt_init_accessor(&acc, BT_PROCESS, getpid(), tid);