티스토리 뷰
코어 났을 때에 스레드 나열해서 해당 스레드의 스택트래이스를 보는 방법을 각 유닉스 디버거 별로 썼다. ㅎㅎ
Rename the core file to something other than ‘core’. This is in case there is a failure during the command execution that would create another core file which would overwrite the original core file, for example, core.date where ‘date’ is the actual date the core file was created. A time stamp can also be added if there are numerous files from the same day.
The unix ’script’ command is useful for capturing the output from the debugger:
script filename
After exiting the debugger, use Ctrl-D or ‘exit’ to stop capturing to the script file.
The first request is to run the command that lists all threads at a high-level (threads, tlist, etc.) and then collects the detailed stack traces for all threads.
The following are platform-specific commands for obtaining the stack traces for all threads:
Solaris – dbx
dbx /path/expres6? /path1/core.date
‘threads’ displays all threads
‘thread tid’ sets to a specific thread
‘where’ to get the stack trace
AIX – dbx
dbx /path/expres6? /path1/core.date
‘thread’ displays all threads
‘thread current tid’ sets to a specific thread
‘where’ to get the stack trace
TRU 64 – dbx
dbx /path/expres6? /path1/core.date
‘tlist’ displays all threads
‘tset’ sets to a specific thread
‘tstack’ to get the stack trace
TRU 64 – ladebug
ladebug /path/express6? /path1/core.date
’show thread’ to display all threads
‘where thread all’ to get stack traces for all threads
HP-UX – ddeinvoke the debugger with
dde -ui line core.date expres63 (full path to expres63)
‘list threads’ display all threads
‘tb -thread all’ displays the stack traces for all threads
gdb (all platforms including Linux)
gdb /path/expres6? /path1/core.date
‘info threads’ to display all threads
‘thread apply all where’ to get stack traces for all threads