[svn:parrot] r40395 - in trunk: src t/tools
dukeleto at svn.parrot.org
dukeleto at svn.parrot.org
Tue Aug 4 08:33:57 UTC 2009
Author: dukeleto
Date: Tue Aug 4 08:33:55 2009
New Revision: 40395
URL: https://trac.parrot.org/parrot/changeset/40395
Log:
[parrot_debugger] Improve error checking of eval, add tests and untodo-ify tests relating to TT#889
Modified:
trunk/src/debug.c
trunk/src/parrot_debugger.c
trunk/t/tools/parrot_debugger.t
Modified: trunk/src/debug.c
==============================================================================
--- trunk/src/debug.c Mon Aug 3 22:50:35 2009 (r40394)
+++ trunk/src/debug.c Tue Aug 4 08:33:55 2009 (r40395)
@@ -2056,6 +2056,7 @@
ASSERT_ARGS(PDB_delete_breakpoint)
PDB_breakpoint_t * const breakpoint = PDB_find_breakpoint(interp, command);
const PDB_line_t *line;
+ long bp_id;
if (breakpoint) {
if (!interp->pdb->file)
@@ -2086,9 +2087,11 @@
else {
interp->pdb->breakpoint = NULL;
}
-
+ bp_id = breakpoint->id;
/* Kill the breakpoint */
mem_sys_free(breakpoint);
+
+ Parrot_io_eprintf(interp->pdb->debugger, "Breakpoint %li deleted\n", bp_id);
}
}
@@ -3239,12 +3242,22 @@
void
PDB_eval(PARROT_INTERP, ARGIN(const char *command))
{
+ opcode_t *run;
ASSERT_ARGS(PDB_eval)
+ TRACEDEB_MSG("PDB_eval");
/* This code is almost certainly wrong. The Parrot debugger needs love. */
- opcode_t *run = PDB_compile(interp, command);
- if (run)
+ if(!strlen(command)) {
+ fprintf(stderr, "Must give a command to eval\n");
+ return;
+ }
+ TRACEDEB_MSG("PDB_eval compiling code");
+ run = PDB_compile(interp, command);
+
+ if (run) {
+ TRACEDEB_MSG("PDB_eval running compiled code");
DO_OP(run, interp);
+ }
}
/*
@@ -3274,13 +3287,16 @@
interp->iglobals, IGLOBALS_COMPREG_HASH);
PMC *compiler = VTABLE_get_pmc_keyed_str(interp, compreg_hash, key);
+ TRACEDEB_MSG("PDB_compile");
if (!VTABLE_defined(interp, compiler)) {
fprintf(stderr, "Couldn't find PASM compiler");
return NULL;
}
+ TRACEDEB_MSG("PDB_compile creating code string");
buf = Parrot_sprintf_c(interp, "%s%s", command, end);
+ TRACEDEB_MSG("PDB_compile invoking code");
return VTABLE_invoke(interp, compiler, buf);
}
Modified: trunk/src/parrot_debugger.c
==============================================================================
--- trunk/src/parrot_debugger.c Mon Aug 3 22:50:35 2009 (r40394)
+++ trunk/src/parrot_debugger.c Tue Aug 4 08:33:55 2009 (r40395)
@@ -111,6 +111,11 @@
Print interpreter information relating to memory allocation and garbage
collection.
+=item C<gcdebug>
+
+Toggle garbage collection debugging mode. In gcdebug mode a garbage collection
+cycle is run before each opcocde, which is the same as using the gcdebug core.
+
=item C<quit> or C<q>
Exit the debugger.
Modified: trunk/t/tools/parrot_debugger.t
==============================================================================
--- trunk/t/tools/parrot_debugger.t Mon Aug 3 22:50:35 2009 (r40394)
+++ trunk/t/tools/parrot_debugger.t Tue Aug 4 08:33:55 2009 (r40395)
@@ -1,5 +1,5 @@
#! perl
-# Copyright (C) 2007-2008, Parrot Foundation.
+# Copyright (C) 2007-2009, Parrot Foundation.
# $Id$
=head1 NAME
@@ -192,8 +192,6 @@
.end
PIR
-TODO: {
- local $TODO = 'TT#889 - deleting breakpoints does not currently work';
pdb_output_like( <<PASM, "pasm", "b\n d 1", qr/Breakpoint 1 deleted/, 'Delete a breakpoint');
set I0, 242
PASM
@@ -204,9 +202,33 @@
.end
PIR
-}
+pdb_output_like( <<PIR, "pir", "l", qr/\.sub main :main/, 'list source');
+.sub main :main
+ \$I0 = 242
+.end
+PIR
+
+pdb_output_like( <<PIR, "pir", "l 2", qr/N4 = 6.28/, 'list source with start line');
+.sub main :main
+ \$N3 = 3.14
+ \$N4 = 6.28
+ print "\\n"
+.end
+PIR
+
+pdb_output_like( <<PIR, "pir", "d 42", qr/No breakpoint number 42/, 'delete invalid breakpoint');
+.sub main :main
+ \$I0 = 242
+.end
+PIR
+
+pdb_output_like( <<PIR, "pir", "e ", qr/Must give a command to eval/, 'eval nothing');
+.sub main :main
+ \$I0 = 242
+.end
+PIR
-BEGIN { $tests += 31 }
+BEGIN { $tests += 35 }
BEGIN { plan tests => $tests; }
More information about the parrot-commits
mailing list