Debugging with VS Code
The Genero BDL VS Code extension can be used to debug programs with VS Code debugger capabilities.
VS Code extension setup
Genero BDL provides a VS Code extension to be plugged into your VS Code editor. Setup instructions to install the VS Code extension for Genero BDL are provided in Visual Studio Code extension.
Once the VS Code extension for Genero BDL is installed, you can debug your programs from the VS Code editor.
Using the Launch task
-
Select the .4gl source containing the
MAIN
block. -
Select (4gl) Launch.
: This will execute the selected launch task, by default it will be -
The program starts in debug mode, and debugger stops at the first instruction of the program. You can control this with the
"stopAtEntry"
property in your launch task (check tasks.json configuration file). -
Go to the DEBUG CONSOLE panel: The prompt at the bottom allows you to evaluate expressions (for example, type sqlca + enter)
-
Go to the source code, and add a break point in one of the next lines.
-
Continue the program with F5, the program continues until the break point.
-
Right-click on the break point, and edit the break point (to add for example a condition)
Using the Attach task
VS Code can attach to a running fglrun
process.
With VS Code having a folder opened with the source code of your project, start an attach debug session as follows:
-
Go to the TERMINAL panel or go to another terminal emulator, and start a program with GUI interface, using the same Genero environment.
-
In VS Code, select the Run and Debug option, choose (4gl) Attach, start debugging (F5), then choose a running fglrun process.
-
The program should stop at the current instruction, and you can debug the source code.
Several debug sessions are possible. For example, when a program starts a child program with
RUN
, another debug session will start.
Debugging a TUI program
- In the environment, make sure that TERM and INFORMIXTERM variables are properly set to display
program forms in your terminal emulator, for example:
$ export TERM=xterm $ export INFORMIXTERM=terminfo
- Start VS Code with this environment set.
- In the launch.json file, modify (or copy and modify) the "(4gl)
launch" task to set the
externalConsole
property totrue
:
This will enable TTY output of fglrun to the TERMINAL panel."externalConsole": true,
- Select the program source to execute.
- Select the Run and Debug option and start the modified launch task.
- Click on Continue or press F5 to give the control to the runtime system.
- The TUI program interface should display in the TERMINAL panel.