2 define ifdef My Debug Win 32 Console
2. 일반적인 디버깅 기법 #define, #ifdef 지시자를 이용한 간단한 예제 • 프로젝트명 : My. Debug • 프로그램 형태 : Win 32 Console Application • [Project >> Add To Project >> New…] 메뉴를 이용해서 C++ Source File을 선택하고 파일명 : Debug. Main • My. DebugMy. Debug. dsw 파일 4 Object Oriented Programming
2. 일반적인 디버깅 기법 #define, #ifdef 지시자를 이용한 간단한 예제 실행 결과 Value : 100 이부분 주석처리 후 실행 결과 Value : 100 Address : 0 x 0012 FF 7 C 5 Object Oriented Programming
6. Visual C++ 톨에서의 디버깅 기법 Debug 창 버튼 설명 Restart (Ctrl + Shift + F 5) Stop Debugging (Shift + F 5) 다음 실행 위치 (Alt + *) Step Into (F 11) Step Over (F 10) Step Out (Shift + F 11) Run To Cursor Memory Registers Variables Watch Quick. Watch (Shift + F 9) 8 Disassembly Call Stack Object Oriented Programming
6. Visual C++ 톨에서의 디버깅 기법 Debugging 수행 화면 다음 수행할 위치 Variables 10 Watch Object Oriented Programming
6. Visual C++ 톨에서의 디버깅 기법 Debugging 예제 – Break. Point, Step Into, Step Over, Watch 사용법 • 프로젝트명 : My. Debug 2 • 프로그램 형태 : Win 32 Console Application • [Project >> Add To Project >> New…] 메뉴를 이용해서 C++ Source File을 선택하고 파일명 : Debug 2 Main • 클래스를 이용한 예외처리 • My. Debug 2My. Debug 2. dsw 파일 11 Object Oriented Programming
6. Visual C++ 톨에서의 디버깅 기법 Debugging 예제 – Break. Point, Step Into, Step Over, Watch 사용법 #include <iostream. h> double Quotient(int n. Numerator, int n. Denominator) { double d. Result = (double)n. Numerator / (double)n. Denominator; return d. Result; } void main() { int N = 12, D = 0; double R; R = Quotient(N, D); cout << "The quotient is " << R << endl; int Array[10]; for (int i = 0; i < 10; i++) { Array[i] = 99; } Array[0] = 100; } 12 Object Oriented Programming
6. Visual C++ 톨에서의 디버깅 기법 Debugging 예제 – Watch 테이블 사용법 ① Break. Point 찍기 (F 9) Break. Point 찍을 위치 ② Debugging 시작 (F 5) F 10을 누르면 i값이 증가됨 15 Object Oriented Programming
6. Visual C++ 톨에서의 디버깅 기법 TRACE, TRACE 1, TRACE 2, TRACE 3 매크로 사용 • 디버깅 해도 TRACE 결과가 나오지 않는 경우 >> [Tools >> MFC Tracer] 메뉴 선택해서 [Enable tracing]을 체크 18 Object Oriented Programming
6. Visual C++ 톨에서의 디버깅 기법 Dump()함수 수행 결과 (Debug탭) 22 Object Oriented Programming
- Slides: 22