diff options
-rw-r--r-- | dbug/dbug.c | 140 | ||||
-rw-r--r-- | dbug/dbug_long.h | 16 | ||||
-rw-r--r-- | dbug/user.r | 22 | ||||
-rw-r--r-- | include/my_dbug.h | 4 | ||||
-rw-r--r-- | mysys/my_thr_init.c | 2 |
5 files changed, 19 insertions, 165 deletions
diff --git a/dbug/dbug.c b/dbug/dbug.c index da8733c803f..3626afa59e6 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -138,26 +138,16 @@ #define BOOLEAN my_bool /* - * Make it easy to change storage classes if necessary. - */ - -#define IMPORT extern /* Names defined externally */ -#define EXPORT /* Allocated here, available globally */ -#define AUTO auto /* Names to be allocated on stack */ -#define REGISTER register /* Names to be placed in registers */ - -#ifdef M_I386 /* predefined by xenix 386 compiler */ -#define AUTOS_REVERSE 1 -#else -#define AUTOS_REVERSE 0 -#endif - -/* * Externally supplied functions. */ #ifndef HAVE_PERROR -static void perror(); /* Fake system/library error print routine */ +static void perror(char *s) +{ + if (s && *s != '\0') + (void) fprintf(stderr, "%s: ", s); + (void) fprintf(stderr, "<unknown system error>\n"); +} #endif /* @@ -1718,7 +1708,7 @@ BOOLEAN _db_keyword_(CODE_STATE *cs, const char *keyword, int strict) static void Indent(CODE_STATE *cs, int indent) { - REGISTER int count; + int count; indent= max(indent-1-cs->stack->sub_level,0)*INDENT; for (count= 0; count < indent ; count++) @@ -1750,7 +1740,7 @@ static void Indent(CODE_STATE *cs, int indent) static void FreeList(struct link *linkp) { - REGISTER struct link *old; + struct link *old; while (linkp != NULL) { @@ -1849,8 +1839,8 @@ static void DoPrefix(CODE_STATE *cs, uint _line_) static void DBUGOpenFile(CODE_STATE *cs, const char *name,const char *end,int append) { - REGISTER FILE *fp; - REGISTER BOOLEAN newfile; + FILE *fp; + BOOLEAN newfile; if (name != NULL) { @@ -1976,7 +1966,7 @@ static void DbugExit(const char *why) static char *DbugMalloc(size_t size) { - register char *new_malloc; + char *new_malloc; if (!(new_malloc= (char*) malloc(size))) DbugExit("out of memory"); @@ -2017,7 +2007,7 @@ static const char *DbugStrTok(const char *s) static const char *BaseName(const char *pathname) { - register const char *base; + const char *base; base= strrchr(pathname, FN_LIBCHAR); if (base++ == NullS) @@ -2054,8 +2044,8 @@ static const char *BaseName(const char *pathname) static BOOLEAN Writable(const char *pathname) { - REGISTER BOOLEAN granted; - REGISTER char *lastslash; + BOOLEAN granted; + char *lastslash; granted= FALSE; if (EXISTS(pathname)) @@ -2079,105 +2069,11 @@ static BOOLEAN Writable(const char *pathname) } #endif - /* - * FUNCTION - * - * _db_setjmp_ save debugger environment - * - * SYNOPSIS - * - * VOID _db_setjmp_() - * - * DESCRIPTION - * - * Invoked as part of the user's DBUG_SETJMP macro to save - * the debugger environment in parallel with saving the user's - * environment. - * - */ - -#ifdef HAVE_LONGJMP - -EXPORT void _db_setjmp_() -{ - CODE_STATE *cs; - get_code_state_or_return; - - cs->jmplevel= cs->level; - cs->jmpfunc= cs->func; - cs->jmpfile= cs->file; -} - -/* - * FUNCTION - * - * _db_longjmp_ restore previously saved debugger environment - * - * SYNOPSIS - * - * VOID _db_longjmp_() - * - * DESCRIPTION - * - * Invoked as part of the user's DBUG_LONGJMP macro to restore - * the debugger environment in parallel with restoring the user's - * previously saved environment. - * - */ - -EXPORT void _db_longjmp_() -{ - CODE_STATE *cs; - get_code_state_or_return; - - cs->level= cs->jmplevel; - if (cs->jmpfunc) - cs->func= cs->jmpfunc; - if (cs->jmpfile) - cs->file= cs->jmpfile; -} -#endif - -/* - * FUNCTION - * - * perror perror simulation for systems that don't have it - * - * SYNOPSIS - * - * static VOID perror(s) - * char *s; - * - * DESCRIPTION - * - * Perror produces a message on the standard error stream which - * provides more information about the library or system error - * just encountered. The argument string s is printed, followed - * by a ':', a blank, and then a message and a newline. - * - * An undocumented feature of the unix perror is that if the string - * 's' is a null string (NOT a NULL pointer!), then the ':' and - * blank are not printed. - * - * This version just complains about an "unknown system error". - * - */ - -#ifndef HAVE_PERROR -static void perror(s) -char *s; -{ - if (s && *s != '\0') - (void) fprintf(stderr, "%s: ", s); - (void) fprintf(stderr, "<unknown system error>\n"); -} -#endif /* HAVE_PERROR */ - - - /* flush dbug-stream, free mutex lock & wait delay */ - /* This is because some systems (MSDOS!!) dosn't flush fileheader */ - /* and dbug-file isn't readable after a system crash !! */ + flush dbug-stream, free mutex lock & wait delay + This is because some systems (MSDOS!!) dosn't flush fileheader + and dbug-file isn't readable after a system crash !! +*/ static void DbugFlush(CODE_STATE *cs) { diff --git a/dbug/dbug_long.h b/dbug/dbug_long.h index 829df181ef1..e77218b29b7 100644 --- a/dbug/dbug_long.h +++ b/dbug/dbug_long.h @@ -116,16 +116,10 @@ # define DBUG_VOID_RETURN return # define DBUG_EXECUTE(keyword,a1) # define DBUG_PRINT(keyword,arglist) -# define DBUG_2(keyword,format) /* Obsolete */ -# define DBUG_3(keyword,format,a1) /* Obsolete */ -# define DBUG_4(keyword,format,a1,a2) /* Obsolete */ -# define DBUG_5(keyword,format,a1,a2,a3) /* Obsolete */ # define DBUG_PUSH(a1) # define DBUG_POP() # define DBUG_PROCESS(a1) # define DBUG_FILE (stderr) -# define DBUG_SETJMP setjmp -# define DBUG_LONGJMP longjmp # define DBUG_DUMP(keyword,a1) # else # define DBUG_ENTER(a) \ @@ -142,19 +136,9 @@ {if (_db_on_) {if (_db_keyword_ (keyword)) { a1 }}} # define DBUG_PRINT(keyword,arglist) \ {if (_db_on_) {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;}} -# define DBUG_2(keyword,format) \ - DBUG_PRINT(keyword,(format)) /* Obsolete */ -# define DBUG_3(keyword,format,a1) \ - DBUG_PRINT(keyword,(format,a1)) /* Obsolete */ -# define DBUG_4(keyword,format,a1,a2) \ - DBUG_PRINT(keyword,(format,a1,a2)) /* Obsolete */ -# define DBUG_5(keyword,format,a1,a2,a3) \ - DBUG_PRINT(keyword,(format,a1,a2,a3)) /* Obsolete */ # define DBUG_PUSH(a1) _db_push_ (a1) # define DBUG_POP() _db_pop_ () # define DBUG_PROCESS(a1) (_db_process_ = a1) # define DBUG_FILE (_db_fp_) -# define DBUG_SETJMP(a1) (_db_setjmp_ (), setjmp (a1)) -# define DBUG_LONGJMP(a1,a2) (_db_longjmp_ (), longjmp (a1, a2)) # define DBUG_DUMP(keyword,a1,a2) _db_dump_(__LINE__,keyword,a1,a2) # endif diff --git a/dbug/user.r b/dbug/user.r index da308ef2a68..e4e27ee8274 100644 --- a/dbug/user.r +++ b/dbug/user.r @@ -823,28 +823,6 @@ number of bytes to dump. .SP 1 EX: \fCDBUG_DBUG\ ("net",\ packet,\ len);\fR .SP 1 -.LI DBUG_SETJMP\ -Used in place of the setjmp() function to first save the current -debugger state and then execute the standard setjmp call. -This allows to the debugger to restore its state when the -DBUG_LONGJMP macro is used to invoke the standard longjmp() call. -Currently all instances of DBUG_SETJMP must occur within the -same function and at the same function nesting level. -.SP 1 -EX: \fCDBUG_SETJMP\ (env);\fR -.SP 1 -.LI DBUG_LONGJMP\ -Used in place of the longjmp() function to first restore the -previous debugger state at the time of the last DBUG_SETJMP -and then execute the standard longjmp() call. -Note that currently all DBUG_LONGJMP macros restore the state -at the time of the last DBUG_SETJMP. -It would be possible to maintain separate DBUG_SETJMP and DBUG_LONGJMP -pairs by having the debugger runtime support module use the first -argument to differentiate the pairs. -.SP 1 -EX: \fCDBUG_LONGJMP\ (env,val);\fR -.SP 1 .LI DBUG_LOCK_FILE\ Used in multi-threaded environment to lock DBUG_FILE stream. It can be used, for example, in functions that need to write something to a diff --git a/include/my_dbug.h b/include/my_dbug.h index c397fbcf959..6aef3ac1b36 100644 --- a/include/my_dbug.h +++ b/include/my_dbug.h @@ -89,8 +89,6 @@ extern const char* _db_get_func_(void); #define DBUG_SET_INITIAL(a1) _db_set_init_ (a1) #define DBUG_PROCESS(a1) _db_process_(a1) #define DBUG_FILE _db_fp_() -#define DBUG_SETJMP(a1) (_db_setjmp_ (), setjmp (a1)) -#define DBUG_LONGJMP(a1,a2) (_db_longjmp_ (), longjmp (a1, a2)) #define DBUG_DUMP(keyword,a1,a2) _db_dump_(__LINE__,keyword,a1,a2) #define DBUG_END() _db_end_ () #define DBUG_LOCK_FILE _db_lock_file_() @@ -155,8 +153,6 @@ extern void _db_suicide_(); #define DBUG_SET_INITIAL(a1) do { } while(0) #define DBUG_POP() do { } while(0) #define DBUG_PROCESS(a1) do { } while(0) -#define DBUG_SETJMP(a1) setjmp(a1) -#define DBUG_LONGJMP(a1) longjmp(a1) #define DBUG_DUMP(keyword,a1,a2) do { } while(0) #define DBUG_END() do { } while(0) #define DBUG_ASSERT(A) do { } while(0) diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index 146a223a9e3..36f86bf99ce 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -278,7 +278,7 @@ my_bool my_thread_init(void) my_bool error=0; #ifdef EXTRA_DEBUG_THREADS - fprintf(stderr,"my_thread_init(): thread_id: 0x%lx\n", + fprintf(stderr,"my_thread_init(): pthread_self: 0x%lx\n", (ulong) pthread_self()); #endif |