Debugging is a multistage procedure of identifying an issue, isolating its source, and then either fixing this issue or finding a suitable work-around.
Lycia goes together with an embedded debugger that is why any program compiled with Lycia can be debugged in LyciaStudio.
Lycia debugger allows revising the executed 4gl code line-by-line. This means that you can analyze the results received after each line is executed. If any issues occur, you can terminate the program and look for the cause of the issues.
Here is a short description of the main debugging steps:
Refer here to find more details.
In Lycia, you trace and control debugging from the Debug perspective.
Some issues cannot be found when debugging.
For example, you have written a wrong form name in a line which calls a form. The debugger will not see it as a issue because 4gl code in the line is correct. But at runtime, no form will be found and you will receive an error message instead.
In this video, you will find basic information about debugging and some real-life examples:
GLOBALS
DEFINE a, b, c INTEGER,
END GLOBALS
DEFINE leave CHAR (2)
MAIN
LET a = 1
CALL first_function() RETURNING b
LET c = b - a
CALL second_function()
IF c > 0 THEN
DISPLAY "C is equal to ", c AT 5, 2
PROMPT "Press any key to exit" FOR leave
EXIT PROGRAM
ELSE
DISPLAY "C is equal to 0 or less than 0" AT 5, 2
PROMPT "Press any key to exit" FOR leave
EXIT PROGRAM
END IF
END MAIN
FUNCTION first_function()
DEFINE r_b INTEGER
PROMPT "Enter value for variable B: " FOR r_b
RETURN r_b
END FUNCTION
FUNCTION second_function()
DISPLAY "A is equal to ", a CLIPPED, 1 space, "- it is a constant value" AT 2, 2
DISPLAY "B is equal to ", b CLIPPED, 1 space, "- it is the value you've entered" AT 3, 2
DISPLAY "A has been subtracted from B to get C" AT 4, 2
END FUNCTION