-/* This is called after all the modules have registered their local tixboxes,
- * and does a sanity check: are we good to go?
- */
-
-void
-startupHpc(void) {
- char *hpcRix;
-
- debugTrace(DEBUG_hpc,"startupHpc");
-
- if (hpc_inited == 0) {
- return;
- }
- // HPCRIX contains the name of the file to send our dynamic runtime output to (a named pipe).
-
- hpcRix = getenv("HPCRIX");
- if (hpcRix) {
- int comma;
- Info *tmpModule;
- int rixFD, rixCmdFD;
- int tixCount = 0;
-
- assert(hpc_inited);
-
- if (sscanf(hpcRix,"%d:%d",&rixFD,&rixCmdFD) != 2) {
- /* Bad format for HPCRIX.
- */
- debugTrace(DEBUG_hpc,"Bad HPCRIX (%s)",hpcRix);
- exit(0);
- }
-
- debugTrace(DEBUG_hpc,"found HPCRIX pipes: %d:%d",rixFD,rixCmdFD);
-
- rixFile = fdopen(rixFD,"w");
- assert(rixFile != NULL);
-
- rixCmdFile = fdopen(rixCmdFD,"r");
- assert(rixCmdFile != NULL);
-
- // If we fork a process, then we do not want ticks inside
- // the sub-process to talk to the debugger. So we remember
- // our pid at startup time, so we can check if we are still
- // the original process.
-
- debuggee_pid = getpid();
-
- comma = 0;
-
- fprintf(rixFile,"Starting %s\n",prog_name);
- fprintf(rixFile,"[");
- tmpModule = modules;
- for(;tmpModule != 0;tmpModule = tmpModule->next) {
- if (comma) {
- fprintf(rixFile,",");
- } else {
- comma = 1;
- }
- fprintf(rixFile,"(\"%s\",%u)",
- tmpModule->modName,
- tmpModule->tickCount);
-
- tixCount += tmpModule->tickCount;
-
- debugTrace(DEBUG_hpc,"(tracer)%s: %u (offset=%u) (hash=%u)\n",
- tmpModule->modName,
- tmpModule->tickCount,
- tmpModule->hashNo,
- tmpModule->tickOffset);
-
- }
- fprintf(rixFile,"]\n");
- fflush(rixFile);
-
- // Allocate the tixBox breakpoint array
- // These are set to 1 if you want to
- // stop at a specific breakpoint
- tixBoxBP = (int *)calloc(tixCount,sizeof(int));
- }
-
-}
-
-