]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Make file_err() not abort the current process; recover and keep
authorJulian Seward <jseward@acm.org>
Tue, 3 Sep 2002 12:03:23 +0000 (12:03 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 3 Sep 2002 12:03:23 +0000 (12:03 +0000)
going instead.  This fixes a problem running OpenOffice on cachegrind.

MERGE TO HEAD

git-svn-id: svn://svn.valgrind.org/valgrind/branches/VALGRIND_1_0_BRANCH@860

vg_cachesim.c

index e0d09811acdb82940fd286e853b2a3f1519f40e2..ec5686d1da2b0b44be2a8a57fcfd36c9357f6160 100644 (file)
@@ -73,9 +73,10 @@ Int VG_(log2) ( Int x )
 static void file_err()
 {
    VG_(message)(Vg_UserMsg,
-                "error: can't open cache simulation output file `%s'",
-                OUT_FILE );
-   VG_(exit)(1);
+      "error: can't open cache simulation output file `%s'",
+      OUT_FILE );
+   VG_(message)(Vg_UserMsg,
+      "       ... so detailed simulation results will be missing.");
 }
 
 /*------------------------------------------------------------*/
@@ -1281,7 +1282,8 @@ void VG_(init_cachesim)(void)
          file_err(); 
       }
    }
-   VG_(close)(fd);
+   if (-1 != fd)
+      VG_(close)(fd);
 
    initCC(&Ir_total);
    initCC(&Dr_total);
@@ -1487,7 +1489,12 @@ static void fprint_BBCC_table_and_calc_totals(Int client_argc,
 
    VGP_PUSHCC(VgpCacheDump);
    fd = VG_(open_write)(OUT_FILE);
-   if (-1 == fd) { file_err(); }
+   if (-1 == fd) { 
+      /* If the file can't be opened for whatever reason (conflict
+         between multiple cachegrinded processes?), give up now. */
+      file_err(); 
+      return;
+   }
 
    /* "desc:" lines (giving I1/D1/L2 cache configuration) */
    VG_(sprintf)(buf, "desc: I1 cache:         %s\n", I1.desc_line);