make the debug level controlable

This commit is contained in:
Bill Currie 2002-10-16 17:31:15 +00:00
parent 54564a4726
commit 378931412d

View file

@ -72,6 +72,7 @@ static const struct option long_options[] = {
{"functions", no_argument, 0, 'F'}, {"functions", no_argument, 0, 'F'},
{"lines", no_argument, 0, 'l'}, {"lines", no_argument, 0, 'l'},
{"modules", no_argument, 0, 'M'}, {"modules", no_argument, 0, 'M'},
{"verbose", no_argument, 0, 'v'},
{NULL, 0, NULL, 0}, {NULL, 0, NULL, 0},
}; };
@ -82,6 +83,8 @@ static progs_t pr;
static void *membase; static void *membase;
static int memsize = 1024*1024; static int memsize = 1024*1024;
static int verbosity = 0;
static hashtab_t *func_tab; static hashtab_t *func_tab;
static QFile * static QFile *
@ -162,7 +165,7 @@ init_qf (void)
membase = malloc (memsize); membase = malloc (memsize);
Memory_Init (membase, memsize); Memory_Init (membase, memsize);
Cvar_Get ("pr_debug", "1", 0, 0, ""); Cvar_Get ("pr_debug", va ("%d", verbosity), 0, 0, "");
PR_Init_Cvars (); PR_Init_Cvars ();
PR_Init (); PR_Init ();
@ -210,8 +213,7 @@ main (int argc, char **argv)
int c; int c;
void (*func)(progs_t *pr) = dump_globals; void (*func)(progs_t *pr) = dump_globals;
init_qf (); while ((c = getopt_long (argc, argv, "dgsfFlMv", long_options, 0)) != EOF) {
while ((c = getopt_long (argc, argv, "dgsfFlM", long_options, 0)) != EOF) {
switch (c) { switch (c) {
case 'd': case 'd':
func = disassemble_progs; func = disassemble_progs;
@ -234,10 +236,14 @@ main (int argc, char **argv)
case 'M': case 'M':
func = dump_modules; func = dump_modules;
break; break;
case 'v':
verbosity++;
break;
default: default:
return 1; return 1;
} }
} }
init_qf ();
while (optind < argc) { while (optind < argc) {
load_progs (argv[optind++]); load_progs (argv[optind++]);
func (&pr); func (&pr);