Different solutions are available to debug a GWA application.
gwadb is the tool provided for
debugging GWA applications. For example, to start a debug session in a directory where you have a
program called main.4gl, you must first compile your program and then run the
debug command:
$ gwadb main
Internally, this command will call gwabuildtool to build the
application package in the gwa_dist directory and gwasrv will be called to serve your application in the browser.
Your application opens in the default browser with an address like this:
(Line breaks have
been added to improve readability.)
A loading page
is displayed while waiting for you to start debugging.Figure: GWA loading
In the terminal, the fgldb
debugging tool is running in attached mode to your program, ready to run fgldb
commands like run, break, step,
continue, quit, and so on.
gwadb main
gwadb:Wait for debuggee.....running fgldb on port:9400
(fgldb) run
For more details about using fgldb tool commands and debugging, go to Starting fglrun in debug mode or type help at the prompt.
Note:Genero Studio graphical
debugger
If using Genero Studio, the graphical debugger may be used. For more details, refer
to the Packaging for GWA and Graphical Debugger topics in the Genero Studio User Guide.
After quitting the debugger, the browser window should be marked as closed like this:Figure: GWA page closing debugger
Example: debug demo
The GWA installation includes a debug demo. To run the demo:
Locate the debug demo. If GWA was installed in FGLDIR, you will find the demo in
$FGLDIR/demo/gwa/debug or if installed in a separate directory, you will find
it in gwa-install-dir/demo/gwa/debug
If you have make installed, you can run the Makefile
included with the demo, which internally compiles the source files and builds the application
package in the gwa_dist directory before running the gwadb
command:
make gwa.debug
Or if you also want to build the distribution files,
run this target in the
makefile:
make gwa.debug_build
Both commands, start the
application in the browser and open fgldb in the terminal.
If not using make, you must compile the demo program first and then run the
debug command. For example, If you run the gwadb command with the module to
debug, it builds the gwa_dist directory
internally:
gwadb main
Or you can run the gwadb command
with the home page of the application after calling gwabuildtool to build the application package in the default
gwa_dist directory:
gwabuildtool -p .
gwadb gwa_dist/index.html
Both commands, start the application in the browser and
open fgldb in the terminal for debugging.