Expressions in debugger commands
A limited expression syntax can be used in debugger commands.
Some debugger commands such as display take an expression as argument. The Genero debugger supports a reduced syntax for command expressions described in this section. For a detailed description of comparison operators, constant values and operands, see Expressions.
Syntax
variable
|
char-const
|
int-const
|
dec-const
|
NULL
|
TRUE
|
FALSE
|
expression IS [
NOT]
NULL
|
expression = expression
|
expression == expression
|
expression <= expression
|
expression => expression
|
expression < expression
|
expression > expression
|
expression + expression
|
expression - expression
|
expression * expression
|
expression / expression
|
expression OR expression
|
expression AND expression
|
NOT expression
|
- expression
|
( expression )
- variable is a program variable name, of any type (primitive type, record, array, ...)
- char-const is a character string literal delimited by single or double quotes.
- int-const is an integer literal.
- dec-const is a decimal number literal.
- expression is a combination of:
- one of the above listed syntax elements,
- an imported symbol (variable, function, ...),
- a build-in function such as
length(expression)
, - a class method such as
base.Application.getArgument(nnn)
, - a type function,
- a user-defined C extension function,
- chaining method calls is supported:
s.subString(2,3).getLength()
Example
Source code main.4gl:
IMPORT util
MAIN
VAR rec RECORD pkey INT, name VARCHAR(50) END RECORD
LET rec.pkey = 124
LET rec.pkey = "aaaaaa"
DISPLAY util.JSON.stringify(rec)
VAR arr DYNAMIC ARRAY OF STRING
LET arr[3] = "zzzzzz"
DISPLAY arr.getLength()
END MAIN
Using the debugger:
$ fglcomp main.4gl
$ fglrun -d main.42m
(fgldb) break 5
Breakpoint 1 at 0x00000000: file main.4gl, line 5.
(fgldb) run
Breakpoint 1, main() at main.4gl:5
5 VAR rec RECORD pkey INT, name VARCHAR(50) END RECORD
(fgldb) print base.Application.getArgument(0)
$1 = "main"
(fgldb) next
7 LET rec.pkey = 124
(fgldb) next
8 LET rec.pkey = "aaaaaa"
(fgldb) print rec.pkey * 100
$2 = 12400
(fgldb) print rec
$3 = {pkey = 124, name = (null)}
(fgldb) next
9 DISPLAY util.JSON.stringify(rec)
(fgldb) call util.JSON.parse('"eee"',rec.name)
(fgldb) p rec
$6 = {pkey = (null), name = "eee"}
(fgldb) next
11 VAR arr DYNAMIC ARRAY OF STRING
(fgldb) next
12 LET arr[3] = "zzzzzz"
(fgldb) next
13 DISPLAY arr.getLength()
(fgldb) print arr
$7 = {(null), (null), "zzzzzz"}
(fgldb) print arr.getLength()
$8 = 3
(fgldb) quit