[gcov] use __gcov_dump() instead for gcc 11 (#7629)

__gcov_flush is removed from gcc 11. This commit moves reset setup to a
single header file.
This commit is contained in:
Yakun Xu
2022-04-25 06:23:00 -07:00
committed by GitHub
parent 79757a69f6
commit 013ab41291
6 changed files with 84 additions and 62 deletions
+3 -23
View File
@@ -39,6 +39,8 @@
#include "cli/cli_config.h"
#include "common/code_utils.hpp"
#include "lib/platform/reset_util.h"
/**
* This function initializes the CLI app.
*
@@ -47,19 +49,6 @@
*/
extern void otAppCliInit(otInstance *aInstance);
#if OPENTHREAD_EXAMPLES_SIMULATION
#include <setjmp.h>
#include <unistd.h>
jmp_buf gResetJump;
void __gcov_flush();
#endif
#ifndef OPENTHREAD_ENABLE_COVERAGE
#define OPENTHREAD_ENABLE_COVERAGE 0
#endif
#if OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
void *otPlatCAlloc(size_t aNum, size_t aSize)
{
@@ -93,16 +82,7 @@ int main(int argc, char *argv[])
{
otInstance *instance;
#if OPENTHREAD_EXAMPLES_SIMULATION
if (setjmp(gResetJump))
{
alarm(0);
#if OPENTHREAD_ENABLE_COVERAGE
__gcov_flush();
#endif
execvp(argv[0], argv);
}
#endif
OT_SETUP_RESET_JUMP(argv);
#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
size_t otInstanceBufferLength = 0;
+2 -23
View File
@@ -36,6 +36,7 @@
#include "openthread-system.h"
#include "lib/platform/reset_util.h"
/**
* This function initializes the NCP app.
*
@@ -44,19 +45,6 @@
*/
extern void otAppNcpInit(otInstance *aInstance);
#if OPENTHREAD_EXAMPLES_SIMULATION
#include <setjmp.h>
#include <unistd.h>
jmp_buf gResetJump;
void __gcov_flush();
#endif
#ifndef OPENTHREAD_ENABLE_COVERAGE
#define OPENTHREAD_ENABLE_COVERAGE 0
#endif
#if OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
void *otPlatCAlloc(size_t aNum, size_t aSize)
{
@@ -78,16 +66,7 @@ int main(int argc, char *argv[])
{
otInstance *instance;
#if OPENTHREAD_EXAMPLES_SIMULATION
if (setjmp(gResetJump))
{
alarm(0);
#if OPENTHREAD_ENABLE_COVERAGE
__gcov_flush();
#endif
execvp(argv[0], argv);
}
#endif
OT_SETUP_RESET_JUMP(argv);
#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
size_t otInstanceBufferLength = 0;