Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
02b82326
Commit
02b82326
authored
Jul 10, 2011
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small dbug cleanup
parent
a00b3849
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
165 deletions
+19
-165
dbug/dbug.c
dbug/dbug.c
+18
-122
dbug/dbug_long.h
dbug/dbug_long.h
+0
-16
dbug/user.r
dbug/user.r
+0
-22
include/my_dbug.h
include/my_dbug.h
+0
-4
mysys/my_thr_init.c
mysys/my_thr_init.c
+1
-1
No files found.
dbug/dbug.c
View file @
02b82326
...
...
@@ -137,27 +137,17 @@
#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
)
{
...
...
dbug/dbug_long.h
View file @
02b82326
...
...
@@ -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
dbug/user.r
View file @
02b82326
...
...
@@ -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
...
...
include/my_dbug.h
View file @
02b82326
...
...
@@ -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)
...
...
mysys/my_thr_init.c
View file @
02b82326
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment