OSF DCE Application Development Guide--Core Components

Using the DCE Serviceability Application Interface
This macro can be used to test the active debug level and avoid calling a debug
output routine if the level of its message is disabled at the time of the call (disabling
the level does not stop any routines from being executed; it only suppresses the
output messages at that level). See Section 4.3.13 for more information.
DCE_SVC_DEBUG_IS( )
Tests the active debug level for a subcomponent. Returns TRUE if the debug level is
the same as that specified in the call; otherwise returns FALSE. For example, the
following call would return TRUE only if the debug level for hel_s_main had been
set to svc_c_debug2:
DCE_SVC_DEBUG_IS(hel_svc_handle, hel_s_main, svc_c_debug2);
dce_assert( )
Evaluates an int expression passed to it and, if the expression evaluates to 0 (that is,
if the expression is false), automatically calls dce_svc_printf() with parameters that
will cause a message with a severity level of svc_c_sev_fatal (that is, fatal) and an
action attribute of svc_c_action_abort to be printed that will identify the following:
— The expression
— The source file in which the assertion failed
— The line at which the assertion failed
For example, the following call will cause the failed expression (namely, the string)
to be printed and the program to be aborted.
dce_assert(hel_svc_handle, ("Test diagnostic message" == NULL))
A NULL can be substituted for the serviceability handle as the first argument.
It is very important that debug messages not be used for errors that can occur during
ordinary operation. This is because the debug messaging code can be omitted when
compiling for production.
4.3.12.1 Setting Debug Levels
Nine serviceability debug message levels are available. The precise meaning of each
level for an application is left to the developer; but the general intention is that ascending
to a higher level (for example, from svc_c_debug2 to svc_c_debug3) should increase the
level of information detail.
Setting debug messaging at a certain level means that all levels up to and including the
specified level are enabled. For example, if the debug level is set at svc_c_debug4, then
the svc_c_debug1, svc_c_debug2, and svc_c_debug3 levels are enabled as well.
A message can have a debug level attached to it in either of two ways:
The debug level can be specified as one of the attributes in the message’s definition
in the sams file.
124245 Tandem Computers Incorporated 4 35