Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

debug - program debugging in forked tasks

&pagelevel(4)&pagelevel

The debug command enables POSIX programs which can be started from within a shell to be debugged.


Syntax


Format 1:debug[ -e] program[ arguments]...
Format 2:debug[ -p] pid



Format 1:debug[ -e] program[ arguments]...


The program to be debugged is loaded in the task generated from within the shell by means of a fork (fork task).

Once the program has been loaded, but before the first command is executed, control is passed to the user on BS2000 command level. The process ID of the fork task is displayed as a prompt (see also Example 1 below).


-e

program is loaded without its external symbols dictionary.

program

Name of the program to be debugged. The program must be executable.

arguments

program arguments.


Format 2:debug[ -p] pid


The program running in the fork task with process ID pid is stopped.

The user is given control on BS2000 command level. The process ID of the interrupted fork task is displayed as a prompt (see also Example 2).


-p

Interrupts the program in the task with process ID pid.

pid

Process ID of the task that is to be stopped.

Example 1

The example below illustrates what happens up to the point where the program to be debugged is loaded. When the prompt pid/ appears, the program is ready to start as it would be after a /LOAD-PROGRAM command. AID commands can be used to influence how debugging is to proceed. The program starts again after the /RESUME-PROGRAM command in the fork task.

/START-POSIX-SHELL
$ cd myprogdir
$ ls -l myprog
-rwxr-xr-x  1  MYUSER    MYGROUP 1150976  Wed May 11 13:10:50 MSZ 2005 myprog
$ debug myprog
% AID0348 Program stopped due to EXEC event (PID=0000000055)
0000000055/

Example 2

This example illustrates what happens when a program executing in a fork task is interrupted. When the pid/ prompt appears, the program has been interrupted as when K2 is pressed. AID commands can be used to influence how debugging is to proceed. The program starts again after the RESUME-PROGRAM command in the interrupted fork task.

/START-POSIX-SHELL
$ ps -e
    UID  PID  PPID  C     STIME TTY        TIME  CMD
SYSROOT  243     1  0  16:32:38 term/001   0:01  [sh]
SYSROOT  245   243  0  16:33:44 term/001   0:00  [loop]
$ debug -p 245
% AID0492 %STOP was send for fork task (PID=0000000245)
$
% AID0348 Program stopped due to STOP event (PID=0000000245)
0000000245/