Fix Do_Micro_Error to respect stack direction, and print arguments.
authorMatt Birkholz <puck@birchwood-abbey.net>
Fri, 19 Dec 2014 17:05:34 +0000 (10:05 -0700)
committerMatt Birkholz <puck@birchwood-abbey.net>
Fri, 19 Dec 2014 17:05:34 +0000 (10:05 -0700)
src/microcode/utils.c

index c948256f1e42448eabfa62707bc9441c6a339965..35466bb24d4d510e1caab29f63a62bcd588cb362 100644 (file)
@@ -552,17 +552,26 @@ Do_Micro_Error (long error_code, bool from_pop_return_p)
   if ((GET_RC == RC_INTERNAL_APPLY)
       || (GET_RC == RC_INTERNAL_APPLY_VAL))
     {
-      SCHEME_OBJECT * sp = (STACK_LOC (CONTINUATION_SIZE));
-      Print_Expression ((sp[STACK_ENV_FUNCTION]), "Procedure was");
+      Print_Expression (STACK_REF(CONTINUATION_SIZE + STACK_ENV_FUNCTION),
+                       "Procedure");
       outf_error ("\n");
-      outf_error ("# of arguments: %lu\n",
-                 (APPLY_FRAME_HEADER_N_ARGS (sp[STACK_ENV_HEADER])));
+      {
+       int i, nargs = (APPLY_FRAME_HEADER_N_ARGS
+                       (STACK_REF(CONTINUATION_SIZE + STACK_ENV_HEADER)));
+       for (i = 0; i < nargs; i += 1)
+         {
+           outf_error ("Argument %d: ", i+1);
+           Print_Expression ((STACK_REF(CONTINUATION_SIZE
+                                        + STACK_ENV_FIRST_ARG + i)), "");
+           outf_error ("\n");
+         }
+      }
     }
   else
     {
-      Print_Expression (GET_EXP, "Expression was");
+      Print_Expression (GET_EXP, "Expression");
       outf_error ("\n");
-      Print_Expression (GET_ENV, "Environment was");
+      Print_Expression (GET_ENV, "Environment");
       outf_error ("\n");
     }
   Print_Return ("Return code");