This file is part of Callgrind, a Valgrind tool for call graph
profiling programs.
- Copyright (C) 2002-2010, Josef Weidendorfer (Josef.Weidendorfer@gmx.de)
+ Copyright (C) 2002-2011, Josef Weidendorfer (Josef.Weidendorfer@gmx.de)
This tool is derived from and contains lot of code from Cachegrind
Copyright (C) 2002 Nicholas Nethercote (njn@valgrind.org)
Int fd, size;
SysRes res;
Char* dir;
+ const HChar *tmpdir;
CLG_ASSERT(thisPID != 0);
VG_(sprintf)(result_file2, "%s/%s",
dir, DEFAULT_RESULTNAME);
+ tmpdir = VG_(tmpdir)();
info_file = (char*) CLG_MALLOC("cl.command.sc.5",
+ VG_(strlen)(tmpdir) +
VG_(strlen)(DEFAULT_INFONAME) + 10);
CLG_ASSERT(info_file != 0);
- VG_(sprintf)(info_file, "%s.%d", DEFAULT_INFONAME, thisPID);
+ VG_(sprintf)(info_file, "%s/%s.%d", tmpdir, DEFAULT_INFONAME, thisPID);
CLG_DEBUG(1, "Setup for interactive control (PID: %d):\n", thisPID);
CLG_DEBUG(1, " output file: '%s'\n", out_file);
#define DEFAULT_OUTFORMAT "callgrind.out.%p"
#define DEFAULT_COMMANDNAME "callgrind.cmd"
#define DEFAULT_RESULTNAME "callgrind.res"
-#define DEFAULT_INFONAME "/tmp/callgrind.info"
+#define DEFAULT_INFONAME "callgrind.info"
typedef struct _CommandLineOptions CommandLineOptions;
struct _CommandLineOptions {
written is guaranteed not to exceed 64+strlen(part_of_name). */
extern Int VG_(mkstemp) ( HChar* part_of_name, /*OUT*/HChar* fullname );
-/* Return the name of a directory for temporary files. */
-extern const HChar* VG_(tmpdir)(void);
-
/* Record the process' working directory at startup. Is intended to
be called exactly once, at startup, before the working directory
changes. Return True for success, False for failure, so that the
extern Char* VG_(basename)( const Char* path );
extern Char* VG_(dirname) ( const Char* path );
+/* Return the name of a directory for temporary files. */
+extern const HChar* VG_(tmpdir)(void);
+
/* Copy the working directory at startup into buf[0 .. size-1], or return
False if buf is too small. */
extern Bool VG_(get_startup_wd) ( Char* buf, SizeT size );