Presentation is loading. Please wait.

Presentation is loading. Please wait.

Debugging Projects Using C++.NET Click with the mouse button to control the flow of the presentation.

Similar presentations


Presentation on theme: "Debugging Projects Using C++.NET Click with the mouse button to control the flow of the presentation."— Presentation transcript:

1 Debugging Projects Using C++.NET Click with the mouse button to control the flow of the presentation

2 Three Debugging Techniques Breakpoints Stepping Through Code Watching Values in Variables

3 Setting Breakpoints Right-click – with the mouse on the line of code to break at Right-click – with the mouse on the line of code to break at Select “Insert Breakpoint” – from the menu and a red dot will appear at the beginning of the line. Select “Insert Breakpoint” – from the menu and a red dot will appear at the beginning of the line.

4 Using the Breakpoint Click the Debug menu Click the Debug menu Click “Start” (or just press the F5 button) Click “Start” (or just press the F5 button) The program will execute and will pause when it reaches the breakpoint Note the yellow arrow. It indicates the next line of code to be executed. At this point there are some options

5 Breakpoint Options Peeking the Value of the variable Peeking the Value of the variable Hold the mouse over the variable You can continue running the program by pressing F5. You can continue running the program by pressing F5.

6 The Debug Toolbar If your program is currently executing the toolbar becomes available and allows short-cuts to many of the debug operations. If your program is currently executing the toolbar becomes available and allows short-cuts to many of the debug operations. If at a breakpoint, the options to Stop or to Restart the program are available. If at a breakpoint, the options to Stop or to Restart the program are available. The Show Next Statement – option on the toolbar will show the next line to be run. The Show Next Statement – option on the toolbar will show the next line to be run.

7 The Debug Toolbar (contd.) The toolbar includes the following options: Step into, Step over, and Step out.

8 Step IntoStep Into Allows the viewing of each line of code as it is being executed. If the line of code calls an external piece of code, the IDE will go to the code and continue stepping line-by- line as before.

9 Step OverStep Over Allows the debugger to execute but not step through a sequence of code. For example calling a function but not stepping line-by- line through the function.

10 Step OutStep Out Allows the termination of stepping through code. For example if a function is being executed with stepping – selecting “Step out” will continue execution but the stepping will stop until the execution return to the function call line.

11 Debugging Options Menu – all options are available from the Debug Menu on the Menu bar Menu – all options are available from the Debug Menu on the Menu bar Keyboard Shortcuts – most common debug operations are available as “Function Key” operations. Keyboard Shortcuts – most common debug operations are available as “Function Key” operations.

12 Function Key operations F5 – Start (with Debugging) F5 – Start (with Debugging) -F5 – Start (without Debugging) -F5 – Start (without Debugging) -B – Set a New Breakpoint -B – Set a New Breakpoint F10 – Step Over F10 – Step Over F11 – Step Into F11 – Step Into - -F9 – Clear All Breakpoints - -F9 – Clear All Breakpoints

13 Watch Watch allows the tracking of values in a variable within the program. To create a “Quick Watch”: Press F11 to start Stepping into the code Press F11 to start Stepping into the code When the first line is marked with a yellow arrow – right click on a variable. When the first line is marked with a yellow arrow – right click on a variable. Then click QuickWatch Then click QuickWatch

14 Watch (contd.) Click on Add Watch Click on Add Watch Don’t be surprised if you see an error value (i.e. “CXX0072 Error: variables need stack frame”). It just means you have not started yet. Click the “Close” Button on the window Click the “Close” Button on the window Press F5 to allow the program to run. Press F5 to allow the program to run.


Download ppt "Debugging Projects Using C++.NET Click with the mouse button to control the flow of the presentation."

Similar presentations


Ads by Google