From 96edc100c047e76c5baba816ffa26f3698c330e2 Mon Sep 17 00:00:00 2001 From: Martin Roth Date: Tue, 27 Sep 2022 18:30:55 -0600 Subject: [PATCH] tests: Add option for debug symbols & no optimization To make it easier to build the tests with debug symbols, add a check for the "GDB_DEBUG" environment variable. If set, build with -g and -Og to enable the symbols and disable optimization. Signed-off-by: Martin Roth Change-Id: I3a644dcccb7e15473413b775da8f70617afaefce Reviewed-on: https://review.coreboot.org/c/coreboot/+/67918 Tested-by: build bot (Jenkins) Reviewed-by: Jakub Czapiga --- tests/Makefile.inc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/Makefile.inc b/tests/Makefile.inc index 2c1a30bb8d..90f01d159a 100644 --- a/tests/Makefile.inc +++ b/tests/Makefile.inc @@ -10,7 +10,13 @@ endif include $(top)/tests/Makefile.common -# Enable code coverage if COV=1 +# Enable GDB debug build if requested +GDB_DEBUG ?= 0 +ifneq ($(GDB_DEBUG),0) +TEST_CFLAGS += -g -Og +endif + +# Enable code coverage if requested ifeq ($(COV),1) TEST_CFLAGS += --coverage TEST_LDFLAGS += --coverage @@ -175,6 +181,7 @@ list-unit-tests: help-unit-tests help:: @echo '*** coreboot unit-tests targets ***' @echo ' Use "COV=1 make [target]" to enable code coverage for unit tests' + @echo ' Use "GDB_DEBUG=1 make [target]" to build with debug symbols' @echo ' unit-tests - Run all unit-tests from tests/' @echo ' clean-unit-tests - Remove unit-tests build artifacts' @echo ' list-unit-tests - List all unit-tests'