debug.h File Reference

Go to the source code of this file.

Namespaces

namespace  rutz
namespace  rutz::debug

Defines

#define GVX_PANIC(message)   rutz::debug::panic_aux(message, __FILE__, __LINE__)
 Print a message, followed by a rutz::backtrace (if available), then abort().
#define GVX_ABORT_IF(expr)   do { if ( expr ) { rutz::debug::panic_aux(#expr, __FILE__, __LINE__); } } while (0)
 Abort if the given expression evaluates to true.
#define GVX_CONCAT(x, y)   x ## y
#define GVX_DO_DBG_REGISTER(ext)
#define GVX_DBG_REGISTER   GVX_DO_DBG_REGISTER(1)
#define GVX_DBG_LEVEL   dbg_level_1
#define dbg_eval(lev, x)   do { if (GVX_DBG_LEVEL() >= lev) rutz::debug::eval(#x, lev, __FILE__, __LINE__, false, x); } while (0)
#define dbg_eval_nl(lev, x)   do { if (GVX_DBG_LEVEL() >= lev) rutz::debug::eval(#x, lev, __FILE__, __LINE__, true, x); } while (0)
#define dbg_print(lev, x)   do { if (GVX_DBG_LEVEL() >= lev) rutz::debug::eval(0, lev, __FILE__, __LINE__, false, x); } while (0)
#define dbg_print_nl(lev, x)   do { if (GVX_DBG_LEVEL() >= lev) rutz::debug::eval(0, lev, __FILE__, __LINE__, true, x); } while (0)
#define dbg_dump(lev, x)   do { if (GVX_DBG_LEVEL() >= lev) { rutz::debug::dump(#x, lev, __FILE__, __LINE__); (x).debug_dump(); } } while (0)
#define dbg_nl(lev)   do { if (GVX_DBG_LEVEL() >= lev) rutz::debug::start_newline(); } while (0)
#define GVX_ASSERT(expr)   do { if ( !(expr) ) rutz::debug::assert_aux(#expr, __FILE__, __LINE__); } while(0)
#define GVX_INVARIANT(expr)   do { if ( !(expr) ) rutz::debug::invariant_aux(#expr, __FILE__, __LINE__); } while(0)
#define GVX_PRECONDITION(expr)   do { if ( !(expr) ) rutz::debug::precondition_aux(#expr, __FILE__, __LINE__); } while(0)
#define GVX_POSTCONDITION(expr)   do { if ( !(expr) ) rutz::debug::postcondition_aux(#expr, __FILE__, __LINE__); } while(0)

Functions

void rutz::debug::eval (const char *what, int level, const char *where, int line_no, bool nl, bool expr) throw ()
void rutz::debug::eval (const char *what, int level, const char *where, int line_no, bool nl, char expr) throw ()
void rutz::debug::eval (const char *what, int level, const char *where, int line_no, bool nl, unsigned char expr) throw ()
void rutz::debug::eval (const char *what, int level, const char *where, int line_no, bool nl, short expr) throw ()
void rutz::debug::eval (const char *what, int level, const char *where, int line_no, bool nl, unsigned short expr) throw ()
void rutz::debug::eval (const char *what, int level, const char *where, int line_no, bool nl, int expr) throw ()
void rutz::debug::eval (const char *what, int level, const char *where, int line_no, bool nl, unsigned int expr) throw ()
void rutz::debug::eval (const char *what, int level, const char *where, int line_no, bool nl, long expr) throw ()
void rutz::debug::eval (const char *what, int level, const char *where, int line_no, bool nl, unsigned long expr) throw ()
void rutz::debug::eval (const char *what, int level, const char *where, int line_no, bool nl, float expr) throw ()
void rutz::debug::eval (const char *what, int level, const char *where, int line_no, bool nl, double expr) throw ()
void rutz::debug::eval (const char *what, int level, const char *where, int line_no, bool nl, const char *expr) throw ()
void rutz::debug::eval (const char *what, int level, const char *where, int line_no, bool nl, void *expr) throw ()
void rutz::debug::dump (const char *what, int level, const char *where, int line_no) throw ()
void rutz::debug::start_newline () throw ()
void rutz::debug::panic_aux (const char *what, const char *where, int line_no) throw ()
void rutz::debug::assert_aux (const char *what, const char *where, int line_no) throw ()
void rutz::debug::precondition_aux (const char *what, const char *where, int line_no) throw ()
void rutz::debug::postcondition_aux (const char *what, const char *where, int line_no) throw ()
void rutz::debug::invariant_aux (const char *what, const char *where, int line_no) throw ()
int rutz::debug::create_key (const char *filename)
 Allocate a debug key for the given filename.
bool rutz::debug::is_valid_key (int key)
 Query whether the given value is a valid debug key.
int rutz::debug::lookup_key (const char *filename)
 Get the debug key associated with the given filename.
int rutz::debug::get_level_for_key (int key)
 Get the current debug level associated with the given debug key.
void rutz::debug::set_level_for_key (int key, int level)
 Set the current debug level for the given debug key.
const char * rutz::debug::get_filename_for_key (int key)
 Get the filename associated with the given debug key.
void rutz::debug::set_global_level (int lev)


Detailed Description

debugging facilities, assertions, preconditions, postconditions, invariants

Definition in file debug.h.


Define Documentation

#define GVX_ABORT_IF ( expr   )     do { if ( expr ) { rutz::debug::panic_aux(#expr, __FILE__, __LINE__); } } while (0)

Abort if the given expression evaluates to true.

This is like GVX_ASSERT(), except (1) it has the opposite sense (GVX_ASSERT() says some expression must be TRUE, GVX_ABORT_IF() says some expression must be false), and (2) it can't ever be turned off (whereas GVX_ASSERT() is under the control of the GVX_NO_DEBUG macro).

Definition at line 95 of file debug.h.

#define GVX_DO_DBG_REGISTER ( ext   ) 

Value:

static const int GVX_CONCAT(DEBUG_KEY, ext) =                        \
  rutz::debug::create_key(__FILE__);                                 \
                                                                     \
static inline int GVX_CONCAT(dbg_level_, ext) ()                     \
{                                                                    \
  return rutz::debug::get_level_for_key(GVX_CONCAT(DEBUG_KEY, ext)); \
}

Definition at line 100 of file debug.h.


The software described here is Copyright (c) 1998-2005, Rob Peters.
This page was generated Wed Dec 3 06:51:49 2008 by Doxygen version 1.5.5.