X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FHpc.c;h=50730ea70bad4359092bcf43b9619245139335a3;hb=80a766fdb6864eae613962e43ad9eb371e0ce80c;hp=8e67ffcc8804cefc620e9c65e8b990fe17e34ee2;hpb=d5934bbb856aa0aa620c9b2e0fa51c90a1a5a048;p=ghc-hetmet.git diff --git a/rts/Hpc.c b/rts/Hpc.c index 8e67ffc..50730ea 100644 --- a/rts/Hpc.c +++ b/rts/Hpc.c @@ -10,6 +10,7 @@ #include #include #include "HsFFI.h" +#include "Rts.h" #include "Hpc.h" /* This is the runtime support for the Haskell Program Coverage (hpc) toolkit, @@ -31,6 +32,13 @@ typedef struct _Info { struct _Info *next; } Info; +// This is a cruel hack, we should completely redesign the format specifier handling in the RTS. +#if SIZEOF_LONG == 8 +#define PRIuWORD64 "lu" +#else +#define PRIuWORD64 "llu" +#endif + Info *modules = 0; Info *nextModule = 0; StgWord64 *tixBoxes = 0; // local copy of tixBoxes array, from file. @@ -38,7 +46,7 @@ int totalTixes = 0; // total number of tix boxes. -static char *tixFilename = "Main.tix"; +static char *tixFilename; static void failure(char *msg) { printf("Hpc failure: %s\n",msg); @@ -104,6 +112,10 @@ static void hpc_init(void) { } hpc_inited = 1; + + tixFilename = (char *) malloc(strlen(prog_name) + 6); + sprintf(tixFilename, "%s.tix", prog_name); + if (init_open(tixFilename)) { totalTixes = 0; @@ -309,7 +321,7 @@ exitHpc(void) { } if (tmpModule->tixArr) { - fprintf(f,"%lld",tmpModule->tixArr[i]); + fprintf(f,"%" PRIuWORD64,tmpModule->tixArr[i]); } else { fprintf(f,"0"); }