Browse Prior Art Database

Automated Software Trace

IP.com Disclosure Number: IPCOM000112222D
Original Publication Date: 1994-Apr-01
Included in the Prior Art Database: 2005-Mar-27
Document File: 2 page(s) / 68K

Publishing Venue

IBM

Related People

Yao, HH: AUTHOR

Abstract

Disclosed is a software trace mechanism that automates the entire process of software tracing (Figure). Trace generation starts at the program source files. An ID assigner is first invoked to assign a unique ID for each source file. The file ID generated by the inserter is a constant declaration accepted by the compiler used to compile the source files. An example in C source files is

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 52% of the total text.

Automated Software Trace

      Disclosed is a software trace mechanism that automates the
entire process of software tracing (Figure).  Trace generation starts
at the program source files.  An ID assigner is first invoked to
assign a unique ID for each source file.  The file ID generated by
the inserter is a constant declaration accepted by the compiler used
to compile the source files.  An example in C source files is

Static const unsigned int file_id = <n>;
where <n> starts from 1 and increments for each file.  Within the
source files, the programmer specifies the locations of interest in
the files (trace points) and variables to be traced using trace
statements.  Some examples of such trace statements in a C source
file are

TRACE( "point 1 reached\n" );

TRACE3( "the values are %x %x %x\n", v1, v2, v3 );

      Each program file includes a header file that contains the
routines or macros for generating a unique ID for each trace point.
Trace IDs are constructed by concatenating the file ID with the line
number of the trace point.  This allows unique identification of each
source file as well as every possible trace point in the file.  Some
examples of the trace macros are

 #define TRACE( f ) trace( 1, file_id << 16 | __LINE__ )
    #define TRACE1( f, v1 ) trace( 2, file_id << 16 | __LINE__, v1 )
    #define TRACE2( f, v1, v2 ) trace( 3, file_id << 16 | __LINE__, \
                v1, v2 )
   #define TRACE3( f, v1, v2, v3 ) trace( 4, file_id << 16 |
__LINE__, \
                v1, v2, v3 )

      In the example shown, __LINE__ expands to a unique location ID
that is combined with the source file ID.  The different macros are
for different numbers of arguments to be traced.  A companion trace
routine writes the trace ID constants and the values of variables of
interest into a block of memory set aside fo...