From c7a684d16808f0062284a0737503451894be4ce9 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Fri, 2 Nov 2018 19:09:57 -0400 Subject: parse: Add support for -D all to enable all debug flags --- cmdline.h | 2 ++ parse.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/cmdline.h b/cmdline.h index df49dd6..78e1f9a 100644 --- a/cmdline.h +++ b/cmdline.h @@ -37,6 +37,8 @@ enum debug_flags { DEBUG_STAT = 1 << 5, /** Print the parse tree. */ DEBUG_TREE = 1 << 6, + /** All debug flags. */ + DEBUG_ALL = (1 << 7) - 1, }; /** diff --git a/parse.c b/parse.c index 258f770..4103e0b 100644 --- a/parse.c +++ b/parse.c @@ -818,6 +818,7 @@ static void debug_help(CFILE *cfile) { cfprintf(cfile, " %{bld}search%{rs}: Trace the filesystem traversal.\n"); cfprintf(cfile, " %{bld}stat%{rs}: Trace all stat() calls.\n"); cfprintf(cfile, " %{bld}tree%{rs}: Print the parse tree.\n"); + cfprintf(cfile, " %{bld}all%{rs}: All debug flags at once.\n"); } /** @@ -852,6 +853,8 @@ static struct expr *parse_debug(struct parser_state *state, int arg1, int arg2) cmdline->debug |= DEBUG_STAT; } else if (strcmp(flag, "tree") == 0) { cmdline->debug |= DEBUG_TREE; + } else if (strcmp(flag, "all") == 0) { + cmdline->debug |= DEBUG_ALL; } else { cfprintf(cmdline->cerr, "%{wr}warning: Unrecognized debug flag '%s'.%{rs}\n\n", flag); debug_help(cmdline->cerr); -- cgit v1.2.3