[svn:parrot] r40321 - in trunk: src t/tools

dukeleto at svn.parrot.org dukeleto at svn.parrot.org
Wed Jul 29 01:53:40 UTC 2009


Author: dukeleto
Date: Wed Jul 29 01:53:37 2009
New Revision: 40321
URL: https://trac.parrot.org/parrot/changeset/40321

Log:
Fix TT#884 and add a test for setting a breakpoint in the parrot_debugger

Modified:
   trunk/src/debug.c
   trunk/t/tools/parrot_debugger.t

Modified: trunk/src/debug.c
==============================================================================
--- trunk/src/debug.c	Wed Jul 29 00:02:41 2009	(r40320)
+++ trunk/src/debug.c	Wed Jul 29 01:53:37 2009	(r40321)
@@ -1354,9 +1354,6 @@
             if (pdb->script_file)
                 Parrot_io_eprintf(pdb->debugger, " in line %lu", pdb->script_line);
             Parrot_io_eprintf(pdb->debugger, ".  Try \"help\".");
-#if TRACE_DEBUGGER
-            fprintf(stderr, " (parse_command result: %li)", c);
-#endif
             close_script_file(interp);
             return 1;
         }
@@ -1740,10 +1737,18 @@
 
     TRACEDEB_MSG("PDB_set_break");
 
-
     /* If there is a source file use line number, else opcode position */
 
+
     if (pdb->file) {
+        TRACEDEB_MSG("PDB_set_break file");
+
+        if (!pdb->file->size) {
+            Parrot_io_eprintf(pdb->debugger,
+                "Can't set a breakpoint in empty file\n");
+            return;
+        }
+
         /* If no line number was specified, set it at the current line */
         if (ln != 0) {
             unsigned long i;
@@ -1765,6 +1770,7 @@
             /* Get the line to set it */
             line = pdb->file->line;
 
+            TRACEDEB_MSG("PDB_set_break reading ops");
             while (line->opcode != pdb->cur_opcode) {
                 line = line->next;
                 if (!line) {
@@ -1787,9 +1793,11 @@
         breakpos = line->opcode;
     }
     else {
+        TRACEDEB_MSG("PDB_set_break no file");
         breakpos = interp->code->base.data + ln;
     }
 
+    TRACEDEB_MSG("PDB_set_break allocate breakpoint");
     /* Allocate the new break point */
     newbreak = mem_allocate_zeroed_typed(PDB_breakpoint_t);
 

Modified: trunk/t/tools/parrot_debugger.t
==============================================================================
--- trunk/t/tools/parrot_debugger.t	Wed Jul 29 00:02:41 2009	(r40320)
+++ trunk/t/tools/parrot_debugger.t	Wed Jul 29 01:53:37 2009	(r40321)
@@ -105,8 +105,11 @@
 pdb_output_like( <<PASM, "pasm", "info", qr/Total memory allocated =/, 'info (pasm)');
     set I1, 242
 PASM
+pdb_output_like( <<PASM, "pasm", "b", qr/Breakpoint 1 at pos 0/, 'set breakpoint');
+    set I1, 242
+PASM
 
-BEGIN { $tests += 12 }
+BEGIN { $tests += 13 }
 
 BEGIN { plan tests => $tests; }
 


More information about the parrot-commits mailing list