[RFC PATCH 20/28] cli: lil: Add config to enable debug output

Sean Anderson
2021-07-01T06:19:54Z

This provides an easy way to enable assertions and debug messages. It will
also be used to enable tracing features in future patches.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
---

cmd/Kconfig | 6 ++++++
common/Makefile | 3 +++
2 files changed, 9 insertions(+)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 7c8962cfc2..bba72bbdc2 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -61,6 +61,12 @@ config LIL_RECLIMIT
avoid call stack overflows and is also useful when running through an
automated fuzzer like AFL. Set to 0 to disable the recursion limit.

+config LIL_DEBUG
+ bool "Enable LIL debugging"
+ help
+ This enables debug prints, assertions, and other tracing features in
+ LIL. If you are not working on LIL, say 'n' here.
+
endif

endif
diff --git a/common/Makefile b/common/Makefile
index dce04b305e..558e1932fe 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -11,6 +11,9 @@ obj-y += exports.o
obj-$(CONFIG_HASH) += hash.o
obj-$(CONFIG_HUSH_PARSER) += cli_hush.o
obj-$(CONFIG_LIL) += cli_lil.o
+ifneq ($(CONFIG_LIL_DEBUG),)
+CFLAGS_cli_lil.o += -DDEBUG
+endif
obj-$(CONFIG_AUTOBOOT) += autoboot.o

# This option is not just y/n - it can have a numeric value
--
2.32.0