Author: kjs
Date: Fri Jan  2 05:03:50 2009
New Revision: 34802

Modified:
   trunk/src/debug.c

Log:
[src] Fix disassembling of PBC so that it prints ":slurpy", not "flat" on 
parameters.

Modified: trunk/src/debug.c
==============================================================================
--- trunk/src/debug.c   (original)
+++ trunk/src/debug.c   Fri Jan  2 05:03:50 2009
@@ -2560,6 +2560,7 @@
 {
     int         j;
     size_t     size = 0;
+    int        specialop = 0;
 
     /* Write the opcode name */
     const char * p = full_name ? info->full_name : info->name;
@@ -2764,10 +2765,16 @@
        one fixed parameter (the signature vector), plus a varying number of
        registers/constants.  For each arg/return, we show the register and its
        flags using PIR syntax. */
-    if (*(op) == PARROT_OP_set_args_pc ||
-            *(op) == PARROT_OP_get_results_pc ||
-            *(op) == PARROT_OP_get_params_pc ||
-            *(op) == PARROT_OP_set_returns_pc) {
+    if (*(op) == PARROT_OP_set_args_pc || *(op) == PARROT_OP_set_returns_pc)
+        specialop = 1;
+
+    /* if it's a retrieving op, specialop = 2, so that later a :flat flag
+     * can be changed into a :slurpy flag. See flag handling below.
+     */
+    if (*(op) == PARROT_OP_get_results_pc || *(op) == PARROT_OP_get_params_pc)
+        specialop = 2;
+
+    if (specialop > 0) {
         char buf[1000];
         PMC * const sig = interp->code->const_table->constants[op[1]]->u.key;
         int n_values = SIG_ELEMS(sig);
@@ -2791,6 +2798,7 @@
                                      NULL
         };
 
+
         /* Register decoding.  It would be good to abstract this, too. */
         static const char regs[] = "ISPN";
 
@@ -2816,7 +2824,11 @@
                  * 100 is just an estimate of all buf lengths added together.
                  */
                 while (flags && idx < sizeof (buf) - 100) {
-                    const char * const flag_string = flag_names[flag_idx];
+                    const char * const flag_string
+                                    = (specialop == 2  && 
STREQ(flag_names[flag_idx], " :flat"))
+                                    ? " :slurpy"
+                                    : flag_names[flag_idx];
+
                     if (! flag_string)
                         break;
                     if (flags & 1 && *flag_string) {

Reply via email to