arch: adjust gcov configuration name
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
parent
8fe6c0ee8e
commit
034af29aab
21 changed files with 38 additions and 61 deletions
19
arch/Kconfig
19
arch/Kconfig
|
@ -311,25 +311,6 @@ config ARCH_SIZET_LONG
|
|||
C++ library routines because the NuttX size_t might not have
|
||||
the same underlying type as your toolchain's size_t.
|
||||
|
||||
config ARCH_COVERAGE
|
||||
bool "Enable code coverage analysis"
|
||||
select HAVE_CXXINITIALIZE
|
||||
default n
|
||||
---help---
|
||||
Generate code coverage
|
||||
|
||||
config ARCH_COVERAGE_ALL
|
||||
bool "Enable code coverage for the entire image"
|
||||
depends on ARCH_COVERAGE
|
||||
default n
|
||||
---help---
|
||||
This option activates code coverage instrumentation for the
|
||||
entire image. If you don't enable this option, you have to
|
||||
explicitly specify "-fprofile-generate -ftest-coverage" for
|
||||
the files/directories you want to check. Enabling this option
|
||||
will get image size increased and performance decreased
|
||||
significantly.
|
||||
|
||||
config ARCH_INSTRUMENT_ALL
|
||||
bool "Instrument All"
|
||||
default n
|
||||
|
|
|
@ -72,10 +72,6 @@ ifneq ($(CONFIG_STACK_USAGE_WARNING),0)
|
|||
ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_COVERAGE_ALL),y)
|
||||
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
||||
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
|
||||
endif
|
||||
|
@ -491,7 +487,7 @@ ifeq ($(CONFIG_LIBSUPCXX),y)
|
|||
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_COVERAGE),y)
|
||||
ifeq ($(CONFIG_SCHED_GCOV),y)
|
||||
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcov.a))
|
||||
endif
|
||||
|
||||
|
|
|
@ -66,10 +66,6 @@ ifeq ($(CONFIG_STACK_CANARIES),y)
|
|||
ARCHOPTIMIZATION += -fstack-protector-all
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_COVERAGE_ALL),y)
|
||||
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
||||
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
|
||||
endif
|
||||
|
@ -196,7 +192,7 @@ ifeq ($(CONFIG_LIBSUPCXX),y)
|
|||
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_COVERAGE),y)
|
||||
ifeq ($(CONFIG_SCHED_GCOV),y)
|
||||
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcov.a))
|
||||
endif
|
||||
|
||||
|
|
|
@ -107,10 +107,6 @@ if(CONFIG_STACK_CANARIES)
|
|||
add_compile_options(-fstack-protector-all)
|
||||
endif()
|
||||
|
||||
if(CONFIG_ARCH_COVERAGE_ALL)
|
||||
add_compile_options(-fprofile-generate -ftest-coverage)
|
||||
endif()
|
||||
|
||||
if(CONFIG_MM_UBSAN_ALL)
|
||||
add_compile_options(${CONFIG_MM_UBSAN_OPTION})
|
||||
endif()
|
||||
|
|
|
@ -56,7 +56,7 @@ if(CONFIG_LIBSUPCXX)
|
|||
OUTPUT_VARIABLE extra_library)
|
||||
list(APPEND EXTRA_LIB ${extra_library})
|
||||
endif()
|
||||
if(CONFIG_ARCH_COVERAGE)
|
||||
if(CONFIG_SCHED_GCOV)
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS}
|
||||
--print-file-name=libgcov.a
|
||||
|
|
|
@ -158,7 +158,7 @@ if(${CONFIG_STACK_USAGE_WARNING})
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(CONFIG_ARCH_COVERAGE)
|
||||
if(CONFIG_SCHED_GCOV)
|
||||
add_compile_options(-fprofile-generate -ftest-coverage)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ if(CONFIG_LIBSUPCXX)
|
|||
list(APPEND EXTRA_LIB ${extra_library})
|
||||
endif()
|
||||
|
||||
if(CONFIG_ARCH_COVERAGE)
|
||||
if(CONFIG_SCHED_GCOV)
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS}
|
||||
--print-file-name=libgcov.a
|
||||
|
|
|
@ -81,10 +81,6 @@ ifneq ($(CONFIG_STACK_USAGE_WARNING),0)
|
|||
ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_COVERAGE_ALL),y)
|
||||
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
|
||||
endif
|
||||
|
||||
ARCHCFLAGS += -fno-common
|
||||
ARCHCXXFLAGS += -fno-common
|
||||
|
||||
|
@ -400,7 +396,7 @@ ifeq ($(CONFIG_LIBSUPCXX),y)
|
|||
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_COVERAGE),y)
|
||||
ifeq ($(CONFIG_SCHED_GCOV),y)
|
||||
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcov.a))
|
||||
endif
|
||||
|
||||
|
|
|
@ -90,6 +90,14 @@ config SIM_UBSAN_DUMMY
|
|||
---help---
|
||||
Keep SIM_UBSAN compile time but disable runtime actions.
|
||||
|
||||
config SIM_GCOV_ALL
|
||||
bool "Enable code coverage for the entire image"
|
||||
depends on COVERAGE
|
||||
default n
|
||||
---help---
|
||||
This option activates code coverage instrumentation for the
|
||||
entire image.
|
||||
|
||||
choice
|
||||
prompt "X64_64 ABI"
|
||||
default SIM_X8664_SYSTEMV if HOST_LINUX
|
||||
|
|
|
@ -140,7 +140,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y)
|
|||
STDLIBS += -lm
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_COVERAGE),y)
|
||||
ifeq ($(CONFIG_SCHED_GCOV),y)
|
||||
STDLIBS += -lgcov
|
||||
endif
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ if(CONFIG_STACK_USAGE_WARNING)
|
|||
add_compile_options(-Wstack-usage=${CONFIG_STACK_USAGE_WARNING})
|
||||
endif()
|
||||
|
||||
if(CONFIG_SIM_GCOV_ALL)
|
||||
if(CONFIG_SCHED_GCOV)
|
||||
add_compile_options(-fprofile-generate -ftest-coverage)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ set(HOSTSRCS)
|
|||
set(HOST_INCLUDE_DIRS)
|
||||
set(STDLIBS pthread)
|
||||
|
||||
if(CONFIG_ARCH_COVERAGE)
|
||||
if(CONFIG_SCHED_GCOV)
|
||||
list(APPEND STDLIBS gcov)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_COVERAGE
|
||||
#ifdef CONFIG_SCHED_GCOV
|
||||
void __gcov_dump(void);
|
||||
#endif
|
||||
|
||||
|
@ -72,7 +72,7 @@ extern int backtrace(void **array, int size);
|
|||
|
||||
void host_abort(int status)
|
||||
{
|
||||
#ifdef CONFIG_ARCH_COVERAGE
|
||||
#ifdef CONFIG_SCHED_GCOV
|
||||
/* Dump gcov data. */
|
||||
|
||||
host_uninterruptible_no_return(__gcov_dump);
|
||||
|
|
|
@ -75,7 +75,7 @@ if(${CONFIG_STACK_USAGE_WARNING})
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(CONFIG_ARCH_COVERAGE)
|
||||
if(CONFIG_SCHED_GCOV)
|
||||
add_compile_options(-fprofile-generate -ftest-coverage)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ if(CONFIG_LIBSUPCXX)
|
|||
list(APPEND EXTRA_LIB ${extra_library})
|
||||
endif()
|
||||
|
||||
if(CONFIG_ARCH_COVERAGE)
|
||||
if(CONFIG_SCHED_GCOV)
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} ${NUTTX_EXTRA_FLAGS}
|
||||
--print-file-name=libgcov.a
|
||||
|
|
|
@ -91,10 +91,6 @@ ifneq ($(CONFIG_STACK_USAGE_WARNING),0)
|
|||
ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_COVERAGE_ALL),y)
|
||||
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
|
||||
endif
|
||||
|
||||
# Instrumentation options
|
||||
|
||||
ifeq ($(CONFIG_ARCH_INSTRUMENT_ALL),y)
|
||||
|
@ -195,7 +191,7 @@ ifeq ($(CONFIG_LIBSUPCXX),y)
|
|||
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_COVERAGE),y)
|
||||
ifeq ($(CONFIG_SCHED_GCOV),y)
|
||||
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcov.a))
|
||||
endif
|
||||
|
||||
|
|
|
@ -95,10 +95,6 @@ ifneq ($(CONFIG_STACK_USAGE_WARNING),0)
|
|||
ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_COVERAGE_ALL),y)
|
||||
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
|
||||
endif
|
||||
|
||||
# Instrumentation options
|
||||
|
||||
ifeq ($(CONFIG_ARCH_INSTRUMENT_ALL),y)
|
||||
|
@ -199,7 +195,7 @@ ifeq ($(CONFIG_LIBSUPCXX),y)
|
|||
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_COVERAGE),y)
|
||||
ifeq ($(CONFIG_SCHED_GCOV),y)
|
||||
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcov.a))
|
||||
endif
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ CONFIG_ARCH="sim"
|
|||
CONFIG_ARCH_BOARD="sim"
|
||||
CONFIG_ARCH_BOARD_SIM=y
|
||||
CONFIG_ARCH_CHIP="sim"
|
||||
CONFIG_ARCH_COVERAGE=y
|
||||
CONFIG_ARCH_SIM=y
|
||||
CONFIG_BOARDCTL_POWEROFF=y
|
||||
CONFIG_BUILTIN=y
|
||||
|
@ -39,6 +38,7 @@ CONFIG_PTHREAD_MUTEX_TYPES=y
|
|||
CONFIG_PTHREAD_MUTEX_UNSAFE=y
|
||||
CONFIG_READLINE_TABCOMPLETION=y
|
||||
CONFIG_RR_INTERVAL=10
|
||||
CONFIG_SCHED_GCOV=y
|
||||
CONFIG_SCHED_HAVE_PARENT=y
|
||||
CONFIG_SCHED_LPWORK=y
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
|
|
|
@ -72,7 +72,7 @@ ifneq ($(CONFIG_STACK_USAGE_WARNING),0)
|
|||
ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_COVERAGE_ALL),y)
|
||||
ifeq ($(CONFIG_SIM_GCOV_ALL),y)
|
||||
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
|
||||
endif
|
||||
|
||||
|
|
|
@ -1341,6 +1341,18 @@ config SCHED_STACK_RECORD
|
|||
to disable.Through instrumentation, record the backtrace at
|
||||
the deepest point in the stack.
|
||||
|
||||
config SCHED_GCOV
|
||||
bool "Enable GCOV support"
|
||||
select HAVE_CXXINITIALIZE
|
||||
default n
|
||||
---help---
|
||||
Enable GCOV support for code coverage analysis.
|
||||
After turning on this option, code coverage can be analyzed.
|
||||
If this option is enabled, image size and performance will be
|
||||
significantly reduced. Before use, you need to add the
|
||||
"-fprofile-generate -ftest-coverage" compilation parameters
|
||||
to the file to be analyzed.
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Files and I/O"
|
||||
|
|
|
@ -659,7 +659,7 @@ endef
|
|||
|
||||
# CLEAN - Default clean target
|
||||
|
||||
ifeq ($(CONFIG_ARCH_COVERAGE),y)
|
||||
ifeq ($(CONFIG_SCHED_GCOV),y)
|
||||
EXTRA = *.gcno *.gcda
|
||||
endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue