To view the latest 11.3.x version, see PATROL Agent 11.3.02.

PslDebug--Run-Time Error Checking Variable


The PslDebug built-in local variable provides a run-time error checking and trace facility that detects a variety of common PSL coding errors. You can enable or disable run-time checking and/or tracing by equating PslDebug to a numeric value representing 1 or more of 16 error-checking flag bits. The trace data produced by the PslDebug trace flags is useful in debugging PSL programs during the initial stages of programming or as a pre-debug before calling the more powerful (and hence more time consuming) PSL debugger.
The general arrangement of the flags is as follows:

  • error checking: 0-128
  • tracing: 256-16384

The format of PslDebug within a PSL script is identical to that of any other PSL variable:

PslDebug = n;

where n is the sum of one or more of the values from the following table:

Value

Definition

PslDebug Enable All Error Checking and Tracing

-1

enable all PSL run-time error checking and tracing functions
Setting PslDebug = -1 is equivalent to setting all error checking and tracing flag
bits, or setting PslDebug = 257 (1 + 256 enables all error checking and all tracing
flag bits).

PslDebug Enable/Disable All Error Checking

0

disable all run-time error checking

1

enable all PSL run-time error checking
Setting PslDebug = 1 is equivalent to setting all error checking flag bits.

Numeric Operation Warnings

2

enable warnings when arithmetic operations involve NULL string operands. This check is a stylistic one used to verify that numeric variables are explicitly
initialized to zero rather than defaulting to NULL strings. These are treated as zero in arithmetic operations.
Example
The expression x+10 generates this warning when x is the NULL string.

4

enable warnings for arithmetic operations involving nonnumerical operands
Example
“mary” + “john”
This expression attempts to numerically add two character strings.

8

enable warnings for illegal or undefined arithmetic operations
Example
divide by zero

Variable Initialization Warnings

16

enable warnings for variables that were not explicitly initialized. This checks for variables that are used before being explicitly equated to a value. Variables are initialized to the NULL string by default. BMC Software recommends that you explicitly initialize all variables to a value (even the NULL string) as a matter of good programming style.

Built-in Function Warnings

32

enable warnings for PSL Version 2.0 built-in functions
This check allows you to suppress warning messages that were not suppressible in
PSL Version 2.0.
Example
A file not found message for the cat() function will generate this warning.
PslDebug = 32 is the default if PslDebug is not specified to provide the same
default behavior as PSL Version 2.0.

64

enable warnings for PSL Version 3.0 built-in functions. This is a new error check for built-in functions that were not in PATROL Version 2.0. The errors detected include passing non-numeric arguments when a numeric value is required, passing a bad argument, or passing the wrong number of arguments to a printf() function.

128

not used

PslDebug Enable All Tracing

256

enable all PSL run-time tracing
Setting PslDebug = 256 is equivalent to setting all tracing flag bits.

Function Tracing

512

enable function call tracing. Function call tracing reports which functions are called but does not return information about the arguments. Function call tracing traces both user-defined and built-in functions.

1024

enable function argument tracing. Function argument tracing reports the arguments passed to all user-defined or built-in functions. Function argument tracing requires that function call tracing (PslDebug = 512) also be enabled; that is, PslDebug = 1536 for function argument tracing.

2048

enable function return value tracing. Function return value tracing reports the value returned by calls to all user-defined or built-in functions.

Variable Tracing

4096

enable variable assignment tracing
Assignment tracing reports the variable name (if available) and its assigned value.

8192

enable errno tracing
The errno tracing reports any nonzero values stored in the PSL errno variable.

Lock Tracing

16384

enable PSL lock tracing
Lock tracing reports the interprocess actions that occur during lock() and unlock() function processing, including granting, denying, and releasing locks.

Migration Tracing

32768

enable KM developers to know what features or notations will change in the future and write a forward compatible application. One example of this is pconfig migration tracing.
Migration tracing reports when access to a pconfig variable should be using the following notation: //pcfg/pcfgVariable.

You set multiple flag bits by equating PslDebug to the sum of their values. For example, PslDebug = 44 would enable the following flags:

  • arithmetic operations involving nonnumeric operands (4)
  • illegal or undefined arithmetic operations (8)
  • PSL Version 2.0 built-in functions (32)

where the sum (4 + 8 + 32) is 44.

Where to go from here

Diagnosing-PSL-Program-Errors 

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*