C++_debugging - Why Debug a Program? When your program...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 332: C++ debugging Why Debug a Program? When your program crashes Finding out where it crashed Examining program memory at that point When a bug occurs in your program Watching program variables Identifying where a problem occurs (and why) Tracing through a program’s behaviors Learning what a program does Good basic testing approach
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE 332: C++ debugging Debugging on Various Platforms We’ll use Visual Studio’s graphical debugger Much more on this as we go through the semester Set command line arguments in the project properties It’s also good to know about common text-based tools gdb Debugger provided with the g++ compiler (e.g., on Linux) Using –g switch embeds debug info during compilation dbx Debugger provided with Sun CC Also requires –g switch to embed debug symbols
Background image of page 2
CSE 332: C++ debugging Some Essential Debugging Commands start (or restart) execution in the debugger Visual Studio: F5 (Start Debugging) gdb: run (also give its command line arguments) execute one line, stepping into any functions Visual Studio: F11 (Step Into) gdb: step execute one line, stepping over any functions VS: F10 (Step Over) gdb: next set breakpoint at a line or function entry point VS: F9 (Toggle Breakpoint) gdb: break (can give file and line, function, etc.)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE 332: C++ debugging “Core” Dumps A program dumps a memory image when it crashes
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 11

C++_debugging - Why Debug a Program? When your program...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online