Browse Prior Art Database

Method for Providing Dynamic Debug Messages in an AIX Application

IP.com Disclosure Number: IPCOM000116951D
Original Publication Date: 1995-Dec-01
Included in the Prior Art Database: 2005-Mar-31
Document File: 2 page(s) / 64K

Publishing Venue

IBM

Related People

Shue, DY: AUTHOR

Abstract

Unix applications are often built with "debug" statements. This is usually a macro which is enabled or disabled at compile time. The inclusion of the macro results in code that is automatically and always executed at runtime to produce printed messages that aid in debugging a program. While benign, there is the problem of requiring a different executable to run in order to debug code. There is the additional problem of having to stop an application and then start the debug version. This sequence might happen repeatedly, which is counterproductive, and it might be difficult to reproduce or otherwise trap a bug. A scheme for being able to dynamically enable or disable debugging messages in all related processes would alleviate these problems. The following scheme is proposed:

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

Method for Providing Dynamic Debug Messages in an AIX Application

      Unix applications are often built with "debug" statements.
This is usually a macro which is enabled or disabled at compile time.
The inclusion of the macro results in code that is automatically and
always executed at runtime to produce printed messages that aid in
debugging a program.  While benign, there is the problem of requiring
a different executable to run in order to debug code.  There is the
additional problem of having to stop an application and then start
the debug version.  This sequence might happen repeatedly, which is
counterproductive, and it might be difficult to reproduce or
otherwise trap a bug.  A scheme for being able to dynamically enable
or disable debugging messages in all related processes would
alleviate these problems.  The following scheme is proposed:

      Define a global variable, such as "debug", which will be used
for the main procedure and all other procedures in the same module.
For associated modules this is defined as an "extern".

      Replace debug macros with IF statements testing a global
variable, or a debug macro which incorporates an IF statement could
be used.  The test can be a simple on/off or a switch that produces
different "levels" of messages depending on the value of the debug
global variable, or additionally can be used to re-direct messages,
e.g., to the null device or to a file.  "Print" statements for
debugging are included within the IF code block.  By placing these in
strategic places, thorough diagnostic information can be obtained for
both data and code flow.

      The mechanism used to change the state...