Home

Services

Sample ASPECT code

ASPECT tips and tricks

ASPECT resources on the web

General Procomm Plus information

Procomm Plus Support Files

To create a debug ASPECT script, open the ASPECT Editor, select the Tools | Compiler Options menu item, and enable the Compile for debug checkbox. You can also make this change by selecting the Tools | Scripts | Compile/Edit menu item within Procomm Plus and clicking the Compile Options button. Next, place a breakpoint command in your script, just before the portion of the script that you want to view in the debugger. Recompile your script and run it. When the breakpoint command is executed, the ASPECT Run-Time Debugger window will appear. In this window, you will be able to see which script command is about to be executed and the value of any variables (both the predefined global variables and those you have declared). If you are experiencing unexpected results when running your script, you can step through the script instruction by instruction, watching any pertinent variables, until you locate the problem. While much of the same functionality can be gained by printing program status via the usermsg or statmsg command, I find the debugger is a much easier and quicker way to solve script problems.

Another method to invoke the debugger without the use of the breakpoint command is to press Ctrl-Break while the script is running. Please note that the script must have been compiled as a debug script.

Another useful feature of debug scripts is the ability to include commands that only execute when a debug script is executed. To do this, a structure as such is used:

#ifdef ASPDEBUG
   ;perform commands that will only be executed if script is compiled for debug
#endif

For example, you could have usermsg or statmsg commands display the current contents of a variable for troubleshooting purposes, but only if the script was compiled for debug.

I have also copied an example from the help file that further illustrates how to output debug information while your script is running. This functionality is similar to an assert in C.

proc Example
param integer Value

	#ifdef ASPDEBUG
	if(value<0)||(value>100)
		usermsg "File: %s Line %ld Value out of range." ASPFILE ASPLINE
	endif
	#endif
	; Additional commands and processes
	; can be placed here.
endproc

For additional information on debugging script issues, see the "Step-by-Step: Resolving Run-Time Errors" topic in the ASPECT help file.


This document maintained by John Schultz. Material Copyright © 2002-2017
Procomm Plus and ASPECT are registered trademarks of Symantec Corporation