static Int out_counter = 0;
static HChar* out_file = 0;
-static HChar* out_directory = 0;
static Bool dumps_initialized = False;
/* Command */
return out_counter;
}
-HChar* CLG_(get_out_file)()
-{
- CLG_(init_dumps)();
- return out_file;
-}
-
-HChar* CLG_(get_out_directory)()
-{
- CLG_(init_dumps)();
- return out_directory;
-}
-
/*------------------------------------------------------------*/
/*--- Output file related stuff ---*/
/*------------------------------------------------------------*/
}
/*
- * Set up file names for dump output: <out_directory>, <out_file>.
+ * Set up file names for dump output: <out_file>.
* <out_file> is derived from the output format string, which defaults
* to "callgrind.out.%p", where %p is replaced with the PID.
* For the final file name, on intermediate dumps a counter is appended,
*/
void CLG_(init_dumps)()
{
- Int lastSlash, i;
SysRes res;
static int thisPID = 0;
/* If a file name was already set, clean up before */
if (out_file) {
VG_(free)(out_file);
- VG_(free)(out_directory);
VG_(free)(filename);
out_counter = 0;
}
out_file =
VG_(expand_file_name)("--callgrind-out-file", CLG_(clo).out_format);
- /* get base directory for dump/command/result files */
- CLG_ASSERT(out_file[0] == '/');
- lastSlash = 0;
- i = 1;
- while(out_file[i]) {
- if (out_file[i] == '/') lastSlash = i;
- i++;
- }
- i = lastSlash;
- out_directory = (HChar*) CLG_MALLOC("cl.dump.init_dumps.1", i+1);
- VG_(strncpy)(out_directory, out_file, i);
- out_directory[i] = 0;
-
/* allocate space big enough for final filenames */
filename = (HChar*) CLG_MALLOC("cl.dump.init_dumps.2",
VG_(strlen)(out_file)+32);