Author: julianalbo
Date: Tue Aug 19 04:32:08 2008
New Revision: 30326

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

Log:
parrot_debugger now loads the source automatically when launched with pir or 
pasm argument

Modified: trunk/src/debug.c
==============================================================================
--- trunk/src/debug.c   (original)
+++ trunk/src/debug.c   Tue Aug 19 04:32:08 2008
@@ -499,6 +499,8 @@
 {
     char *file;
 
+    TRACEDEB_MSG("Parrot_debugger_load");
+
     if (!interp->pdb)
         Parrot_ex_throw_from_c_args(interp, NULL, 0, "No debugger");
 
@@ -1858,6 +1860,8 @@
     /* Write the opcode name */
     const char * p = full_name ? info->full_name : info->name;
 
+    TRACEDEB_MSG("PDB_disassemble_op");
+
     if (! p)
         p= "**UNKNOWN**";
     strcpy(dest, p);
@@ -2156,6 +2160,8 @@
     size_t space;  /* How much space do we have? */
     size_t size, alloced, n;
 
+    TRACEDEB_MSG("PDB_disassemble");
+
     pfile = mem_allocate_typed(PDB_file_t);
     pline = mem_allocate_typed(PDB_line_t);
 
@@ -2351,9 +2357,12 @@
     PDB_file_t    *pfile;
     PDB_line_t    *pline;
     PDB_t         * const pdb = interp->pdb;
-    opcode_t      *pc         = pdb->cur_opcode;
+    opcode_t      *pc         = interp->code->base.data;
+
     unsigned long  size = 0;
 
+    TRACEDEB_MSG("PDB_load_source");
+
     /* If there was a file already loaded or the bytecode was
        disassembled, free it */
     if (pdb->file)
@@ -2383,6 +2392,9 @@
     pfile->line   = pline;
     pline->number = 1;
 
+    PARROT_ASSERT(interp->op_info_table);
+    PARROT_ASSERT(pc);
+
     while ((c = fgetc(file)) != EOF) {
         /* Grow it */
         if (++size == 1024) {
@@ -2417,6 +2429,8 @@
 
     pdb->state |= PDB_SRC_LOADED;
     pdb->file   = pfile;
+
+    TRACEDEB_MSG("PDB_load_source finished");
 }
 
 /*

Modified: trunk/src/parrot_debugger.c
==============================================================================
--- trunk/src/parrot_debugger.c (original)
+++ trunk/src/parrot_debugger.c Tue Aug 19 04:32:08 2008
@@ -209,6 +209,9 @@
 
         fclose(imc_yyin_get(yyscanner));
         PackFile_fixup_subs(interp, PBC_POSTCOMP, NULL);
+
+        /* load the source for debugger list */
+        PDB_load_source(interp, filename);
     }
 
     Parrot_unblock_GC_mark(interp);

Reply via email to