FTAM/9000 Programmer's Guide

Chapter 9 349
Handling Errors
Using API Tracing
Using API Tracing
API tracing allows you to get detailed information about your program's
interactions with the HP FTAM API without your having to access your
source code. It provides the return value of each API call made by your
program as well as the input parameters to each call.
API Tracing Variables
HP FTAM API tracing is controlled by the following three global
variables.
ft_trace indicates the trace level to be used. The default value of
ft_trace is 0, which indicates no tracing, but the value may instead be
defined in the %<api_trace.h> file as either of the following:
API_TR_ENTRY_EXIT — procedure entry and exit are traced. No
parameter information is displayed. This is useful if you are
interested only in seeing what FTAM calls your program is
making. This value is defined as 0x1.
API_TR_INPUT — input parameters to the FTAM functions, as
well as procedure entry and exit, are traced. This is useful is you
want to verify that FTAM is actually receiving the values you
expect. This value is defined as 0x2.
ft_trace_fp is a file pointer that is used to write the trace records. The
default is stderr. You can redirect the trace information to be saved to
a specific file, and then use fopen to open the file.
ft_trace_max_udata indicates the maximum amount of user data (in
bytes) to be displayed during tracing. The default is 16.
Enabling API Tracing
The following steps show how to enable API tracing in your program.
1. To include the appropriate definitions, add lines similar to the
following to your program:
#include %<api_trace.h>
extern int ft_trace;
extern FILE *ft_trace_fp;
extern int ft_trace_max_udata