On Mon, 9 Sep 2002, Andy Dougherty wrote:

> On Mon, 9 Sep 2002, Andy Dougherty wrote:
> 
> > 64-bit-int builds appear to be broken.  This is from Linux/SPARC with
> > INTVAL='long long'.  This configuration used to work quite recently.
> 
> I've at least figured out why it core dumps -- do_panic() assumes we've
> got a valid interpreter, and tries to print out interpreter->line and
> interpreter->flags.  That's obviously not going to work if the problem is
> (as it is here) that interpreter=0x0.  I think the giant print statement
> needs to be broken up into pieces which are conditional on the appropriate
> things being passed in.

This patch breaks up the giant print statement into manageable pieces,
and included paranoid checking before dereferencing pointers.

--- parrot-orig/exceptions.c    Wed Mar  6 10:45:28 2002
+++ parrot-andy/exceptions.c    Tue Sep 10 11:55:04 2002
@@ -34,33 +34,29 @@
 do_panic(struct Parrot_Interp *interpreter, const char *message,
          const char *file, int line)
 {
-    printf("Parrot VM: PANIC: %s!\n\
-C file %s, line %d\n\
-Parrot file %s, line %d\n\
-\n\
+    printf("Parrot VM: PANIC: %s!\n", message ? message : "(no message available)");
+    printf("C file %s, line %d\n", file ? file : "(file name not available)", line);
+    printf("Parrot file %s, ", "(not available)");
+    if (interpreter)
+        printf("line %d\n", interpreter->current_line);
+    else
+        printf("line ((not available)\n");
+    printf("\n\
 We highly suggest you notify the Parrot team if you have not been working on \n\
 Parrot.  Use bugs6.perl.org or send an e-mail to [EMAIL PROTECTED]  \n\
 Include the entire text of this error message and the text of the script that \n\
 generated the error.  If you've made any modifications to Parrot, please \n\
-describe them as well.\n\
-\n\
-Version     : " PARROT_VERSION     "\n\
-Configured  : " PARROT_CONFIG_DATE "\n\
-Architecture: " PARROT_ARCHNAME    "\n\
-JIT Capable : %s\n\
-\n\
-Interp Flags: 0x%x\n\
-Exceptions  : (missing from core)\n\
-\n\
-Dumping core...\n\
-\n",
-        message, 
-        file, 
-        line, 
-        "(not available)", 
-        (int)interpreter->current_line, 
-        (JIT_CAPABLE ? "Yes" : "No"),
-        interpreter->flags);
+describe them as well.\n");
+    printf("Version     : %s\n", PARROT_VERSION);
+    printf("Configured  : %s\n", PARROT_CONFIG_DATE);
+    printf("Architecture: %s\n", PARROT_ARCHNAME);
+    printf("JIT Capable : %s\n", (JIT_CAPABLE ? "Yes" : "No"));
+    if (interpreter)
+        printf("Interp Flags: 0x%x\n", interpreter->flags);
+    else
+        printf("Interp Flags: (not available)\n");
+    printf("Exceptions  : (missing from core)\n");
+    printf("\nDumping core...\n\n");
     dumpcore();
 }  
 

-- 
    Andy Dougherty              [EMAIL PROTECTED]

Reply via email to