Author: Whiteknight
Date: Thu Aug 21 14:36:13 2008
New Revision: 30429
Modified:
branches/pdd09gc/compilers/imcc/cfg.c
branches/pdd09gc/compilers/imcc/optimizer.c
branches/pdd09gc/compilers/imcc/reg_alloc.c
branches/pdd09gc/compilers/imcc/unit.h
branches/pdd09gc/config/auto/warnings.pm
branches/pdd09gc/config/gen/makefiles/root.in
branches/pdd09gc/include/parrot/debugger.h
branches/pdd09gc/languages/pipp/src/pmc/phpboolean.pmc
branches/pdd09gc/languages/pipp/src/pmc/phpfloat.pmc
branches/pdd09gc/languages/pipp/src/pmc/phpinteger.pmc
branches/pdd09gc/languages/pipp/src/pmc/phpstring.pmc
branches/pdd09gc/languages/pipp/src/pmc/phpundef.pmc
branches/pdd09gc/src/byteorder.c
branches/pdd09gc/src/charset.c
branches/pdd09gc/src/debug.c
branches/pdd09gc/src/dynext.c
branches/pdd09gc/src/encoding.c
branches/pdd09gc/src/ops/core.ops
branches/pdd09gc/src/pmc/exception.pmc
branches/pdd09gc/src/runops_cores.c
branches/pdd09gc/t/op/exceptions.t
branches/pdd09gc/tools/dev/pbc_to_exe_gen.pl
Log:
[pdd09gc] update to trunk from r30356
Modified: branches/pdd09gc/compilers/imcc/cfg.c
==============================================================================
--- branches/pdd09gc/compilers/imcc/cfg.c (original)
+++ branches/pdd09gc/compilers/imcc/cfg.c Thu Aug 21 14:36:13 2008
@@ -354,7 +354,8 @@
build_cfg(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
{
Basic_block *last = NULL;
- int i, changes;
+ unsigned int i;
+ int changes;
IMCC_info(interp, 2, "build_cfg\n");
@@ -394,7 +395,7 @@
* s. #25948
*/
if (!bb->pred_list) {
- int j;
+ unsigned int j;
for (j = i; j < unit->n_basic_blocks; j++) {
Basic_block * const b_bsr = unit->bb_list[j];
@@ -456,7 +457,7 @@
/* Decouple unreachable blocks (not the first block, with no predecessors)
* from the CFG */
do {
- int i;
+ unsigned int i;
changes = 0;
for (i = 1; i < unit->n_basic_blocks; i++) {
@@ -732,7 +733,7 @@
static void
analyse_life_symbol(ARGIN(const IMC_Unit *unit), ARGMOD(SymReg* r))
{
- int i;
+ unsigned int i;
#if IMC_TRACE_HIGH
fprintf(stderr, "cfg.c: analyse_life_symbol(%s)\n", r->name);
@@ -798,7 +799,7 @@
fprintf(stderr, "free_life_into(%s)\n", r->name);
#endif
if (r->life_info) {
- int i;
+ unsigned int i;
for (i = 0; i < unit->n_basic_blocks; i++) {
mem_sys_free(r->life_info[i]);
@@ -1167,7 +1168,7 @@
free_dominators(ARGMOD(IMC_Unit *unit))
{
if (unit->dominators) {
- int i;
+ unsigned int i;
for (i = 0; i < unit->n_basic_blocks; i++) {
set_free(unit->dominators[i]);
@@ -1194,7 +1195,7 @@
free_dominance_frontiers(ARGMOD(IMC_Unit *unit))
{
if (unit->dominance_frontiers) {
- int i;
+ unsigned int i;
for (i = 0; i < unit->n_basic_blocks; i++) {
set_free(unit->dominance_frontiers[i]);
@@ -1223,7 +1224,8 @@
Loop_info *li;
Loop_info **loop_info = unit->loop_info;
int n_loops = (int)unit->n_loops;
- int i, j, changed;
+ int i, k, changed;
+ unsigned int j;
for (i = 0; i < n_loops; i++) {
loop_info[i]->size = 0;
@@ -1263,22 +1265,22 @@
last = j;
}
- for (j = i + 1; j < n_loops; j++) {
+ for (k = i + 1; k < n_loops; k++) {
if (set_contains(loop_info[i]->loop, first)
&& !set_contains(loop_info[i]->loop, last)) {
IMCC_debug(interp, DEBUG_CFG, "sort_loops",
"loop %d contains first but not"
- "last of outer loop %d\n", j, i);
+ "last of outer loop %d\n", k, i);
}
if (set_contains(loop_info[i]->loop, last)
&& !set_contains(loop_info[i]->loop, first)) {
IMCC_debug(interp, DEBUG_CFG, "sort_loops",
"loop %d contains last but not"
- "first of outer loop %d\n", j, i);
+ "first of outer loop %d\n", k, i);
}
- loop_info[j]->depth = loop_info[i]->depth + 1;
+ loop_info[k]->depth = loop_info[i]->depth + 1;
}
}
}
@@ -1298,7 +1300,7 @@
void
find_loops(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
{
- int i;
+ unsigned int i;
IMCC_info(interp, 2, "find_loops\n");
@@ -1381,7 +1383,8 @@
Basic_block *footer = e->from;
Basic_block *enter = 0;
- int i, n_loops;
+ unsigned int i;
+ int n_loops;
/* look from where loop was entered */
for (i = 0, edge=header->pred_list; edge; edge=edge->pred_next)
@@ -1540,7 +1543,7 @@
clear_basic_blocks(ARGMOD(IMC_Unit *unit))
{
if (unit->bb_list) {
- int i;
+ unsigned int i;
for (i = 0; i < unit->n_basic_blocks; i++)
mem_sys_free(unit->bb_list[i]);
Modified: branches/pdd09gc/compilers/imcc/optimizer.c
==============================================================================
--- branches/pdd09gc/compilers/imcc/optimizer.c (original)
+++ branches/pdd09gc/compilers/imcc/optimizer.c Thu Aug 21 14:36:13 2008
@@ -1154,7 +1154,7 @@
static int
branch_reorg(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
{
- int i;
+ unsigned int i;
int changed = 0;
IMCC_info(interp, 2, "\tbranch_reorg\n");
@@ -1394,7 +1394,8 @@
static int
unused_label(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
{
- int i, used;
+ unsigned int i;
+ int used;
int changed = 0;
IMCC_info(interp, 2, "\tunused_label\n");
@@ -1465,7 +1466,7 @@
static int
dead_code_remove(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
{
- int i;
+ unsigned int i;
int changed = 0;
Instruction *ins, *last;
Modified: branches/pdd09gc/compilers/imcc/reg_alloc.c
==============================================================================
--- branches/pdd09gc/compilers/imcc/reg_alloc.c (original)
+++ branches/pdd09gc/compilers/imcc/reg_alloc.c Thu Aug 21 14:36:13 2008
@@ -835,7 +835,7 @@
interferes(PARROT_INTERP, ARGIN(const IMC_Unit *unit),
ARGIN(const SymReg *r0), ARGIN(const SymReg *r1))
{
- int i;
+ unsigned int i;
/* Registers don't interfere with themselves */
if (r0 == r1)
Modified: branches/pdd09gc/compilers/imcc/unit.h
==============================================================================
--- branches/pdd09gc/compilers/imcc/unit.h (original)
+++ branches/pdd09gc/compilers/imcc/unit.h Thu Aug 21 14:36:13 2008
@@ -38,7 +38,7 @@
Instruction *last_ins;
SymHash hash;
int bb_list_size;
- int n_basic_blocks;
+ unsigned int n_basic_blocks;
Basic_block **bb_list;
Set **dominators;
int *idoms;
Modified: branches/pdd09gc/config/auto/warnings.pm
==============================================================================
--- branches/pdd09gc/config/auto/warnings.pm (original)
+++ branches/pdd09gc/config/auto/warnings.pm Thu Aug 21 14:36:13 2008
@@ -34,7 +34,6 @@
$data{description} = q{Detect supported compiler warnings};
$data{result} = q{};
- # potential addition? -fvisibility=hidden
# Please keep these sorted by flag name, such that "-Wno-foo" is
# sorted as "-Wfoo", so we can turn off/on as needed.
my @potential_warnings = qw(
Modified: branches/pdd09gc/config/gen/makefiles/root.in
==============================================================================
--- branches/pdd09gc/config/gen/makefiles/root.in (original)
+++ branches/pdd09gc/config/gen/makefiles/root.in Thu Aug 21 14:36:13 2008
@@ -779,7 +779,7 @@
$(LINK) @[EMAIL PROTECTED]@ \
$(SRC_DIR)/main$(O) $(SRC_DIR)/parrot_config$(O) \
@rpath_blib@ $(ALL_PARROT_LIBS) $(LINKFLAGS) $(LINK_DYNAMIC)
-#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -manifest
[EMAIL PROTECTED] -outputresource:$@;1
+#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -nologo
-manifest [EMAIL PROTECTED] -outputresource:$@;1
pbc_to_exe.pir : $(PARROT) tools/dev/pbc_to_exe_gen.pl
$(PERL) tools/dev/pbc_to_exe_gen.pl \
@@ -808,7 +808,7 @@
lib/Parrot/OpLib/core.pm $(SRC_DIR)/null_config$(O)
$(LINK) @[EMAIL PROTECTED]@ $(SRC_DIR)/main$(O)
$(SRC_DIR)/null_config$(O) \
@rpath_blib@ $(ALL_PARROT_LIBS) $(LINKFLAGS)
-#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -manifest
[EMAIL PROTECTED] -outputresource:$@;1
+#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -nologo
-manifest [EMAIL PROTECTED] -outputresource:$@;1
$(INSTALLABLEPARROT) : $(SRC_DIR)/main$(O) $(GEN_HEADERS) $(LIBPARROT) \
lib/Parrot/OpLib/core.pm $(SRC_DIR)/install_config$(O) \
@@ -816,7 +816,7 @@
$(LINK) @[EMAIL PROTECTED]@ \
$(SRC_DIR)/main$(O) \
$(ALL_PARROT_LIBS) $(LINKFLAGS) $(SRC_DIR)/install_config$(O)
-#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -manifest
[EMAIL PROTECTED] -outputresource:$@;1
+#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -nologo
-manifest [EMAIL PROTECTED] -outputresource:$@;1
$(INC_DIR)/parrot.h : $(INC_DIR)/pbcversion.h $(INC_DIR)/vtable.h
@@ -880,7 +880,7 @@
$(LIBPARROT_STATIC) : $(O_FILES)
$(MKPATH) @blib_dir@
$(AR_CR) @[EMAIL PROTECTED]@ @ar_extra@ $(O_FILES)
-#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -manifest
[EMAIL PROTECTED] -outputresource:$@;2
+#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -nologo
-manifest [EMAIL PROTECTED] -outputresource:$@;2
$(RANLIB) $@
$(LIBPARROT_SHARED) : $(O_FILES)
@@ -888,7 +888,7 @@
$(LD) $(LD_SHARE_FLAGS) $(LDFLAGS) @[EMAIL PROTECTED]@
@libparrot_soname@ \
#CONDITIONED_LINE(cygchkdll):
-Wl,--out-implib=blib/lib/libparrot.dll.a \
$(O_FILES) $(C_LIBS) $(ICU_SHARED)
-#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -manifest
[EMAIL PROTECTED] -outputresource:$@;2
+#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -nologo
-manifest [EMAIL PROTECTED] -outputresource:$@;2
#CONDITIONED_LINE(libparrot_shared_alias): ( cd @blib_dir@ ; ln -sf
@libparrot_shared@ @libparrot_shared_alias@ )
@@ -903,14 +903,14 @@
$(SRC_DIR)/parrot_debugger$(O) \
$(SRC_DIR)/parrot_config$(O) \
@rpath_blib@ $(ALL_PARROT_LIBS) $(LINKFLAGS)
-#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -manifest
[EMAIL PROTECTED] -outputresource:$@;1
+#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -nologo
-manifest [EMAIL PROTECTED] -outputresource:$@;1
$(INSTALLABLEPDB) : $(SRC_DIR)/parrot_debugger$(O) $(LIBPARROT)
$(LINK) @[EMAIL PROTECTED]@ \
$(SRC_DIR)/parrot_debugger$(O) \
$(SRC_DIR)/parrot_config$(O) \
$(ALL_PARROT_LIBS) $(LINKFLAGS)
-#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -manifest
[EMAIL PROTECTED] -outputresource:$@;1
+#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -nologo
-manifest [EMAIL PROTECTED] -outputresource:$@;1
#
# Parrot Disassembler
@@ -922,13 +922,13 @@
$(LINK) @[EMAIL PROTECTED]@ \
$(SRC_DIR)/pbc_disassemble$(O) \
@rpath_blib@ $(ALL_PARROT_LIBS) $(LINKFLAGS)
-#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -manifest
[EMAIL PROTECTED] -outputresource:$@;1
+#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -nologo
-manifest [EMAIL PROTECTED] -outputresource:$@;1
$(INSTALLABLEDIS) : $(SRC_DIR)/pbc_disassemble$(O) $(LIBPARROT)
$(LINK) @[EMAIL PROTECTED]@ \
$(SRC_DIR)/pbc_disassemble$(O) \
$(ALL_PARROT_LIBS) $(LINKFLAGS)
-#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -manifest
[EMAIL PROTECTED] -outputresource:$@;1
+#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -nologo
-manifest [EMAIL PROTECTED] -outputresource:$@;1
#
# Parrot Dump
@@ -938,7 +938,7 @@
$(LINK) @[EMAIL PROTECTED]@ \
$(SRC_DIR)/pdump$(O) \
$(SRC_DIR)/packdump$(O) @rpath_blib@ $(ALL_PARROT_LIBS) $(LINKFLAGS)
-#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -manifest
[EMAIL PROTECTED] -outputresource:$@;1
+#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -nologo
-manifest [EMAIL PROTECTED] -outputresource:$@;1
$(SRC_DIR)/pdump$(O) : $(GEN_HEADERS)
@@ -946,7 +946,7 @@
$(LINK) @[EMAIL PROTECTED]@ \
$(SRC_DIR)/pdump$(O) \
$(SRC_DIR)/packdump$(O) $(ALL_PARROT_LIBS) $(LINKFLAGS)
-#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -manifest
[EMAIL PROTECTED] -outputresource:$@;1
+#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -nologo
-manifest [EMAIL PROTECTED] -outputresource:$@;1
# pbc_info
@@ -954,7 +954,7 @@
$(LINK) @[EMAIL PROTECTED]@ \
$(SRC_DIR)/pbc_info$(O) \
@rpath_blib@ $(ALL_PARROT_LIBS) $(LINKFLAGS)
-#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -manifest
[EMAIL PROTECTED] -outputresource:$@;1
+#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -nologo
-manifest [EMAIL PROTECTED] -outputresource:$@;1
$(SRC_DIR)/pbc_info$(O) : $(GEN_HEADERS)
@@ -962,7 +962,7 @@
$(LINK) @[EMAIL PROTECTED]@ \
$(SRC_DIR)/pbc_info$(O) \
$(ALL_PARROT_LIBS) $(LINKFLAGS)
-#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -manifest
[EMAIL PROTECTED] -outputresource:$@;1
+#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -nologo
-manifest [EMAIL PROTECTED] -outputresource:$@;1
#
# Parrot Bytecode File Merger
@@ -973,14 +973,14 @@
$(SRC_DIR)/pbc_merge$(O) \
$(SRC_DIR)/parrot_config$(O) \
@rpath_blib@ $(ALL_PARROT_LIBS) $(LINK_DYNAMIC) $(LINKFLAGS)
-#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -manifest
[EMAIL PROTECTED] -outputresource:$@;1
+#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -nologo
-manifest [EMAIL PROTECTED] -outputresource:$@;1
$(INSTALLABLEPBCMERGE) : $(SRC_DIR)/pbc_merge$(O) $(LIBPARROT)
$(LINK) @[EMAIL PROTECTED]@ \
$(SRC_DIR)/pbc_merge$(O) \
$(SRC_DIR)/install_config$(O) \
$(ALL_PARROT_LIBS) $(LINKFLAGS)
-#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -manifest
[EMAIL PROTECTED] -outputresource:$@;1
+#CONDITIONED_LINE(win32): if exist [EMAIL PROTECTED] mt.exe -nologo
-manifest [EMAIL PROTECTED] -outputresource:$@;1
###############################################################################
Modified: branches/pdd09gc/include/parrot/debugger.h
==============================================================================
--- branches/pdd09gc/include/parrot/debugger.h (original)
+++ branches/pdd09gc/include/parrot/debugger.h Thu Aug 21 14:36:13 2008
@@ -26,7 +26,9 @@
PDB_BREAK = 1 << 4, /* Set only from debug_break */
PDB_EXIT = 1 << 5,
PDB_ENTER = 1 << 6,
- PDB_GCDEBUG = 1 << 7
+ PDB_GCDEBUG = 1 << 7,
+ PDB_TRACING = 1 << 8,
+ PDB_ECHO = 1 << 9
};
enum {
Modified: branches/pdd09gc/languages/pipp/src/pmc/phpboolean.pmc
==============================================================================
--- branches/pdd09gc/languages/pipp/src/pmc/phpboolean.pmc (original)
+++ branches/pdd09gc/languages/pipp/src/pmc/phpboolean.pmc Thu Aug 21
14:36:13 2008
@@ -66,10 +66,21 @@
=over 4
+=item C<STRING* serialize()>
+
+Return a representation of this boolean in the same format as PHP's serialize
function.
+
=cut
*/
+ METHOD STRING* serialize() {
+ STRING *serialized;
+ serialized = string_printf(INTERP, "b:%d;", VTABLE_get_integer(INTERP,
SELF));
+ RETURN(STRING *serialized);
+ }
+
+
/*
=back
Modified: branches/pdd09gc/languages/pipp/src/pmc/phpfloat.pmc
==============================================================================
--- branches/pdd09gc/languages/pipp/src/pmc/phpfloat.pmc (original)
+++ branches/pdd09gc/languages/pipp/src/pmc/phpfloat.pmc Thu Aug 21
14:36:13 2008
@@ -48,10 +48,30 @@
=over 4
+=item C<STRING* serialize()>
+
+Return a representation of this float in the same format as PHP's serialize
function.
+
=cut
*/
+ METHOD STRING* serialize() {
+ STRING *serialized;
+ INTVAL zero_index = -1;
+
+ /* PHP's serialized floats stringify the exact value stored rather than
+ * just the significant digits. */
+ serialized = string_printf(INTERP, "%.*f", 100,
VTABLE_get_number(INTERP, SELF));
+ while (string_ord(INTERP, serialized, zero_index - 1) == '0')
+ zero_index--;
+
+ serialized = string_chopn(INTERP, serialized, 0 - zero_index);
+ serialized = string_printf(INTERP, "f:%Ss;", serialized);
+ RETURN(STRING *serialized);
+ }
+
+
/*
=back
Modified: branches/pdd09gc/languages/pipp/src/pmc/phpinteger.pmc
==============================================================================
--- branches/pdd09gc/languages/pipp/src/pmc/phpinteger.pmc (original)
+++ branches/pdd09gc/languages/pipp/src/pmc/phpinteger.pmc Thu Aug 21
14:36:13 2008
@@ -67,6 +67,22 @@
RETURN(PMC *SELF);
}
+/*
+
+=item C<STRING* serialize()>
+
+Return a representation of this integer in the same format as PHP's serialize
function.
+
+=cut
+
+*/
+ METHOD STRING* serialize() {
+ STRING *serialized;
+ serialized = string_printf(INTERP, "i:%d;", VTABLE_get_integer(INTERP,
SELF));
+ RETURN(STRING *serialized);
+ }
+
+
}
/*
Modified: branches/pdd09gc/languages/pipp/src/pmc/phpstring.pmc
==============================================================================
--- branches/pdd09gc/languages/pipp/src/pmc/phpstring.pmc (original)
+++ branches/pdd09gc/languages/pipp/src/pmc/phpstring.pmc Thu Aug 21
14:36:13 2008
@@ -162,8 +162,26 @@
RETURN(PMC *retval);
}
+/*
+
+=item C<STRING* serialize()>
+
+Return a representation of this string in the same format as PHP's serialize
function.
+
+=cut
+
+*/
+ METHOD STRING* serialize() {
+ STRING *serialized;
+ serialized = string_printf(INTERP, "s:%d:\"%Ss\";",
VTABLE_elements(INTERP, SELF),
+ VTABLE_get_string(INTERP, SELF));
+ RETURN(STRING *serialized);
+ }
+
+
}
+
/*
=back
Modified: branches/pdd09gc/languages/pipp/src/pmc/phpundef.pmc
==============================================================================
--- branches/pdd09gc/languages/pipp/src/pmc/phpundef.pmc (original)
+++ branches/pdd09gc/languages/pipp/src/pmc/phpundef.pmc Thu Aug 21
14:36:13 2008
@@ -50,8 +50,21 @@
=cut
+=item C<STRING* serialize()>
+
+Return a representation of this PMC in the same format as PHP's serialize
function.
+
+=cut
+
*/
+ METHOD STRING* serialize() {
+ STRING *serialized;
+ serialized = CONST_STRING(INTERP, "N;");
+ RETURN(STRING *serialized);
+ }
+
+
/*
=back
Modified: branches/pdd09gc/src/byteorder.c
==============================================================================
--- branches/pdd09gc/src/byteorder.c (original)
+++ branches/pdd09gc/src/byteorder.c Thu Aug 21 14:36:13 2008
@@ -194,7 +194,7 @@
=item C<void fetch_buf_be_4>
-RT#48260: Not yet documented!!!
+Converts a 4-byte big-endian buffer C<b> into a little-endian C<rb>.
=cut
@@ -217,7 +217,7 @@
=item C<void fetch_buf_le_4>
-RT#48260: Not yet documented!!!
+Converts a 4-byte little-endian buffer C<b> into a big-endian buffer C<rb>.
=cut
@@ -240,7 +240,7 @@
=item C<void fetch_buf_be_8>
-RT#48260: Not yet documented!!!
+Converts an 8-byte big-endian buffer C<b> into a little-endian buffer C<rb>
=cut
@@ -267,7 +267,7 @@
=item C<void fetch_buf_le_8>
-RT#48260: Not yet documented!!!
+Converts an 8-byte little-endian buffer C<b> into a big-endian buffer C<rb>.
=cut
@@ -294,7 +294,7 @@
=item C<void fetch_buf_le_12>
-RT#48260: Not yet documented!!!
+Converts a 12-byte little-endian buffer C<b> into a big-endian buffer C<b>.
=cut
@@ -325,7 +325,7 @@
=item C<void fetch_buf_be_12>
-RT#48260: Not yet documented!!!
+Converts a 12-byte big-endian buffer C<b> into a little-endian buffer C<b>.
=cut
@@ -356,7 +356,7 @@
=item C<void fetch_buf_le_16>
-RT#48260: Not yet documented!!!
+Converts a 16-byte little-endian buffer C<b> into a big-endian buffer C<b>.
=cut
@@ -391,7 +391,7 @@
=item C<void fetch_buf_be_16>
-RT#48260: Not yet documented!!!
+Converts a 16-byte big-endian buffer C<b> into a little-endian buffer C<b>.
=cut
Modified: branches/pdd09gc/src/charset.c
==============================================================================
--- branches/pdd09gc/src/charset.c (original)
+++ branches/pdd09gc/src/charset.c Thu Aug 21 14:36:13 2008
@@ -80,7 +80,7 @@
=item C<CHARSET * Parrot_new_charset>
-RT#48260: Not yet documented!!!
+Allocates a new C<CHARSET> structure from the system.
=cut
@@ -99,7 +99,8 @@
=item C<void Parrot_charsets_encodings_deinit>
-RT#48260: Not yet documented!!!
+Deinitializes (unloads) the charset system. Frees all charsets and the array
+that holds the charsets back to the system.
=cut
@@ -127,7 +128,8 @@
=item C<const CHARSET * Parrot_find_charset>
-RT#48260: Not yet documented!!!
+Searches through the list of charsets for the charset given by C<charsetname>.
+Returns the charset if it is found, NULL otherwise.
=cut
@@ -154,7 +156,7 @@
=item C<CHARSET * Parrot_load_charset>
-RT#48260: Not yet documented!!!
+Throws an exception (Can't load charsets dynamically yet. RT#58184).
=cut
@@ -226,7 +228,8 @@
=item C<STRING* Parrot_charset_name>
-RT#48260: Not yet documented!!!
+Returns the name of the charset given by the INTVAL index
+C<number_of_charset>.
=cut
@@ -247,7 +250,7 @@
=item C<const CHARSET * Parrot_get_charset>
-RT#48260: Not yet documented!!!
+Returns the charset given by the INTVAL index C<number_of_charset>.
=cut
@@ -268,7 +271,8 @@
=item C<const char * Parrot_charset_c_name>
-RT#48260: Not yet documented!!!
+Returns a NULL-terminated C string with the name of the charset given by
+INTVAL index C<number_of_charset>.
=cut
@@ -289,7 +293,9 @@
=item C<static INTVAL register_charset>
-RT#48260: Not yet documented!!!
+Adds a new charset C<charset> with name <charsetname> to the list of
+all charsets. Returns 0 and does nothing if a charset with that name
+already exists. Returns 1 otherwise.
=cut
@@ -328,7 +334,12 @@
=item C<static void register_static_converters>
-RT#48260: Not yet documented!!!
+Registers several standard converters between common charsets, including:
+
+ ISO 8859_1 -> ascii
+ ISO 8859_1 -> bin
+ ascii -> bin
+ ascii -> ISO 8859_1
=cut
@@ -356,7 +367,16 @@
=item C<INTVAL Parrot_register_charset>
-RT#48260: Not yet documented!!!
+Register a new charset C<charset> with name C<charsetname>. Charset may only
+be one of the 4 following names:
+
+ binary
+ iso-8859-1
+ unicode
+ ascii
+
+Attempts to register other charsets are ignored. Returns 0 if the registration
+failed, for any reason.
=cut
@@ -398,7 +418,8 @@
=item C<void Parrot_charsets_encodings_init>
-RT#48260: Not yet documented!!!
+Creates the initial charsets and encodings, and registers the initial
+charset converters.
=cut
@@ -436,7 +457,7 @@
=item C<INTVAL Parrot_make_default_charset>
-RT#48260: Not yet documented!!!
+Sets the current default charset to C<charset> with name C<charsetname>.
=cut
@@ -455,7 +476,7 @@
=item C<const CHARSET * Parrot_default_charset>
-RT#48260: Not yet documented!!!
+Returns the default charset.
=cut
@@ -474,7 +495,7 @@
=item C<charset_converter_t Parrot_find_charset_converter>
-RT#48260: Not yet documented!!!
+Finds a converter from charset C<lhs> to charset C<rhs>.
=cut
@@ -509,7 +530,7 @@
=item C<void Parrot_register_charset_converter>
-RT#48260: Not yet documented!!!
+Registers a converter C<func> from charset C<lhs> to C<rhs>.
=cut
Modified: branches/pdd09gc/src/debug.c
==============================================================================
--- branches/pdd09gc/src/debug.c (original)
+++ branches/pdd09gc/src/debug.c Thu Aug 21 14:36:13 2008
@@ -31,10 +31,13 @@
#include "parrot/oplib/ops.h"
#include "debug.str"
-/* Hand switched debugger tracing */
-/*#define TRACE_DEBUGGER 1*/
+/* Hand switched debugger tracing
+ * Set to 1 to enable tracing to stderr
+ * Set to 0 to disable
+ */
+#define TRACE_DEBUGGER 0
-#ifdef TRACE_DEBUGGER
+#if TRACE_DEBUGGER
# define TRACEDEB_MSG(msg) fprintf(stderr, "%s\n", (msg))
#else
# define TRACEDEB_MSG(msg)
@@ -93,7 +96,8 @@
debug_cmd_disable = 772140,
debug_cmd_continue = 1053405,
debug_cmd_disassemble = 1903830,
- debug_cmd_gcdebug = 779790
+ debug_cmd_gcdebug = 779790,
+ debug_cmd_echo = 276675
};
/* HEADERIZER HFILE: include/parrot/debugger.h */
@@ -101,6 +105,10 @@
/* HEADERIZER BEGIN: static */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will
be lost. */
+static void chop_newline(ARGMOD(char * buf))
+ __attribute__nonnull__(1)
+ FUNC_MODIFIES(* buf);
+
static void close_script_file(PARROT_INTERP)
__attribute__nonnull__(1);
@@ -168,6 +176,376 @@
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will
be lost. */
/* HEADERIZER END: static */
+/*
+ * Command functions and help dispatch
+ */
+
+typedef void (* debugger_func_t)(ARGIN(PDB_t * pdb), ARGIN(const char * cmd));
+
+
+static void dbg_break(ARGIN(PDB_t * pdb), ARGIN(const char * cmd)) /*
HEADERIZER SKIP */
+{
+ TRACEDEB_MSG("dbg_break");
+
+ PDB_set_break(pdb->debugee, cmd);
+}
+
+static void dbg_continue(ARGIN(PDB_t * pdb), ARGIN(const char * cmd)) /*
HEADERIZER SKIP */
+{
+ TRACEDEB_MSG("dbg_continue");
+
+ PDB_continue(pdb->debugee, cmd);
+}
+
+static void dbg_delete(ARGIN(PDB_t * pdb), ARGIN(const char * cmd)) /*
HEADERIZER SKIP */
+{
+ TRACEDEB_MSG("dbg_delete");
+
+ PDB_delete_breakpoint(pdb->debugee, cmd);
+}
+
+static void dbg_disable(ARGIN(PDB_t * pdb), ARGIN(const char * cmd)) /*
HEADERIZER SKIP */
+{
+ TRACEDEB_MSG("dbg_disable");
+
+ PDB_disable_breakpoint(pdb->debugee, cmd);
+}
+
+static void dbg_disassemble(ARGIN(PDB_t * pdb), ARGIN(const char * cmd)) /*
HEADERIZER SKIP */
+{
+ TRACEDEB_MSG("dbg_disassemble");
+
+ PDB_disassemble(pdb->debugee, cmd);
+}
+
+static void dbg_echo(ARGIN(PDB_t * pdb), ARGIN(const char * cmd)) /*
HEADERIZER SKIP */
+{
+ TRACEDEB_MSG("dbg_echo");
+
+ if (pdb->state & PDB_ECHO) {
+ TRACEDEB_MSG("Disabling echo");
+ pdb->state &= ~PDB_ECHO;
+ }
+ else {
+ TRACEDEB_MSG("Enabling echo");
+ pdb->state |= PDB_ECHO;
+ }
+}
+
+static void dbg_enable(ARGIN(PDB_t * pdb), ARGIN(const char * cmd)) /*
HEADERIZER SKIP */
+{
+ PDB_enable_breakpoint(pdb->debugee, cmd);
+}
+
+static void dbg_eval(ARGIN(PDB_t * pdb), ARGIN(const char * cmd)) /*
HEADERIZER SKIP */
+{
+ PDB_eval(pdb->debugee, cmd);
+}
+
+static void dbg_gcdebug(ARGIN(PDB_t * pdb), ARGIN(const char * cmd)) /*
HEADERIZER SKIP */
+{
+ TRACEDEB_MSG("dbg_gcdebug");
+
+ if (pdb->state & PDB_GCDEBUG) {
+ TRACEDEB_MSG("Disabling gcdebug mode");
+ pdb->state &= ~PDB_GCDEBUG;
+ }
+ else {
+ TRACEDEB_MSG("Enabling gcdebug mode");
+ pdb->state |= PDB_GCDEBUG;
+ }
+}
+
+static void dbg_help(ARGIN(PDB_t * pdb), ARGIN(const char * cmd)) /*
HEADERIZER SKIP */
+{
+ TRACEDEB_MSG("dbg_help");
+
+ PDB_help(pdb->debugee, cmd);
+}
+
+static void dbg_info(ARGIN(PDB_t * pdb), ARGIN(const char * cmd)) /*
HEADERIZER SKIP */
+{
+ TRACEDEB_MSG("dbg_info");
+
+ PDB_info(pdb->debugee);
+}
+
+static void dbg_list(ARGIN(PDB_t * pdb), ARGIN(const char * cmd)) /*
HEADERIZER SKIP */
+{
+ TRACEDEB_MSG("dbg_list");
+
+ PDB_list(pdb->debugee, cmd);
+}
+
+static void dbg_load(ARGIN(PDB_t * pdb), ARGIN(const char * cmd)) /*
HEADERIZER SKIP */
+{
+ TRACEDEB_MSG("dbg_load");
+
+ PDB_load_source(pdb->debugee, cmd);
+}
+
+static void dbg_next(ARGIN(PDB_t * pdb), ARGIN(const char * cmd)) /*
HEADERIZER SKIP */
+{
+ TRACEDEB_MSG("dbg_next");
+
+ PDB_next(pdb->debugee, cmd);
+}
+
+static void dbg_print(ARGIN(PDB_t * pdb), ARGIN(const char * cmd)) /*
HEADERIZER SKIP */
+{
+ TRACEDEB_MSG("dbg_print");
+
+ PDB_print(pdb->debugee, cmd);
+}
+
+static void dbg_quit(ARGIN(PDB_t * pdb), ARGIN(const char * cmd)) /*
HEADERIZER SKIP */
+{
+ TRACEDEB_MSG("dbg_quit");
+
+ pdb->state |= PDB_EXIT;
+ pdb->state &= ~PDB_STOPPED;
+}
+
+static void dbg_run(ARGIN(PDB_t * pdb), ARGIN(const char * cmd)) /* HEADERIZER
SKIP */
+{
+ TRACEDEB_MSG("dbg_run");
+
+ PDB_init(pdb->debugee, cmd);
+ PDB_continue(pdb->debugee, NULL);
+}
+
+static void dbg_script(ARGIN(PDB_t * pdb), ARGIN(const char * cmd)) /*
HEADERIZER SKIP */
+{
+ TRACEDEB_MSG("dbg_script");
+
+ PDB_script_file(pdb->debugee, cmd);
+}
+
+static void dbg_stack(ARGIN(PDB_t * pdb), ARGIN(const char * cmd)) /*
HEADERIZER SKIP */
+{
+ TRACEDEB_MSG("dbg_stack");
+
+ PDB_backtrace(pdb->debugee);
+}
+
+static void dbg_trace(ARGIN(PDB_t * pdb), ARGIN(const char * cmd)) /*
HEADERIZER SKIP */
+{
+ TRACEDEB_MSG("dbg_trace");
+
+ PDB_trace(pdb->debugee, cmd);
+}
+
+static void dbg_watch(ARGIN(PDB_t * pdb), ARGIN(const char * cmd)) /*
HEADERIZER SKIP */
+{
+ TRACEDEB_MSG("dbg_watch");
+
+ PDB_watchpoint(pdb->debugee, cmd);
+}
+
+typedef struct DebuggerCmd_t {
+ debugger_func_t func;
+ const char * const help;
+} DebuggerCmd;
+
+static const DebuggerCmd
+ cmd_break = {
+ & dbg_break,
+"Set a breakpoint at a given line number (which must be specified).\n\n\
+Optionally, specify a condition, in which case the breakpoint will only\n\
+activate if the condition is met. Conditions take the form:\n\n\
+ if [REGISTER] [COMPARISON] [REGISTER or CONSTANT]\n\n\
+\
+For example:\n\n\
+ break 10 if I4 > I3\n\n\
+ break 45 if S1 == \"foo\"\n\n\
+The command returns a number which is the breakpoint identifier."
+ },
+ cmd_continue = {
+ & dbg_continue,
+"Continue the program execution.\n\n\
+Without arguments, the program runs until a breakpoint is found\n\
+(or until the program terminates for some other reason).\n\n\
+If a number is specified, then skip that many breakpoints.\n\n\
+If the program has terminated, then \"continue\" will do nothing;\n\
+use \"run\" to re-run the program."
+ },
+ cmd_delete = {
+ & dbg_delete,
+"Delete a breakpoint.\n\n\
+The breakpoint to delete must be specified by its breakpoint number.\n\
+Deleted breakpoints are gone completely. If instead you want to\n\
+temporarily disable a breakpoint, use \"disable\"."
+ },
+ cmd_disable = {
+ & dbg_disable,
+"Disable a breakpoint.\n\n\
+The breakpoint to disable must be specified by its breakpoint number.\n\
+Disabled breakpoints are not forgotten, but have no effect until re-enabled\n\
+with the \"enable\" command."
+ },
+ cmd_disassemble = {
+ & dbg_disassemble,
+"Disassemble code"
+ },
+ cmd_echo = {
+ & dbg_echo,
+"Toggle echo mode.\n\n\
+In echo mode the script commands are written to stderr before executing."
+ },
+ cmd_enable = {
+ & dbg_enable,
+"Re-enable a disabled breakpoint."
+ },
+ cmd_eval = {
+ & dbg_eval,
+"No documentation yet"
+ },
+ cmd_gcdebug = {
+ & dbg_gcdebug,
+"Toggle gcdebug mode.\n\n\
+In gcdebug mode a garbage collection cycle is run before each opcocde,\n\
+same as using the gcdebug core."
+ },
+ cmd_help = {
+ & dbg_help,
+"Print a list of available commands."
+ },
+ cmd_info = {
+ & dbg_info,
+"Print information about the current interpreter"
+ },
+ cmd_list = {
+ & dbg_list,
+"List the source code.\n\n\
+Optionally specify the line number to begin the listing from and the number\n\
+of lines to display."
+ },
+ cmd_load = {
+ & dbg_load,
+"Load a source code file."
+ },
+ cmd_next = {
+ & dbg_next,
+"Execute a specified number of instructions.\n\n\
+If a number is specified with the command (e.g. \"next 5\"), then\n\
+execute that number of instructions, unless the program reaches a\n\
+breakpoint, or stops for some other reason.\n\n\
+If no number is specified, it defaults to 1."
+ },
+ cmd_print = {
+ & dbg_print,
+"Print register: e.g. \"p i2\"\n\
+Note that the register type is case-insensitive. If no digits appear\n\
+after the register type, all registers of that type are printed."
+ },
+ cmd_quit = {
+ & dbg_quit,
+"Exit the debugger"
+ },
+ cmd_run = {
+ & dbg_run,
+"Run (or restart) the program being debugged.\n\n\
+Arguments specified after \"run\" are passed as command line arguments to\n\
+the program.\n"
+ },
+ cmd_script = {
+ & dbg_script,
+"Interprets a file s user commands.\n\
+Usage:\n\
+(pdb) script file.script"
+ },
+ cmd_stack = {
+ & dbg_stack,
+"Print a stack trace of the parrot VM"
+ },
+ cmd_trace = {
+ & dbg_trace,
+"Similar to \"next\", but prints additional trace information.\n\
+This is the same as the information you get when running Parrot with\n\
+the -t option.\n"
+ },
+ cmd_watch = {
+ & dbg_watch,
+"Add a watchpoint"
+ };
+
+static const DebuggerCmd * get_command(long cmdhash) /* HEADERIZER SKIP */
+{
+ switch ((enum DebugCmd)cmdhash) {
+ case debug_cmd_break:
+ return & cmd_break;
+ case debug_cmd_continue:
+ case debug_cmd_c:
+ return & cmd_continue;
+ case debug_cmd_delete:
+ case debug_cmd_d:
+ return & cmd_delete;
+ case debug_cmd_disable:
+ return & cmd_disable;
+ case debug_cmd_disassemble:
+ return & cmd_disassemble;
+ case debug_cmd_echo:
+ return & cmd_echo;
+ case debug_cmd_enable:
+ return & cmd_enable;
+ case debug_cmd_eval:
+ case debug_cmd_e:
+ return & cmd_eval;
+ case debug_cmd_gcdebug:
+ return & cmd_gcdebug;
+ case debug_cmd_help:
+ case debug_cmd_h:
+ return & cmd_help;
+ case debug_cmd_info:
+ return & cmd_info;
+ case debug_cmd_list:
+ case debug_cmd_l:
+ return & cmd_list;
+ case debug_cmd_load:
+ return & cmd_load;
+ case debug_cmd_next:
+ case debug_cmd_n:
+ return & cmd_next;
+ case debug_cmd_print:
+ case debug_cmd_p:
+ return & cmd_print;
+ case debug_cmd_quit:
+ case debug_cmd_q:
+ return & cmd_quit;
+ case debug_cmd_r:
+ case debug_cmd_run:
+ return & cmd_run;
+ case debug_cmd_script_file:
+ case debug_cmd_f:
+ return & cmd_script;
+ case debug_cmd_stack:
+ case debug_cmd_s:
+ return & cmd_stack;
+ case debug_cmd_trace:
+ case debug_cmd_t:
+ return & cmd_trace;
+ default:
+ return NULL;
+ }
+}
+
+/*
+
+=item C<static void chop_newline>
+
+If the C string argument end with a newline, delete it.
+
+=cut
+
+*/
+
+static void
+chop_newline(ARGMOD(char * buf))
+{
+ int l = strlen(buf);
+ if (l > 0 && buf [l - 1] == '\n')
+ buf [l - 1] = '\0';
+}
/*
@@ -392,6 +770,19 @@
return command;
}
+/*
+
+=item C<static void debugger_cmdline>
+
+Debugger command line.
+
+Gets and executes commands, looping until the debugger state
+is chnaged, either to exit or to start executing code.
+
+=cut
+
+*/
+
static void
debugger_cmdline(PARROT_INTERP)
{
@@ -400,6 +791,7 @@
/*while (!(interp->pdb->state & PDB_EXIT)) {*/
while (interp->pdb->state & PDB_STOPPED) {
const char * command;
+ interp->pdb->state &= ~PDB_TRACING;
PDB_get_command(interp);
command = interp->pdb->cur_command;
if (command[0] == '\0')
@@ -410,6 +802,16 @@
TRACEDEB_MSG("debugger_cmdline finished");
}
+/*
+
+=item C<static void close_script_file>
+
+Close the script file, returning to command prompt mode.
+
+=cut
+
+*/
+
static void
close_script_file(PARROT_INTERP)
{
@@ -652,20 +1054,23 @@
return;
}
+ chop_newline(buf);
+
/* skip spaces */
- for (ptr = (char *)&buf; *ptr && isspace((unsigned char)*ptr);
ptr++);
+ for (ptr = buf; *ptr && isspace((unsigned char)*ptr); ptr++);
+
+ /* skip blank and commented lines */
+ } while (*ptr == '\0' || *ptr == '#');
- /* avoid null blank and commented lines */
- if (*buf == '\0' || *buf == '#')
- continue;
- } while (0);
+ if (pdb->state & PDB_ECHO)
+ fprintf(stderr, "[%s]\n", buf);
/* RT #46117: handle command error and print out script line
* PDB_run_command should return non-void value?
* stop execution of script if fails
* RT #46115: avoid this verbose output? add -v flag? */
-#ifdef TRACE_DEBUGGER
+#if TRACE_DEBUGGER
fprintf(stderr, "(script) %s\n", buf);
#endif
@@ -678,7 +1083,7 @@
return;
}
#endif
- strcpy(pdb->cur_command, buf);
+ strcpy(pdb->cur_command, buf);
}
else {
@@ -763,6 +1168,7 @@
unsigned long c;
PDB_t * const pdb = interp->pdb;
const char * const original_command = command;
+ const DebuggerCmd *cmd;
TRACEDEB_MSG("PDB_run_command");
@@ -772,110 +1178,33 @@
command = parse_command(original_command, &c);
if (command)
- skip_command(command);
+ command = skip_command(command);
else
return 0;
- switch ((enum DebugCmd)c) {
- case debug_cmd_f:
- case debug_cmd_script_file:
- command = nextarg(command);
- PDB_script_file(interp, command);
- break;
- case debug_cmd_disassemble:
- PDB_disassemble(interp, command);
- break;
- case debug_cmd_load:
- PDB_load_source(interp, command);
- break;
- case debug_cmd_l:
- case debug_cmd_list:
- PDB_list(interp, command);
- break;
- case debug_cmd_b:
- case debug_cmd_break:
- PDB_set_break(interp, command);
- break;
- case debug_cmd_w:
- case debug_cmd_watch:
- PDB_watchpoint(interp, command);
- break;
- case debug_cmd_d:
- case debug_cmd_delete:
- PDB_delete_breakpoint(interp, command);
- break;
- case debug_cmd_disable:
- PDB_disable_breakpoint(interp, command);
- break;
- case debug_cmd_enable:
- PDB_enable_breakpoint(interp, command);
- break;
- case debug_cmd_r:
- case debug_cmd_run:
- PDB_init(interp, command);
- PDB_continue(interp, NULL);
- break;
- case debug_cmd_c:
- case debug_cmd_continue:
- PDB_continue(interp, command);
- break;
- case debug_cmd_p:
- case debug_cmd_print:
- PDB_print(interp, command);
- break;
- case debug_cmd_n:
- case debug_cmd_next:
- PDB_next(interp, command);
- break;
- case debug_cmd_t:
- case debug_cmd_trace:
- PDB_trace(interp, command);
- break;
- case debug_cmd_e:
- case debug_cmd_eval:
- PDB_eval(interp, command);
- break;
- case debug_cmd_info:
- PDB_info(interp);
- break;
- case debug_cmd_gcdebug:
- if (pdb->state & PDB_GCDEBUG) {
- TRACEDEB_MSG("Disabling gcdebug mode");
- pdb->state &= ~PDB_GCDEBUG;
- }
- else {
- TRACEDEB_MSG("Enabling gcdebug mode");
- pdb->state |= PDB_GCDEBUG;
- }
- break;
- case debug_cmd_h:
- case debug_cmd_help:
- PDB_help(interp, command);
- break;
- case debug_cmd_q:
- case debug_cmd_quit:
- pdb->state |= PDB_EXIT;
- pdb->state &= ~PDB_STOPPED;
- break;
- case debug_cmd_s:
- case debug_cmd_stack:
- PDB_backtrace(interp);
- break;
- case (enum DebugCmd)0:
+ cmd= get_command(c);
+ if (cmd) {
+ (* cmd->func)(pdb, command);
+ return 0;
+ }
+ else {
+ if (c == 0) {
+ /*
/*
if (pdb->last_command)
PDB_run_command(interp, pdb->last_command);
*/
- break;
- default:
+ return 0;
+ }
+ else {
PIO_eprintf(interp,
"Undefined command: \"%s\". Try \"help\".",
original_command);
-#ifdef TRACE_DEBUGGER
+#if TRACE_DEBUGGER
fprintf(stderr, " (parse_command result: %li)", c);
#endif
return 1;
+ }
}
- return 0;
}
/*
@@ -895,12 +1224,16 @@
{
unsigned long n = 1;
PDB_t * const pdb = interp->pdb;
+ Interp *debugee;
+
+ TRACEDEB_MSG("PDB_next");
/* Init the program if it's not running */
if (!(pdb->state & PDB_RUNNING))
PDB_init(interp, command);
- command = nextarg(command);
+ /*command = nextarg(command);*/
+
/* Get the number of operations to execute if any */
if (command && isdigit((unsigned char) *command))
n = atol(command);
@@ -908,6 +1241,9 @@
/* Erase the stopped flag */
pdb->state &= ~PDB_STOPPED;
+ /* Testing use of the debugger runloop */
+ #if 0
+
/* Execute */
for (; n && pdb->cur_opcode; n--)
DO_OP(pdb->cur_opcode, pdb->debugee);
@@ -922,6 +1258,20 @@
*/
if (!pdb->cur_opcode)
(void)PDB_program_end(interp);
+ #endif
+
+ debugee = pdb->debugee;
+
+ new_runloop_jump_point(debugee);
+ if (setjmp(debugee->current_runloop->resume)) {
+ Parrot_eprintf(interp, "Unhandled exception while tracing\n");
+ pdb->state |= PDB_STOPPED;
+ return;
+ }
+ pdb->tracing = n;
+ pdb->debugee->run_core = PARROT_DEBUGGER_CORE;
+
+ TRACEDEB_MSG("PDB_next finished");
}
/*
@@ -949,7 +1299,8 @@
PDB_init(interp, command);
*/
- command = nextarg(command);
+ /*command = nextarg(command);*/
+
/* if the number of ops to run is specified, convert to a long */
if (command && isdigit((unsigned char) *command))
n = atol(command);
@@ -967,6 +1318,7 @@
}
pdb->tracing = n;
pdb->debugee->run_core = PARROT_DEBUGGER_CORE;
+ pdb->state |= PDB_TRACING;
/* Clear the following when done some testing */
@@ -2532,7 +2884,8 @@
return;
}
- command = nextarg(command);
+ /*command = nextarg(command);*/
+
/* set the list line if provided */
if (isdigit((unsigned char) *command)) {
line_number = atol(command) - 1;
@@ -2744,116 +3097,19 @@
PDB_help(PARROT_INTERP, ARGIN(const char *command))
{
unsigned long c;
+ const DebuggerCmd *cmd;
/* Extract the command after leading whitespace (for error messages). */
while (*command && isspace((unsigned char)*command))
command++;
parse_command(command, &c);
- switch (c) {
- case debug_cmd_disassemble:
- PIO_eprintf(interp, "No documentation yet");
- break;
- case debug_cmd_load:
- PIO_eprintf(interp, "No documentation yet");
- break;
- case debug_cmd_list:
- PIO_eprintf(interp,
- "List the source code.\n\n\
-Optionally specify the line number to begin the listing from and the number\n\
-of lines to display.\n");
- break;
- case debug_cmd_run:
- PIO_eprintf(interp,
- "Run (or restart) the program being debugged.\n\n\
-Arguments specified after \"run\" are passed as command line arguments to\n\
-the program.\n");
- break;
- case debug_cmd_break:
- PIO_eprintf(interp,
-"Set a breakpoint at a given line number (which must be specified).\n\n\
-Optionally, specify a condition, in which case the breakpoint will only\n\
-activate if the condition is met. Conditions take the form:\n\n\
- if [REGISTER] [COMPARISON] [REGISTER or CONSTANT]\n\n\
-\
-For example:\n\n\
- break 10 if I4 > I3\n\n\
- break 45 if S1 == \"foo\"\n\n\
-The command returns a number which is the breakpoint identifier.");
- break;
- case debug_cmd_script_file:
-PIO_eprintf(interp, "Interprets a file.\n\
-Usage:\n\
-(pdb) script file.script\n");
- break;
- case debug_cmd_watch:
- PIO_eprintf(interp, "No documentation yet");
- break;
- case debug_cmd_delete:
- PIO_eprintf(interp,
-"Delete a breakpoint.\n\n\
-The breakpoint to delete must be specified by its breakpoint number.\n\
-Deleted breakpoints are gone completely. If instead you want to\n\
-temporarily disable a breakpoint, use \"disable\".\n");
- break;
- case debug_cmd_disable:
- PIO_eprintf(interp,
-"Disable a breakpoint.\n\n\
-The breakpoint to disable must be specified by its breakpoint number.\n\
-Disabled breakpoints are not forgotten, but have no effect until re-enabled\n\
-with the \"enable\" command.\n");
- break;
- case debug_cmd_enable:
- PIO_eprintf(interp, "Re-enable a disabled breakpoint.\n");
- break;
- case debug_cmd_continue:
- PIO_eprintf(interp,
-"Continue the program execution.\n\n\
-Without arguments, the program runs until a breakpoint is found\n\
-(or until the program terminates for some other reason).\n\n\
-If a number is specified, then skip that many breakpoints.\n\n\
-If the program has terminated, then \"continue\" will do nothing;\n\
-use \"run\" to re-run the program.\n");
- break;
- case debug_cmd_next:
- PIO_eprintf(interp,
-"Execute a specified number of instructions.\n\n\
-If a number is specified with the command (e.g. \"next 5\"), then\n\
-execute that number of instructions, unless the program reaches a\n\
-breakpoint, or stops for some other reason.\n\n\
-If no number is specified, it defaults to 1.\n");
- break;
- case debug_cmd_eval:
- PIO_eprintf(interp, "No documentation yet");
- break;
- case debug_cmd_trace:
- PIO_eprintf(interp,
-"Similar to \"next\", but prints additional trace information.\n\
-This is the same as the information you get when running Parrot with\n\
-the -t option.\n");
- break;
- case debug_cmd_print:
- PIO_eprintf(interp, "Print register: e.g. \"p i2\"\n\
-Note that the register type is case-insensitive. If no digits appear\n\
-after the register type, all registers of that type are printed.\n");
- break;
- case debug_cmd_info:
- PIO_eprintf(interp,
- "Print information about the current interpreter\n");
- break;
- case debug_cmd_gcdebug:
- PIO_eprintf(interp,
-"Toggle gcdebug mode.\n\n\
-In gcdebug mode a garbage collection cycle is run before each opcocde,\n\
-same as using the gcdebug core.\n");
- break;
- case debug_cmd_quit:
- PIO_eprintf(interp, "Exit the debugger.\n");
- break;
- case debug_cmd_help:
- PIO_eprintf(interp, "Print a list of available commands.\n");
- break;
- case 0:
+ cmd = get_command(c);
+ if (cmd) {
+ PIO_eprintf(interp, "%s\n", cmd->help);
+ }
+ else {
+ if (c == 0) {
/* C89: strings need to be 509 chars or less */
PIO_eprintf(interp, "\
List of commands:\n\
@@ -2863,6 +3119,7 @@
run (r) -- run the program\n\
break (b) -- add a breakpoint\n\
script (f) -- interprets a file as user commands\n\
+ echo -- toggle echo of script commands\n\
watch (w) -- add a watchpoint\n\
delete (d) -- delete a breakpoint\n\
disable -- disable a breakpoint\n\
@@ -2879,10 +3136,10 @@
quit (q) -- exit the debugger\n\
help (h) -- print this help\n\n\
Type \"help\" followed by a command name for full documentation.\n\n");
- break;
- default:
- PIO_eprintf(interp, "Unknown command: \"%s\".", command);
- break;
+ }
+ else {
+ PIO_eprintf(interp, "Unknown command\n");
+ }
}
}
Modified: branches/pdd09gc/src/dynext.c
==============================================================================
--- branches/pdd09gc/src/dynext.c (original)
+++ branches/pdd09gc/src/dynext.c Thu Aug 21 14:36:13 2008
@@ -296,7 +296,9 @@
=item C<PMC * Parrot_init_lib>
-RT#48260: Not yet documented!!!
+Initializes a new library. First, calls C<load_func> to load the library
+(if C<load_func> is provided) and then calls C<init_func>. Returns a
+ParrotLibrary PMC object that represents the initialized library.
=cut
@@ -329,7 +331,9 @@
=item C<static PMC * run_init_lib>
-RT#48260: Not yet documented!!!
+Loads and Initializes a new library and returns a ParrotLibrary PMC.
+Takes the name of a library C<libname>, that is loaded with handle C<handle>.
+Calls the necessary initialization routines, if any.
=cut
@@ -405,7 +409,9 @@
=item C<static STRING * clone_string_into>
-RT#48260: Not yet documented!!!
+Extracts a STRING value from PMC C<value> in interpreter C<s>. Copies that
+string into the pool of interpreter C<d> using the default encoding
+and charset.
=cut
@@ -430,7 +436,7 @@
=item C<static PMC * make_string_pmc>
-RT#48260: Not yet documented!!!
+Converts a STRING C<string> into a String PMC.
=cut
@@ -451,7 +457,8 @@
=item C<PMC * Parrot_clone_lib_into>
-RT#48260: Not yet documented!!!
+Clones a ParrotLibrary PMC C<lib_pmc> from interpreter C<s> into interpreter
+C<d>.
=cut
Modified: branches/pdd09gc/src/encoding.c
==============================================================================
--- branches/pdd09gc/src/encoding.c (original)
+++ branches/pdd09gc/src/encoding.c Thu Aug 21 14:36:13 2008
@@ -56,7 +56,8 @@
=item C<void parrot_init_encodings_2>
-RT#48260: Not yet documented!!!
+Helper function for initializing characterset encodings. Initializes the
+C<all_encodings> array.
=cut
@@ -77,7 +78,7 @@
=item C<void parrot_deinit_encodings>
-RT#48260: Not yet documented!!!
+Deinitialize encodings and free all memory used by them.
=cut
@@ -101,7 +102,7 @@
=item C<ENCODING * Parrot_new_encoding>
-RT#48260: Not yet documented!!!
+Allocates the memory for a new C<ENCODING> from the system.
=cut
@@ -120,7 +121,8 @@
=item C<const ENCODING * Parrot_find_encoding>
-RT#48260: Not yet documented!!!
+Finds an encoding with the name C<encodingname>. Returns the encoding
+if it is successfully found, returns NULL otherwise.
=cut
@@ -145,7 +147,8 @@
=item C<const ENCODING * Parrot_load_encoding>
-RT#48260: Not yet documented!!!
+Loads an encoding. Currently throws an exception because we cannot load
+encodings. See RT#58186.
=cut
@@ -221,7 +224,8 @@
=item C<STRING* Parrot_encoding_name>
-RT#48260: Not yet documented!!!
+Returns the name of a character encoding based on the INTVAL index
+C<number_of_encoding> to the All_encodings array.
=cut
@@ -242,7 +246,7 @@
=item C<const ENCODING* Parrot_get_encoding>
-RT#48260: Not yet documented!!!
+Returns the encoding given by the INTVAL index C<number_of_encoding>.
=cut
@@ -263,7 +267,8 @@
=item C<const char * Parrot_encoding_c_name>
-RT#48260: Not yet documented!!!
+Returns the NULL-terminated C string representation of the encodings name
+given by the C<number_of_encoding>.
=cut
@@ -284,7 +289,8 @@
=item C<static INTVAL register_encoding>
-RT#48260: Not yet documented!!!
+Registers a new character encoding C<encoding> with the given name
+C<encodingname>. Returns 1 if successful, returns 0 otherwise.
=cut
@@ -322,7 +328,8 @@
=item C<INTVAL Parrot_register_encoding>
-RT#48260: Not yet documented!!!
+Registers a character encoding C<encoding> with name C<encodingname>.
+Only allows one of 4 possibilities: fixed_8, utf8, utf16, and ucs2.
=cut
@@ -365,7 +372,7 @@
=item C<INTVAL Parrot_make_default_encoding>
-RT#48260: Not yet documented!!!
+Sets the default encoding to C<encoding> with name C<encodingname>.
=cut
@@ -384,7 +391,7 @@
=item C<const ENCODING * Parrot_default_encoding>
-RT#48260: Not yet documented!!!
+Gets the default encoding.
=cut
@@ -403,7 +410,8 @@
=item C<encoding_converter_t Parrot_find_encoding_converter>
-RT#48260: Not yet documented!!!
+Finds a converter from encoding C<rhs> to C<lhs>. Not yet implemented, so
+throws an exception.
=cut
@@ -413,13 +421,12 @@
encoding_converter_t
Parrot_find_encoding_converter(PARROT_INTERP, ARGIN(ENCODING *lhs),
ARGIN(ENCODING *rhs))
{
- UNUSED(interp);
UNUSED(lhs);
UNUSED(rhs);
- /* XXX Apparently unwritten */
-
- return NULL;
+ /* XXX Apparently unwritten RT#58188 */
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
+ "Can't find encoding converters yet.");
}
Modified: branches/pdd09gc/src/ops/core.ops
==============================================================================
--- branches/pdd09gc/src/ops/core.ops (original)
+++ branches/pdd09gc/src/ops/core.ops Thu Aug 21 14:36:13 2008
@@ -252,7 +252,7 @@
goto OFFSET($2);
}
-=item B<local_return>()
+=item B<local_return>(invar PMC)
Pop the location off the top of the call stack and go there.
@@ -818,7 +818,7 @@
opcode_t * dest;
opcode_t * const ret = expr NEXT();
PMC * resume = new_ret_continuation_pmc(interp, ret);
- VTABLE_set_attr_str(interp, $1, const_string(interp, "retcont"), resume);
+ VTABLE_set_attr_str(interp, $1, const_string(interp, "resume"), resume);
dest = Parrot_ex_throw_from_op(interp, $1, resume);
goto ADDRESS(dest);
}
Modified: branches/pdd09gc/src/pmc/exception.pmc
==============================================================================
--- branches/pdd09gc/src/pmc/exception.pmc (original)
+++ branches/pdd09gc/src/pmc/exception.pmc Thu Aug 21 14:36:13 2008
@@ -57,7 +57,7 @@
ATTR FLOATVAL birthtime; /* The creation time stamp of the exception.
*/
ATTR STRING *message; /* The exception message. */
ATTR PMC *payload; /* The payload for the exception. */
- ATTR PMC *retcont; /* The return continuation for the exception.
*/
+ ATTR PMC *resume; /* A continuation for resuming after handling
the exception. */
ATTR INTVAL severity; /* The severity of the exception. */
ATTR INTVAL type; /* The type of the exception. */
ATTR INTVAL exit_code; /* The exit code of the exception. */
@@ -94,7 +94,7 @@
core_struct->handled = 0;
core_struct->message = CONST_STRING(interp, "");
core_struct->payload = PMCNULL;
- core_struct->retcont = PMCNULL;
+ core_struct->resume = PMCNULL;
core_struct->stacktrace = PMCNULL;
core_struct->handler_iter = PMCNULL;
}
@@ -115,8 +115,8 @@
pobject_lives(interp, (PObj *)core_struct->message);
if (core_struct->payload)
pobject_lives(interp, (PObj *)core_struct->payload);
- if (core_struct->retcont)
- pobject_lives(interp, (PObj *)core_struct->retcont);
+ if (core_struct->resume)
+ pobject_lives(interp, (PObj *)core_struct->resume);
if (core_struct->stacktrace)
pobject_lives(interp, (PObj *)core_struct->stacktrace);
if (core_struct->handler_iter)
@@ -539,8 +539,8 @@
else if (string_equal(INTERP, name, CONST_STRING(INTERP, "payload"))
== 0) {
GET_ATTR_payload(interp, SELF, value);
}
- else if (string_equal(INTERP, name, CONST_STRING(INTERP, "retcont"))
== 0) {
- GET_ATTR_retcont(interp, SELF, value);
+ else if (string_equal(INTERP, name, CONST_STRING(INTERP, "resume")) ==
0) {
+ GET_ATTR_resume(interp, SELF, value);
}
else if (string_equal(INTERP, name, CONST_STRING(INTERP,
"stacktrace")) == 0) {
GET_ATTR_stacktrace(interp, SELF, value);
@@ -591,8 +591,8 @@
else if (string_equal(INTERP, name, CONST_STRING(INTERP, "payload"))
== 0) {
SET_ATTR_payload(interp, SELF, value);
}
- else if (string_equal(INTERP, name, CONST_STRING(INTERP, "retcont"))
== 0) {
- SET_ATTR_retcont(interp, SELF, value);
+ else if (string_equal(INTERP, name, CONST_STRING(INTERP, "resume")) ==
0) {
+ SET_ATTR_resume(interp, SELF, value);
}
else if (string_equal(INTERP, name, CONST_STRING(INTERP,
"stacktrace")) == 0) {
SET_ATTR_stacktrace(interp, SELF, value);
Modified: branches/pdd09gc/src/runops_cores.c
==============================================================================
--- branches/pdd09gc/src/runops_cores.c (original)
+++ branches/pdd09gc/src/runops_cores.c Thu Aug 21 14:36:13 2008
@@ -340,7 +340,7 @@
if (interp->pdb->state & PDB_GCDEBUG)
Parrot_do_dod_run(interp, 0);
- if (interp->pdb->tracing) {
+ if (interp->pdb->state & PDB_TRACING) {
trace_op(interp,
interp->code->base.data,
interp->code->base.data +
Modified: branches/pdd09gc/t/op/exceptions.t
==============================================================================
--- branches/pdd09gc/t/op/exceptions.t (original)
+++ branches/pdd09gc/t/op/exceptions.t Thu Aug 21 14:36:13 2008
@@ -622,7 +622,7 @@
.local pmc c
.get_results (e, s)
say 'In the exception handler'
- c = e['retcont']
+ c = e['resume']
c()
.end
CODE
Modified: branches/pdd09gc/tools/dev/pbc_to_exe_gen.pl
==============================================================================
--- branches/pdd09gc/tools/dev/pbc_to_exe_gen.pl (original)
+++ branches/pdd09gc/tools/dev/pbc_to_exe_gen.pl Thu Aug 21 14:36:13 2008
@@ -452,7 +452,7 @@
embed_manifest:
# MSVC app manifest exists, embed it
.local string embed_manifest
- embed_manifest = 'mt.exe -manifest '
+ embed_manifest = 'mt.exe -nologo -manifest '
embed_manifest .= manifest_file_name
embed_manifest .= ' -outputresource:'
embed_manifest .= exefile