Commit 3b8d4180 authored by Monty's avatar Monty

Flush gcov files for DBUG_ASSERT and DBUG_SUICIDE

parent e0a6cfb3
...@@ -269,7 +269,7 @@ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC") ...@@ -269,7 +269,7 @@ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
OPTION(ENABLE_GCOV "Enable gcov (debug, Linux builds only)" OFF) OPTION(ENABLE_GCOV "Enable gcov (debug, Linux builds only)" OFF)
IF (ENABLE_GCOV) IF (ENABLE_GCOV)
MY_CHECK_AND_SET_COMPILER_FLAG("-fprofile-arcs -ftest-coverage -lgcov" DEBUG) MY_CHECK_AND_SET_COMPILER_FLAG("-DHAVE_gcov -fprofile-arcs -ftest-coverage -lgcov" DEBUG)
ENDIF() ENDIF()
OPTION(WITHOUT_PACKED_SORT_KEYS "disable packed sort keys" OFF) OPTION(WITHOUT_PACKED_SORT_KEYS "disable packed sort keys" OFF)
......
...@@ -85,6 +85,9 @@ ...@@ -85,6 +85,9 @@
#undef SAFE_MUTEX #undef SAFE_MUTEX
#include <m_string.h> #include <m_string.h>
#include <errno.h> #include <errno.h>
#ifdef HAVE_gcov
extern void __gcov_flush();
#endif
#ifndef DBUG_OFF #ifndef DBUG_OFF
...@@ -2209,6 +2212,9 @@ void _db_suicide_() ...@@ -2209,6 +2212,9 @@ void _db_suicide_()
fprintf(stderr, "SIGKILL myself\n"); fprintf(stderr, "SIGKILL myself\n");
fflush(stderr); fflush(stderr);
#ifdef HAVE_gcov
__gcov_flush();
#endif
retval= kill(getpid(), SIGKILL); retval= kill(getpid(), SIGKILL);
assert(retval == 0); assert(retval == 0);
...@@ -2253,7 +2259,13 @@ my_bool _db_my_assert(const char *file, int line, const char *msg) ...@@ -2253,7 +2259,13 @@ my_bool _db_my_assert(const char *file, int line, const char *msg)
my_bool a = my_assert; my_bool a = my_assert;
_db_flush_(); _db_flush_();
if (!a) if (!a)
{
fprintf(stderr, "%s:%d: assert: %s\n", file, line, msg); fprintf(stderr, "%s:%d: assert: %s\n", file, line, msg);
fflush(stderr);
#ifdef HAVE_gcov
__gcov_flush();
#endif
}
return a; return a;
} }
#else #else
......
...@@ -63,7 +63,7 @@ my $cmd; ...@@ -63,7 +63,7 @@ my $cmd;
if ($opt_purge) if ($opt_purge)
{ {
$cmd= "find . -name '*.da' -o -name '*.gcda' -o -name '*.gcov' -o ". $cmd= "find . -name '*.da' -o -name '*.gcda' -o -name '*.gcov' -o ".
"-name '*.dgcov' | grep -v 'README\.gcov' | xargs rm -f ''"; "-name '*.dgcov' | xargs rm -f ''";
logv "Running: $cmd"; logv "Running: $cmd";
system($cmd)==0 or die "system($cmd): $? $!"; system($cmd)==0 or die "system($cmd): $? $!";
exit 0; exit 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment