Allow controlling trace level from cmdline.

0.96
Török Edvin 16 years ago
parent 0a11015bf5
commit acb53e3a41
  1. 8
      clambc/bcrun.c
  2. 2
      shared/optparser.c

@ -47,6 +47,8 @@ static void help(void)
printf("clambc <file> [function] [param1 ...]\n\n");
printf(" --help -h Show help\n");
printf(" --version -V Show version\n");
printf(" --trace <level> Set bytecode trace level 0..7 (default 7)\n");
printf(" --no-trace-showsource Don't show source line during tracing\n");
printf(" file file to test\n");
printf("\n");
return;
@ -120,6 +122,7 @@ int main(int argc, char *argv[])
unsigned funcid=0, i;
struct cli_all_bc bcs;
unsigned int fd = -1;
unsigned tracelevel;
opts = optparse(NULL, argc, argv, 1, OPT_CLAMBC, 0, NULL);
if (!opts) {
@ -203,8 +206,9 @@ int main(int argc, char *argv[])
dbg_state.file = "<libclamav>";
dbg_state.line = 0;
dbg_state.col = 0;
dbg_state.showline = 1;
cli_bytecode_context_set_trace(ctx, trace_val,
dbg_state.showline = !optget(opts, "no-trace-showsource")->enabled;
tracelevel = optget(opts, "trace")->numarg;
cli_bytecode_context_set_trace(ctx, tracelevel,
tracehook,
tracehook_op,
tracehook_val);

@ -121,6 +121,8 @@ const struct clam_option __clam_options[] = {
{ NULL, "force-interpreter", 'f', TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMBC, "Force using the interpreter instead of the JIT", "" },
{ NULL, "input", 'i', TYPE_STRING, NULL, -1, NULL, 0, OPT_CLAMBC, "Input file to run the bytecode n", ""},
{ NULL, "trace", 't', TYPE_NUMBER, MATCH_NUMBER, 7, NULL, 0, OPT_CLAMBC, "bytecode trace level",""},
{ NULL, "no-trace-showsource", 's', TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMBC, "Don't show source line during tracing",""},
/* cmdline only - deprecated */
{ NULL, "http-proxy", 0, TYPE_STRING, NULL, 0, NULL, 0, OPT_FRESHCLAM | OPT_DEPRECATED, "", "" },

Loading…
Cancel
Save