Attaching to a running program
It is possible to start the debugger for a program running on the same computer.
Basics
Use the fgldb command with the -p
pid
option, to switch an fglrun process running on
the same computer into debug mode.
The fgldb command must be executed on the machine where the fglrun process executes.
The graphical debugger of Genero Studio is able to start the fgldb tool on another computer through ssh, so that it is possible to debug a program running on a remote machine. See Genero Studio documentation for more details.
The fgldb command line tool takes the fglrun process id as value for the
-p
argument.
Debug a program running on a UNIX server
First, identify the process id of the fglrun program running on your server.
$ ps a | grep fglrun
10646 pts/0 S+ 0:00 /opt/myapp/fgl/lib/fglrun stockinfo.42m
You may want to debug processes that use a lot of machine resources (processor, memory or open files). Use a system utility to find a process id by resources used (for example, the top command on Linux®).
$ fgldb -p 10646
108 DISPLAY ARRAY contlist TO sr.*
(fgldb)
(fgldb)
prompt indicates that you are now connected
to the fglrun process, and the program flow is suspended. To continue with the
program flow, enter the "continue
" debugger command:(fgldb) continue
Continuing.
...
Continuing.
^CINTERRUPT
108 DISPLAY ARRAY contlist TO sr.*
(fgldb)
(fgldb) b 427
Breakpoint 2 at 0x00000000: file contacts.4gl, line 427.
(fgldb) continue
Continuing.
Breakpoint 2, edit_contact() at contacts.4gl:427
427 IF new THEN
(fgldb)
detach
" debugger command:(fgldb) detach
Connection closed by foreign host.