C언어

thread deadlock debugging

고요한하늘... 2015. 3. 6. 21:09

http://en.wikibooks.org/wiki/Linux_Applications_Debugging_Techniques/Deadlocks

쓰레드 디버깅 방법( linux)


모든 thread에 대해서 backtrace

(gdb) thread apply all bt

특정 thread 선택

(gdb) thread 4

스택위치 지정

(gdb) frame 2


레지스터 정보 확인

(gdb) info reg
...
r8             0x6015a0	6296992


뮤텍스 정보 확인

(gdb) p *(pthread_mutex_t*)0x6015a0


pthread_mutext_t를 보기위한 symbol table이 로딩되지 않을 경우

(gdb) print *((int*)(0x6015e0))
$4 = 2
(gdb) print *((int*)(0x6015e0)+1)
$5 = 0
(gdb) print *((int*)(0x6015e0)+2)
$6 = 12275