mdbug.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
// ------------------------------------------------------------
//
// mdbug.h
//
// Include file for the mdbug class.
//
#pragma ident "%Z%%M% %I% %E% SMI"
// Copyright (c) 1994 by Sun Microsystems, Inc.
// .LIBRARY base
// .NAME mdbug - macros for debugging C++ programs.
// .FILE dbug.cc
// .FILE mdbug.h
// .SECTION Description
// The mdbug package provides a set of macros for debugging C++ programs.
// Features include tracing function entry and exit points, printing
// of debug messages, and heap corruption detection. All features can
// be selectively enabled at run time using command line options. Also
// defining the macro DBUG_OFF removes all mdbug code from the compilation.
#ifndef MDBUG_H
#define MDBUG_H
#define DBUG_STMT(A) do { A } while (0)
#ifndef DBUG_OFF
static long sd_lineno; // Output line number.
static const char *sd_process; // Current process.
static void dbug_thread_exit(void *data);
const char *d_func; // Name of current function.
const char *d_file; // Name of current file.
int d_leaveline; // Exit line from routine.
~dbug_routine();
int db_keyword(const char *keyword);
void db_printf(const char *, ...);
static const char *db_push(const char *);
static void db_pop();
void db_process(const char *);
static int db_debugon();
};
#define dbug_assert(A) \
#define dbug_precond(A) \
// ------------------------------------------------------------
//
// db_debugon
//
// Description:
// Returns 1 if debugging is currently enabled, 0 otherwise.
// Arguments:
// Returns:
// Errors:
// Preconditions:
inline int
{
return (sd_on);
}
#else /* if DBUG_OFF */
#define dbug_enter(A) 0
#define dbug_leave() 0
#define dbug_traceprint(KEY) 0
#define dbug_push(A) 0
#define dbug_pop() 0
#define dbug_process(A) 0
#define dbug_assert(A) 0
#define dbug_precond(A) 0
#endif /* DBUG_OFF */
#endif /* MDBUG_H */