70 likes | 98 Views
Chapter 11 Debugging Techniques. Date: 2008/05/08. Four strategies. Don’t re-invent the wheel. Develop and test your code incrementally. Code defensively. Include debugging code. Program bugs. Syntactic errors ex. cout << “hello”; count << “hello”; error Semantic errors
E N D
Chapter 11 Debugging Techniques Date: 2008/05/08
Four strategies • Don’t re-invent the wheel. • Develop and test your code incrementally. • Code defensively. • Include debugging code.
Program bugs • Syntactic errors • ex. cout << “hello”; count << “hello”; error • Semantic errors • ex. char array[5]; array=“school”; error • Sometimes the program terminates abnormally.
Debug(1/2) • Starting Debug F5 • Step over F10 • Step In F11 • Debug toolbar • Tools customize
Debug(2/2) • Debug windows can help us debug. • Debug windows (while Debugging) • Autos • Output • Callstack • Watch • Error Lists • Breakpoints ……
Breakpoints • A breakpoint is a point in your program where the debugger automatically suspends execution. • Set condition
Adding Debug code • Solution Configuration • Debug • Release • #ifdef _DEBUG //Debug code #endif