#include <string.h>
#include <assert.h>
#include "HsFFI.h"
+#include "Rts.h"
#include "Hpc.h"
/* This is the runtime support for the Haskell Program Coverage (hpc) toolkit,
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.
-static char *tixFilename = "Main.tix";
+static char *tixFilename;
static void failure(char *msg) {
printf("Hpc failure: %s\n",msg);
}
hpc_inited = 1;
+
+ tixFilename = (char *) malloc(strlen(prog_name) + 6);
+ sprintf(tixFilename, "%s.tix", prog_name);
+
if (init_open(tixFilename)) {
totalTixes = 0;
}
if (tmpModule->tixArr) {
- fprintf(f,"%lld",tmpModule->tixArr[i]);
+ fprintf(f,"%" PRIuWORD64,tmpModule->tixArr[i]);
} else {
fprintf(f,"0");
}