develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34290 - trunk/src

From:
chromatic
Date:
December 23, 2008 13:18
Subject:
[svn:parrot] r34290 - trunk/src
Message ID:
20081223211843.96A63CBA12@x12.develooper.com
Author: chromatic
Date: Tue Dec 23 13:18:42 2008
New Revision: 34290

Modified:
   trunk/src/dynext.c
   trunk/src/jit_debug.c

Log:
[JIT] Added checks for the return values of some system calls when writing
stabs files.

Modified: trunk/src/dynext.c
==============================================================================
--- trunk/src/dynext.c	(original)
+++ trunk/src/dynext.c	Tue Dec 23 13:18:42 2008
@@ -358,13 +358,13 @@
 
     /* get load_func */
     if (lib_name) {
-        STRING * const load_func_name = Parrot_sprintf_c(interp,
+        STRING * const load_name  = Parrot_sprintf_c(interp,
                                         "Parrot_lib_%Ss_load", lib_name);
-        char * const cload_func_name = string_to_cstring(interp, load_func_name);
+        char   * const cload_func_name = string_to_cstring(interp, load_name);
         STRING *init_func_name;
 
         load_func    = (PMC * (*)(PARROT_INTERP))
-            (Parrot_dlsym(handle, cload_func_name));
+            D2FPTR(Parrot_dlsym(handle, cload_func_name));
 
         string_cstring_free(cload_func_name);
 

Modified: trunk/src/jit_debug.c
==============================================================================
--- trunk/src/jit_debug.c	(original)
+++ trunk/src/jit_debug.c	Tue Dec 23 13:18:42 2008
@@ -167,11 +167,14 @@
     fprintf(stabs, ".stabs \"PMCType:T(0,%d)=e", i++);
     for (j = 0; j < interp->n_vtable_max; ++j) {
         if (interp->vtables[j] && interp->vtables[j]->whoami) {
-            STRING* name = interp->vtables[j]->whoami;
-            fwrite(name->strstart, name->strlen, 1, stabs);
+            STRING *name  = interp->vtables[j]->whoami;
+            size_t  items = fwrite(name->strstart, name->strlen, 1, stabs);
+            if (!items)
+                fprintf(stderr, "Error writing stabs!\n");
             fprintf(stabs, ":%d,", j);
         }
     }
+
     fprintf(stabs, ";\"," N_LSYM ",0,0,0\n");
 
     /* PMC type */
@@ -356,12 +359,15 @@
     fprintf(stabs, ".stabs \"\"," N_FUN ",0,1,%p\n",
             (char *) jit_info->arena.size);
     fclose(stabs);
+
     /* run the stabs file through C<as> generating file.o */
     cmd = Parrot_sprintf_c(interp, "as %Ss -o %Ss", stabsfile, ofile);
 
     {
-        char *temp = string_to_cstring(interp, cmd);
-        system(temp);
+        char *temp   = string_to_cstring(interp, cmd);
+        int   status = system(temp);
+        if (status)
+            fprintf(stderr, "Assembly failed: %d\n%s\n", status, temp);
         string_cstring_free(temp);
     }
 }



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About