diff --git a/src/Options.cc b/src/Options.cc index 3d5c8808fd..6fac075223 100644 --- a/src/Options.cc +++ b/src/Options.cc @@ -157,6 +157,7 @@ static void set_analysis_option(const char* opt, Options& opts) if ( util::streq(opt, "help") ) { fprintf(stderr, "--optimize options:\n"); + fprintf(stderr, " dump-uds dump use-defs to stdout; implies xform\n"); fprintf(stderr, " dump-xform dump transformed scripts to stdout; implies xform\n"); fprintf(stderr, " help print this list\n"); fprintf(stderr, " inline inline function calls\n"); @@ -167,7 +168,9 @@ static void set_analysis_option(const char* opt, Options& opts) auto& a_o = opts.analysis_options; - if ( util::streq(opt, "dump-xform") ) + if ( util::streq(opt, "dump-uds") ) + a_o.activate = a_o.dump_uds = true; + else if ( util::streq(opt, "dump-xform") ) a_o.activate = a_o.dump_xform = true; else if ( util::streq(opt, "inline") ) a_o.inliner = true; diff --git a/src/script_opt/ScriptOpt.cc b/src/script_opt/ScriptOpt.cc index 456478c638..09f715cd11 100644 --- a/src/script_opt/ScriptOpt.cc +++ b/src/script_opt/ScriptOpt.cc @@ -115,6 +115,7 @@ void analyze_scripts() if ( ! did_init ) { check_env_opt("ZEEK_DUMP_XFORM", analysis_options.dump_xform); + check_env_opt("ZEEK_DUMP_UDS", analysis_options.dump_uds); check_env_opt("ZEEK_INLINE", analysis_options.inliner); check_env_opt("ZEEK_XFORM", analysis_options.activate); diff --git a/src/script_opt/ScriptOpt.h b/src/script_opt/ScriptOpt.h index 4a4569a0bc..e898a8c415 100644 --- a/src/script_opt/ScriptOpt.h +++ b/src/script_opt/ScriptOpt.h @@ -27,6 +27,9 @@ struct AnalyOpt { // them. Always done if only_func is set. bool dump_xform = false; + // If true, dump out the use-defs for each analyzed function. + bool dump_uds = false; + // If non-nil, then only analyze the given function/event/hook. std::optional only_func;