Skip to content

Commit a512531

Browse files
author
Tor Didriksen
committed
Bug#14028421 DBUG_SUICIDE() DOES NOT FLUSH GCOV DATA
1 parent 63d17b8 commit a512531

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,9 @@ ENDIF()
218218
OPTION(ENABLE_GCOV "Enable gcov (debug, Linux builds only)" OFF)
219219
IF (ENABLE_GCOV AND NOT WIN32 AND NOT APPLE)
220220
SET(CMAKE_CXX_FLAGS_DEBUG
221-
"${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage")
221+
"${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage -DHAVE_GCOV")
222222
SET(CMAKE_C_FLAGS_DEBUG
223-
"${CMAKE_C_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage")
223+
"${CMAKE_C_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage -DHAVE_GCOV")
224224
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG
225225
"${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage -lgcov")
226226
ENDIF()

dbug/dbug.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2223,12 +2223,23 @@ void _db_flush_()
22232223

22242224

22252225
#ifndef __WIN__
2226+
2227+
#ifdef HAVE_GCOV
2228+
extern void __gcov_flush();
2229+
#endif
2230+
22262231
void _db_suicide_()
22272232
{
22282233
int retval;
22292234
sigset_t new_mask;
22302235
sigfillset(&new_mask);
22312236

2237+
#ifdef HAVE_GCOV
2238+
fprintf(stderr, "Flushing gcov data\n");
2239+
fflush(stderr);
2240+
__gcov_flush();
2241+
#endif
2242+
22322243
fprintf(stderr, "SIGKILL myself\n");
22332244
fflush(stderr);
22342245

0 commit comments

Comments
 (0)