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, goto commands and jmp commands.
Sets variable values. An Actionpoint statement can contain multiple 'set' commands, all of which 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
set command - Variable Examples
Local Variable Examples
set #mychar = 'a'
set #mystr = "a string"
set #myint = 10
set #myfloat = 0.5
set #mytrue = true
This 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.
The goto command uses breakpoints to achieve its goal, which causes a slight delay in code execution. This can be noticeable in regions of code that are executed very frequently, so you might prefer to use the jmp command in such code, to achieve the same diversion of execution but with less delay.
The jmp command is effectively the same as the goto command.
Both these commands cause the execution to be changed to line 125.
However the jmp statement internally uses instrumentation to direct the program to move execution, whereas the goto statement uses breakpoints to do that, which causes a delay in processing. The difference is, therefore, superior performance for the jmp statement, especially where regions of code are executed very frequently.
Where a User Defined Variable (UDV) exists and it 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 examples
(this.m_nCount > 10) OR (nCount%1)
(this.m_nCount > 10) OR (bForce)
Equality operators in conditional expressions
<> - Not Equal
!= - Not Equal
== - Equal
= - Equal
Assignment operator in Actionpoint
= - Assigns RHS to LHS
Arithmetic operators in conditional expressions
/ - division
+ - plus
- - minus
* - multiplication
% - modulus
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)