Implement GCC code coverage analysis
In order to provide some insight on what code is executed during coreboot's run time and how well our test scenarios work, this adds code coverage support to coreboot's ram stage. This should be easily adaptable for payloads, and maybe even romstage. See http://gcc.gnu.org/onlinedocs/gcc/Gcov.html for more information. To instrument coreboot, select CONFIG_COVERAGE ("Code coverage support") in Kconfig, and recompile coreboot. coreboot will then store its code coverage information into CBMEM, if possible. Then, run "cbmem -CV" as root on the target system running the instrumented coreboot binary. This will create a whole bunch of .gcda files that contain coverage information. Tar them up, copy them to your build system machine, and untar them. Then you can use your favorite coverage utility (gcov, lcov, ...) to visualize code coverage. For a sneak peak of what will expect you, please take a look at http://www.coreboot.org/~stepan/coreboot-coverage/ Change-Id: Ib287d8309878a1f5c4be770c38b1bc0bb3aa6ec7 Signed-off-by: Stefan Reinauer <reinauer@google.com> Reviewed-on: http://review.coreboot.org/2052 Tested-by: build bot (Jenkins) Reviewed-by: David Hendricks <dhendrix@chromium.org> Reviewed-by: Martin Roth <martin@se-eng.com> Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
committed by
Ronald G. Minnich
parent
6e21f43008
commit
d37ab454d4
18
src/Kconfig
18
src/Kconfig
@@ -194,6 +194,15 @@ config REQUIRES_BLOB
|
||||
coreboot build for such a board can override this manually, but
|
||||
this option serves as warning that it might fail.
|
||||
|
||||
config COVERAGE
|
||||
bool "Code coverage support"
|
||||
depends on COMPILER_GCC
|
||||
default n
|
||||
help
|
||||
Add code coverage support for coreboot. This will store code
|
||||
coverage information in CBMEM for extraction from user space.
|
||||
If unsure, say N.
|
||||
|
||||
endmenu
|
||||
|
||||
source src/mainboard/Kconfig
|
||||
@@ -868,6 +877,15 @@ config TRACE
|
||||
the 0xaaaabbbb is the actual function and 0xccccdddd is EIP
|
||||
of calling function. Please note some printk releated functions
|
||||
are omitted from trace to have good looking console dumps.
|
||||
|
||||
config DEBUG_COVERAGE
|
||||
bool "Debug code coverage"
|
||||
default n
|
||||
depends on COVERAGE
|
||||
help
|
||||
If enabled, the code coverage hooks in coreboot will output some
|
||||
information about the coverage data that is dumped.
|
||||
|
||||
endmenu
|
||||
|
||||
# These probably belong somewhere else, but they are needed somewhere.
|
||||
|
Reference in New Issue
Block a user