From 34daa4c1cb99ed66c974336f23269cb508f71c74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sat, 2 May 2015 13:28:56 +0200 Subject: parse_kconfig add debug output of boolexpr --- scripts/parse_kconfig/doutput.c | 38 +++++++++++++++++++++++++++++++++++++- scripts/parse_kconfig/doutput.h | 2 ++ scripts/parse_kconfig/parse.c | 2 ++ 3 files changed, 41 insertions(+), 1 deletion(-) (limited to 'scripts/parse_kconfig') diff --git a/scripts/parse_kconfig/doutput.c b/scripts/parse_kconfig/doutput.c index ac7927f..5b94842 100644 --- a/scripts/parse_kconfig/doutput.c +++ b/scripts/parse_kconfig/doutput.c @@ -2,7 +2,7 @@ void doutput_expr(struct expr *expr) { #ifdef DEBUG - if (verbose_level < 3) + if (verbose_level <= 3) return; switch (expr->type) { case E_OR: @@ -62,3 +62,39 @@ void doutput_expr(struct expr *expr) { } #endif /* DEBUG */ } + +void doutput_boolexpr(struct boolexpr *bl, struct symlist *sl) { +#ifdef DEBUG + if (verbose_level <= 3) + return; + switch (bl->type) { + case BT_TRUE: + printf(" true\n"); + break; + case BT_FALSE: + printf(" false\n"); + break; + case BT_SYM: + printf(" CONFIG_%s\n", sl->array[bl->id - 1].name); + break; + case BT_OR: + printf(" OR\n"); + doutput_boolexpr(bl->left, sl); + doutput_boolexpr(bl->right, sl); + break; + case BT_AND: + printf(" AND\n"); + doutput_boolexpr(bl->left, sl); + doutput_boolexpr(bl->right, sl); + break; + case BT_NOT: + if (bl->left->type == BT_SYM) { + printf(" NOT CONFIG_%s\n", sl->array[bl->left->id - 1].name); + } else { + printf(" NOT\n"); + doutput_boolexpr(bl->left, sl); + } + break; + } +#endif /* DEBUG */ +} diff --git a/scripts/parse_kconfig/doutput.h b/scripts/parse_kconfig/doutput.h index f82fd9b..0d1a5fb 100644 --- a/scripts/parse_kconfig/doutput.h +++ b/scripts/parse_kconfig/doutput.h @@ -7,7 +7,9 @@ #include #include +#include "boolexpr.h" void doutput_expr(struct expr *expr); +void doutput_boolexpr(struct boolexpr *bl, struct symlist *sl); #endif /* _DOUTPUT_H_ */ diff --git a/scripts/parse_kconfig/parse.c b/scripts/parse_kconfig/parse.c index 7de4f2b..54941dc 100644 --- a/scripts/parse_kconfig/parse.c +++ b/scripts/parse_kconfig/parse.c @@ -163,6 +163,8 @@ void cpy_dep() { pw = boolexpr_and(pw, w3); pw = boolexpr_and(pw, w4); } + Dprintf(" CNF:\n"); + doutput_boolexpr(pw, gsymlist); cnf_boolexpr(gsymlist, pw); switch (pw->type) { case BT_TRUE: -- cgit v1.2.3