debug.cc File Reference

#include "rutz/debug.h"
#include "rutz/backtrace.h"
#include "rutz/mutex.h"
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>

Include dependency graph for debug.cc:

Go to the source code of this file.

Namespaces

namespace  GVX_DBG_REGISTER

Defines

#define EVAL_IMPL(T)

Functions

void GVX_DBG_REGISTER::show_position (int level, const char *where, int line_no) throw ()
 EVAL_IMPL (bool)
 EVAL_IMPL (char)
 EVAL_IMPL (unsigned char)
 EVAL_IMPL (short)
 EVAL_IMPL (int)
 EVAL_IMPL (long)
 EVAL_IMPL (float)
 EVAL_IMPL (double)
 EVAL_IMPL (const char *)
 EVAL_IMPL (void *)
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)

Variables

const int GVX_DBG_REGISTER::MAX_KEYS = 1024
bool GVX_DBG_REGISTER::g_debug_line_complete = true
pthread_mutex_t GVX_DBG_REGISTER::g_debug_output_mutex = PTHREAD_MUTEX_INITIALIZER
int GVX_DBG_REGISTER::g_debug_next_key = 0
unsigned char GVX_DBG_REGISTER::g_key_levels [MAX_KEYS]
const char * GVX_DBG_REGISTER::g_key_filenames [MAX_KEYS]
pthread_mutex_t GVX_DBG_REGISTER::g_debug_keys_mutex = PTHREAD_MUTEX_INITIALIZER


Detailed Description

debugging facilities, assertions, preconditions, postconditions, invariants

Definition in file debug.cc.


Define Documentation

#define EVAL_IMPL (  ) 

Value:

void rutz::debug::eval(const char* what, int level,     \
                       const char* where, int line_no,  \
                       bool nl, T expr) throw()         \
{                                                       \
  GVX_MUTEX_LOCK(&g_debug_output_mutex);                \
  using std::cerr;                                      \
  cerr.exceptions(std::ios::goodbit);                   \
  if (g_debug_line_complete)                            \
    {                                                   \
      show_position(level, where, line_no);             \
    }                                                   \
  if (what)                                             \
    {                                                   \
      cerr << "(" << #T << ") " << what << " = ";       \
    }                                                   \
  cerr << expr;                                         \
  if (nl)                                               \
    {                                                   \
      cerr << "\n";                                     \
      g_debug_line_complete = true;                     \
    }                                                   \
  else                                                  \
    {                                                   \
      cerr << ", ";                                     \
      g_debug_line_complete = false;                    \
    }                                                   \
}

Definition at line 70 of file debug.cc.


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.