Tracing the run-time path for C code compiled with TEST
To trace a program showing the entry and exit points without requiring
any changes to the program, place the following z/OS® Debugger commands
in a file and
USE
them when z/OS Debugger initially
displays your program. Assuming you have a data set USERID.DTUSE(TRACE)
that
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 will be 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, with the USE file as a source of input
for z/OS Debugger commands:
>main
>foo
<foo
<main
If you do not want to create the USE file, you
can enter the commands through the command line, and the same effect
is achieved.