Exforsys.com
 
Home Tutorials VB.NET 2005
 

Web Application Tracing and Debugging

 

Web Application Tracing and Debugging - Page 3

Page 3 of 3

.
.
.



Debugging

Setting breakpoints and conditional breakpoints

While we have a facility to step through the program, it is not an easy task to do so. Setting a breakpoint at strategic location in the code is useful as the program runs normally till that point is reached. The program can be checked at execution time at the breakpoint. Then the user can press F5 to continue or step through the code by pressing F10 or F11. To insert a break point the user has to place the cursor on the line of the code where he wants to break the execution and press F9. Alternatively the user can also click on the margin to the left of you code. A breakpoint symbol is displayed on that line.


A breakpoint can be removed by placing the cursor on the line with break point and press F9 again or click on the breakpoint symbol to clear that break point. The context menu can also be used for this purpose.


If several break points have been set, the user can choose to remove all the break points by clearing all breakpoints by choosing the Clear All Breakpoints in the Debug menu. All breakpoints can be enabled or disabled by choosing the appropriate option. Breakpoints can also be created by choosing the new breakpoint option from the debug menu. A dialog box is presented with a dialog box like the screenshot shown below.



If the execution is to be broken based on the value of a variable, then a conditional Breakpoint can be added. Right-clicking on the breakpoint opens a condition dialog box. See screenshot below.



The Condition is an expression that determines whether the breakpoint is hit or skipped. When the debugger reaches the breakpoint, it will evaluate the condition. The breakpoint will be hit only if the condition is satisfied. You can use a condition with a location breakpoint to stop at a specified location only when a certain condition is true. If the application that is being debugged is a banking application, where the account balance is never allowed to go below zero, then it must be ensured that the value for the variable account balance is always greater than zero. The breakpoints may be set at certain locations in the code and condition attached like balance < 0 to each one. When the program is run, execution will break at those points only when the balance is less than zero. The variables and program state can be examined at the first breakpoint location, then continue execution to the second breakpoint location, and so on.


Debugging a running process

A running process can be debugged by first attaching to. Choose the option Attach to Process from the Debug menu to attach a process. In case no project is open, a process can be attached by choosing Attach to Process from the Tools menu. This action opens the Attach to Process dialog box to open. In the dialog box choose the program that has to be attached from the available processes list. After choosing this process then click on the attach button.



The list of available processes is displayed automatically when the processes dialog box is opened. Process can start and stop in the background while the dialog box is open. Because of this the contents may not be current and the user will have to be refresh the list from time to time, by clicking the refresh button.


It is also possible for the user to be attached to multiple programs simultaneously when debugging, but only one program is active in the debugger at any given time. The active program can be set in the debug location toolbar. All the debug commands affect the current program only.


The debug windows option can be clicked in Debug menu to select the processes window. In this processes window double click the process that has to be made active.


Debugging a remote process

A remote process can be attached in the same way as a user can attach to a local process. In order to attach a remote process, go to the Attach to Process dialog box as in the earlier case. Check on the transport check box to ensure that proper transport is selected. In the name box type the name of the remote machine or select the machine name from the drop down list. Click on the ellipse button next to the name list to open the Browse for Computer. In the browse for computer dialog box, use the name of the list to open the machine. Click OK to connect to the process in the remote machine.


In this lesson we have dealt in some detail the procedure involved in testing and debugging applications. In the next lesson we shall be examining how to work with legacy code.





First Page: Web Application Tracing and Debugging


Read Next: ActiveX Controls and Legacy Code



 

 

Comments



Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links

 

Subscribe via RSS


Get Daily Updates via Subscribe to Exforsys Free Training via email


Get Latest Free Training Updates delivered directly to your Inbox...

Enter your email address:


 

Subscribe to Exforsys Free Training via RSS
 

 
Partners -  Privacy and Legal Policy -  Site News -  Contact   Sitemap  

Copyright © 2000 - 2009 exforsys.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape