stubgen.so is now include in the build process

This commit is contained in:
ocoursiere
2003-09-21 22:46:55 +00:00
parent e5aeed15d2
commit a08b796230
36 changed files with 12514 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
//
// FILE: Debug.C
// AUTHOR: tab, bmc
// DESCR: Debug log file utility functions
//
static char rcsid[] = "$Id: Debug.C,v 1.1 2003-09-21 22:46:55 ocoursiere Exp $";
#include "Debug.H"
#include <stdio.h>
#include <string.h>
#include <assert.h>
char dbg_file_list[DBG_MAX_FILES][DBG_MAX_FNAMELEN];
int dbg_num_files = 0;
#pragma init (dbg_init)
void dbg_init() {
FILE *f;
char *filename;
if (!(filename = getenv (DBG_ENV_VAR)))
filename = DBG_DEFAULT_FILE;
if ((f = fopen(filename, "r")) == NULL) {
return;
}
while ((!feof(f)) && (dbg_num_files < DBG_MAX_FILES)) {
char buf[DBG_MAX_FNAMELEN];
fgets(buf, DBG_MAX_FNAMELEN, f);
if (buf) {
// remove terminating newline
if (buf[strlen(buf)-1] == '\n') {
buf[strlen(buf)-1] = NULL;
}
if (buf[0] == 0)
continue;
strcpy(dbg_file_list[dbg_num_files], buf);
dbg_num_files++;
}
}
fclose(f);
}
int dbg_file_active(char *filename) {
for (int i = 0; i<= dbg_num_files; i++) {
if (strcasecmp(filename, dbg_file_list[i]) == 0) {
return 1;
}
}
return 0;
}

View File

@@ -0,0 +1,51 @@
//
// FILE: Debug.H
// AUTHOR: bmc
// DESCR: Debug header for FallOS
//
// $Id: Debug.H,v 1.1 2003-09-21 22:46:55 ocoursiere Exp $
//
#ifdef _ASSERT_H
#ifndef FALLOS_DEBUG_HEADER
#error Attempted to include <assert.h> before Debug.H
#endif
#endif
#ifndef FALLOS_DEBUG_HEADER
#define FALLOS_DEBUG_HEADER
#define _ASSERT_H
#include <stdlib.h>
#include <stdio.h>
#define panic(X) { printf ("Panic at line %d in file %s:\n%s\n", __LINE__, __FILE__, X); exit(1); }
//
// We define assert to print out the assertion message and then spin.
// The reason to spin instead of exiting is to allow you to Ctrl-C in
// the debugger and be able to walk up the stack, etc...
//
#define assert(X) if (!(X)) { \
printf ("Assertion failure at line %d in file %s:\n%s\n", __LINE__, \
__FILE__, #X); while(1); }
int dbg_file_active (char *fn);
void dbg_init();
#define DBG_MAX_FILES 100
#define DBG_MAX_FNAMELEN 100
#define DBG_DEFAULT_FILE ".dbg_files"
#define DBG_ENV_VAR "DBG_FILES"
#ifndef NDEBUG
#define dprintf(arg) if (dbg_file_active (__FILE__)) printf arg;
#define dpause(arg) if (dbg_file_active (__FILE__)) printf arg;
#else
#define dprintf(arg)
#define dpause(arg)
#endif
#endif