Actionpoints are breakpoints that can perform actions. When a breakpoint is hit, the actionpoint script is invoked by the debugger, and the process continues to run. Actionpoints are sophisticated debugging tools, and provide expert developers with an additional command suite. With them, a developer can alter the behavior of a function, capture the point at which a behavior changes, and modify/detect an object's state. To support these features, Actionpoints can alter the value of primitive local and member variables, can define their own 'user-defined-variables' and alter program execution.
User-Defined Variables in Actionpoints and Breakpoints
User Defined Variables (UDVs):
- Provide the means for setting a UDV primitive or string in Actionpoint statements
- Can be used in condition statements of multiple markers/breakpoints
- Can be seen easily in the same Local Variables window
- The final values of all UDVs are logged when debugging ends.
In the UDV syntax, the UDV name:
- Must be preceded by a # (hash) character
- Is case-insensitive
Actionpoint statements can contain set commands and goto commands.
set command - sets variable values. An Actionpoint statement can contain multiple set commands. They should precede any goto command.
The set command syntax is:
set LHS = RHS
LHS = the name of the variable as a:
- user defined variable (UDV) such as #myval
- local or member variable such as strName or this.m_strName
RHS = the value to assign:
- As a literal or local variable
- If a literal, as one of: integer, boolean, floating point, char or string
Local Variable Examples
set #mychar = 'a'
set #mystr = "a string"
set #myint = 10
set #myfloat = 0.5
set #mytrue = true
goto command - switches execution to a different line number in a function. An Actionpoint statement can contain only one goto command, as the final command in the statement.
The goto command syntax is:
Where L is a line number in the current function.
Where a UDV exists and is of type int, it can be incremented and decremented using the ++ and -- operators. For example:
- Create a UDV and set its value and type to a local integer variable.
AP1: set #myint = nTotalSoFar
- Increment the UDV.
- Decrement the UDV.
Actionpoints can report elapsed time between two points. There is only one timer available, which is reset or started with the startTimer command. The current elapsed time can then be printed with the printTimer command. Finally, the total elapsed time is printed and the timer ended with the endTimer command.
Example Actionpoint Conditions
With Literals and constants:
(#mystr <> "")
(#myint > 10)
(#myfloat > 0.0)
With Local Variables:
(#myval == this.m_strValue)
(#myint <> this->m_nCount)
(#myint != this->m_nCount)
Instruction recording can be useful for detecting changes to a known behavior; the point in execution (B) that diverges from a previous execution(s) (A). The commands are:
- recStart - starts recording or starts comparing if a previous recording exists
- recStop - ends recording
- recPause - pause recording
- recResume - resumes recording
The recStart command begins recording instructions. Executed instructions are then stored. When a recStop command is encountered, the recording is saved. There can only be one saved recording at any one time between two Actionpoints. When a recStart is encountered and a previous recording exists, the debugger will begin comparing each subsequent instruction with its recording. It could perform many comparisons. If and when a difference is detected, the debugger will break and the line of code where the behavior changed will be displayed in the code editor. The iteration of the comparison is also printed.
The recording is stored in memory by default, but it can also be stored to a file with the command syntax:
When a recStart command is encountered that specifies a file, and that file exists, it is loaded into memory and the debugger will immediately enter comparison mode.
There is no implicit precedence in Breakpoint, Actionpoint and Testpoint conditional expressions. In complex expressions, the use of parentheses is mandatory. See these examples:
Actionpoint UDV example
(#myint=1) AND (#mystr="Germany")
Local variables example
(this.m_nCount > 10) OR (nCount%1)
(this.m_nCount > 10) OR (bForce)
Equality operators in conditional expressions
<> Not Equal
!= Not Equal
Assignment operator in Actionpoint
= Assigns RHS to LHS
Arithmetic operators in conditional expressions
Logical operators in conditional expressions
AND - both must be true
OR - one must be true
&& - both must be true
|| - one must be true
^ - Exclusive OR (only one must be true)