summaryrefslogtreecommitdiffstats
path: root/tools/valgrind
diff options
context:
space:
mode:
authordkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-21 23:54:14 +0000
committerdkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-21 23:54:14 +0000
commit6f3ab65893dade678a0c0b755ab0f01da5edc957 (patch)
tree060f72d6a306c9c562c7bf753b32c33a0324a971 /tools/valgrind
parent65791da398b5448345e638c494bd8c0c9de510bf (diff)
downloadchromium_src-6f3ab65893dade678a0c0b755ab0f01da5edc957.zip
chromium_src-6f3ab65893dade678a0c0b755ab0f01da5edc957.tar.gz
chromium_src-6f3ab65893dade678a0c0b755ab0f01da5edc957.tar.bz2
Use local copies of files from bug tracker (URL still in comments); avoids wget dependency
Review URL: http://codereview.chromium.org/159175 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21238 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/valgrind')
-rwxr-xr-xtools/valgrind/build-valgrind-for-chromium.sh18
-rw-r--r--tools/valgrind/fork.patch109
-rw-r--r--tools/valgrind/longlines.patch11
3 files changed, 131 insertions, 7 deletions
diff --git a/tools/valgrind/build-valgrind-for-chromium.sh b/tools/valgrind/build-valgrind-for-chromium.sh
index 047c063..c81231e 100755
--- a/tools/valgrind/build-valgrind-for-chromium.sh
+++ b/tools/valgrind/build-valgrind-for-chromium.sh
@@ -1,4 +1,8 @@
#!/bin/sh
+# Script to build valgrind for use with chromium
+
+THISDIR=`dirname $0`
+THISDIR=`cd $THISDIR && /bin/pwd`
set -x
set -e
@@ -14,18 +18,18 @@ svn update -r '{2009-07-15}'
cd ..
# Work around bug https://bugs.kde.org/show_bug.cgi?id=162848
-# fork() not handled properly
-wget "https://bugs.kde.org/attachment.cgi?id=35150"
-patch -p0 < "attachment.cgi?id=35150"
+# "fork() not handled properly"
+#wget -O fork.patch "https://bugs.kde.org/attachment.cgi?id=35150"
+patch -p0 < "$THISDIR"/fork.patch
# Work around bug https://bugs.kde.org/show_bug.cgi?id=186796
-# long suppressions truncated
-wget "https://bugs.kde.org/attachment.cgi?id=35174"
-patch -p0 < "attachment.cgi?id=35174"
+# "long suppressions truncated"
+#wget -O longlines.patch "https://bugs.kde.org/attachment.cgi?id=35174"
+patch -p0 < "$THISDIR"/longlines.patch
sh autogen.sh
./configure --prefix=/usr/local/valgrind-20090715
-make
+make -j4
sudo make install
cd /usr
test -f bin/valgrind && sudo mv bin/valgrind bin/valgrind.orig
diff --git a/tools/valgrind/fork.patch b/tools/valgrind/fork.patch
new file mode 100644
index 0000000..6b64003
--- /dev/null
+++ b/tools/valgrind/fork.patch
@@ -0,0 +1,109 @@
+Index: coregrind/m_main.c
+===================================================================
+--- coregrind/m_main.c (revision 10399)
++++ coregrind/m_main.c (working copy)
+@@ -755,15 +755,26 @@
+ If logging to file or a socket, write details of parent PID and
+ command line args, to help people trying to interpret the
+ results of a run which encompasses multiple processes. */
+-static void print_preamble(Bool logging_to_fd, const char* toolname)
++
++// TODO(timurrrr): we add a non-static declaration of this function since
++// we need it in coregrind/m_libcproc.c
++// Should we move it to some header file?
++void print_preamble(Bool logging_to_fd, const char* toolname);
++
++void print_preamble(Bool logging_to_fd, const char* toolname)
+ {
+ HChar* xpre = VG_(clo_xml) ? " <line>" : "";
+ HChar* xpost = VG_(clo_xml) ? "</line>" : "";
+ Int i;
++ static const char* last_toolname = NULL;
+
+ vg_assert( VG_(args_for_client) );
+ vg_assert( VG_(args_for_valgrind) );
++ // This way you may pass toolname == NULL provided the first invocation
++ // with toolname != NULL takes place in valgrind_main().
++ toolname = (toolname == NULL ? last_toolname : toolname);
+ vg_assert( toolname );
++ last_toolname = toolname;
+
+ if (VG_(clo_xml)) {
+ VG_(message)(Vg_UserMsg, "<?xml version=\"1.0\"?>");
+Index: coregrind/m_libcproc.c
+===================================================================
+--- coregrind/m_libcproc.c (revision 10399)
++++ coregrind/m_libcproc.c (working copy)
+@@ -33,9 +33,12 @@
+ #include "pub_core_vkiscnums.h"
+ #include "pub_core_libcbase.h"
+ #include "pub_core_libcassert.h"
++#include "pub_core_libcfile.h"
+ #include "pub_core_libcprint.h"
+ #include "pub_core_libcproc.h"
+ #include "pub_core_libcsignal.h"
++#include "pub_core_tooliface.h"
++#include "pub_core_options.h"
+ #include "pub_core_seqmatch.h"
+ #include "pub_core_mallocfree.h"
+ #include "pub_core_syscall.h"
+@@ -703,10 +706,59 @@
+ (*atforks[i].parent)(tid);
+ }
+
++// Defined in m_main.c
++void print_preamble(Bool logging_to_fd, const char* toolname);
++
++// If --log-file=ABC%pXYZ is specified, we'd like to have separate log files
++// for each forked child.
++// If %p is present in the --log-file option, this function creates
++// a new log file and redirects the child's output to it.
++static void open_new_logfile_for_forked_child(void)
++{
++ SysRes sres;
++ Int tmp_log_fd = -1;
++ Char *logfilename, *clo_log_name;
++
++ clo_log_name = VG_(clo_log_name);
++ if (clo_log_name == NULL || !VG_(strstr)(clo_log_name, "%p")) {
++ // Don't create new log streams unless --log-file=ABC%pXYZ is specified.
++ return;
++ }
++
++ logfilename = VG_(expand_file_name)("--log-file", clo_log_name);
++ sres = VG_(open) (logfilename,
++ VKI_O_CREAT | VKI_O_WRONLY | VKI_O_TRUNC,
++ VKI_S_IRUSR | VKI_S_IWUSR);
++ if (!sr_isError(sres)) {
++ tmp_log_fd = sr_Res(sres);
++ // Move log_fd into the safe range,
++ // so it doesn't conflict with any app fds.
++ tmp_log_fd = VG_(fcntl) (tmp_log_fd, VKI_F_DUPFD, VG_(fd_hard_limit));
++ if (tmp_log_fd >= 0) {
++ VG_(clo_log_fd) = tmp_log_fd;
++ VG_(fcntl) (VG_(clo_log_fd), VKI_F_SETFD, VKI_FD_CLOEXEC);
++ } else {
++ VG_(message) (Vg_UserMsg,
++ "valgrind: failed to move logfile fd into safe range, "
++ "using stderr");
++ VG_(clo_log_fd) = 2; // stderr
++ }
++ } else {
++ VG_(message) (Vg_UserMsg,
++ "Can't create log file '%s' (%s); giving up!",
++ logfilename, VG_(strerror) (sr_Err(sres)));
++ VG_(core_panic)("Error creating log file for child process");
++ }
++
++ print_preamble(False, NULL);
++}
++
+ void VG_(do_atfork_child)(ThreadId tid)
+ {
+ Int i;
+
++ open_new_logfile_for_forked_child();
++
+ for (i = 0; i < n_atfork; i++)
+ if (atforks[i].child != NULL)
+ (*atforks[i].child)(tid);
diff --git a/tools/valgrind/longlines.patch b/tools/valgrind/longlines.patch
new file mode 100644
index 0000000..a3c0619
--- /dev/null
+++ b/tools/valgrind/longlines.patch
@@ -0,0 +1,11 @@
+--- /data/dkegel/valgrind-10414-vex-1906/coregrind/m_errormgr.c 2009-07-08 15:49:30.000000000 -0700
++++ coregrind/m_errormgr.c 2009-07-08 17:17:36.000000000 -0700
+@@ -942,7 +942,7 @@
+ */
+ static void load_one_suppressions_file ( Char* filename )
+ {
+-# define N_BUF 200
++# define N_BUF 2000
+ SysRes sres;
+ Int fd, i, j, lineno = 0;
+ Bool eof;