2015. 1. 12. 11:38

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


download psexec 


How to debug Windows services with Windbg




2014. 11. 13. 13:45

Debugging WOW64

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.


2014. 8. 19. 16:39

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

2012. 10. 4. 09:45

resolving C++ Template names

template function 에 break point를 설정하는 경우 bp test<a> ...

'<' 가 redirection character로 인식이 되어 해당 명령이 실패한다.

이 경우 bp @!" test<a> ..." 문자를 이용하면 break point 가 설정이 된다.

물론 x 명령어를 이용하여 해당 function 의 주소값을 입력하는 방안되 있다.

2012. 9. 28. 17:18

windbg script blog

2012. 9. 24. 16:30

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 하며 분석을 한다.


2011. 11. 24. 14:04

Common WinDbg Commands

2011. 3. 30. 13:24

debug diagnostic

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=28bd5941-c458-46f1-b24d-f60151d875a3&displaylang=en

위 링크에서 download 받을 수 있다.

골치 아픈 memory leak 문제가 있었는데, 여러가지 tool 을 사용해 보았다.
하지만 딱히 hint 를 얻지 못한 상태에서 위 tool을 사용하였는데 해결의 실마리를 얻었다.

비단 memory leak 뿐 아니라 postmortem 
 debugging 등 다양한 기능을 제공한다.

detect memory leak 

Leakdiag 와 비교 시 장점은  Report 하는 데이터가 많으며 속도가 빠르다. 특히 LeakDiag는 symbol을 callstack에 매칭하는 작업이 엄청 시간이 걸리는데 반해 이 tool은 그다지 시간 소요가 없다.

  1. 해당 process 선택 하고 context menu 에서 Monitor For Leaks를 선택한다.( 특정 dll을 해당 process로 inject 을 한다.)

     
 2. memory leak 일 발생되는 동작을 반복한다.
 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 으로 이동한다.  
Available Analysis Scripts 에서 Memory Pressure Analyzers 를 선택한다.
하단의 Add Data Files 버튼을 클릭하여 아까 생성한 dump 파일을 선택한다.
Start Analysis 버튼을 클릭하면 결과 보고서가 생성된다.


 
2011. 3. 17. 15:24

windbg a-z

2011. 2. 18. 17:48

System File Checker

Vista 이상 OS 에서 해당 PC 의 system module 이 없거나 변경 된 경우 사용한다.
특정 PC에서만 문제 현상이 있는 경우 유용하게 사용 가능한 Util 이다.