Tracing the run-time path for C++ code compiled with TEST
To trace a program showing the entry and exit of that program without
requiring any changes to it, place the following z/OS® Debugger commands,
shown in the example below, in a file and
USE
them
when z/OS Debugger initially
displays your program. Assume you have a data set that contains USERID.DTUSE(TRACE)
and
contains the following z/OS Debugger commands:
int indent;
indent = 0;
SET INTERCEPT ON FILE stdout;
AT ENTRY * { \
++indent; \
if (indent < 0) indent = 0; \
printf("%*.s>%s\n", indent, " ", %block); \
GO; \
}
AT EXIT * {\
if (indent < 0) indent = 0; \
printf("%*.s<%s\n", indent, " ", %block); \
--indent; \
GO; \
}
You can use this file as the source of commands to z/OS Debugger by entering
the following command: USE USERID.DTUSE(TRACE)
The
trace of running the program listed below after executing the USE
file is displayed in the Log window: int foo(int i, int j) {
return i+j;
}
int main(void) {
return foo(1,2);
}
The following trace in the Log window is displayed after
running the sample program, using the USE file as a source of input
for z/OS Debugger commands:
>main
>foo(int,int)
<foo(int,int)
<main
If you do not want to create the USE file, you can enter the commands through the command line, and the same effect will be achieved.