[svn:parrot] r46915 - trunk/src/runcore

NotFound at svn.parrot.org NotFound at svn.parrot.org
Sun May 23 15:35:46 UTC 2010


Author: NotFound
Date: Sun May 23 15:35:46 2010
New Revision: 46915
URL: https://trac.parrot.org/parrot/changeset/46915

Log:
sanity check in trace of string reg key items

Modified:
   trunk/src/runcore/trace.c

Modified: trunk/src/runcore/trace.c
==============================================================================
--- trunk/src/runcore/trace.c	Sun May 23 15:31:25 2010	(r46914)
+++ trunk/src/runcore/trace.c	Sun May 23 15:35:46 2010	(r46915)
@@ -231,15 +231,18 @@
             break;
           case KEY_string_FLAG|KEY_register_FLAG:
             {
-            const STRING * const s = REG_STR(interp,
-                 VTABLE_get_integer(interp, key));
-            STRING * const escaped = Parrot_str_escape_truncate(interp, s, 20);
-            if (escaped)
-                len += Parrot_io_eprintf(debugger, "S%vd=\"%Ss\"",
-                    VTABLE_get_integer(interp, key), escaped);
+            const INTVAL keynum = VTABLE_get_integer(interp, key);
+            if (keynum < Parrot_pcc_get_regs_used(interp, CURRENT_CONTEXT(interp), REGNO_STR)) {
+                const STRING * const s = REG_STR(interp, keynum);
+                STRING * const escaped = Parrot_str_escape_truncate(interp, s, 20);
+                if (escaped)
+                    len += Parrot_io_eprintf(debugger, "S%vd=\"%Ss\"",
+                            keynum, escaped);
+                else
+                    len += Parrot_io_eprintf(debugger, "S%vd=\"(null)\"", keynum);
+            }
             else
-                len += Parrot_io_eprintf(debugger, "S%vd=\"(null)\"",
-                        VTABLE_get_integer(interp, key));
+                len += Parrot_io_eprintf(debugger, "**WRONG KEY STRING REG %d**", keynum);
             }
             break;
           case KEY_pmc_FLAG|KEY_register_FLAG:


More information about the parrot-commits mailing list