Title: Debugging in Visual Studio
1Debugging in Visual Studio
Materials used in this presentation may be
downloaded from acm . southalabama . edu /
Mothra / debug /
- Timothy Lee J00220066
- ITE 370 Ms. Chapman
- Technical Presentation 04-10-07
2What is a bug?
Materials used in this presentation may be
downloaded from acm . southalabama . edu /
Mothra / debug /
- A fault occurs when a human makes an error.
- A failure is any departure from a systems
required behavior.
From Software Engineering, 3rd Edition, by Shari
Lawrence Pfleeger and Joanne Atlee, 2006 Pearson
Education Inc., Upper Saddle River, NJ
3Types of Errors
Materials used in this presentation may be
downloaded from acm . southalabama . edu /
Mothra / debug /
- Syntax Errors-any error that prevents the
program from compiling and executing. - Execution Errors-any statement that attempts to
perform an illegal operation. - Logic Errors-any statement that executes
successfully, but doesnt perform as expected,
usually due to a human computational error.
4Breakpoints
- Continue
- Break (pause execution)
- Stop Debugging (quit execution)
- Restart
- Show Next Statement
- Step Into
- Step Over
- Step Out
5Breakpoints (continued)
- SHORTCUT KEYS
- Start/Continue F5
- Stop ShiftF5
- Restart CtrlShiftF5
- Step Into F11
- Step Over F10
- Step Out ShiftF11
6Customizing Breakpoints
- Conditions only break if condition is true
- Hit Count times a breakpoint has been
reached can set to stop breaking after a
certain count - Tracepoints print string when breakpoint is
reached - option to not break when breakpoint reached
- Run To Cursor execute program and break at
cursor position
7Managing Breakpoints
- Disable/Enable All Breakpoints(Debug main menu)
- Breakpoints Window
- (Debug main menu -gt Windows -gt Breakpoints)
- - allows user to view all Breakpoints an a
program, jump to their code, edit their
properties, enable/disable and delete.
8Call Stack
- Displays all currently executing procedures in
the order that they have been called. - Will link you to specific procedures.
9Immediate Window
- View current variablesType ?
variableNames - Change variables valuestype varialbeName
value
10Calls to the Debug Class
- There exists a System.Diagnostics.Debug Class.
With multiple tools available to aid debugging. - Debug.Assert(condition, message, detailed
message)create custom error messages that
display only when a condition is true. - Debug.WriteLine(message)alternative to
Console.WriteLine( ) - When you compile your program as a release build,
these objects are disabled, saving you the time
of going through and removing Console.PrintLine
statements.
Explore additional members of Debug
at http//msdn2.microsoft.com/en-us/library/syst
em.diagnostics.debug_members.aspx
11Visualizations
- Autos Window
- shows variables used by the current and previous
statements. - Locals Windowshows all of the variables in the
current scope - Quick Watch Watch Windowshows only variables
you attach to a Watch Window - Windows display the name, value, and type of
variables. Gives you the ability to manually
change values using a visual interface rather
than typing text commands.
12Data Visualizers
- When a program is paused, hovering the cursor
over a variables will display its value. - For complex datatypes, you can view either a
text, html, or xml Visualizer presenting an
organized view of the data.