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
|
C++ library routines because the NuttX size_t might not have
|
||||||
the same underlying type as your toolchain's size_t.
|
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
|
config ARCH_INSTRUMENT_ALL
|
||||||
bool "Instrument All"
|
bool "Instrument All"
|
||||||
default n
|
default n
|
||||||
|
|
|
@ -72,10 +72,6 @@ ifneq ($(CONFIG_STACK_USAGE_WARNING),0)
|
||||||
ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING)
|
ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_COVERAGE_ALL),y)
|
|
||||||
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
||||||
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
|
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
|
||||||
endif
|
endif
|
||||||
|
@ -491,7 +487,7 @@ ifeq ($(CONFIG_LIBSUPCXX),y)
|
||||||
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
|
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_COVERAGE),y)
|
ifeq ($(CONFIG_SCHED_GCOV),y)
|
||||||
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcov.a))
|
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcov.a))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -66,10 +66,6 @@ ifeq ($(CONFIG_STACK_CANARIES),y)
|
||||||
ARCHOPTIMIZATION += -fstack-protector-all
|
ARCHOPTIMIZATION += -fstack-protector-all
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_COVERAGE_ALL),y)
|
|
||||||
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
||||||
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
|
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
|
||||||
endif
|
endif
|
||||||
|
@ -196,7 +192,7 @@ ifeq ($(CONFIG_LIBSUPCXX),y)
|
||||||
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
|
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_COVERAGE),y)
|
ifeq ($(CONFIG_SCHED_GCOV),y)
|
||||||
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcov.a))
|
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcov.a))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -107,10 +107,6 @@ if(CONFIG_STACK_CANARIES)
|
||||||
add_compile_options(-fstack-protector-all)
|
add_compile_options(-fstack-protector-all)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CONFIG_ARCH_COVERAGE_ALL)
|
|
||||||
add_compile_options(-fprofile-generate -ftest-coverage)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CONFIG_MM_UBSAN_ALL)
|
if(CONFIG_MM_UBSAN_ALL)
|
||||||
add_compile_options(${CONFIG_MM_UBSAN_OPTION})
|
add_compile_options(${CONFIG_MM_UBSAN_OPTION})
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -56,7 +56,7 @@ if(CONFIG_LIBSUPCXX)
|
||||||
OUTPUT_VARIABLE extra_library)
|
OUTPUT_VARIABLE extra_library)
|
||||||
list(APPEND EXTRA_LIB ${extra_library})
|
list(APPEND EXTRA_LIB ${extra_library})
|
||||||
endif()
|
endif()
|
||||||
if(CONFIG_ARCH_COVERAGE)
|
if(CONFIG_SCHED_GCOV)
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS}
|
COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS}
|
||||||
--print-file-name=libgcov.a
|
--print-file-name=libgcov.a
|
||||||
|
|
|
@ -158,7 +158,7 @@ if(${CONFIG_STACK_USAGE_WARNING})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CONFIG_ARCH_COVERAGE)
|
if(CONFIG_SCHED_GCOV)
|
||||||
add_compile_options(-fprofile-generate -ftest-coverage)
|
add_compile_options(-fprofile-generate -ftest-coverage)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ if(CONFIG_LIBSUPCXX)
|
||||||
list(APPEND EXTRA_LIB ${extra_library})
|
list(APPEND EXTRA_LIB ${extra_library})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CONFIG_ARCH_COVERAGE)
|
if(CONFIG_SCHED_GCOV)
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS}
|
COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS}
|
||||||
--print-file-name=libgcov.a
|
--print-file-name=libgcov.a
|
||||||
|
|
|
@ -81,10 +81,6 @@ ifneq ($(CONFIG_STACK_USAGE_WARNING),0)
|
||||||
ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING)
|
ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_COVERAGE_ALL),y)
|
|
||||||
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
|
|
||||||
endif
|
|
||||||
|
|
||||||
ARCHCFLAGS += -fno-common
|
ARCHCFLAGS += -fno-common
|
||||||
ARCHCXXFLAGS += -fno-common
|
ARCHCXXFLAGS += -fno-common
|
||||||
|
|
||||||
|
@ -400,7 +396,7 @@ ifeq ($(CONFIG_LIBSUPCXX),y)
|
||||||
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
|
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_COVERAGE),y)
|
ifeq ($(CONFIG_SCHED_GCOV),y)
|
||||||
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcov.a))
|
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcov.a))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,14 @@ config SIM_UBSAN_DUMMY
|
||||||
---help---
|
---help---
|
||||||
Keep SIM_UBSAN compile time but disable runtime actions.
|
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
|
choice
|
||||||
prompt "X64_64 ABI"
|
prompt "X64_64 ABI"
|
||||||
default SIM_X8664_SYSTEMV if HOST_LINUX
|
default SIM_X8664_SYSTEMV if HOST_LINUX
|
||||||
|
|
|
@ -140,7 +140,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y)
|
||||||
STDLIBS += -lm
|
STDLIBS += -lm
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_COVERAGE),y)
|
ifeq ($(CONFIG_SCHED_GCOV),y)
|
||||||
STDLIBS += -lgcov
|
STDLIBS += -lgcov
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ if(CONFIG_STACK_USAGE_WARNING)
|
||||||
add_compile_options(-Wstack-usage=${CONFIG_STACK_USAGE_WARNING})
|
add_compile_options(-Wstack-usage=${CONFIG_STACK_USAGE_WARNING})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CONFIG_SIM_GCOV_ALL)
|
if(CONFIG_SCHED_GCOV)
|
||||||
add_compile_options(-fprofile-generate -ftest-coverage)
|
add_compile_options(-fprofile-generate -ftest-coverage)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ set(HOSTSRCS)
|
||||||
set(HOST_INCLUDE_DIRS)
|
set(HOST_INCLUDE_DIRS)
|
||||||
set(STDLIBS pthread)
|
set(STDLIBS pthread)
|
||||||
|
|
||||||
if(CONFIG_ARCH_COVERAGE)
|
if(CONFIG_SCHED_GCOV)
|
||||||
list(APPEND STDLIBS gcov)
|
list(APPEND STDLIBS gcov)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_COVERAGE
|
#ifdef CONFIG_SCHED_GCOV
|
||||||
void __gcov_dump(void);
|
void __gcov_dump(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ extern int backtrace(void **array, int size);
|
||||||
|
|
||||||
void host_abort(int status)
|
void host_abort(int status)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_ARCH_COVERAGE
|
#ifdef CONFIG_SCHED_GCOV
|
||||||
/* Dump gcov data. */
|
/* Dump gcov data. */
|
||||||
|
|
||||||
host_uninterruptible_no_return(__gcov_dump);
|
host_uninterruptible_no_return(__gcov_dump);
|
||||||
|
|
|
@ -75,7 +75,7 @@ if(${CONFIG_STACK_USAGE_WARNING})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CONFIG_ARCH_COVERAGE)
|
if(CONFIG_SCHED_GCOV)
|
||||||
add_compile_options(-fprofile-generate -ftest-coverage)
|
add_compile_options(-fprofile-generate -ftest-coverage)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ if(CONFIG_LIBSUPCXX)
|
||||||
list(APPEND EXTRA_LIB ${extra_library})
|
list(APPEND EXTRA_LIB ${extra_library})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CONFIG_ARCH_COVERAGE)
|
if(CONFIG_SCHED_GCOV)
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} ${NUTTX_EXTRA_FLAGS}
|
COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} ${NUTTX_EXTRA_FLAGS}
|
||||||
--print-file-name=libgcov.a
|
--print-file-name=libgcov.a
|
||||||
|
|
|
@ -91,10 +91,6 @@ ifneq ($(CONFIG_STACK_USAGE_WARNING),0)
|
||||||
ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING)
|
ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_COVERAGE_ALL),y)
|
|
||||||
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Instrumentation options
|
# Instrumentation options
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_INSTRUMENT_ALL),y)
|
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))
|
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_COVERAGE),y)
|
ifeq ($(CONFIG_SCHED_GCOV),y)
|
||||||
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcov.a))
|
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcov.a))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -95,10 +95,6 @@ ifneq ($(CONFIG_STACK_USAGE_WARNING),0)
|
||||||
ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING)
|
ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_COVERAGE_ALL),y)
|
|
||||||
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Instrumentation options
|
# Instrumentation options
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_INSTRUMENT_ALL),y)
|
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))
|
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_COVERAGE),y)
|
ifeq ($(CONFIG_SCHED_GCOV),y)
|
||||||
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcov.a))
|
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcov.a))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ CONFIG_ARCH="sim"
|
||||||
CONFIG_ARCH_BOARD="sim"
|
CONFIG_ARCH_BOARD="sim"
|
||||||
CONFIG_ARCH_BOARD_SIM=y
|
CONFIG_ARCH_BOARD_SIM=y
|
||||||
CONFIG_ARCH_CHIP="sim"
|
CONFIG_ARCH_CHIP="sim"
|
||||||
CONFIG_ARCH_COVERAGE=y
|
|
||||||
CONFIG_ARCH_SIM=y
|
CONFIG_ARCH_SIM=y
|
||||||
CONFIG_BOARDCTL_POWEROFF=y
|
CONFIG_BOARDCTL_POWEROFF=y
|
||||||
CONFIG_BUILTIN=y
|
CONFIG_BUILTIN=y
|
||||||
|
@ -39,6 +38,7 @@ CONFIG_PTHREAD_MUTEX_TYPES=y
|
||||||
CONFIG_PTHREAD_MUTEX_UNSAFE=y
|
CONFIG_PTHREAD_MUTEX_UNSAFE=y
|
||||||
CONFIG_READLINE_TABCOMPLETION=y
|
CONFIG_READLINE_TABCOMPLETION=y
|
||||||
CONFIG_RR_INTERVAL=10
|
CONFIG_RR_INTERVAL=10
|
||||||
|
CONFIG_SCHED_GCOV=y
|
||||||
CONFIG_SCHED_HAVE_PARENT=y
|
CONFIG_SCHED_HAVE_PARENT=y
|
||||||
CONFIG_SCHED_LPWORK=y
|
CONFIG_SCHED_LPWORK=y
|
||||||
CONFIG_SCHED_WAITPID=y
|
CONFIG_SCHED_WAITPID=y
|
||||||
|
|
|
@ -72,7 +72,7 @@ ifneq ($(CONFIG_STACK_USAGE_WARNING),0)
|
||||||
ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING)
|
ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_COVERAGE_ALL),y)
|
ifeq ($(CONFIG_SIM_GCOV_ALL),y)
|
||||||
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
|
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -1341,6 +1341,18 @@ config SCHED_STACK_RECORD
|
||||||
to disable.Through instrumentation, record the backtrace at
|
to disable.Through instrumentation, record the backtrace at
|
||||||
the deepest point in the stack.
|
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
|
endmenu
|
||||||
|
|
||||||
menu "Files and I/O"
|
menu "Files and I/O"
|
||||||
|
|
|
@ -659,7 +659,7 @@ endef
|
||||||
|
|
||||||
# CLEAN - Default clean target
|
# CLEAN - Default clean target
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_COVERAGE),y)
|
ifeq ($(CONFIG_SCHED_GCOV),y)
|
||||||
EXTRA = *.gcno *.gcda
|
EXTRA = *.gcno *.gcda
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue