ACSE/Presentation and ROSE Interface Programmer's Guide

72 Chapter 5
Troubleshooting Your Application
Using A/P API Tracing
2. Within your program, enable tracing and select the level of tracing
you want by modifying the value of the ap_trace variable. For
example, to enable procedure tracing, input parameters tracing,
output parameters tracing, and error tracing enter the statement:
ap_trace = API_TR_ENTRY_EXIT | API_TR_INPUT |
API_TR_OUTPUT|API_TR_INT_ERROR;
3. If you want to redirect the trace output from the default file stderr
enter the statement: where /tmp/my_ap_trace is the name of the file
you choose for tracing.
if ((ap_trace_fp = fopen(“/tmp/my_ap_trace”, “w”)) ==
NULL) ap_trace_fp = stderr;
4. If you want more than the first 16 bytes of data to be displayed (the
default), then modify the ap_trace_max_udata parameter. For
example to increase the data displayed to 256 bytes enter:
p_trace_max_udata = 256;
Trace Output
The format of the trace output is as follows:
The first line indicates what function is being called and at what
time. The “->” symbol indicates procedure entry for example:
15:53:38 -> ap_open()
The subsequent line(s) indicate the input parameters to the function
call. The parameter name and its value are listed. For example:
14:53:39 -> ap_set_env()
fd = 3.
attr = AP_ROLE_ALLOWED
*val = 1
After the input parameters are displayed, the procedure exit is
shown. The time of return, and the return value are shown. The “<-”
symbol indicates procedure exit. For example:
15:53:38 <- ap_open() = 3
Lastly, any output parameters returned by the function call are
displayed. The parameter name is listed with its value. For example: