Attaching KClient Workbench to background processes
It is possible to allow a KClient session to attach to a background KCML process for debugging purposes. There are two ways of doing this, outlined below. This is available from KCML 6.90.
Attaching to an existing background process
Using connection manager, connect as an administrator. Find the process in the processes page and select that entry and then Attach Workbench appears in the list of things you can do to it along with PANIC etc. It only appears for background processes and will only work if you have permissions to signal the process. It also launches a KClient on a special port to connect to the process which has just started listening. Once you have attached you debug in the normal way. You cannot quit the workbench without causing the background process to terminate.
Launching a process so that it can be attached to
To do this the KCML must be set to listen for a KClient session as start up. This is done either by specifying the -w argstring argument to KCML or by setting the environment variable KCML_ATTACH_WORKBENCH to argstring.
The format of argstring is either a simple port-number or a sequence of colon separated values. Trailing colons can be omitted:
program:port-number:action
program | The name of a program to stop on. If the program to be executed contains the string program then the KCML session will allow the workbench to attach, otherwise KCML will execute as normal. This is particularly useful when running KMake and a particular build step needs to be debugged. |
port-number | A non-zero value specifying the port to listen on. The port must not be already in use. |
action | By default the program executes as normal and debugging only starts if the program has a run-time error or executes a STOP or PANIC statement. As this is background process there are no forms to break in on. If this value is set to STOP then the workbench is entered immediately and the program is not executed until run from the workbench. |
The KClient session should be started once KCML has stopped waiting for it to attach. The -L flag should be used to indicate that there is no logging on and the connection needs to be specified. For example
kcml -S service -p program -w :1400:STOP kclient -L -h localhost:1400
will start KCML for a service to run the specified program. It will then wait for the kclient session to attach before entering the workbench. The connection of localhost means that the KCML is running on the same machine as KClient, but it would also work on a separate machine.