mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
inlining of Zeek script functions
This commit is contained in:
parent
3c39f11726
commit
c42586af2c
63 changed files with 21807 additions and 171 deletions
|
@ -3,6 +3,7 @@
|
|||
#include "zeek-config.h"
|
||||
|
||||
#include "zeek/Options.h"
|
||||
#include "zeek/script_opt/ScriptOpt.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
|
@ -104,6 +105,7 @@ void usage(const char* prog, int code)
|
|||
fprintf(stderr, " -H|--save-seeds <file> | save seeds to given file\n");
|
||||
fprintf(stderr, " -I|--print-id <ID name> | print out given ID\n");
|
||||
fprintf(stderr, " -N|--print-plugins | print available plugins and exit (-NN for verbose)\n");
|
||||
fprintf(stderr, " -O|--optimize[=<option>] | enable script optimization (use -O help for options)\n");
|
||||
fprintf(stderr, " -P|--prime-dns | prime DNS\n");
|
||||
fprintf(stderr, " -Q|--time | print execution time summary to stderr\n");
|
||||
fprintf(stderr, " -S|--debug-rules | enable rule debugging\n");
|
||||
|
@ -141,6 +143,30 @@ void usage(const char* prog, int code)
|
|||
exit(code);
|
||||
}
|
||||
|
||||
static void set_analysis_option(const char* opt, Options& opts)
|
||||
{
|
||||
if ( util::streq(opt, "help") )
|
||||
{
|
||||
fprintf(stderr, "--optimize options:\n");
|
||||
fprintf(stderr, " help print this list\n");
|
||||
fprintf(stderr, " inline inline function calls\n");
|
||||
fprintf(stderr, " recursive report on recursive functions and exit\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if ( util::streq(opt, "inline") )
|
||||
opts.analysis_options.inliner = true;
|
||||
else if ( util::streq(opt, "recursive") )
|
||||
opts.analysis_options.inliner =
|
||||
opts.analysis_options.report_recursive = true;
|
||||
|
||||
else
|
||||
{
|
||||
fprintf(stderr,"zeek: unrecognized --optimize option: %s\n", opt);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
Options parse_cmdline(int argc, char** argv)
|
||||
{
|
||||
Options rval;
|
||||
|
@ -252,6 +278,7 @@ Options parse_cmdline(int argc, char** argv)
|
|||
{"load-seeds", required_argument, nullptr, 'G'},
|
||||
{"save-seeds", required_argument, nullptr, 'H'},
|
||||
{"print-plugins", no_argument, nullptr, 'N'},
|
||||
{"optimize", required_argument, nullptr, 'O'},
|
||||
{"prime-dns", no_argument, nullptr, 'P'},
|
||||
{"time", no_argument, nullptr, 'Q'},
|
||||
{"debug-rules", no_argument, nullptr, 'S'},
|
||||
|
@ -279,7 +306,7 @@ Options parse_cmdline(int argc, char** argv)
|
|||
};
|
||||
|
||||
char opts[256];
|
||||
util::safe_strncpy(opts, "B:e:f:G:H:I:i:j::n:p:r:s:T:t:U:w:X:CDFNPQSWabdhv",
|
||||
util::safe_strncpy(opts, "B:e:f:G:H:I:i:j::n:O:p:r:s:T:t:U:w:X:CDFNPQSWabdhv",
|
||||
sizeof(opts));
|
||||
|
||||
#ifdef USE_PERFTOOLS_DEBUG
|
||||
|
@ -401,6 +428,9 @@ Options parse_cmdline(int argc, char** argv)
|
|||
case 'N':
|
||||
++rval.print_plugins;
|
||||
break;
|
||||
case 'O':
|
||||
set_analysis_option(optarg, rval);
|
||||
break;
|
||||
case 'P':
|
||||
if ( rval.dns_mode != detail::DNS_DEFAULT )
|
||||
usage(zargs[0], 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue