Instead of calling pthread_debug, you can call pthread_debug_cmd. The pthread_debug_cmd function implements the same commands, except that instead of prompting it processes command strings specified as an argument to the function. You can include multiple commands by separating them with semicolons (;). For example:
pthread_debug_cmd ("thread -if;cond -f");
The pthread_debug_cmd function returns a value representing the status of the last command executed. When called from a program, you can check the return status values listed in Table D-1 against the various status constants defined in the pthread.h header file.
Return Status Meaning PTHREAD_DBG_SUCCESS Command was successful. PTHREAD_DBG_QUIT Last command was quit or exit. PTHREAD_DBG_NONESEL No objects were selected (no output). PTHREAD_DBG_NOPRIV Unable to complete command due to privilege violation. PTHREAD_DBG_INVPARAM Invalid command parameter (such as bad policy keyword). PTHREAD_DBG_INVSEQ Invalid sequence number. PTHREAD_DBG_ Inconsistent state detected in internal data; INCONSTATE this may mean a thread is currently modifying data. PTHREAD_DBG_CORRUPT Corrupt data detected (inconsistent state prevents the command from continuing). PTHREAD_DBG_ Invalid command option specified. INVOPTION PTHREAD_DBG_NOARG No arguments specified to command that requires them. PTHREAD_DBG_INVADDR Invalid address argument specified. PTHREAD_DBG_INVCMD Invalid command specified. PTHREAD_DBG_NULLCMD No command specified.