diff options
author | Daniel Hahler <git@thequod.de> | 2019-06-15 18:30:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-15 18:30:04 +0200 |
commit | d3d25f957dc01df5d2e1d84adcba5ab427a770ba (patch) | |
tree | 9df6dcac65afe20e2af3ecc4f4ca48859239519f | |
parent | 2f1a653a845680efab1a27f6411e36e8cd2f3696 (diff) | |
download | rneovim-d3d25f957dc01df5d2e1d84adcba5ab427a770ba.tar.gz rneovim-d3d25f957dc01df5d2e1d84adcba5ab427a770ba.tar.bz2 rneovim-d3d25f957dc01df5d2e1d84adcba5ab427a770ba.zip |
Dump gcov coverage in process_spawn (#10230)
Fixes https://github.com/neovim/neovim/pull/3926#issuecomment-502343527.
-rw-r--r-- | src/nvim/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/nvim/event/process.c | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 77c5bf59e4..99171dbb02 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -7,6 +7,7 @@ if(USE_GCOV) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage") + add_compile_definitions(USE_GCOV) endif() endif() diff --git a/src/nvim/event/process.c b/src/nvim/event/process.c index 7a8a39dbcf..7059a41def 100644 --- a/src/nvim/event/process.c +++ b/src/nvim/event/process.c @@ -22,6 +22,11 @@ # include "event/process.c.generated.h" #endif +/// Externally defined with gcov. +#ifdef USE_GCOV +void __gcov_dump(void); +#endif + // Time for a process to exit cleanly before we send KILL. // For PTY processes SIGTERM is sent first (in case SIGHUP was not enough). #define KILL_TIMEOUT_MS 2000 @@ -50,6 +55,11 @@ int process_spawn(Process *proc, bool in, bool out, bool err) proc->err.closed = true; } +#ifdef USE_GCOV + // Dump coverage data before forking, to avoid "Merge mismatch" errors. + __gcov_dump(); +#endif + int status; switch (proc->type) { case kProcessTypeUv: |