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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
981454b3
Commit
981454b3
authored
Feb 03, 2006
by
mikron@c-130be253.1238-1-64736c10.cust.bredbandsbolaget.se
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WL 2826: Eigth step
Inserted monty patch to allow for adding and dropping DBUG keywords per thread
parent
edb8811f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
6 deletions
+89
-6
dbug/dbug.c
dbug/dbug.c
+82
-5
include/my_dbug.h
include/my_dbug.h
+7
-1
No files found.
dbug/dbug.c
View file @
981454b3
...
...
@@ -249,6 +249,7 @@ typedef struct st_code_state {
uint
u_line
;
/* User source code line number */
int
locked
;
/* If locked with _db_lock_file */
const
char
*
u_keyword
;
/* Keyword for current macro */
struct
link
*
keywords
;
/* Thread specific, active keywords */
}
CODE_STATE
;
/* Parse a debug command string */
...
...
@@ -1252,7 +1253,9 @@ static BOOLEAN DoProfile ()
BOOLEAN
_db_strict_keyword_
(
const
char
*
keyword
)
{
if
(
stack
->
keywords
==
NULL
)
CODE_STATE
*
state
;
if
(
stack
->
keywords
==
NULL
&&
(
!
(
state
=
code_state
())
||
state
->
keywords
==
NULL
))
return
FALSE
;
return
_db_keyword_
(
keyword
);
}
...
...
@@ -1288,16 +1291,15 @@ const char *keyword)
REGISTER
BOOLEAN
result
;
CODE_STATE
*
state
;
if
(
!
init_done
)
_db_push_
(
""
);
/* Sasha: pre-my_thread_init() safety */
if
(
!
(
state
=
code_state
()))
return
FALSE
;
result
=
FALSE
;
if
(
DEBUGGING
&&
!
state
->
disable_output
&&
state
->
level
<=
stack
->
maxdepth
&&
InList
(
stack
->
functions
,
state
->
func
)
&&
InList
(
stack
->
keywords
,
keyword
)
&&
(
InList
(
stack
->
keywords
,
keyword
)
||
(
state
->
keywords
&&
InList
(
state
->
keywords
,
keyword
)))
&&
InList
(
stack
->
processes
,
_db_process_
))
result
=
TRUE
;
return
(
result
);
...
...
@@ -1373,6 +1375,81 @@ struct link *linkp)
}
/*
* FUNCTION
*
* Add key word to _db_strict_keyword_ list
*
* SYNOPSIS
*
* VOID _db_add_strict_keyword(keyword)
* const char *keyword;
*
* DESCRIPTION
*
* Add key word to _db_strict_keyword_ to active DEBUG_EXECUTE_IF
* statements for this thread only
*
* Returns TRUE if keyword accepted, FALSE otherwise.
*
*/
BOOLEAN
_db_add_strict_keyword_
(
const
char
*
keyword
)
{
CODE_STATE
*
state
;
struct
link
*
tmp
;
uint
length
;
if
(
!
(
state
=
code_state
())
||
!
(
tmp
=
(
struct
link
*
)
DbugMalloc
(
sizeof
(
struct
link
)
+
(
length
=
strlen
(
keyword
)
+
1
))))
return
FALSE
;
tmp
->
str
=
(
char
*
)
(
tmp
+
1
);
memcpy
(
tmp
->
str
,
keyword
,
length
);
tmp
->
next_link
=
state
->
keywords
;
state
->
keywords
=
tmp
;
return
TRUE
;
}
/*
* FUNCTION
*
* Remove key word from thread specific _db_strict_keyword_ list
*
* SYNOPSIS
*
* VOID _db_del_strict_keyword_(keyword)
* const char *keyword;
*
* DESCRIPTION
*
* Delete key word from _db_strict_keyword_ to decative DEBUG_EXECUTE_IF
* statements for this thread only
*
* Returns TRUE if keyword deleted, FALSE otherwise.
*
*/
BOOLEAN
_db_del_strict_keyword_
(
const
char
*
keyword
)
{
CODE_STATE
*
state
;
struct
link
*
link
,
**
linkp
;
if
(
!
(
state
=
code_state
()))
return
FALSE
;
for
(
linkp
=
&
state
->
keywords
;
(
link
=
*
linkp
);
linkp
=
&
link
->
next_link
)
{
if
(
STREQ
(
link
->
str
,
keyword
))
{
*
linkp
=
link
->
next_link
;
free
(
link
);
return
TRUE
;
}
}
return
(
FALSE
);
}
/*
* FUNCTION
*
...
...
include/my_dbug.h
View file @
981454b3
...
...
@@ -24,8 +24,10 @@ extern "C" {
extern
int
_db_on_
,
_no_db_
;
extern
FILE
*
_db_fp_
;
extern
char
*
_db_process_
;
extern
int
_db_keyword_
(
const
char
*
keyword
);
extern
int
_db_keyword_
(
const
char
*
keyword
);
extern
int
_db_strict_keyword_
(
const
char
*
keyword
);
extern
int
_db_add_strict_keyword_
(
const
char
*
keyword
);
extern
int
_db_del_strict_keyword_
(
const
char
*
keyword
);
extern
void
_db_setjmp_
(
void
);
extern
void
_db_longjmp_
(
void
);
extern
void
_db_push_
(
const
char
*
control
);
...
...
@@ -76,6 +78,8 @@ extern void _db_unlock_file(void);
(_db_on_ ? ((_db_strict_keyword_ (keyword)) ? ((a1), 0) : 0) : 0)
#define DBUG_COND(keyword) \
((_db_on_ && _db_strict_keyword_ (keyword)) ? 1 : 0)
#define DBUG_ADD_KEYWORD(key) _db_add_strict_keyword_(key)
#define DBUG_DEL_KEYWORD(key) _db_del_strict_keyword_(key)
#else
/* No debugger */
#define DBUG_ENTER(a1)
...
...
@@ -85,6 +89,8 @@ extern void _db_unlock_file(void);
#define DBUG_EXECUTE_IF(keyword,a1) {}
#define DBUG_EXECUTE_COND(keyword, a1) 0
#define DBUG_COND(keyword) 0
#define DBUG_ADD_KEYWORD(key)
#define DBUG_DEL_KEYWORD(key)
#define DBUG_PRINT(keyword,arglist) {}
#define DBUG_PUSH(a1) {}
#define DBUG_POP() {}
...
...
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