2018년 3월 20일 화요일

Windbg 필수 명령어

2010. 8. 3. 12:54


다음의 내용은 Quad Dimensions에서 Debugging 교육 자료로 만든 내용입니다.
본부장
가져 가실때는 이 정보 남겨 주시는것이 예의 겠지요 ^^




 
Windbg 필수 명령어

l  Windbg 다운로드
최신버전은 사이즈가 크기 때문에 windbg만 들어 있는 옛날 버전을 받을 것. (2009년 버전)
l  많이 사용하는 명령어는 아래 URL에 정리되어 있다.
l  WinDbg 사용 방법 및 예제가 잘 정리된 사이트
l  심볼 파일에(.pdb) 들어 있는 정보
-       함수 이름과 주소 ( 어셈블러상에 함수 주소에 따른 함수명 정보 기록)
-       전역/지역 변수의 이름과 주소
-       디버거를 도와주는 프레임 포인터 최적화(FPO) 정보
-       소스 파일 경로와 각 심볼과 연관된 라인 번호
-       변수와 구조체 등에 대한 타입 정보
l  .map 파일
함수들의 주소와 소스코드의 줄 번호를 mapping 시켜둔 테이블 정보 파일

다음은 꼭 알고 있어야 하는 필수 명령어이다.

Lock 개체
!locks
Thread에서 lock된 개체 확인
오류분석
!analyze v
전반적인 오류 분석 , dump를 볼 때도 사용
Call Stack trace
k, kb x
Displays stack trace of current thread (x frames). Kb causes the display to include the first three parameters passed to each function.

kp, or kv
Register watch
r
Displays register set.
r eax : displays the eax register.


Step


t
Trace = Step into (F11)


p
Step over (F10)


Step out
Shift + F11


역어셈블


U
Unassemble next few instructions


u <start_address>
Unassemble instructions at start_address


u <start_address>
<end_address>
Unassemble instructions from start_address till end_address


uf <exe!function>
함수전체 unassemble. uf testexe!func
Breakpoints




bl
List breakpoints.


be, bd, bc
Enable / disable / clear breakpoint.


bp
Set a breakpoint.


bu
Set unresolved breakpoint. Breakpoint is resolved by symbolic name, not absolute address. Use this to set breakpoint at a function whose containing module has not yet been loaded.
bu foo

bm 
함수 이름 기준으로 지정사용 가능
bm exename!func
bm exename!func*

debug go


g <address_X /symbol>
Go. Resumes execution until address_X


gh
Go, exception handled


gn
Go, exception not handled


Quit
q



Dump data



dv
Display local variables.
.pdb 파일이 필요하다.

dd <address>
Display dword values at specified address.
4(int) bytes data dump
dd <address> L2 ( 8 bytes만 표시 )

ds, da du
ds, da (ASCII 문자열), du (Unicode 문자열)


dt [dt module!typedefadr]
Dump type. Will dump the contents of the memory using typedef as a template.


함수명보기
ln <address>
해당 주소 근처의 모듈과 함수 명 표시
메모리 정보
!address <address>
해당 메모리의 정보 표시
Threads
~
Lists all threads


화면삭제
.cls
화면을 모두 삭제

댓글 없음:

댓글 쓰기