13.21 Tracing

The tracing facilities are provided through a modification and extension of the software interrupt facilities. Briefly, if a parent process is tracing the progress of child process, every time the child process encounters a software interrupt, the parent process is given the opportunity to intervene as part of the total response to the interrupt.

The parent’s intervention may involve interrogation of values within the child process’s data areas, including the “per process data area”. Subject to certain constraints, the parent process may also change values within these data areas.

The source of the software interrupts may be the parent process, the user himself (e.g. by entering “kill” commands or “delete”s through his terminal) or the child process itself (e.g. instructions or other maladies).

The communication between child and parent processes is a kind of ritual dance:

(1)

the child experiences a software interrupt and “stops”;

(2)

the waiting parent discovers the “stopped” child (line 3301), and revives. Subsequently ...

(3)

the parent may execute the “ptrace” system call which has the effect of leaving a request message in the system defined structure “ipc” (3939) for the child process;

(4)

the parent then goes to “sleep” while the child “wakes up”;

(5)

the child reads the message in “ipc” and acts upon it (e.g copying one of its own values into “ipc.ip_data”);

(6)

the child then goes to “sleep” while the parent “wakes up”;

(7)

the parent inspects the result, as recorded in “ipc”, of the operation;

(8)

steps (3) to (7) may be repeated several times in succession.

Finally the parent may allow the child to continue its normal execution, possibly without ever knowing that a software interrupt had occurred.

A discussion of the tracing facility is contained in the Section “PTRACE (II)” of the UPM. To the list of functional limitations noted in the “Bugs” paragraph, we can add the following comments on efficiency: