[svn:parrot] r36446 - in trunk: include/parrot src src/gc src/pmc

NotFound at svn.parrot.org NotFound at svn.parrot.org
Sun Feb 8 16:55:21 UTC 2009


Author: NotFound
Date: Sun Feb  8 16:55:19 2009
New Revision: 36446
URL: https://trac.parrot.org/parrot/changeset/36446

Log:
[debugger] drop 'debugger' member from interpreter, use pdb->debugger instead

Modified:
   trunk/include/parrot/interpreter.h
   trunk/src/debug.c
   trunk/src/exceptions.c
   trunk/src/gc/mark_sweep.c
   trunk/src/oo.c
   trunk/src/packfile.c
   trunk/src/parrot_debugger.c
   trunk/src/pmc/coroutine.pmc
   trunk/src/pmc/sub.pmc
   trunk/src/runops_cores.c
   trunk/src/trace.c
   trunk/src/warnings.c

Modified: trunk/include/parrot/interpreter.h
==============================================================================
--- trunk/include/parrot/interpreter.h	Sun Feb  8 15:26:43 2009	(r36445)
+++ trunk/include/parrot/interpreter.h	Sun Feb  8 16:55:19 2009	(r36446)
@@ -356,8 +356,7 @@
 
     const char *output_file;                  /* where to write output */
 
-    PDB_t  *pdb;                              /* Debug system */
-    Interp *debugger;                         /* trace / debug interpreter */
+    PDB_t  *pdb;                              /* debug /trace system */
 
     struct Stack_Chunk *dynamic_env;          /* current dynamic environment */
 

Modified: trunk/src/debug.c
==============================================================================
--- trunk/src/debug.c	Sun Feb  8 15:26:43 2009	(r36445)
+++ trunk/src/debug.c	Sun Feb  8 16:55:19 2009	(r36446)
@@ -1261,17 +1261,17 @@
         } while (isspace((unsigned char)ch) && ch != '\n');
 */
         {
-        Interp * pi = interp->debugger;
-        STRING * readline = CONST_STRING(pi, "readline_interactive");
-        STRING * prompt = CONST_STRING(pi, "(pdb) ");
-        STRING *s= Parrot_str_new(pi, NULL, 0);
-        PMC *tmp_stdin = Parrot_io_stdhandle(interp->debugger, 0, NULL);
+        Interp * interpdeb = interp->pdb->debugger;
+        STRING * readline = CONST_STRING(interpdeb, "readline_interactive");
+        STRING * prompt = CONST_STRING(interpdeb, "(pdb) ");
+        STRING *s= Parrot_str_new(interpdeb, NULL, 0);
+        PMC *tmp_stdin = Parrot_io_stdhandle(interpdeb, 0, NULL);
 
-        Parrot_PCCINVOKE(interp->debugger,
+        Parrot_PCCINVOKE(interpdeb,
             tmp_stdin, readline,
             "S->S", prompt, & s);
         {
-        char * aux = Parrot_str_to_cstring(interp->debugger, s);
+        char * aux = Parrot_str_to_cstring(interpdeb, s);
         strcpy(c, aux);
         Parrot_str_free_cstring(aux);
         }

Modified: trunk/src/exceptions.c
==============================================================================
--- trunk/src/exceptions.c	Sun Feb  8 15:26:43 2009	(r36445)
+++ trunk/src/exceptions.c	Sun Feb  8 16:55:19 2009	(r36446)
@@ -115,9 +115,12 @@
     Parrot_io_flush(interp, Parrot_io_STDOUT(interp));
     Parrot_io_flush(interp, Parrot_io_STDERR(interp));
 
-    if (interp->debugger) {
-        Parrot_io_flush(interp->debugger, Parrot_io_STDOUT(interp->debugger));
-        Parrot_io_flush(interp->debugger, Parrot_io_STDERR(interp->debugger));
+    if (interp->pdb) {
+        Interp * interpdeb = interp->pdb->debugger;
+	if (interpdeb) {
+            Parrot_io_flush(interpdeb, Parrot_io_STDOUT(interpdeb));
+            Parrot_io_flush(interpdeb, Parrot_io_STDERR(interpdeb));
+        }
     }
 
     if (Parrot_str_not_equal(interp, message, CONST_STRING(interp, "")) == 1) {

Modified: trunk/src/gc/mark_sweep.c
==============================================================================
--- trunk/src/gc/mark_sweep.c	Sun Feb  8 15:26:43 2009	(r36445)
+++ trunk/src/gc/mark_sweep.c	Sun Feb  8 16:55:19 2009	(r36446)
@@ -160,7 +160,7 @@
     if (arena_base->DOD_block_level)
         return;
 
-    if (interp->debugger) {
+    if (interp->pdb && interp->pdb->debugger) {
         /*
          * if the other interpreter did a DOD run, it can set
          * live bits of shared objects, but these aren't reset, because

Modified: trunk/src/oo.c
==============================================================================
--- trunk/src/oo.c	Sun Feb  8 15:26:43 2009	(r36445)
+++ trunk/src/oo.c	Sun Feb  8 16:55:19 2009	(r36446)
@@ -909,7 +909,9 @@
     else
         result = "no";
 
-    tracer = interp->debugger ? interp->debugger : interp;
+    tracer = (interp->pdb && interp->pdb->debugger) ?
+        interp->pdb->debugger :
+        interp;
     Parrot_io_eprintf(tracer, "# find_method class '%Ss' method '%Ss': %s\n",
             class_name, name, result);
 }

Modified: trunk/src/packfile.c
==============================================================================
--- trunk/src/packfile.c	Sun Feb  8 15:26:43 2009	(r36445)
+++ trunk/src/packfile.c	Sun Feb  8 16:55:19 2009	(r36446)
@@ -2882,8 +2882,8 @@
      * which gives misleading trace messages
      */
     if (really && Interp_trace_TEST(interp, PARROT_TRACE_SUB_CALL_FLAG)) {
-        Interp * const tracer = interp->debugger ?
-            interp->debugger : interp;
+        Interp * const tracer = interp->pdb->debugger ?
+            interp->pdb->debugger : interp;
         Parrot_io_eprintf(tracer, "*** switching to %s\n",
                 new_cs->base.name);
     }

Modified: trunk/src/parrot_debugger.c
==============================================================================
--- trunk/src/parrot_debugger.c	Sun Feb  8 15:26:43 2009	(r36445)
+++ trunk/src/parrot_debugger.c	Sun Feb  8 16:55:19 2009	(r36446)
@@ -156,8 +156,6 @@
 
     /*Parrot_set_config_hash();  TODO link with cfg */
 
-    /* attach pdb structure */
-    interp->debugger = pdb->debugger;
     pdb->state       = PDB_ENTER;
 
     Parrot_block_GC_mark(interp);

Modified: trunk/src/pmc/coroutine.pmc
==============================================================================
--- trunk/src/pmc/coroutine.pmc	Sun Feb  8 15:26:43 2009	(r36445)
+++ trunk/src/pmc/coroutine.pmc	Sun Feb  8 16:55:19 2009	(r36446)
@@ -37,7 +37,9 @@
 print_sub_name(PARROT_INTERP, PMC *sub)
 {
     Parrot_coro * const co     = PMC_coro(sub);
-    Interp      * const tracer = interp->debugger ? interp->debugger : interp;
+    Interp      * const tracer = (interp->pdb && interp->pdb->debugger) ?
+        interp->pdb->debugger :
+        interp;
 
     Parrot_io_eprintf(tracer, "# %s coro '%Ss'",
         !(PObj_get_FLAGS(sub) & SUB_FLAG_CORO_FF) ?

Modified: trunk/src/pmc/sub.pmc
==============================================================================
--- trunk/src/pmc/sub.pmc	Sun Feb  8 15:26:43 2009	(r36445)
+++ trunk/src/pmc/sub.pmc	Sun Feb  8 16:55:19 2009	(r36446)
@@ -25,7 +25,9 @@
 static void
 print_sub_name(PARROT_INTERP, PMC *sub)
 {
-    Interp * const tracer = interp->debugger ? interp->debugger : interp;
+    Interp * const tracer = (interp->pdb && interp->pdb->debugger) ?
+        interp->pdb->debugger :
+	interp;
 
     /* sub was located via globals */
     Parrot_io_eprintf(tracer, "# Calling sub '%Ss'\n# ",

Modified: trunk/src/runops_cores.c
==============================================================================
--- trunk/src/runops_cores.c	Sun Feb  8 15:26:43 2009	(r36445)
+++ trunk/src/runops_cores.c	Sun Feb  8 16:55:19 2009	(r36446)
@@ -135,19 +135,26 @@
 
     dod = arena_base->dod_runs;
     gc = arena_base->collect_runs;
-    if (!interp->debugger) {
+    if (interp->pdb) {
+        debugger = interp->pdb->debugger;
+        PARROT_ASSERT(debugger);
+    }
+    else {
         PMC *pio;
 
-        debugger = interp->debugger =
-            /*
-             * using a distinct interpreter for tracing should be ok
-             * - just in case, make it easy to switch
-             */
-#if 1
-            make_interpreter(interp, 0);
+        /*
+         * using a distinct interpreter for tracing should be ok
+         * - just in case, make it easy to switch
+         */
+#if 0
+        debugger = interp:
 #else
-            interp;
+        Parrot_debugger_init(interp);
+        PARROT_ASSERT(interp->pdb);
+        debugger = interp->pdb->debugger;
 #endif
+        PARROT_ASSERT(debugger);
+
         /* set the top of the stack so GC can trace it for GC-able pointers
          * see trace_system_areas() in src/cpu_dep.c */
         debugger->lo_var_ptr = interp->lo_var_ptr;
@@ -162,8 +169,6 @@
             Parrot_io_setbuf(debugger, pio, 8192);
         }
     }
-    else
-        debugger = interp->debugger;
 
     trace_op(interp, code_start, code_end, pc);
     while (pc) {

Modified: trunk/src/trace.c
==============================================================================
--- trunk/src/trace.c	Sun Feb  8 15:26:43 2009	(r36445)
+++ trunk/src/trace.c	Sun Feb  8 16:55:19 2009	(r36446)
@@ -83,7 +83,7 @@
 trace_pmc_dump(PARROT_INTERP, ARGIN_NULLOK(PMC *pmc))
 {
     ASSERT_ARGS(trace_pmc_dump)
-    Interp * const debugger = interp->debugger;
+    Interp * const debugger = interp->pdb->debugger;
 
     if (!pmc) {
         Parrot_io_eprintf(debugger, "(null)");
@@ -170,7 +170,7 @@
 trace_key_dump(PARROT_INTERP, ARGIN(PMC *key))
 {
     ASSERT_ARGS(trace_key_dump)
-    Interp * const debugger = interp->debugger;
+    Interp * const debugger = interp->pdb->debugger;
 
     int len = Parrot_io_eprintf(debugger, "[");
 
@@ -255,7 +255,7 @@
     ASSERT_ARGS(trace_op_dump)
     INTVAL s, n;
     int more = 0, var_args;
-    Interp * const debugger = interp->debugger;
+    Interp * const debugger = interp->pdb->debugger;
     op_info_t * const info = &interp->op_info_table[*pc];
     PMC *sig;
     int type;

Modified: trunk/src/warnings.c
==============================================================================
--- trunk/src/warnings.c	Sun Feb  8 15:26:43 2009	(r36445)
+++ trunk/src/warnings.c	Sun Feb  8 16:55:19 2009	(r36446)
@@ -49,7 +49,9 @@
 print_pbc_location(PARROT_INTERP)
 {
     ASSERT_ARGS(print_pbc_location)
-    Interp * const tracer = interp->debugger ? interp->debugger : interp;
+    Interp * const tracer = (interp->pdb && interp->pdb->debugger) ?
+        interp->pdb->debugger :
+        interp;
     Parrot_io_eprintf(tracer, "%Ss\n",
             Parrot_Context_infostr(interp,
                 CONTEXT(interp)));


More information about the parrot-commits mailing list