]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix callgrind part of bug 280757.
authorJosef Weidendorfer <Josef.Weidendorfer@gmx.de>
Mon, 17 Oct 2011 18:12:48 +0000 (18:12 +0000)
committerJosef Weidendorfer <Josef.Weidendorfer@gmx.de>
Mon, 17 Oct 2011 18:12:48 +0000 (18:12 +0000)
For this, we make VG_(tmpdir) available to tools.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12163

callgrind/command.c
callgrind/global.h
coregrind/pub_core_libcfile.h
include/pub_tool_libcfile.h

index 674fd0fa697663d258c21aee733fd6044ebad391..400fbbdc76754d93040db7207604535b801833c6 100644 (file)
@@ -2,7 +2,7 @@
    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)
@@ -58,6 +58,7 @@ static void setup_control(void)
   Int fd, size;
   SysRes res;
   Char* dir;
+  const HChar *tmpdir;
 
   CLG_ASSERT(thisPID != 0);
 
@@ -95,10 +96,12 @@ static void setup_control(void)
   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);
index c56b11fad739bdf7819e7737ba82caee4728f862..19065daaa6bcf27cd54b8b562afb866b9f1f97cb 100644 (file)
@@ -53,7 +53,7 @@
 #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 {
index 9a5bc5477b7cb9796d4371d653b5e1ff2ad2c4b3..9cfaab20d51559a792924459c2c250dc4923b229 100644 (file)
@@ -90,9 +90,6 @@ extern SysRes VG_(pread) ( Int fd, void* buf, Int count, OffT offset );
    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
index 8a1766600cbcef582d56410c0a96c52494a1e037..700f50de9e9432df4b85ef1f6a5d5daf96f2173f 100644 (file)
@@ -94,6 +94,9 @@ extern Int    VG_(getdents)( Int fd, struct vki_dirent *dirp, UInt count );
 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 );