Title: ???? ?? MS Visual C Tutorial
1???? ??MS Visual C Tutorial
2Overview
- Debugging Example (using debugger)
- Set breakpoints
- Start debugger
- Debugger Windows
- Execute the program Step By Step
- A Real Example
Visual Studio C 6.0 is used in the slide.
Currently Visual Studio .Net is available.
3Debugging Example
- Debugging
- The process of finding and removing errors (bugs)
from a software program - The most time-consuming and hardest job, when
developing a large software - Debugger
- A software tool that is used to detect the source
of errors, by performing step-by-step execution
of application code and viewing the content of
code variables. - Using printf is not a good way to debug your
program
4Debugging Example1. Set Breakpoints
press F9 to set a breakpoint on the line When
the execution reaches any of them, it will be
stopped
5Debugging Example1. Set Breakpoints (Advanced)
- Advanced Breakpoints
- Setting Breakpoints When Values Change or Become
True - Setting Breakpoints at a Memory Location
- How to use these features
- Edit Breakpoints (AltF9)
For more information, visit http//msdn.microsof
t.com/library/default.asp?url/library/en-us/vccor
e98/HTML/_core_using_breakpoints.3a_.additional_in
formation.asp
6Debugging Example2. Start Debugger
- Go (F5)
- Executes code from the current statement until a
breakpoint or the end of the program is reached - Step Into (F11)
- Single-steps through instructions in the program
- Run to Cursor (CtrlF10)
- Executes the program to the cursor
7Debugging Example3. Debugger Windows (Default)
Current execution point
User specified values and expressions
Information about variables
8Debugging Example3. Debugger Windows (Advanced)
- Watch, Variables
- Included in the default window
- Call Stack
- Stack of all functions that have not returned
- Memory
- Current memory contents
- Registers
- Contents of the general purpose and
- CPU status registers
- Disassembly
- Assembly-language code
9Debugging Example4. Execute the Program Step By
Step
- Go (F5)
- Restart (CtrlShiftF5)
- Stop Debugging (ShitF5)
- Step Into (F11)
- Single-step through instructions in the program.
Enters each function call that is encountered - Step Over (F10)
- Single-steps through instructions in the program.
Execute a function call without stepping through
the function instructions - Step Out (ShiftF11)
- Run to Cursor (CtrlF10)