1 / 31

Windows 디버거 사용하기

Windows 디버거 사용하기. 그대가 있기에 외롭지 않아 !. Advanced Windows Debugging Chapter.2 <NHN 게임서비스플래폼팀 > 2008.06.16 안준석. 개 요. 디버거의 역할과 활용에 대해 알아본다 . 디버거의 기능을 완전하게 사용하기 위한 환경 설정법을 익힌다 . 기본적인 디버거 명령어를 공부하고 어떤 작업을 할 수 있는지 알아본다. 디버거 살짝 맛 보기 !. 순 서. 아하 ! 디버거 ! Prerequisite Debugger Basic

Download Presentation

Windows 디버거 사용하기

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Windows디버거 사용하기 그대가 있기에 외롭지 않아! Advanced Windows Debugging Chapter.2 <NHN 게임서비스플래폼팀> 2008.06.16 안준석

  2. 개요 • 디버거의 역할과 활용에 대해 알아본다. • 디버거의 기능을 완전하게 사용하기 위한 환경 설정법을 익힌다. • 기본적인 디버거 명령어를 공부하고 어떤 작업을 할 수 있는지 알아본다. 디버거 살짝 맛 보기!

  3. 순서 • 아하! 디버거! • Prerequisite • Debugger Basic • Basic Debugger Tasks • Remote Debugging • 마무리

  4. 아하! 디버거! 디버거는 내 친구 디버거 사용 메타포

  5. 디버거는 내 친구? • 디버거는 내 친구 • 삽질 할 때 옆에 있어주지요.. 왜! • 디버거는 내 친구 • 가끔 구렁텅이에 빠뜨리기도 하지요..

  6. 출시 전 디버깅 • 프로그램 작동 시나리오 예상 • 브레이크 포인트 설정 • 호출 스택(Call Stack) 확인 • 변수 값 확인(Watch)

  7. 출시 그리고 디버깅 • 버전이 안 맞아요 • 윈도우 ME 에서 안되요 • 모르겠어요 안되요 안되! 잘 설정한 디버거가 약이죠! • 저 버전의 심볼이 필요해! • 저 버전의 소스가 필요해! • OS 도 똑같이!

  8. 디버거 사용 메타포 스택그리고 레지스터 함수,파라미터,변수 심볼과 소스 경로

  9. Prerequisite 프로시저와 스택 복귀 주소 로컬 변수 파라미터 ※ 이번 섹션의 예제 대부분은 『Windows 구조와 원리:OS를 관통하는 프로그래밍의 원리 2th - 정덕영』 에서 발췌 됐습니다.

  10. 프로시저와 스택 높은 주소 파라미터#2 EBP + 0x0C 파라미터#1 EBP + 0x08 복귀 주소 EBP + 0x04 이전의 EBP 현재 EBP LOCAL 변수 EBP - xx 스택은 아래로 힙은 위로 낮은 주소

  11. 스택과 복귀 주소 main() { A(); } int A() { B(); } int B() { } main() 복귀주소 A() 복귀주소 B() 복귀주소 현재 ESP

  12. 스택과 로컬 변수 main() { int local1; A(); } A() { int local2; } main() 복귀주소 local1 A() 복귀주소 local2 현재 ESP

  13. 스택과파라미터 main() { sum(1, 2) } int sum(int a, int b) { return a + b; } main: push 2 push 1 call sum sum : … 스택에 데이터가 Push 되면? ESP 만으로는 역부족!

  14. 스택 프레임 main() { sum(1, 2) } int sum(int a, int b) { return a + b; } main() 복귀주소 EBP + 0x10 2 EBP + 0x0C 1 EBP + 0x08 sum() 복귀주소 EBP + 0x04 이전의 EBP EBP eax EBP – 0x04

  15. Debugger Basic 분류 명령어 설정 리다이렉션

  16. 분류 • User Mode • 단일 유저 모드 프로세스 대상 • Cdb.exe, ntsd.exe, windbg.exe • Kernel Mode • 시스템 전체 대상 • Kd.exe, windbg.exe

  17. 명령어 • Built-in Commands • kP • Meta Commands • .help • Extension Commands • !teb, !thread

  18. 사용 설정 • User Mode Debugger • 완벽한 동작을 위해 두 가지 필요 • 타겟 이미지와 연관 된 심볼 • Kernel Mode Debugger • 두 대의 컴퓨터 • OS 버전이 달라도 된다 • OS에 기능이 통합되어 있다 • Boot.ini 에서 설정!

  19. 리다이렉션

  20. Basic Debugger Tasks 설정 명령어 예

  21. 디버거 사용하기

  22. 설정 Symbol Source

  23. 심볼 설정 • Symbol • Symbol Path • Symbol Server • Symbol Cache • Reloading the Symbols • Validating Symbols • Using Symbols 우리 팀도 심볼 서버 만들죠!

  24. 소스 설정 • Source

  25. 명령어 찾아서 • Exploratory Commands • Other Exploratory Commands • Context-Changing Commands 탐색과 고치기 명령! 고친다!

  26. Exploratory Commands 명령어는 책에서! • Why Did the Debugger Stop? • What Is the Target System? • What are the Current Register Values? • What Code Is the Processor Executing Now? • What Is the Current Call Stack? • Setting a Code Breakpoint • What Are the Variable Values? • How Do You Inspect Memory? • Setting a Breakpoint on Access • What does That memory Location Contain?

  27. Context-Changing Commands • Tracing Code Execution • Stepping Over a Function Execution • Continuing Code Execution • Tracing and Watching a Function Execution • Changing the Context

  28. Remote Debugging Overview

  29. 마무리 Reference

  30. Reference • Advanced Windows Debugging p.29~p.121 • Windows 구조와 원리 2th • 뇌를 자극하는 윈도우 시스템 프로그래밍 • Advanced Windows Programming 4th

  31. 좋은 도구를 익혀 시간을 아낍시다!! 감사합니다. joonseok.ahn@live.co.kr 2008.06.16안준석

More Related