diff options
author | Karel Kočí <cynerd@email.cz> | 2015-05-01 21:52:27 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2015-05-01 21:52:27 +0200 |
commit | ad499b111339a813cfcce4f717c38513f0e05ab7 (patch) | |
tree | fbd0b8a1a70bb42966186a53fc5319d36de51bb7 /scripts/parse_kconfig | |
parent | f9a646a81d90b64ee83db7bb8c5a4ac2c4402298 (diff) | |
download | linux-conf-perf-ad499b111339a813cfcce4f717c38513f0e05ab7.tar.gz linux-conf-perf-ad499b111339a813cfcce4f717c38513f0e05ab7.tar.bz2 linux-conf-perf-ad499b111339a813cfcce4f717c38513f0e05ab7.zip |
parse_kconfig add debug outputs
Diffstat (limited to 'scripts/parse_kconfig')
-rw-r--r-- | scripts/parse_kconfig/doutput.c | 64 | ||||
-rw-r--r-- | scripts/parse_kconfig/doutput.h | 13 | ||||
-rw-r--r-- | scripts/parse_kconfig/parse.c | 23 |
3 files changed, 93 insertions, 7 deletions
diff --git a/scripts/parse_kconfig/doutput.c b/scripts/parse_kconfig/doutput.c new file mode 100644 index 0000000..ac7927f --- /dev/null +++ b/scripts/parse_kconfig/doutput.c @@ -0,0 +1,64 @@ +#include "doutput.h" + +void doutput_expr(struct expr *expr) { +#ifdef DEBUG + if (verbose_level < 3) + return; + switch (expr->type) { + case E_OR: + printf(" OR\n"); + doutput_expr(expr->left.expr); + doutput_expr(expr->right.expr); + break; + case E_AND: + printf(" AND\n"); + doutput_expr(expr->left.expr); + doutput_expr(expr->right.expr); + break; + case E_NOT: + printf(" NOT\n"); + doutput_expr(expr->left.expr); + break; + case E_EQUAL: + printf(" = "); + printf("%s ", expr->left.sym->name); + if (!strcmp("y", expr->right.sym->name)) + printf("YES\n"); + else if (!strcmp("n", expr->right.sym->name)) + printf("NO\n"); + else if (!strcmp("m", expr->right.sym->name)) + printf("MODULE\n"); + else + printf("%s\n", expr->left.sym->name); + break; + case E_UNEQUAL: + printf(" != "); + printf("%s ", expr->left.sym->name); + if (!strcmp("y", expr->right.sym->name)) + printf("YES\n"); + else if (!strcmp("n", expr->right.sym->name)) + printf("NO\n"); + else + printf("OTHER %s\n", expr->right.sym->name); + break; + case E_LIST: + printf(" list\n"); + break; + case E_SYMBOL: + printf(" symbol"); + if (expr->left.sym->name != NULL) + printf(": %s", expr->left.sym->name); + printf("\n"); + break; + case E_RANGE: + printf(" range\n"); + break; + case E_NONE: + printf(" none\n"); + break; + default: + printf(" ERROR\n"); + break; + } +#endif /* DEBUG */ +} diff --git a/scripts/parse_kconfig/doutput.h b/scripts/parse_kconfig/doutput.h new file mode 100644 index 0000000..f82fd9b --- /dev/null +++ b/scripts/parse_kconfig/doutput.h @@ -0,0 +1,13 @@ +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#ifndef _DOUTPUT_H_ +#define _DOUTPUT_H_ + +#include <kconfig/lkc.h> +#include <macros.h> + +void doutput_expr(struct expr *expr); + +#endif /* _DOUTPUT_H_ */ diff --git a/scripts/parse_kconfig/parse.c b/scripts/parse_kconfig/parse.c index 1a6fc92..dcd6852 100644 --- a/scripts/parse_kconfig/parse.c +++ b/scripts/parse_kconfig/parse.c @@ -10,6 +10,7 @@ #include "symlist.h" #include "output.h" #include "macros.h" +#include "doutput.h" int verbose_level; char *file, *folder; @@ -57,13 +58,15 @@ int main(int argc, char **argv) { char *rules_file, *symbol_map_file, *variable_count_file; asprintf(&rules_file, "%s/%s", folder, DEFAULT_RULES_FILE); asprintf(&symbol_map_file, "%s/%s", folder, DEFAULT_SYMBOL_MAP_FILE); - asprintf(&variable_count_file, "%s/%s", folder, DEFAULT_VARIABLE_COUNT_FILE); + asprintf(&variable_count_file, "%s/%s", folder, + DEFAULT_VARIABLE_COUNT_FILE); output_init(rules_file, symbol_map_file); build_symlist(); cpy_dep(); - output_write_variable_count(variable_count_file, gsymlist->lastsym - 1); + output_write_variable_count(variable_count_file, + gsymlist->lastsym - 1); output_finish(); return 0; @@ -99,6 +102,7 @@ void cpy_dep() { if ((sym->type == S_BOOLEAN || sym->type == S_TRISTATE)) { el_id = symlist_id(gsymlist, sym->name); el = &(gsymlist->array[el_id - 1]); + Iprintf("Processing: %s\n", sym->name); for_all_defaults(sym, prop) { struct boolexpr *def = @@ -108,21 +112,26 @@ void cpy_dep() { } else { el->def = boolexpr_or(el->def, def); } + Dprintf(" Default value:\n"); + doutput_expr(prop->expr); } if (el->def == NULL) el->def = boolexpr_false(); - if (sym->dir_dep.expr != NULL) + if (sym->dir_dep.expr != NULL) { el->dep = boolexpr_kconfig(gsymlist, sym->dir_dep.expr); - else + Dprintf(" Dependency:\n"); + doutput_expr(sym->dir_dep.expr); + } else el->dep = boolexpr_true(); - if (sym->rev_dep.expr != NULL) + if (sym->rev_dep.expr != NULL) { el->rev_dep = boolexpr_kconfig(gsymlist, sym->rev_dep.expr); - else + Dprintf(" Reverse dependency:\n"); + doutput_expr(sym->rev_dep.expr); + } else el->rev_dep = boolexpr_false(); struct boolexpr *pw; - Iprintf("Workig: %s\n", sym->name); struct boolexpr *boolsym = boolexpr_sym(gsymlist, sym); boolexpr_copy(boolsym); struct boolexpr *boolsym_not = boolexpr_not(boolsym); |