'Debug'에 해당되는 글 25건
- 2015.01.12 Debugging windows services
- 2014.11.13 Debugging WOW64
- 2014.08.19 Unkillable Processes
- 2012.10.04 resolving C++ Template names
- 2012.09.28 windbg script blog
- 2012.09.24 JIT Debugging in Session 0
- 2011.11.24 Common WinDbg Commands
- 2011.03.30 debug diagnostic
- 2011.03.17 windbg a-z
- 2011.02.18 System File Checker
Debugging windows services
using psexec
psexec –sd –i 0 "c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Remote Debugger\x86\msvsmon.exe" /noauth /anyuser /silent
How to debug Windows services with Windbg
Debugging WOW64
Command |
Description |
!wow64exts.sw |
Switches between x86 and native mode. |
!wow64exts.k count |
Dumps a combined 32-bit/64-bit stack trace. If count is specified, the command dumps the first count addresses in each stack trace. |
!wow64exts.info |
Dumps basic information about the PEB of the process, the TEB of the current thread, and thread local storage (TLS) slots used by WOW64. |
!wow64exts.r address |
Dumps context for the specified address. If address is not specified, the command dumps context for the processor. |
Unkillable Processes
When buggy device drivers don’t properly handle the cancellation of outstanding I/O requests.
http://blogs.technet.com/b/markrussinovich/archive/2005/08/17/unkillable-processes.aspx
resolving C++ Template names
template function 에 break point를 설정하는 경우 bp test<a> ...
'<' 가 redirection character로 인식이 되어 해당 명령이 실패한다.
이 경우 bp @!" test<a> ..." 문자를 이용하면 break point 가 설정이 된다.
물론 x 명령어를 이용하여 해당 function 의 주소값을 입력하는 방안되 있다.
windbg script blog
windbg script 관련 정보 제공 blog
http://blogs.msdn.com/b/debuggingtoolbox/
Introduction to WinDbg Scripts for C/C++ Users
windows message monitor
JIT Debugging in Session 0
- 문제
- JIT 는 target process 와 동일한 session으로 시작한다.
- Session 0 의 process와 사용자와 interact 가 불가능하므로 해당 debugger도 마찬가지 상황에 직면한다.
- 해결 방안
- JIT의 registry 항목에 꼭 실제 debugger 프로그램이 들어가야 하는 것은 아니다.
- cmd 를 JIT debugger로 설정한다.
- crash 발생 시 windbg로 target process에 attach 하며 분석을 한다.
Common WinDbg Commands
debug diagnostic
위 링크에서 download 받을 수 있다.
골치 아픈 memory leak 문제가 있었는데, 여러가지 tool 을 사용해 보았다.
하지만 딱히 hint 를 얻지 못한 상태에서 위 tool을 사용하였는데 해결의 실마리를 얻었다.
비단 memory leak 뿐 아니라 postmortem debugging 등 다양한 기능을 제공한다.
detect memory leak
Leakdiag 와 비교 시 장점은 Report 하는 데이터가 많으며 속도가 빠르다. 특히 LeakDiag는 symbol을 callstack에 매칭하는 작업이 엄청 시간이 걸리는데 반해 이 tool은 그다지 시간 소요가 없다.
- 해당 process 선택 하고 context menu 에서 Monitor For Leaks를 선택한다.( 특정 dll을 해당 process로 inject 을 한다.)
3. 작업이 완료 되면 해당 process를 선택하고 context menu 에서 Create Fumm Userdump 를 선택하여 dump 파일을 생성한다.
4. symbol 위치를 설정한다. Tools -> Options And Settings... (기본적으로 ms symbol 은 설정되는 것 같다. 해당 software의 symbol을 Symbol Search Path For Analysis 에 추가하면 된다.
5. Advanced Analysis Tab 으로 이동한다.
하단의 Add Data Files 버튼을 클릭하여 아까 생성한 dump 파일을 선택한다.
Start Analysis 버튼을 클릭하면 결과 보고서가 생성된다.