Permalink
Browse files

[imcc] add imcc_debug flags to Parrot_debug_flags, docs

revamp --imcc-debug, improve --help-debug
remove gcdebug runcore references in the docs
remove run-exec references in harness
leave out the imcc PBC compiler options (unused)

TODO: yydebug == PARROT_IMCC_PARSER
  • Loading branch information...
1 parent 6537151 commit 93a39051aa9aecb73886f9fd0493f10b04ed09bf Reini Urban committed Feb 26, 2014
View
@@ -206,7 +206,7 @@ imcc_preprocess_file_api(Parrot_PMC interp_pmc, Parrot_PMC compiler,
/*
=item C<Parrot_Int imcc_set_debug_api(Parrot_PMC interp_pmc, Parrot_PMC
-compiler, Parrot_Int traceflags, Parrot_Int yydebug)>
+compiler, Parrot_Int imcc_debug, Parrot_Int yydebug)>
=cut
@@ -216,13 +216,13 @@ PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
Parrot_Int
imcc_set_debug_api(Parrot_PMC interp_pmc, Parrot_PMC compiler,
- Parrot_Int traceflags, Parrot_Int yydebug)
+ Parrot_Int imcc_debug, Parrot_Int yydebug)
{
ASSERT_ARGS(imcc_set_debug_api)
IMCC_API_CALLIN(interp_pmc, interp)
imc_info_t * imcc = (imc_info_t *)VTABLE_get_pointer(interp, compiler);
- imcc_set_debug_mode(imcc, traceflags, yydebug);
+ imcc_set_debug_mode(imcc, imcc_debug, yydebug);
IMCC_API_CALLOUT(interp_pmc, interp)
}
View
@@ -385,7 +385,7 @@ SymReg* get_pasm_reg(ARGMOD(imc_info_t * imcc), ARGIN(const char *name))
typedef enum _enum_opt {
OPT_NONE,
- OPT_PRE,
+ OPT_PRE,/* 0x001 */
OPT_CFG = 0x002,
OPT_SUB = 0x004,
OPT_PASM = 0x100,
View
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2012, Parrot Foundation.
+# Copyright (C) 2011-2014, Parrot Foundation.
=pod
@@ -75,16 +75,13 @@ may be available on your system:
fast bare-bones core without bounds-checking or
context-updating
- subprof subroutine-level profiler
- (see POD in 'src/runcore/subprof.c')
-
trace bounds checking core with trace info
(see 'parrot --help-debug')
- profiling see 'docs/dev/profilling.pod'
+ profiling see F<docs/dev/profiling.pod>
- gcdebug performs a full GC run before every op dispatch
- (good for debugging GC problems)
+ subprof subroutine-level profiler
+ (see POD in F<src/runcore/subprof.c>)
=item B<-p>
@@ -286,6 +283,6 @@ most of these people, I<see> F<CREDITS>.
=head1 COPYRIGHT
-Copyright (C) 2001-2012, Parrot Foundation.
+Copyright (C) 2001-2014, Parrot Foundation.
=cut
View
@@ -40,6 +40,7 @@ struct init_args_t {
Parrot_Int turn_gc_off;
Parrot_Int preprocess_only;
Parrot_Int yydebug;
+ Parrot_Int imcc_debug;
};
extern int Parrot_set_config_hash(Parrot_PMC interp_pmc);
@@ -260,9 +261,8 @@ run_imcc(Parrot_PMC interp, Parrot_String sourcefile, ARGIN(struct init_args_t *
imcc_get_pasm_compreg_api(interp, 1, &pasm_compiler)))
show_last_error_and_exit(interp);
if (flags->preprocess_only) {
- if (flags->yydebug) {
- Parrot_api_debug_flag(interp, PARROT_YYDEBUG_FLAG, 1);
- r = imcc_set_debug_api(interp, pir_compiler, 0, flags->yydebug);
+ if (flags->yydebug || flags->imcc_debug) {
+ r = imcc_set_debug_api(interp, pir_compiler, flags->imcc_debug, flags->yydebug);
if (!r) exit(EXIT_FAILURE);
}
r = imcc_preprocess_file_api(interp, pir_compiler, sourcefile);
@@ -273,9 +273,8 @@ run_imcc(Parrot_PMC interp, Parrot_String sourcefile, ARGIN(struct init_args_t *
const Parrot_PMC compiler = pasm_mode ? pasm_compiler : pir_compiler;
Parrot_PMC pbc;
- if (flags->yydebug) {
- Parrot_api_debug_flag(interp, PARROT_YYDEBUG_FLAG, 1);
- r = imcc_set_debug_api(interp, compiler, 0, flags->yydebug);
+ if (flags->yydebug || flags->imcc_debug) {
+ r = imcc_set_debug_api(interp, compiler, flags->imcc_debug, flags->yydebug);
if (!r) exit(EXIT_FAILURE);
}
if (!imcc_compile_file_api(interp, compiler, sourcefile, &pbc))
@@ -475,23 +474,10 @@ help_debug(void)
ASSERT_ARGS(help_debug)
/* split printf for C89 compliance on string length */
printf(
- "--imcc-debug -d [Flags] ...\n"
- " 0002 lexer\n"
- " 0004 parser\n"
- " 0008 imc\n"
- " 0010 CFG\n"
- " 0020 optimization 1\n"
- " 0040 optimization 2\n"
- " 0100 AST\n"
- " 1000 PBC\n"
- " 2000 PBC constants\n"
- " 4000 PBC fixups\n"
- "\n");
- printf(
"--parrot-debug -D [Flags] ...\n"
" 0001 memory statistics\n"
" 0002 print backtrace on exception\n"
- " 0004 JIT debugging\n"
+ " 0004 JIT debugging (disabled)\n"
" 0008 interpreter startup\n"
" 0010 thread debugging\n"
" 0020 eval/compile\n"
@@ -502,6 +488,17 @@ help_debug(void)
" 0001 opcodes\n"
" 0002 find_method\n"
" 0004 function calls\n");
+ printf(
+ "\n"
+ "--imcc-debug -d [Flags] ...\n"
+ " 0002 lexer\n"
+ " 0004 parser\n"
+ " 0008 imc\n"
+ " 0010 CFG\n"
+ " 0020 optimization 1\n"
+ " 0040 optimization 2\n"
+ " 0100 AST\n"
+ "\n");
}
/*
@@ -529,7 +526,7 @@ help(void)
" --hash-seed F00F specify hex value to use as hash seed\n"
" -X --dynext add path to dynamic extension search\n"
" <Run core options>\n"
- " -R --runcore slow|bounds|fast\n"
+ " -R --runcore fast|slow|bounds\n"
" -R --runcore trace|profiling|subprof\n"
" -t --trace [flags]\n"
" <VM options>\n"
@@ -549,7 +546,7 @@ help(void)
" -. --wait Read a keystroke before starting\n"
" --runtime-prefix\n"
" <Compiler options>\n"
- " -d --imcc-debug[=HEXFLAGS]\n"
+ " -d --imcc-debug[=HEXFLAGS] (see --help-debug)\n"
" -v --verbose\n"
" -E --pre-process-only\n"
" -o --output=FILE\n"
@@ -761,6 +758,7 @@ parseflags(Parrot_PMC interp, int argc, ARGIN(const char *argv[]),
args->outfile = NULL;
args->sourcefile = NULL;
args->preprocess_only = 0;
+ args->imcc_debug = 0;
args->yydebug = 0;
if (argc == 1) {
@@ -795,20 +793,26 @@ parseflags(Parrot_PMC interp, int argc, ARGIN(const char *argv[]),
else
result = Parrot_api_debug_flag(interp, PARROT_MEM_STAT_DEBUG_FLAG, 1);
break;
+ case 'd':
+ if (opt.opt_arg && is_all_hex_digits(opt.opt_arg))
+ args->imcc_debug = strtoul(opt.opt_arg, NULL, 16);
+ else
+ args->imcc_debug = 1;
+ break;
case 'O':
if (!opt.opt_arg || !*opt.opt_arg || opt.opt_arg[0] == '0') {
- args->trace |= PARROT_TRACE_OPT_0;
+ args->imcc_debug |= PARROT_IMCC_OPT1;
break;
}
if (strchr(opt.opt_arg, 'p'))
- args->trace |= PARROT_TRACE_OPT_PASM;
+ args->imcc_debug |= PARROT_IMCC_OPT1;
if (strchr(opt.opt_arg, 'c'))
- args->trace |= PARROT_TRACE_OPT_SUB;
+ args->imcc_debug |= PARROT_IMCC_OPT2;
/* currently not ok due to different register allocation */
if (strchr(opt.opt_arg, '1'))
- args->trace |= PARROT_TRACE_OPT_PRE;
+ args->imcc_debug |= PARROT_IMCC_OPT1;
if (strchr(opt.opt_arg, '2'))
- args->trace |= (PARROT_TRACE_OPT_PRE|PARROT_TRACE_OPT_CFG);
+ args->imcc_debug |= (PARROT_IMCC_OPT1|PARROT_IMCC_OPT2);
case '.': /* Give Windows Parrot hackers an opportunity to
* attach a debuggger. */
fgetc(stdin);
View
@@ -4,7 +4,7 @@ Copyright (C) 2007-2014, Parrot Foundation.
=head1 NAME
-frontend/parrot2/main.c - The alternate PIR/PASM compiler frontend to libparrot
+frontend/parrot2/main.c - The new PIR/PASM compiler frontend to libparrot
=head1 DESCRIPTION
@@ -34,8 +34,9 @@ struct init_args_t {
Parrot_Int trace;
Parrot_Int have_pasm_file;
Parrot_Int turn_gc_off;
- Parrot_Int yydebug;
Parrot_Int preprocess_only;
+ Parrot_Int imcc_debug;
+ Parrot_Int yydebug; /* possibly merge with imcc_debug */
const char ** argv;
int argc;
};
@@ -385,7 +386,7 @@ help_debug(void)
"--parrot-debug -D [Flags] ...\n"
" 0001 memory statistics\n"
" 0002 print backtrace on exception\n"
- " 0004 JIT debugging\n"
+ " 0004 JIT debugging (disabled)\n"
" 0008 interpreter startup\n"
" 0010 thread debugging\n"
" 0020 eval/compile\n"
@@ -396,6 +397,17 @@ help_debug(void)
" 0001 opcodes\n"
" 0002 find_method\n"
" 0004 function calls\n");
+ printf(
+ "\n"
+ "--imcc-debug -d [Flags] ...\n"
+ " 0002 lexer\n"
+ " 0004 parser\n"
+ " 0008 imc\n"
+ " 0010 CFG\n"
+ " 0020 optimization 1\n"
+ " 0040 optimization 2\n"
+ " 0100 AST\n"
+ "\n");
}
/*
@@ -449,6 +461,7 @@ Parrot_cmd_options(void)
{ 't', 't', OPTION_optional_FLAG, { "--trace" } },
{ 'w', 'w', (OPTION_flags)0, { "--warnings" } },
{ 'y', 'y', (OPTION_flags)0, { "--yydebug" } },
+ { 'd', 'd', OPTION_optional_FLAG, { "--imcc-debug" } },
{ 0, 0, (OPTION_flags)0, { NULL } }
};
return cmd_options;
@@ -589,6 +602,7 @@ parseflags(Parrot_PMC interp, int argc, ARGIN(const char *argv[]),
args->turn_gc_off = 0;
args->have_pasm_file = 0;
args->preprocess_only = 0;
+ args->imcc_debug = 0;
args->yydebug = 0;
pargs[nargs++] = argv[0];
@@ -622,6 +636,12 @@ parseflags(Parrot_PMC interp, int argc, ARGIN(const char *argv[]),
else
result = Parrot_api_debug_flag(interp, PARROT_MEM_STAT_DEBUG_FLAG, 1);
break;
+ case 'd':
+ if (opt.opt_arg && is_all_hex_digits(opt.opt_arg))
+ args->imcc_debug = (Parrot_Int)strtoul(opt.opt_arg, NULL, 16);
+ else
+ args->imcc_debug = 1;
+ break;
case '.': /* Give Windows Parrot hackers an opportunity to
* attach a debuggger. */
@@ -294,7 +294,7 @@
.sub '__show_help_and_exit' :subid('WSubId_3') :anon
- set $S1, "parrot [Options] <file> [<program options...>]\n Options:\n -h --help\n -V --version\n -I --include add path to include search\n -L --library add path to library search\n --hash-seed F00F specify hex value to use as hash seed\n -X --dynext add path to dynamic extension search\n <Run core options>\n -R --runcore slow|bounds|fast\n -R --runcore trace|profiling|subprof\n -t --trace [flags]\n <VM options>\n -D --parrot-debug[=HEXFLAGS]\n --help-debug\n -w --warnings\n -G --no-gc\n -g --gc ms2|gms|ms|inf set GC type\n <GC MS2 options>\n --gc-dynamic-threshold=percentage maximum memory wasted by GC\n --gc-min-threshold=KB\n <GC GMS options>\n --gc-nursery-size=percent of sysmem size of gen0 (default 2)\n --gc-debug\n --leak-test|--destroy-at-end\n -. --wait Read a keystroke before starting\n --runtime-prefix\n <Compiler options>\n -E --pre-process-only\n -o --output=FILE\n --output-pbc\n -a --pasm\n -c --pbc\n -r --run-pbc\n -y --yydebug\n <Language options>\nsee docs/running.pod for more\n"
+ set $S1, "parrot [Options] <file> [<program options...>]\n Options:\n -h --help\n -V --version\n -I --include add path to include search\n -L --library add path to library search\n --hash-seed F00F specify hex value to use as hash seed\n -X --dynext add path to dynamic extension search\n <Run core options>\n -R --runcore fast|slow|bounds\n -R --runcore trace|profiling|subprof\n -t --trace [flags]\n <VM options>\n -D --parrot-debug[=HEXFLAGS]\n --help-debug\n -w --warnings\n -G --no-gc\n -g --gc ms2|gms|ms|inf set GC type\n <GC MS2 options>\n --gc-dynamic-threshold=percentage maximum memory wasted by GC\n --gc-min-threshold=KB\n <GC GMS options>\n --gc-nursery-size=percent of sysmem size of gen0 (default 2)\n --gc-debug\n --leak-test|--destroy-at-end\n -. --wait Read a keystroke before starting\n --runtime-prefix\n <Compiler options>\n -E --pre-process-only\n -o --output=FILE\n --output-pbc\n -a --pasm\n -c --pbc\n -r --run-pbc\n -y --yydebug\n -d --imcc-debug[=HEXFLAGS] (see --help-debug)\n <Language options>\nsee docs/running.pod for more\n"
say $S1
exit 0
@@ -192,7 +192,7 @@ parrot [Options] <file> [<program options...>]
--hash-seed F00F specify hex value to use as hash seed
-X --dynext add path to dynamic extension search
<Run core options>
- -R --runcore slow|bounds|fast
+ -R --runcore fast|slow|bounds
-R --runcore trace|profiling|subprof
-t --trace [flags]
<VM options>
@@ -218,6 +218,7 @@ parrot [Options] <file> [<program options...>]
-c --pbc
-r --run-pbc
-y --yydebug
+ -d --imcc-debug[=HEXFLAGS] (see --help-debug)
<Language options>
see docs/running.pod for more
:>>
View
@@ -49,7 +49,7 @@ PARROT_WARN_UNUSED_RESULT
Parrot_Int imcc_set_debug_api(
Parrot_PMC interp_pmc,
Parrot_PMC compiler,
- Parrot_Int traceflags,
+ Parrot_Int imcc_debug,
Parrot_Int yydebug);
#define ASSERT_ARGS_imcc_compile_file_api __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -32,13 +32,20 @@ typedef enum {
PARROT_NO_DEBUG = 0x00,
PARROT_MEM_STAT_DEBUG_FLAG = 0x01, /* memory usage summary */
PARROT_BACKTRACE_DEBUG_FLAG = 0x02, /* print bt in exception */
- PARROT_JIT_DEBUG_FLAG = 0x04, /* create jit stabs file */
+ PARROT_JIT_DEBUG_FLAG = 0x04, /* create jit stabs file (unused) */
PARROT_START_DEBUG_FLAG = 0x08,
PARROT_THREAD_DEBUG_FLAG = 0x10,
PARROT_EVAL_DEBUG_FLAG = 0x20, /* create EVAL_n file */
PARROT_REG_DEBUG_FLAG = 0x40, /* fill I,N with garbage */
PARROT_CTX_DESTROY_DEBUG_FLAG = 0x80, /* ctx of a sub is gone */
- PARROT_YYDEBUG_FLAG = 0x100, /* debug imcc parsing */
+ PARROT_IMCC_YYDEBUG = 0x100, /* imcc parsing */
+ PARROT_IMCC_LEXER = 0x200,
+ PARROT_IMCC_PARSER = 0x400,
+ PARROT_IMCC_IMC = 0x800,
+ PARROT_IMCC_CFG = 0x1000,
+ PARROT_IMCC_OPT1 = 0x2000,
+ PARROT_IMCC_OPT2 = 0x4000,
+ PARROT_IMCC_AST = 0x8000,
PARROT_ALL_DEBUG_FLAGS = 0xffff
} Parrot_debug_flags;
/* &end_gen */
@@ -49,11 +56,6 @@ typedef enum {
PARROT_TRACE_OPS_FLAG = 0x01, /* op execution trace */
PARROT_TRACE_FIND_METH_FLAG = 0x02, /* find_method */
PARROT_TRACE_SUB_CALL_FLAG = 0x04, /* invoke/retcc */
- PARROT_TRACE_OPT_0 = 0x08, /* TODO imcc -O0 or -O */
- PARROT_TRACE_OPT_PRE = 0x10, /* TODO imcc -O1 */
- PARROT_TRACE_OPT_CFG = 0x20, /* TODO imcc -O2 */
- PARROT_TRACE_OPT_PASM = 0x40, /* TODO imcc OPT_PASM */
- PARROT_TRACE_OPT_SUB = 0x80, /* TODO imcc OPT_SUB */
PARROT_ALL_TRACE_FLAGS = 0xffff
} Parrot_trace_flags;
/* &end_gen */
Oops, something went wrong.

0 comments on commit 93a3905

Please sign in to comment.