25 #include "pips_config.h"
72 #define STACK_LENGTH 50
99 if(i >= 0 && i <=
idls) {
108 "Too many calls to debug_off()\n", i,
idls);
114 const char *
function,
121 int dl = ((level_env = getenv(
env)) != NULL) ? atoi(level_env) : 0;
136 const char *
function,
151 "[%s] (%s:%d) debug on and\n"
152 "[%s] (%s:%d) debug off don't match\n",
155 function, file,
line);
168 (void)
fprintf(stderr,
"Debug stack (last debug_on first): ");
170 for(i=
idls-1;i>=0;i--)
171 (
void)
fprintf(stderr,
"%s=%d [%s] (%s:%d)\n",
189 debug(
const int the_expected_debug_level,
190 const char * calling_function_name,
191 const char * a_message_format,
194 va_list some_arguments;
195 #define MAX_MARGIN (8)
196 static char * margin =
" ";
205 margin_length =
MAX_MARGIN+1-the_expected_debug_level;
206 (void)
fprintf(stderr,
"%s[%s] ",
207 margin + (margin_length>0 ? margin_length : 0),
208 calling_function_name);
210 va_start(some_arguments, a_message_format);
213 (void) vfprintf(stderr, a_message_format, some_arguments);
215 va_end(some_arguments);
225 const char * a_message_format,
228 va_list some_arguments;
234 (void)
fprintf(stderr,
"[unknown] ");
236 va_start(some_arguments, a_message_format);
239 (void) vfprintf(stderr, a_message_format, some_arguments);
241 va_end(some_arguments);
260 double memory_size = -1.0 ;
#define pips_user_warning
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
#define pips_internal_error
double get_process_memory_size(void)
void print_debug_stack(void)
function used to debug (can be called from dbx) BB 6.12.91
void debug_off_function(const char *function, const char *file, const int line)
int get_debug_level(void)
GET_DEBUG_LEVEL returns the current debugging level.
void pips_debug_function(const int the_expected_debug_level, const char *a_message_format,...)
pips_debug is a nice macro that depends on gcc to generate the function name and to handle a variable...
void set_debug_stack_pointer(const int i)
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
int the_current_debug_level
Debugging functions.
void set_debug_level(const int l)
SET_DEBUG_LEVEL is a function that sets the current debuging level to the value passed as argument.
void debug_on_function(const char *env, const char *function, const char *file, const int line)
static debug_level debug_stack[STACK_LENGTH]
idls points to the first free bucket in debug_stack
double get_process_gross_heap_size(void)
_int get_debug_stack_pointer(void)
The pair get_ and set_debug_stack_pointer() should never be used except to clean up the stack after a...
#define message_assert(msg, ex)
#define same_string_p(s1, s2)
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
static int line
FLEX_SCANNER.