diff options
author | Stefan Reinauer <reinauer@chromium.org> | 2012-12-18 16:23:28 -0800 |
---|---|---|
committer | Ronald G. Minnich <rminnich@gmail.com> | 2013-01-12 19:09:55 +0100 |
commit | d37ab454d4ea702df276a66d4e0ea9f73d4f6fe0 (patch) | |
tree | 99b901a5ef3184f11871c4b9b66e43aad47ffaad /src/lib/selfboot.c | |
parent | 6e21f43008bcf74e64755ca896149943b1cc4229 (diff) |
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>
Diffstat (limited to 'src/lib/selfboot.c')
-rw-r--r-- | src/lib/selfboot.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/selfboot.c b/src/lib/selfboot.c index 2556a14d6e..c5fb62adca 100644 --- a/src/lib/selfboot.c +++ b/src/lib/selfboot.c @@ -32,6 +32,7 @@ #if CONFIG_COLLECT_TIMESTAMPS #include <timestamp.h> #endif +#include <coverage.h> /* Maximum physical address we can use for the coreboot bounce buffer. */ #ifndef MAX_ADDR @@ -518,6 +519,9 @@ int selfboot(struct lb_memory *mem, struct cbfs_payload *payload) #if CONFIG_COLLECT_TIMESTAMPS timestamp_add_now(TS_SELFBOOT_JUMP); #endif +#if CONFIG_COVERAGE + coverage_exit(); +#endif /* Before we go off to run the payload, see if * we stayed within our bounds. |