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 the Genero Studio User Guide for more details.
The fgldb command line tool takes the fglrun process id as value for the
-p
argument.
Before starting a debug session, make sure that you fulfill the prerequisites for debugging.
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
When using the Genero Application Server, inspect the GAS log files to find the pid of a fglrun process running behind a GAS application server. Enable full log reports in the GAS to get detailed information about process execution.
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.