INFORMIX SOFTWARE, INC. SmartWare II Technical Support Bulletin 021 Subject: Remember Tools Trace Date: January 25, 1990 The REMEMBER TOOLS TRACE command invokes a utility that aids in the debugging process of a project. This utility is useful in finding the values of all variables in memory and/or setting breakpoints. The Trace utility has two windows. The top window displays the function that Trace was called from, the command that the break occurred on (if Quiet is OFF), the previous and current error numbers and what caused the break to happen. The bottom window displays the current variables in memory by name, type (string or numeric), the declaration of the variable (Public, Global, or Local) and the value stored in it (up to 20 characters). The variable listing is the default display in the bottom window. The Trace utility can set a breakpoint. A breakpoint is a condition that the user can set to cause the execution of the project to stop. There are four types of breakpoints that can be created. They are Each line, Error, Condition, or Function. A breakpoint on "each line" stops the project on every line (similar to the SINGLE-STEP statement). An Error breakpoint stops the project when an error has occurred. A Condition breakpoint stops the project when a logical, true condition (non-zero) is met such as checking for a value within a variable. A Function breakpoint stops the project when a user defined, public function is called. Below the two windows shows the available function key and what they do. The basic operations of each key applies for both the variable listing and for the breakpoints, but the actual operation varies between the two. For variables they are F2 Edit -- This key allows the user to edit the value of a Public variable only. If no variable is within the variable window then F2 will not work. To edit a variable, point to the variable and press the F2 key. The function key line will disappear and Trace will ask for an expression. Use the LET command to change the value of a variable. An example is: LET STRING="ONE" This example assigned the word "ONE" to the Public variable STRING. A PUBLIC, LOCK MODULE variable can be created at the same time as an existing variable is being changed by following the same steps except type in a new name for the variable name. F3 Add -- This key allows the user to add a variable to be displayed in the Trace window. Either type in the variable name or * for all variables in memory. This key will not add a variable to memory. F4 Remove -- This key removes a variable from the display of Trace. It DOES NOT remove the variable from memory. To remove the variable, point to the variable and press F4. If the variable was added to the window with the global specifier, * (asterisk), then the variable can only be removed by pointing to the asterisk and pressing F4. If a variable was added to the window one at a time, then it must be removed one at a time. Pressing F4 on the asterisk will only remove those added that way. F5 Clear -- Clear removes all variables from the window regardless of how it was added to the window. This will not clear the variables from memory. F6 Breakpoints -- This invokes the breakpoint display and allows the Trace utility to edit, add, remove and clear breakpoints. F10 Continue -- This key exits the Trace utility. For breakpoints, the function keys are F2 Edit -- This key allows the user to edit an existing breakpoint. To do this, point to the breakpoint condition and press the F2 key. The function key line disappears and Trace displays the breakpoint condition. Simply modify it and press enter to accept the change. This key only works on condition and function breakpoints. F3 Add -- This key allows the user to create a breakpoint condition. Pressing F3 asks for the type of breakpoint to be created. The user can create a breakpoint on every Line, if an error occurs, a logical condition, or a function call. Choosing a breakpoint on a condition or a function requires that the user enter in the logical condition (that break when true) or the function name (without the parentheses and arguments). Breakpoints stop the execution of the project in the default mode of TRACE ON. Turning TRACE OFF in a project will ignore all breakpoints set until TRACE ON is again called. The TRACE OFF statement does not effect calling trace directly in the project. This is accomplished by using the Trace statement within a project without any specific keywords. An example of a logical break point is STRING="ONE" The project stops execution when, in this case, the PUBLIC variable STRING is the same as the text "ONE." Another way of saying this is when STRING="ONE" is true. A logical breakpoint condition only works with public variables, local and global variables do not work. An example of a function breakpoint is TESTING The project again stops execution on the first line within the user defined function when it is called. In this case, Trace breaks when the first line of the function TESTING is reached. As you can see, no parameters or parentheses are used. The function breakpoint only works on PUBLIC user defined functions. It does not work on SmartWareII functions or global functions. F4 Remove -- This key removes the chosen breakpoint. F5 Clear -- This key clears all breakpoints. F10 Finish -- This key returns to the variable listing. The trace utility is called from the command line by choosing REMEMBER TOOLS TRACE or within a project by having the statement Trace in the project. When the Trace statement is reached in the project, the trace utility is called. This does not suspend the project. Pressing F10 to exit the utility will start the project again.