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
139e8afc
Commit
139e8afc
authored
Dec 22, 2017
by
Monty
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-enable 'S' for --debug (sf_sanity checking for each call)
- Fixed also a wrong comment and a wrong argument to printf
parent
1464f480
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
7 deletions
+21
-7
dbug/dbug.c
dbug/dbug.c
+13
-3
include/my_dbug.h
include/my_dbug.h
+1
-0
include/my_sys.h
include/my_sys.h
+1
-0
mysys/my_init.c
mysys/my_init.c
+4
-0
mysys/my_malloc.c
mysys/my_malloc.c
+0
-2
mysys/safemalloc.c
mysys/safemalloc.c
+2
-2
No files found.
dbug/dbug.c
View file @
139e8afc
...
...
@@ -128,7 +128,6 @@
#define SANITY_CHECK_ON (1U << 12)
/* Check memory on every DBUG_ENTER/RETURN */
#define TRACE_ON (1U << 31)
/* Trace enabled. MUST be the highest bit!*/
#define sf_sanity() (0)
#define TRACING (cs->stack->flags & TRACE_ON)
#define DEBUGGING (cs->stack->flags & DEBUG_ON)
...
...
@@ -272,6 +271,11 @@ static void PushState(CODE_STATE *cs);
static
void
FreeState
(
CODE_STATE
*
cs
,
int
free_state
);
/* Test for tracing enabled */
static
int
DoTrace
(
CODE_STATE
*
cs
);
static
int
default_my_dbug_sanity
(
void
);
int
(
*
dbug_sanity
)(
void
)
=
default_my_dbug_sanity
;
/*
return values of DoTrace.
Can also be used as bitmask: ret & DO_TRACE
...
...
@@ -1121,7 +1125,7 @@ void _db_enter_(const char *_func_, const char *_file_,
if
(
!
TRACING
)
break
;
/* fall through */
case
DO_TRACE
:
if
((
cs
->
stack
->
flags
&
SANITY_CHECK_ON
)
&&
sf_sanity
())
if
((
cs
->
stack
->
flags
&
SANITY_CHECK_ON
)
&&
(
*
dbug_sanity
)
())
cs
->
stack
->
flags
&=
~
SANITY_CHECK_ON
;
if
(
TRACING
)
{
...
...
@@ -1190,7 +1194,7 @@ void _db_return_(struct _db_stack_frame_ *_stack_frame_)
if
(
DoTrace
(
cs
)
&
DO_TRACE
)
{
int
org_cs_locked
;
if
((
cs
->
stack
->
flags
&
SANITY_CHECK_ON
)
&&
sf_sanity
())
if
((
cs
->
stack
->
flags
&
SANITY_CHECK_ON
)
&&
(
*
dbug_sanity
)
())
cs
->
stack
->
flags
&=
~
SANITY_CHECK_ON
;
if
(
TRACING
)
{
...
...
@@ -2248,6 +2252,12 @@ const char* _db_get_func_(void)
return
cs
->
func
;
}
static
int
default_my_dbug_sanity
(
void
)
{
return
0
;
}
#else
/*
...
...
include/my_dbug.h
View file @
139e8afc
...
...
@@ -63,6 +63,7 @@ extern void _db_flush_(void);
extern
void
dbug_swap_code_state
(
void
**
code_state_store
);
extern
void
dbug_free_code_state
(
void
**
code_state_store
);
extern
const
char
*
_db_get_func_
(
void
);
extern
int
(
*
dbug_sanity
)(
void
);
#define DBUG_LEAVE do { \
_db_stack_frame_.line= __LINE__; \
...
...
include/my_sys.h
View file @
139e8afc
...
...
@@ -157,6 +157,7 @@ char *guess_malloc_library();
/* If we have our own safemalloc (for debugging) */
#if defined(SAFEMALLOC)
void
sf_report_leaked_memory
(
my_thread_id
id
);
int
sf_sanity
();
extern
my_thread_id
(
*
sf_malloc_dbug_id
)(
void
);
#define SAFEMALLOC_REPORT_MEMORY(X) sf_report_leaked_memory(X)
#else
...
...
mysys/my_init.c
View file @
139e8afc
...
...
@@ -105,6 +105,10 @@ my_bool my_init(void)
if
(
my_thread_global_init
())
return
1
;
#if defined(SAFEMALLOC) && !defined(DBUG_OFF)
dbug_sanity
=
sf_sanity
;
#endif
/* $HOME is needed early to parse configuration files located in ~/ */
if
((
home_dir
=
getenv
(
"HOME"
))
!=
0
)
home_dir
=
intern_filename
(
home_dir_buff
,
home_dir
);
...
...
mysys/my_malloc.c
View file @
139e8afc
...
...
@@ -200,8 +200,6 @@ void *my_realloc(void *oldpoint, size_t size, myf my_flags)
/**
Free memory allocated with my_malloc.
@remark Relies on free being able to handle a NULL argument.
@param ptr Pointer to the memory allocated by my_malloc.
*/
void
my_free
(
void
*
ptr
)
...
...
mysys/safemalloc.c
View file @
139e8afc
...
...
@@ -330,7 +330,7 @@ static int bad_ptr(const char *where, void *ptr)
magicend
[
3
]
!=
MAGICEND3
)
{
DBUG_PRINT
(
"error"
,(
"Overrun buffer %p"
,
ptr
));
warn
(
"Error: %s overrun buffer %p"
,
where
);
warn
(
"Error: %s overrun buffer %p"
,
where
,
ptr
);
fprintf
(
stderr
,
"Allocated at "
);
print_stack
(
irem
->
frame
);
return
1
;
...
...
@@ -340,7 +340,7 @@ static int bad_ptr(const char *where, void *ptr)
}
/* check all allocated memory list for consistency */
static
int
sf_sanity
()
int
sf_sanity
()
{
struct
st_irem
*
irem
;
int
flag
=
0
;
...
...
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