diff --git a/include/gcov.h b/include/gcov.h index e494fe1e50..1faad7a9a8 100644 --- a/include/gcov.h +++ b/include/gcov.h @@ -161,6 +161,20 @@ extern void __gcov_filename_to_gcfn(FAR const char *filename, FAR void *), FAR void *arg); +/**************************************************************************** + * Name: __gcov_dump_to_memory + * + * Description: + * Dump gcov data directly to memory + * + * Parameters: + * ptr - Memory Address + * size - Memory block size + * + ****************************************************************************/ + +size_t __gcov_dump_to_memory(FAR void *ptr, size_t size); + #undef EXTERN #ifdef __cplusplus } diff --git a/libs/libbuiltin/compiler-rt/coverage.c b/libs/libbuiltin/compiler-rt/coverage.c index 69520f2751..ab24d5f7b2 100644 --- a/libs/libbuiltin/compiler-rt/coverage.c +++ b/libs/libbuiltin/compiler-rt/coverage.c @@ -324,6 +324,15 @@ void __gcov_dump(void) _NX_CLOSE(fd); } +size_t __gcov_dump_to_memory(FAR void *ptr, size_t size) +{ + struct lib_memoutstream_s stream; + + lib_memoutstream(&stream, ptr, size); + + return __llvm_profile_dump(&stream.common); +} + void __gcov_reset(void) { }