|
From: <sv...@va...> - 2014-08-22 17:14:35
|
Author: florian
Date: Fri Aug 22 17:14:22 2014
New Revision: 14333
Log:
Merge from trunk.
Added:
branches/BUF_REMOVAL/drd/tests/tls_threads.stderr.exp
- copied unchanged from r14332, trunk/drd/tests/tls_threads.stderr.exp
branches/BUF_REMOVAL/drd/tests/tls_threads.vgtest
- copied unchanged from r14332, trunk/drd/tests/tls_threads.vgtest
branches/BUF_REMOVAL/helgrind/tests/tls_threads.c
- copied unchanged from r14332, trunk/helgrind/tests/tls_threads.c
branches/BUF_REMOVAL/helgrind/tests/tls_threads.stderr.exp
- copied unchanged from r14332, trunk/helgrind/tests/tls_threads.stderr.exp
branches/BUF_REMOVAL/helgrind/tests/tls_threads.stdout.exp
- copied unchanged from r14332, trunk/helgrind/tests/tls_threads.stdout.exp
branches/BUF_REMOVAL/helgrind/tests/tls_threads.vgtest
- copied unchanged from r14332, trunk/helgrind/tests/tls_threads.vgtest
Modified:
branches/BUF_REMOVAL/ (props changed)
branches/BUF_REMOVAL/NEWS
branches/BUF_REMOVAL/auxprogs/ (props changed)
branches/BUF_REMOVAL/auxprogs/Makefile.am
branches/BUF_REMOVAL/auxprogs/getoff.c
branches/BUF_REMOVAL/cachegrind/cg_main.c
branches/BUF_REMOVAL/callgrind/costs.h
branches/BUF_REMOVAL/callgrind/dump.c
branches/BUF_REMOVAL/callgrind/global.h
branches/BUF_REMOVAL/callgrind/jumps.c
branches/BUF_REMOVAL/configure.ac
branches/BUF_REMOVAL/coregrind/m_clientstate.c
branches/BUF_REMOVAL/coregrind/m_initimg/initimg-darwin.c
branches/BUF_REMOVAL/coregrind/m_initimg/initimg-linux.c
branches/BUF_REMOVAL/coregrind/m_libcbase.c
branches/BUF_REMOVAL/coregrind/m_libcprint.c
branches/BUF_REMOVAL/coregrind/m_main.c
branches/BUF_REMOVAL/coregrind/m_options.c
branches/BUF_REMOVAL/coregrind/m_redir.c
branches/BUF_REMOVAL/coregrind/m_scheduler/scheduler.c
branches/BUF_REMOVAL/coregrind/m_syswrap/priv_types_n_macros.h
branches/BUF_REMOVAL/coregrind/m_syswrap/syswrap-amd64-linux.c
branches/BUF_REMOVAL/coregrind/m_syswrap/syswrap-generic.c
branches/BUF_REMOVAL/coregrind/m_syswrap/syswrap-x86-linux.c
branches/BUF_REMOVAL/coregrind/pub_core_clientstate.h
branches/BUF_REMOVAL/coregrind/pub_core_options.h
branches/BUF_REMOVAL/docs/xml/FAQ.xml
branches/BUF_REMOVAL/docs/xml/manual-core.xml
branches/BUF_REMOVAL/drd/tests/Makefile.am
branches/BUF_REMOVAL/exp-sgcheck/tests/hackedbz2.c
branches/BUF_REMOVAL/gdbserver_tests/filter_gdb
branches/BUF_REMOVAL/gdbserver_tests/hgtls.stdoutB.exp
branches/BUF_REMOVAL/gdbserver_tests/hgtls.vgtest
branches/BUF_REMOVAL/helgrind/docs/hg-manual.xml
branches/BUF_REMOVAL/helgrind/tests/ (props changed)
branches/BUF_REMOVAL/helgrind/tests/Makefile.am
branches/BUF_REMOVAL/include/pub_tool_libcbase.h
branches/BUF_REMOVAL/include/pub_tool_options.h
branches/BUF_REMOVAL/massif/ms_main.c
branches/BUF_REMOVAL/memcheck/mc_errors.c
branches/BUF_REMOVAL/memcheck/mc_include.h
branches/BUF_REMOVAL/memcheck/mc_main.c
branches/BUF_REMOVAL/memcheck/tests/vbit-test/irops.c
branches/BUF_REMOVAL/none/tests/arm64/fp_and_simd.c
branches/BUF_REMOVAL/none/tests/cmdline1.stdout.exp
branches/BUF_REMOVAL/none/tests/cmdline2.stdout.exp
Modified: branches/BUF_REMOVAL/NEWS
==============================================================================
--- branches/BUF_REMOVAL/NEWS (original)
+++ branches/BUF_REMOVAL/NEWS Fri Aug 22 17:14:22 2014
@@ -32,8 +32,8 @@
and creates a 'H-B relationship' between a terminated task and
its master. This avoids some false positive and avoids big
memory usage when a lot of Ada tasks are created and terminated.
- The interceptions are only activated with gnatpro >= 7.3.0w-20140611
- or gcc >= ????? (TBD: check when changes pushed to FSF gcc).
+ The interceptions are only activated with forthcoming releasses of
+ gnatpro >= 7.3.0w-20140611 and gcc >= 5.0.
- Helgrind GDB server monitor command 'info locks' giving
the list of locks, their location, and their status.
@@ -96,6 +96,9 @@
If an object contains both CFI and EXIDX unwind information, Valgrind
will prefer the CFI over the EXIDX.
+* Typos or unknown values in --sim-hints and --kernel-variant command
+ line options are now detected and reported to the user as a usage error.
+
* ==================== FIXED BUGS ====================
The following bugs have been fixed or resolved. Note that "n-i-bz"
@@ -149,6 +152,7 @@
329956 valgrind crashes when lmw/stmw instructions are used on ppc64
330228 mmap must align to VKI_SHMLBA on mips32
330257 LLVM does not support `-mno-dynamic-no-pic` option
+330319 amd64->IR: unhandled instruction bytes: 0xF 0x1 0xD5 (xend)
330459 --track-fds=yes doesn't track eventfds
330469 Add clock_adjtime syscall support
330622 Add test to regression suite for POWER instruction: dcbzl
@@ -207,6 +211,8 @@
338024 inlined functions are not shown if DW_AT_ranges is used
338115 DRD: computed conflict set differs from actual after fork
338160 implement display of thread local storage in gdbsrv
+338205 configure.ac and check for -Wno-tautological-compare
+338445 amd64 vbit-test fails with unknown opcodes used by arm64 VEX
n-i-bz Fix KVM_CREATE_IRQCHIP ioctl handling
n-i-bz s390x: Fix memory corruption for multithreaded applications
n-i-bz vex arm->IR: allow PC as basereg in some LDRD cases
Modified: branches/BUF_REMOVAL/auxprogs/Makefile.am
==============================================================================
--- branches/BUF_REMOVAL/auxprogs/Makefile.am (original)
+++ branches/BUF_REMOVAL/auxprogs/Makefile.am Fri Aug 22 17:14:22 2014
@@ -56,11 +56,18 @@
# getoff-<platform>
# Used to retrieve user space various offsets, using user space libraries.
#----------------------------------------------------------------------------
+
noinst_PROGRAMS = getoff-@VGCONF_ARCH_PRI@-@VGCONF_OS@
if VGCONF_HAVE_PLATFORM_SEC
noinst_PROGRAMS += getoff-@VGCONF_ARCH_SEC@-@VGCONF_OS@
endif
+# The link flags for this are tricky, because we want to build it for
+# both the primary and secondary platforms, and add
+# "-Wl,-read_only_relocs -Wl,suppress" to whichever of those is x86-darwin,
+# if any. Hence there's a double-nested conditional that adds to the
+# LDFLAGS in both cases.
+
getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES = getoff.c
getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CPPFLAGS = $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS = $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
@@ -69,6 +76,13 @@
if HAVE_DLINFO_RTLD_DI_TLS_MODID
getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDADD = $(LDADD) -ldl
endif
+# If there is no secondary platform, and the platforms include x86-darwin,
+# then the primary platform must be x86-darwin. Hence:
+if ! VGCONF_HAVE_PLATFORM_SEC
+if VGCONF_PLATFORMS_INCLUDE_X86_DARWIN
+getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS += -Wl,-read_only_relocs -Wl,suppress
+endif
+endif
if VGCONF_HAVE_PLATFORM_SEC
getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES = getoff.c
@@ -80,6 +94,14 @@
getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDADD = $(LDADD) -ldl
endif
endif
+# If there is a secondary platform, and the platforms include x86-darwin,
+# then the primary platform must be amd64-darwin and the secondary platform
+# must be x86-darwin. Hence:
+if VGCONF_HAVE_PLATFORM_SEC
+if VGCONF_PLATFORMS_INCLUDE_X86_DARWIN
+getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS += -Wl,-read_only_relocs -Wl,suppress
+endif
+endif
#----------------------------------------------------------------------------
# General stuff
Modified: branches/BUF_REMOVAL/auxprogs/getoff.c
==============================================================================
--- branches/BUF_REMOVAL/auxprogs/getoff.c (original)
+++ branches/BUF_REMOVAL/auxprogs/getoff.c Fri Aug 22 17:14:22 2014
@@ -1,3 +1,49 @@
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2014-2014 Philippe Waroquiers
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+/* This file is used to generate target executable(s) getoff-<platform>
+ In a bi-arch setup, this is used to build 2 executables
+ (for the primary and secondary platforms).
+
+ This program uses user space libraries to retrieve some platform
+ dependent offsets needed for Valgrind core, but that cannot (easily)
+ be retrieved by Valgrind core.
+
+ This is currently used only for handling the gdbsrv QGetTlsAddr query :
+ it only computes and outputs lm_modid_offset in struct link_map
+ of the dynamic linker. In theory, we should also compute the offset needed
+ to get the dtv from the thread register/pointer/...
+ Currently, the various valgrind-low-xxxxxx.c files are hardcoding this
+ offset as it is deemed (?) stable, and there is no clear way how to
+ compute this dtv offset.
+
+ The getoff-<platform> executable will be launched automatically by
+ Valgrind gdbserver when the first QGetTlsAddr query is retrieved.
+
+ On plaforms that do not support __thread and/or that do not provide
+ dlinfo RTLD_DI_TLS_MODID, this executable produces no output. */
+
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
@@ -9,8 +55,10 @@
#include <stdio.h>
#include <string.h>
+#ifdef HAVE_DLINFO_RTLD_DI_TLS_MODID
#include <link.h>
#include <dlfcn.h>
+#endif
/* true if arg matches the provided option */
static
@@ -37,13 +85,7 @@
progname);
}
-/* Currently, only computes and output lm_modid_offset in struct link_map
- of the dynamic linker. In theory, we should also compute the offset needed
- to get the dtv from the thread register/pointer/...
- Currently, the various valgrind-low-xxxxxx.c files are hardcoding this
- offset as it is deemed (?) stable, and there is no clear way how to
- compute this dtv offset.
-*/
+
int main (int argc, char** argv)
{
int i;
Modified: branches/BUF_REMOVAL/cachegrind/cg_main.c
==============================================================================
--- branches/BUF_REMOVAL/cachegrind/cg_main.c (original)
+++ branches/BUF_REMOVAL/cachegrind/cg_main.c Fri Aug 22 17:14:22 2014
@@ -1416,10 +1416,7 @@
I1.desc_line, D1.desc_line, LL.desc_line);
// "cmd:" line
- VG_(fdprintf)(fd, "cmd:");
- if (VG_(args_the_exename)) {
- VG_(fdprintf)(fd, " %s", VG_(args_the_exename));
- }
+ VG_(fdprintf)(fd, "cmd: %s", VG_(args_the_exename));
for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
HChar* arg = * (HChar**) VG_(indexXA)( VG_(args_for_client), i );
if (arg) {
Modified: branches/BUF_REMOVAL/callgrind/costs.h
==============================================================================
--- branches/BUF_REMOVAL/callgrind/costs.h (original)
+++ branches/BUF_REMOVAL/callgrind/costs.h Fri Aug 22 17:14:22 2014
@@ -1,11 +1,35 @@
/*--------------------------------------------------------------------*/
-/*--- Callgrind ---*/
-/*--- ct_costs.h ---*/
-/*--- (C) 2004, Josef Weidendorfer ---*/
+/*--- Callgrind cost array interface. costs.h ---*/
/*--------------------------------------------------------------------*/
-#ifndef CT_COSTS
-#define CT_COSTS
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2004-2014 Josef Weidendorfer
+ jos...@gm...
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+
+#ifndef CLG_COSTS
+#define CLG_COSTS
#include "pub_tool_basics.h"
@@ -32,4 +56,4 @@
void CLG_(free_costarrays)(void);
-#endif /* CT_COSTS */
+#endif /* CLG_COSTS */
Modified: branches/BUF_REMOVAL/callgrind/dump.c
==============================================================================
--- branches/BUF_REMOVAL/callgrind/dump.c (original)
+++ branches/BUF_REMOVAL/callgrind/dump.c Fri Aug 22 17:14:22 2014
@@ -37,7 +37,6 @@
static Int out_counter = 0;
static HChar* out_file = 0;
-static HChar* out_directory = 0;
static Bool dumps_initialized = False;
/* Command */
@@ -62,18 +61,6 @@
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 ---*/
/*------------------------------------------------------------*/
@@ -1632,10 +1619,8 @@
Int i,j,size = 0;
HChar* argv;
- if (VG_(args_the_exename)) {
- CLG_ASSERT( VG_(strlen)( VG_(args_the_exename) ) < BUF_LEN-1);
- size = VG_(sprintf)(cmdbuf, " %s", VG_(args_the_exename));
- }
+ CLG_ASSERT( VG_(strlen)( VG_(args_the_exename) ) < BUF_LEN-1);
+ size = VG_(sprintf)(cmdbuf, " %s", VG_(args_the_exename));
for(i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
argv = * (HChar**) VG_(indexXA)( VG_(args_for_client), i );
@@ -1650,7 +1635,7 @@
}
/*
- * 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,
@@ -1665,7 +1650,6 @@
*/
void CLG_(init_dumps)()
{
- Int lastSlash, i;
SysRes res;
static int thisPID = 0;
@@ -1683,7 +1667,6 @@
/* 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;
}
@@ -1692,19 +1675,6 @@
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);
Modified: branches/BUF_REMOVAL/callgrind/global.h
==============================================================================
--- branches/BUF_REMOVAL/callgrind/global.h (original)
+++ branches/BUF_REMOVAL/callgrind/global.h Fri Aug 22 17:14:22 2014
@@ -1,9 +1,32 @@
/*--------------------------------------------------------------------*/
-/*--- Callgrind ---*/
-/*--- global.h ---*/
-/*--- (C) 2004, 2005 Josef Weidendorfer ---*/
+/*--- Callgrind data structures, functions. global.h ---*/
/*--------------------------------------------------------------------*/
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2004-2014 Josef Weidendorfer
+ jos...@gm...
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
#ifndef CLG_GLOBAL
#define CLG_GLOBAL
@@ -28,7 +51,7 @@
/*------------------------------------------------------------*/
-/*--- Calltree compile options --- */
+/*--- Callgrind compile options --- */
/*------------------------------------------------------------*/
/* Enable debug output */
@@ -41,9 +64,6 @@
* (define to 0 if you get compile errors) */
#define CLG_MICROSYSTIME 0
-/* Set to 1 if you want full sanity checks for JCC */
-#define JCC_CHECK 0
-
/*------------------------------------------------------------*/
@@ -104,10 +124,6 @@
/*--- Constants ---*/
/*------------------------------------------------------------*/
-
-/* According to IA-32 Intel Architecture Software Developer's Manual: Vol 2 */
-#define MAX_x86_INSTR_SIZE 16
-
/* Minimum cache line size allowed */
#define MIN_LINE_SIZE 16
@@ -117,9 +133,7 @@
#define OBJ_NAME_LEN 256
#define COSTS_LEN 512 /* at least 17x 64bit values */
#define BUF_LEN 512
-#define COMMIFY_BUF_LEN 128
#define RESULTS_BUF_LEN 256
-#define LINE_BUF_LEN 64
/* Convenience macros */
@@ -452,7 +466,6 @@
#define N_OBJ_ENTRIES 47
#define N_FILE_ENTRIES 53
#define N_FN_ENTRIES 87
-#define N_BBCC2_ENTRIES 37
struct _file_node {
HChar* name;
@@ -681,10 +694,6 @@
const HChar *log_0I1Dr_name, *log_0I1Dw_name;
};
-// set by setup_bbcc at start of every BB, and needed by log_* helpers
-extern Addr CLG_(bb_base);
-extern ULong* CLG_(cost_base);
-
// Event groups
#define EG_USE 0
#define EG_IR 1
@@ -699,7 +708,6 @@
struct event_sets {
EventSet *base, *full;
};
-extern struct event_sets CLG_(sets);
#define fullOffset(group) (CLG_(sets).full->offset[group])
@@ -717,7 +725,6 @@
void CLG_(print_debug_usage)(void);
/* from sim.c */
-extern struct cachesim_if CLG_(cachesim);
void CLG_(init_eventsets)(void);
/* from main.c */
@@ -813,10 +820,7 @@
void CLG_(run_post_signal_on_call_stack_bottom)(void);
/* from dump.c */
-extern FullCost CLG_(total_cost);
void CLG_(init_dumps)(void);
-HChar* CLG_(get_out_file)(void);
-HChar* CLG_(get_out_directory)(void);
/*------------------------------------------------------------*/
/*--- Exported global variables ---*/
@@ -831,11 +835,17 @@
extern Bool CLG_(instrument_state);
/* min of L1 and LL cache line sizes */
extern Int CLG_(min_line_size);
-
extern call_stack CLG_(current_call_stack);
extern fn_stack CLG_(current_fn_stack);
extern exec_state CLG_(current_state);
extern ThreadId CLG_(current_tid);
+extern FullCost CLG_(total_cost);
+extern struct cachesim_if CLG_(cachesim);
+extern struct event_sets CLG_(sets);
+
+// set by setup_bbcc at start of every BB, and needed by log_* helpers
+extern Addr CLG_(bb_base);
+extern ULong* CLG_(cost_base);
/*------------------------------------------------------------*/
Modified: branches/BUF_REMOVAL/callgrind/jumps.c
==============================================================================
--- branches/BUF_REMOVAL/callgrind/jumps.c (original)
+++ branches/BUF_REMOVAL/callgrind/jumps.c Fri Aug 22 17:14:22 2014
@@ -28,15 +28,13 @@
#include "global.h"
-#define N_JCC_INITIAL_ENTRIES 4437
-
/*------------------------------------------------------------*/
/*--- Jump Cost Center (JCC) operations, including Calls ---*/
/*------------------------------------------------------------*/
#define N_JCC_INITIAL_ENTRIES 4437
-jcc_hash current_jccs;
+static jcc_hash current_jccs;
void CLG_(init_jcc_hash)(jcc_hash* jccs)
{
Modified: branches/BUF_REMOVAL/configure.ac
==============================================================================
--- branches/BUF_REMOVAL/configure.ac (original)
+++ branches/BUF_REMOVAL/configure.ac Fri Aug 22 17:14:22 2014
@@ -1708,7 +1708,7 @@
# does this compiler support -mpreferred-stack-boundary=2 ?
-AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
+AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary=2])
safe_CFLAGS=$CFLAGS
CFLAGS="-mpreferred-stack-boundary=2"
@@ -1727,163 +1727,52 @@
AC_SUBST(PREFERRED_STACK_BOUNDARY)
-# does this compiler support -Wno-pointer-sign ?
-AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
-
-safe_CFLAGS=$CFLAGS
-CFLAGS="-Wno-pointer-sign"
-
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
- return 0;
-]])], [
-no_pointer_sign=yes
-AC_MSG_RESULT([yes])
-], [
-no_pointer_sign=no
-AC_MSG_RESULT([no])
-])
-CFLAGS=$safe_CFLAGS
-
-AM_CONDITIONAL(HAS_POINTER_SIGN_WARNING, test x$no_pointer_sign = xyes)
-
-
-# does this compiler support -Wno-write-strings ?
-AC_MSG_CHECKING([if gcc accepts -Wwrite-strings])
-
-safe_CFLAGS=$CFLAGS
-CFLAGS="-Wwrite-strings"
-
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
- return 0;
-]])], [
-no_write_strings=yes
-AC_MSG_RESULT([yes])
-], [
-no_write_strings=no
-AC_MSG_RESULT([no])
-])
-CFLAGS=$safe_CFLAGS
-
-if test x$no_write_strings = xyes; then
- CFLAGS="$CFLAGS -Wwrite-strings"
- CXXFLAGS="$CXXFLAGS -Wwrite-strings"
-fi
-
-AM_CONDITIONAL(HAS_WRITE_STRINGS_WARNING, test x$no_write_strings = xyes)
-
-# does this compiler support -Wno-empty-body ?
-
-AC_MSG_CHECKING([if gcc accepts -Wno-empty-body])
-
-safe_CFLAGS=$CFLAGS
-CFLAGS="-Wno-empty-body"
-
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
- return 0;
-]])], [
-AC_SUBST([FLAG_W_NO_EMPTY_BODY], [-Wno-empty-body])
-AC_MSG_RESULT([yes])
-], [
-AC_SUBST([FLAG_W_NO_EMPTY_BODY], [])
-AC_MSG_RESULT([no])
-])
-CFLAGS=$safe_CFLAGS
-
-
-# does this compiler support -Wno-format-zero-length ?
-
-AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
-
-safe_CFLAGS=$CFLAGS
-CFLAGS="-Wno-format-zero-length"
-
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
- return 0;
-]])], [
-AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
-AC_MSG_RESULT([yes])
-], [
-AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
-AC_MSG_RESULT([no])
-])
+# Convenience function to check whether GCC supports a particular
+# warning option. Takes two arguments, first the warning flag name
+# to check (without -W), then the conditional name to set if that
+# warning flag is supported.
+AC_DEFUN([AC_GCC_WARNING_COND],[
+AC_MSG_CHECKING([if gcc accepts -W$1])
+safe_CFLAGS=$CLFLAGS
+CFLAGS="-W$1"
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
+has_warning_flag=yes
+AC_MSG_RESULT([yes])], [
+has_warning_flag=no
+AC_MSG_RESULT([no])])
CFLAGS=$safe_CFLAGS
+AM_CONDITIONAL([$2], test x$has_warning_flag = xyes)]
+)
+AC_GCC_WARNING_COND([pointer-sign], [HAS_POINTER_SIGN_WARNING])
+AC_GCC_WARNING_COND([write-strings], [HAS_WRITE_STRINGS_WARNING])
-# does this compiler support -Wno-tautological-compare ?
-
-AC_MSG_CHECKING([if gcc accepts -Wno-tautological-compare])
-
-safe_CFLAGS=$CFLAGS
-CFLAGS="-Wno-tautological-compare"
-
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
- return 0;
-]])], [
-AC_SUBST([FLAG_W_NO_TAUTOLOGICAL_COMPARE], [-Wno-tautological-compare])
-AC_MSG_RESULT([yes])
-], [
-AC_SUBST([FLAG_W_NO_TAUTOLOGICAL_COMPARE], [])
-AC_MSG_RESULT([no])
-])
-CFLAGS=$safe_CFLAGS
-
-
-# does this compiler support -Wno-nonnull ?
-
-AC_MSG_CHECKING([if gcc accepts -Wno-nonnull])
-
-safe_CFLAGS=$CFLAGS
-CFLAGS="-Wno-nonnull"
-
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
- return 0;
-]])], [
-AC_SUBST([FLAG_W_NO_NONNULL], [-Wno-nonnull])
-AC_MSG_RESULT([yes])
-], [
-AC_SUBST([FLAG_W_NO_NONNULL], [])
-AC_MSG_RESULT([no])
-])
-CFLAGS=$safe_CFLAGS
-
-
-# does this compiler support -Wno-overflow ?
-
-AC_MSG_CHECKING([if gcc accepts -Wno-overflow])
-
-safe_CFLAGS=$CFLAGS
-CFLAGS="-Wno-overflow"
-
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
- return 0;
-]])], [
-AC_SUBST([FLAG_W_NO_OVERFLOW], [-Wno-overflow])
-AC_MSG_RESULT([yes])
-], [
-AC_SUBST([FLAG_W_NO_OVERFLOW], [])
-AC_MSG_RESULT([no])
-])
+# Convenience function to check whether GCC supports a particular
+# warning option. Similar to AC_GCC_WARNING_COND, but does a
+# substitution instead of setting an conditional. Takes two arguments,
+# first the warning flag name to check (without -W), then the
+# substitution name to set with -Wno-warning-flag if the flag exists,
+# or the empty string if the compiler doesn't accept the flag. Note
+# that checking is done against the warning flag itself, but the
+# substitution is then done to cancel the warning flag.
+AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[
+AC_MSG_CHECKING([if gcc accepts -W$1])
+safe_CFLAGS=$CLFLAGS
+CFLAGS="-W$1"
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
+AC_SUBST([$2], [-Wno-$1])
+AC_MSG_RESULT([yes])], [
+AC_SUBST([$2], [])
+AC_MSG_RESULT([no])])
CFLAGS=$safe_CFLAGS
-
-
-# does this compiler support -Wno-uninitialized ?
-
-AC_MSG_CHECKING([if gcc accepts -Wno-uninitialized])
-
-safe_CFLAGS=$CFLAGS
-CFLAGS="-Wno-uninitialized"
-
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
- return 0;
-]])], [
-AC_SUBST([FLAG_W_NO_UNINITIALIZED], [-Wno-uninitialized])
-AC_MSG_RESULT([yes])
-], [
-AC_SUBST([FLAG_W_NO_UNINITIALIZED], [])
-AC_MSG_RESULT([no])
])
-CFLAGS=$safe_CFLAGS
+AC_GCC_WARNING_SUBST_NO([empty-body], [FLAG_W_NO_EMPTY_BODY])
+AC_GCC_WARNING_SUBST_NO([format-zero-length], [FLAG_W_NO_FORMAT_ZERO_LENGTH])
+AC_GCC_WARNING_SUBST_NO([tautological-compare], [FLAG_W_NO_TAUTOLOGICAL_COMPARE])
+AC_GCC_WARNING_SUBST_NO([nonnull], [FLAG_W_NO_NONNULL])
+AC_GCC_WARNING_SUBST_NO([overflow], [FLAG_W_NO_OVERFLOW])
+AC_GCC_WARNING_SUBST_NO([uninitialized], [FLAG_W_NO_UNINITIALIZED])
# does this compiler support -Wextra or the older -W ?
@@ -2652,7 +2541,8 @@
# Note: this is a kludge in that it assumes the specified mpicc
# understands -m32/-m64 regardless of what is specified using
# --with-mpicc=.
-MPI_CC="mpicc"
+AC_PATH_PROG([MPI_CC], [mpicc], [mpicc],
+ [$PATH:/usr/lib/openmpi/bin:/usr/lib64/openmpi/bin])
mflag_primary=
if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
Modified: branches/BUF_REMOVAL/coregrind/m_clientstate.c
==============================================================================
--- branches/BUF_REMOVAL/coregrind/m_clientstate.c (original)
+++ branches/BUF_REMOVAL/coregrind/m_clientstate.c Fri Aug 22 17:14:22 2014
@@ -107,6 +107,11 @@
VG_(get_StackTrace) in m_stacktrace.c for further info. */
Addr VG_(client__dl_sysinfo_int80) = 0;
+/* Address of the (internal) glibc nptl pthread stack cache size,
+ declared as:
+ static size_t stack_cache_actsize;
+ in nptl/allocatestack.c */
+SizeT* VG_(client__stack_cache_actsize__addr) = 0;
/*--------------------------------------------------------------------*/
/*--- end ---*/
Modified: branches/BUF_REMOVAL/coregrind/m_initimg/initimg-darwin.c
==============================================================================
--- branches/BUF_REMOVAL/coregrind/m_initimg/initimg-darwin.c (original)
+++ branches/BUF_REMOVAL/coregrind/m_initimg/initimg-darwin.c Fri Aug 22 17:14:22 2014
@@ -333,7 +333,6 @@
Addr client_SP; /* client stack base (initial SP) */
Addr clstack_start;
Int i;
- Bool have_exename;
vg_assert(VG_IS_PAGE_ALIGNED(clstack_end+1));
vg_assert( VG_(args_for_client) );
@@ -343,7 +342,6 @@
/* first of all, work out how big the client stack will be */
stringsize = 0;
auxsize = 0;
- have_exename = VG_(args_the_exename) != NULL;
/* paste on the extra args if the loader needs them (ie, the #!
interpreter and its argument) */
@@ -358,8 +356,7 @@
}
/* now scan the args we're given... */
- if (have_exename)
- stringsize += VG_(strlen)( VG_(args_the_exename) ) + 1;
+ stringsize += VG_(strlen)( VG_(args_the_exename) ) + 1;
for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
argc++;
@@ -387,7 +384,7 @@
/* OK, now we know how big the client stack is */
stacksize =
sizeof(Word) + /* argc */
- (have_exename ? sizeof(HChar **) : 0) + /* argc[0] == exename */
+ sizeof(HChar **) + /* argc[0] == exename */
sizeof(HChar **)*argc + /* argv */
sizeof(HChar **) + /* terminal NULL */
sizeof(HChar **)*envc + /* envp */
@@ -435,7 +432,7 @@
if (info->dynamic) *ptr++ = info->text;
/* --- client argc --- */
- *ptr++ = (Addr)(argc + (have_exename ? 1 : 0));
+ *ptr++ = (Addr)(argc + 1);
/* --- client argv --- */
if (info->interp_name) {
@@ -447,8 +444,7 @@
VG_(free)(info->interp_args);
}
- if (have_exename)
- *ptr++ = (Addr)copy_str(&strtab, VG_(args_the_exename));
+ *ptr++ = (Addr)copy_str(&strtab, VG_(args_the_exename));
for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
*ptr++ = (Addr)copy_str(
Modified: branches/BUF_REMOVAL/coregrind/m_initimg/initimg-linux.c
==============================================================================
--- branches/BUF_REMOVAL/coregrind/m_initimg/initimg-linux.c (original)
+++ branches/BUF_REMOVAL/coregrind/m_initimg/initimg-linux.c Fri Aug 22 17:14:22 2014
@@ -400,7 +400,6 @@
Addr client_SP; /* client stack base (initial SP) */
Addr clstack_start;
Int i;
- Bool have_exename;
vg_assert(VG_IS_PAGE_ALIGNED(clstack_end+1));
vg_assert( VG_(args_for_client) );
@@ -412,7 +411,6 @@
/* first of all, work out how big the client stack will be */
stringsize = 0;
- have_exename = VG_(args_the_exename) != NULL;
/* paste on the extra args if the loader needs them (ie, the #!
interpreter and its argument) */
@@ -427,8 +425,7 @@
}
/* now scan the args we're given... */
- if (have_exename)
- stringsize += VG_(strlen)( VG_(args_the_exename) ) + 1;
+ stringsize += VG_(strlen)( VG_(args_the_exename) ) + 1;
for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
argc++;
@@ -452,7 +449,7 @@
stringsize += VG_(strlen)(cauxv->u.a_ptr) + 1;
else if (cauxv->a_type == AT_RANDOM)
stringsize += 16;
- else if (cauxv->a_type == AT_EXECFN && have_exename)
+ else if (cauxv->a_type == AT_EXECFN)
stringsize += VG_(strlen)(VG_(args_the_exename)) + 1;
auxsize += sizeof(*cauxv);
}
@@ -465,7 +462,7 @@
/* OK, now we know how big the client stack is */
stacksize =
sizeof(Word) + /* argc */
- (have_exename ? sizeof(HChar **) : 0) + /* argc[0] == exename */
+ sizeof(HChar **) + /* argc[0] == exename */
sizeof(HChar **)*argc + /* argv */
sizeof(HChar **) + /* terminal NULL */
sizeof(HChar **)*envc + /* envp */
@@ -577,7 +574,7 @@
ptr = (Addr*)client_SP;
/* --- client argc --- */
- *ptr++ = argc + (have_exename ? 1 : 0);
+ *ptr++ = argc + 1;
/* --- client argv --- */
if (info->interp_name) {
@@ -589,8 +586,7 @@
VG_(free)(info->interp_args);
}
- if (have_exename)
- *ptr++ = (Addr)copy_str(&strtab, VG_(args_the_exename));
+ *ptr++ = (Addr)copy_str(&strtab, VG_(args_the_exename));
for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
*ptr++ = (Addr)copy_str(
Modified: branches/BUF_REMOVAL/coregrind/m_libcbase.c
==============================================================================
--- branches/BUF_REMOVAL/coregrind/m_libcbase.c (original)
+++ branches/BUF_REMOVAL/coregrind/m_libcbase.c Fri Aug 22 17:14:22 2014
@@ -509,6 +509,7 @@
}
Bool VG_(parse_enum_set) ( const HChar *tokens,
+ Bool allow_all,
const HChar *input,
UInt *enum_set)
{
@@ -537,7 +538,7 @@
input_word;
input_word = VG_(strtok_r)(NULL, ",", &input_saveptr)) {
word_nr++;
- if (0 == VG_(strcmp)(input_word, "all")) {
+ if (allow_all && 0 == VG_(strcmp)(input_word, "all")) {
seen_all_kw = True;
known_words++;
} else if (0 == VG_(strcmp)(input_word, "none")) {
Modified: branches/BUF_REMOVAL/coregrind/m_libcprint.c
==============================================================================
--- branches/BUF_REMOVAL/coregrind/m_libcprint.c (original)
+++ branches/BUF_REMOVAL/coregrind/m_libcprint.c Fri Aug 22 17:14:22 2014
@@ -488,7 +488,8 @@
// (useful to run regression tests in an outer/inner setup
// and avoid the diff failing due to these unexpected '>').
depth = RUNNING_ON_VALGRIND;
- if (depth > 0 && !VG_(strstr)(VG_(clo_sim_hints), "no-inner-prefix")) {
+ if (depth > 0
+ && !SimHintiS(SimHint_no_inner_prefix, VG_(clo_sim_hints))) {
if (depth > 10)
depth = 10; // ?!?!
for (i = 0; i < depth; i++) {
Modified: branches/BUF_REMOVAL/coregrind/m_main.c
==============================================================================
--- branches/BUF_REMOVAL/coregrind/m_main.c (original)
+++ branches/BUF_REMOVAL/coregrind/m_main.c Fri Aug 22 17:14:22 2014
@@ -174,11 +174,13 @@
" --vgdb-shadow-registers=no|yes let gdb see the shadow registers [no]\n"
" --vgdb-prefix=<prefix> prefix for vgdb FIFOs [%s]\n"
" --run-libc-freeres=no|yes free up glibc memory at exit on Linux? [yes]\n"
-" --sim-hints=hint1,hint2,... known hints:\n"
-" lax-ioctls, enable-outer, fuse-compatible [none]\n"
+" --sim-hints=hint1,hint2,... activate unusual sim behaviours [none] \n"
+" where hint is one of lax-ioctls fuse-compatible enable-outer\n"
+" no-inner-prefix no-nptl-pthread-stackcache none\n"
" --fair-sched=no|yes|try schedule threads fairly on multicore systems [no]\n"
-" --kernel-variant=variant1,variant2,... known variants: bproc [none]\n"
-" handle non-standard kernel variants\n"
+" --kernel-variant=variant1,variant2,... handle non-standard kernel"
+ " variants [none]\n"
+" where variant is one of bproc none\n"
" --merge-recursive-frames=<number> merge frames between identical\n"
" program counters in max <number> frames) [0]\n"
" --num-transtab-sectors=<number> size of translated code cache [%d]\n"
@@ -376,7 +378,11 @@
// Set up VG_(clo_sim_hints). This is needed a.o. for an inner
// running in an outer, to have "no-inner-prefix" enabled
// as early as possible.
- else if VG_STR_CLO (str, "--sim-hints", VG_(clo_sim_hints)) {}
+ else if VG_USETX_CLO (str, "--sim-hints",
+ "no-inner-prefix,fuse-compatible,"
+ "lax-ioctls,enable-outer,"
+ "no-nptl-pthread-stackcache",
+ VG_(clo_sim_hints)) {}
}
}
@@ -545,11 +551,9 @@
}
else if VG_INT_CLO (arg, "--vgdb-poll", VG_(clo_vgdb_poll)) {}
else if VG_INT_CLO (arg, "--vgdb-error", VG_(clo_vgdb_error)) {}
- else if VG_STR_CLO (arg, "--vgdb-stop-at", tmp_str) {
- if (!VG_(parse_enum_set)("startup,exit,valgrindabexit", tmp_str,
- &VG_(clo_vgdb_stop_at)))
- VG_(fmsg_bad_option)(arg, "");
- }
+ else if VG_USET_CLO (arg, "--vgdb-stop-at",
+ "startup,exit,valgrindabexit",
+ VG_(clo_vgdb_stop_at)) {}
else if VG_STR_CLO (arg, "--vgdb-prefix", VG_(clo_vgdb_prefix)) {
VG_(arg_vgdb_prefix) = arg;
}
@@ -622,7 +626,8 @@
VG_(clo_smc_check),
Vg_SmcAllNonFile);
- else if VG_STR_CLO (arg, "--kernel-variant", VG_(clo_kernel_variant)) {}
+ else if VG_USETX_CLO (arg, "--kernel-variant", "bproc",
+ VG_(clo_kernel_variant)) {}
else if VG_BOOL_CLO(arg, "--dsymutil", VG_(clo_dsymutil)) {}
@@ -1270,8 +1275,7 @@
// paste the command line (because of the "==pid==" prefixes), so we now
// favour utility and simplicity over aesthetics.
umsg_or_xml("%sCommand: ", xpre);
- if (VG_(args_the_exename))
- umsg_or_xml_arg(VG_(args_the_exename));
+ umsg_or_xml_arg(VG_(args_the_exename));
for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
HChar* s = *(HChar**)VG_(indexXA)( VG_(args_for_client), i );
@@ -1322,8 +1326,7 @@
VG_(printf_xml)(" </vargv>\n");
VG_(printf_xml)(" <argv>\n");
- if (VG_(args_the_exename))
- VG_(printf_xml)(" <exe>%pS</exe>\n",
+ VG_(printf_xml)(" <exe>%pS</exe>\n",
VG_(args_the_exename));
for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
VG_(printf_xml)(
@@ -1869,8 +1872,7 @@
VG_(err_config_error)("Can't create client cmdline file in %s\n", buf2);
nul[0] = 0;
- exename = VG_(args_the_exename) ? VG_(args_the_exename)
- : "unknown_exename";
+ exename = VG_(args_the_exename);
VG_(write)(fd, exename, VG_(strlen)( exename ));
VG_(write)(fd, nul, 1);
Modified: branches/BUF_REMOVAL/coregrind/m_options.c
==============================================================================
--- branches/BUF_REMOVAL/coregrind/m_options.c (original)
+++ branches/BUF_REMOVAL/coregrind/m_options.c Fri Aug 22 17:14:22 2014
@@ -112,7 +112,7 @@
Int VG_(clo_dump_error) = 0;
Int VG_(clo_backtrace_size) = 12;
Int VG_(clo_merge_recursive_frames) = 0; // default value: no merge
-const HChar* VG_(clo_sim_hints) = NULL;
+UInt VG_(clo_sim_hints) = 0;
Bool VG_(clo_sym_offsets) = False;
Bool VG_(clo_read_inline_info) = False; // Or should be put it to True by default ???
Bool VG_(clo_read_var_info) = False;
@@ -127,7 +127,7 @@
Word VG_(clo_main_stacksize) = 0; /* use client's rlimit.stack */
Bool VG_(clo_wait_for_gdb) = False;
VgSmc VG_(clo_smc_check) = Vg_SmcStack;
-const HChar* VG_(clo_kernel_variant) = NULL;
+UInt VG_(clo_kernel_variant) = 0;
Bool VG_(clo_dsymutil) = False;
Bool VG_(clo_sigill_diag) = True;
UInt VG_(clo_unw_stack_scan_thresh) = 0; /* disabled by default */
Modified: branches/BUF_REMOVAL/coregrind/m_redir.c
==============================================================================
--- branches/BUF_REMOVAL/coregrind/m_redir.c (original)
+++ branches/BUF_REMOVAL/coregrind/m_redir.c Fri Aug 22 17:14:22 2014
@@ -401,6 +401,10 @@
Bool check_ppcTOCs = False;
Bool isText;
const HChar* newdi_soname;
+ Bool dehacktivate_pthread_stack_cache_var_search = False;
+ const HChar* const pthread_soname = "libpthread.so.0";
+ const HChar* const pthread_stack_cache_actsize_varname
+ = "stack_cache_actsize";
# if defined(VG_PLAT_USES_PPCTOC)
check_ppcTOCs = True;
@@ -495,6 +499,10 @@
specList = NULL; /* the spec list we're building up */
+ dehacktivate_pthread_stack_cache_var_search =
+ SimHintiS(SimHint_no_nptl_pthread_stackcache, VG_(clo_sim_hints))
+ && 0 == VG_(strcmp)(newdi_soname, pthread_soname);
+
nsyms = VG_(DebugInfo_syms_howmany)( newdi );
for (i = 0; i < nsyms; i++) {
VG_(DebugInfo_syms_getidx)( newdi, i, &sym_avmas,
@@ -511,8 +519,22 @@
&demangled_fnpatt,
&isWrap, &becTag, &becPrio );
/* ignore data symbols */
- if (!isText)
+ if (!isText) {
+ /* But search for dehacktivate stack cache var if needed. */
+ if (dehacktivate_pthread_stack_cache_var_search
+ && 0 == VG_(strcmp)(*names,
+ pthread_stack_cache_actsize_varname)) {
+ if ( VG_(clo_verbosity) > 1 ) {
+ VG_(message)( Vg_DebugMsg,
+ "deactivate nptl pthread stackcache via kludge:"
+ " found symbol %s at addr %p\n",
+ *names, (void*) sym_avmas.main);
+ }
+ VG_(client__stack_cache_actsize__addr) = (SizeT*) sym_avmas.main;
+ dehacktivate_pthread_stack_cache_var_search = False;
+ }
continue;
+ }
if (!ok) {
/* It's not a full-scale redirect, but perhaps it is a load-notify
fn? Let the load-notify department see it. */
@@ -587,6 +609,13 @@
}
free_symname_array(names_init, &twoslots[0]);
}
+ if (dehacktivate_pthread_stack_cache_var_search) {
+ VG_(message)(Vg_DebugMsg,
+ "WARNING: could not find symbol for var %s in %s\n",
+ pthread_stack_cache_actsize_varname, pthread_soname);
+ VG_(message)(Vg_DebugMsg,
+ "=> pthread stack cache cannot be disabled!\n");
+ }
if (check_ppcTOCs) {
for (i = 0; i < nsyms; i++) {
Modified: branches/BUF_REMOVAL/coregrind/m_scheduler/scheduler.c
==============================================================================
--- branches/BUF_REMOVAL/coregrind/m_scheduler/scheduler.c (original)
+++ branches/BUF_REMOVAL/coregrind/m_scheduler/scheduler.c Fri Aug 22 17:14:22 2014
@@ -61,14 +61,15 @@
#include "pub_core_basics.h"
#include "pub_core_debuglog.h"
#include "pub_core_vki.h"
-#include "pub_core_vkiscnums.h" // __NR_sched_yield
-#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
+#include "pub_core_vkiscnums.h" // __NR_sched_yield
+#include "pub_core_libcsetjmp.h" // to keep _threadstate.h happy
#include "pub_core_threadstate.h"
+#include "pub_core_clientstate.h"
#include "pub_core_aspacemgr.h"
-#include "pub_core_clreq.h" // for VG_USERREQ__*
+#include "pub_core_clreq.h" // for VG_USERREQ__*
#include "pub_core_dispatch.h"
-#include "pub_core_errormgr.h" // For VG_(get_n_errs_found)()
-#include "pub_core_gdbserver.h" // for VG_(gdbserver) and VG_(gdbserver_activity)
+#include "pub_core_errormgr.h" // For VG_(get_n_errs_found)()
+#include "pub_core_gdbserver.h" // for VG_(gdbserver)/VG_(gdbserver_activity)
#include "pub_core_libcbase.h"
#include "pub_core_libcassert.h"
#include "pub_core_libcprint.h"
@@ -1210,6 +1211,30 @@
}
}
+ if (SimHintiS(SimHint_no_nptl_pthread_stackcache, VG_(clo_sim_hints))
+ && tid != 1) {
+ /* We disable the stack cache the first time we see a thread other
+ than the main thread appearing. At this moment, we are sure the pthread
+ lib loading is done/variable was initialised by pthread lib/... */
+ if (VG_(client__stack_cache_actsize__addr)) {
+ if (*VG_(client__stack_cache_actsize__addr) == 0) {
+ VG_(debugLog)(1,"sched",
+ "pthread stack cache size disable done"
+ " via kludge\n");
+ *VG_(client__stack_cache_actsize__addr) = 1000 * 1000 * 1000;
+ /* Set a value big enough to be above the hardcoded maximum stack
+ cache size in glibc, small enough to allow a pthread stack size
+ to be added without risk of overflow. */
+ }
+ } else {
+ VG_(debugLog)(0,"sched",
+ "WARNING: pthread stack cache cannot be disabled!\n");
+ VG_(clo_sim_hints) &= !SimHint2S(SimHint_no_nptl_pthread_stackcache);
+ /* Remove SimHint_no_nptl_pthread_stackcache from VG_(clo_sim_hints)
+ to avoid having a msg for all following threads. */
+ }
+ }
+
/* set the proper running signal mask */
block_signals();
Modified: branches/BUF_REMOVAL/coregrind/m_syswrap/priv_types_n_macros.h
==============================================================================
--- branches/BUF_REMOVAL/coregrind/m_syswrap/priv_types_n_macros.h (original)
+++ branches/BUF_REMOVAL/coregrind/m_syswrap/priv_types_n_macros.h Fri Aug 22 17:14:22 2014
@@ -368,8 +368,8 @@
if (VG_(clo_trace_syscalls)) \
VG_(printf)(format, ## args)
-#define FUSE_COMPATIBLE_MAY_BLOCK() \
- if (VG_(strstr)(VG_(clo_sim_hints),"fuse-compatible")) \
+#define FUSE_COMPATIBLE_MAY_BLOCK() \
+ if (SimHintiS(SimHint_fuse_compatible, VG_(clo_sim_hints))) \
*flags |= SfMayBlock
Modified: branches/BUF_REMOVAL/coregrind/m_syswrap/syswrap-amd64-linux.c
==============================================================================
--- branches/BUF_REMOVAL/coregrind/m_syswrap/syswrap-amd64-linux.c (original)
+++ branches/BUF_REMOVAL/coregrind/m_syswrap/syswrap-amd64-linux.c Fri Aug 22 17:14:22 2014
@@ -664,7 +664,7 @@
/* 184 is used by sys_bproc. If we're not on a declared bproc
variant, fail in the usual way, since it is otherwise unused. */
- if (!VG_(strstr)(VG_(clo_kernel_variant), "bproc")) {
+ if (!KernelVariantiS(KernelVariant_bproc, VG_(clo_kernel_variant))) {
PRINT("non-existent syscall! (syscall 184)");
PRE_REG_READ0(long, "ni_syscall(184)");
SET_STATUS_Failure( VKI_ENOSYS );
Modified: branches/BUF_REMOVAL/coregrind/m_syswrap/syswrap-generic.c
==============================================================================
--- branches/BUF_REMOVAL/coregrind/m_syswrap/syswrap-generic.c (original)
+++ branches/BUF_REMOVAL/coregrind/m_syswrap/syswrap-generic.c Fri Aug 22 17:14:22 2014
@@ -1085,6 +1085,11 @@
break;
# endif
+# ifdef VKI_AF_UNSPEC
+ case VKI_AF_UNSPEC:
+ break;
+# endif
+
default:
/* No specific information about this address family.
Let's just check the full data following the family.
@@ -3434,7 +3439,7 @@
UInt dir = _VKI_IOC_DIR(request);
UInt size = _VKI_IOC_SIZE(request);
- if (VG_(strstr)(VG_(clo_sim_hints), "lax-ioctls") != NULL) {
+ if (SimHintiS(SimHint_lax_ioctls, VG_(clo_sim_hints))) {
/*
* Be very lax about ioctl handling; the only
* assumption is that the size is correct. Doesn't
@@ -3844,7 +3849,7 @@
--sim-hints=enable-outer (used for self hosting). */
ok = ML_(fd_allowed)(ARG1, "write", tid, False);
if (!ok && ARG1 == 2/*stderr*/
- && VG_(strstr)(VG_(clo_sim_hints),"enable-outer"))
+ && SimHintiS(SimHint_enable_outer, VG_(clo_sim_hints)))
ok = True;
if (!ok)
SET_STATUS_Failure( VKI_EBADF );
Modified: branches/BUF_REMOVAL/coregrind/m_syswrap/syswrap-x86-linux.c
==============================================================================
--- branches/BUF_REMOVAL/coregrind/m_syswrap/syswrap-x86-linux.c (original)
+++ branches/BUF_REMOVAL/coregrind/m_syswrap/syswrap-x86-linux.c Fri Aug 22 17:14:22 2014
@@ -1368,7 +1368,7 @@
/* 223 is used by sys_bproc. If we're not on a declared bproc
variant, fail in the usual way. */
- if (!VG_(strstr)(VG_(clo_kernel_variant), "bproc")) {
+ if (!KernelVariantiS(KernelVariant_bproc, VG_(clo_kernel_variant))) {
PRINT("non-existent syscall! (syscall 223)");
PRE_REG_READ0(long, "ni_syscall(223)");
SET_STATUS_Failure( VKI_ENOSYS );
Modified: branches/BUF_REMOVAL/coregrind/pub_core_clientstate.h
==============================================================================
--- branches/BUF_REMOVAL/coregrind/pub_core_clientstate.h (original)
+++ branches/BUF_REMOVAL/coregrind/pub_core_clientstate.h Fri Aug 22 17:14:22 2014
@@ -93,6 +93,24 @@
extern Addr VG_(client__dl_sysinfo_int80);
+/* glibc nptl pthread systems only, when no-nptl-pthread-stackcache
+ was given in --sim-hints.
+ Used for a (kludgy) way to disable the cache of stacks as implemented in
+ nptl glibc.
+ Based on internal knowledge of the pthread glibc nptl/allocatestack.c code:
+ a huge value in stack_cache_actsize (bigger than the constant
+ stack_cache_maxsize) makes glibc believes the cache is full
+ and so stacks are always released when a pthread terminates.
+ Several ugliness in this kludge:
+ * hardcodes private glibc var name "stack_cache_maxsize"
+ * based on knowledge of the code of the functions
+ queue_stack and __free_stacks
+ * static symbol for "stack_cache_maxsize" must be in
+ the debug info.
+ It would be much cleaner to have a documented and supported
+ way to disable the pthread stack cache. */
+extern SizeT* VG_(client__stack_cache_actsize__addr);
+
#endif // __PUB_CORE_CLIENTSTATE_H
/*--------------------------------------------------------------------*/
Modified: branches/BUF_REMOVAL/coregrind/pub_core_options.h
==============================================================================
--- branches/BUF_REMOVAL/coregrind/pub_core_options.h (original)
+++ branches/BUF_REMOVAL/coregrind/pub_core_options.h Fri Aug 22 17:14:22 2014
@@ -36,7 +36,6 @@
// plus some functions and macros for manipulating them. Almost every
// other module imports this one, if only for VG_(clo_verbosity).
//--------------------------------------------------------------------
-
#include "pub_tool_options.h"
/* The max number of suppression files. */
@@ -82,11 +81,6 @@
#define VgdbStopAt2S(a) (1 << (a))
// VgdbStopAt a is member of the Set s ?
#define VgdbStopAtiS(a,s) ((s) & VgdbStopAt2S(a))
-// A set with all VgdbStopAt:
-#define VgdbStopAtallS \
- (VgdbStopAt2S(VgdbStopAt_Startup) \
- | VgdbStopAt2S(VgdbStopAt_Exit) \
- | VgdbStopAt2S(VgdbStopAt_ValgrindAbExit)
extern UInt VG_(clo_vgdb_stop_at); // A set of VgdbStopAt reasons.
/* prefix for the named pipes (FIFOs) used by vgdb/gdb to communicate with valgrind */
@@ -225,8 +219,24 @@
/* DEBUG: display gory details for the k'th most popular error.
default: Infinity. */
extern Int VG_(clo_dump_error);
+
/* Engage miscellaneous weird hacks needed for some progs. */
-extern const HChar* VG_(clo_sim_hints);
+typedef
+ enum {
+ SimHint_lax_ioctls,
+ SimHint_fuse_compatible,
+ SimHint_enable_outer,
+ SimHint_no_inner_prefix,
+ SimHint_no_nptl_pthread_stackcache
+ }
+ SimHint;
+
+// Build mask to check or set SimHint a membership
+#define SimHint2S(a) (1 << (a))
+// SimHint h is member of the Set s ?
+#define SimHintiS(h,s) ((s) & SimHint2S(h))
+extern UInt VG_(clo_sim_hints);
+
/* Show symbols in the form 'name+offset' ? Default: NO */
extern Bool VG_(clo_sym_offsets);
/* Read DWARF3 inline info ? */
@@ -326,9 +336,17 @@
auto-detected. */
extern VgSmc VG_(clo_smc_check);
-/* String containing comma-separated names of minor kernel variants,
+/* A set of minor kernel variants,
so they can be properly handled by m_syswrap. */
-extern const HChar* VG_(clo_kernel_variant);
+typedef enum {
+ KernelVariant_bproc
+ }
+ KernelVariant;
+// Build mask to check or set KernelVariant a membership
+#define KernelVariant2S(v) (1 << (v))
+// KernelVariant v is member of the Set s ?
+#define KernelVariantiS(v,s) ((s) & KernelVariant2S(v))
+extern UInt VG_(clo_kernel_variant);
/* Darwin-specific: automatically run /usr/bin/dsymutil to update
.dSYM directories as necessary? */
Modified: branches/BUF_REMOVAL/docs/xml/FAQ.xml
==============================================================================
--- branches/BUF_REMOVAL/docs/xml/FAQ.xml (original)
+++ branches/BUF_REMOVAL/docs/xml/FAQ.xml Fri Aug 22 17:14:22 2014
@@ -36,7 +36,7 @@
<para>How do you pronounce "Valgrind"?</para>
</question>
<answer id="a-pronounce">
- <para>The "Val" as in the world "value". The "grind" is pronounced
+ <para>The "Val" as in the word "value". The "grind" is pronounced
with a short 'i' -- ie. "grinned" (rhymes with "tinned") rather than
"grined" (rhymes with "find").</para> <para>Don't feel bad: almost
everyone gets it wrong at first.</para>
Modified: branches/BUF_REMOVAL/docs/xml/manual-core.xml
==============================================================================
--- branches/BUF_REMOVAL/docs/xml/manual-core.xml (original)
+++ branches/BUF_REMOVAL/docs/xml/manual-core.xml Fri Aug 22 17:14:22 2014
@@ -1956,6 +1956,7 @@
the simulated behaviour in nonstandard or dangerous ways, possibly
to help the simulation of strange features. By default no hints
are enabled. Use with caution! Currently known hints are:</para>
+
<itemizedlist>
<listitem>
<para><option>lax-ioctls: </option> Be very lax about ioctl
@@ -1965,11 +1966,23 @@
large number of strange ioctl commands becomes very
tiresome.</para>
</listitem>
+
+ <listitem>
+ <para><option>fuse-compatible: </option> Enable special
+ handling for certain system calls that may block in a FUSE
+ file-system. This may be necessary when running Valgrind
+ on a multi-threaded program that uses one thread to manage
+ a FUSE file-system and another thread to access that
+ file-system.
+ </para>
+ </listitem>
+
<listitem>
<para><option>enable-outer: </option> Enable some special
magic needed when the program being run is itself
Valgrind.</para>
</listitem>
+
<listitem>
<para><option>no-inner-prefix: </option> Disable printing
a prefix <option>></option> in front of each stdout or
@@ -1980,13 +1993,39 @@
front of the inner debug logging lines.</para>
</listitem>
<listitem>
- <para><option>fuse-compatible: </option> Enable special
- handling for certain system calls that may block in a FUSE
- file-system. This may be necessary when running Valgrind
- on a multi-threaded program that uses one thread to manage
- a FUSE file-system and another thread to access that
- file-system.
- </para>
+ <para><option>no-nptl-pthread-stackcache: </option>
+ This hint is only relevant when running Valgrind on Linux.</para>
+
+ <para>The GNU glibc pthread library
+ (<function>libpthread.so</function>), which is used by
+ pthread programs, maintains a cache of pthread stacks.
+ When a pthread terminates, the memory used for the pthread
+ stack and some thread local storage related data structure
+ are not always directly released. This memory is kept in
+ a cache (up to a certain size), and is re-used if a new
+ thread is started.</para>
+
+ <para>This cache causes the helgrind tool to report some
+ false positive race condition errors on this cached
+ memory, as helgrind does not understand the internal glibc
+ cache synchronisation primitives. So, when using helgrind,
+ disabling the cache helps to avoid false positive race
+ conditions, in particular when using thread local storage
+ variables (e.g. variables using the
+ <function>__thread</function> qualifier).</para>
+
+ <para>When using the memcheck tool, disabling the cache
+ ensures the memory used by glibc to handle __thread
+ variables is directly released when a thread
+ terminates.</para>
+
+ <para>Note: Valgrind disables the cache using some internal
+ knowledge of the glibc stack cache implementation and by
+ examining the debug information of the pthread
+ library. This technique is thus somewhat fragile and might
+ not work for all glibc versions. This has been succesfully
+ tested with various glibc versions (e.g. 2.11, 2.16, 2.18)
+ on various platforms.</para>
</listitem>
</itemizedlist>
</listitem>
Modified: branches/BUF_REMOVAL/drd/tests/Makefile.am
==============================================================================
--- branches/BUF_REMOVAL/drd/tests/Makefile.am (original)
+++ branches/BUF_REMOVAL/drd/tests/Makefile.am Fri Aug 22 17:14:22 2014
@@ -323,6 +323,8 @@
threaded-fork.vgtest \
threaded-fork-vcs.stderr.exp \
threaded-fork-vcs.vgtest \
+ tls_threads.stderr.exp \
+ tls_threads.vgtest \
trylock.stderr.exp \
trylock.vgtest \
unit_bitmap.stderr.exp \
Modified: branches/BUF_REMOVAL/exp-sgcheck/tests/hackedbz2.c
==============================================================================
--- branches/BUF_REMOVAL/exp-sgcheck/tests/hackedbz2.c (original)
+++ branches/BUF_REMOVAL/exp-sgcheck/tests/hackedbz2.c Fri Aug 22 17:14:22 2014
@@ -999,8 +999,8 @@
else
return c;
}
-
-static Int vex_strlen ( const HChar* str )
+/* Explicitly set noinline so the test can check it is in the backtrace. */
+static __attribute__(( noinline)) Int vex_strlen ( const HChar* str )
{
Int i = 0;
while (str[i] != 0) i++;
Modified: branches/BUF_REMOVAL/gdbserver_tests/filter_gdb
==============================================================================
--- branches/BUF_REMOVAL/gdbserver_tests/filter_gdb (original)
+++ branches/BUF_REMOVAL/gdbserver_tests/filter_gdb Fri Aug 22 17:14:22 2014
@@ -56,6 +56,7 @@
# finishes with a new line, sometimes not ???).
# 'exited with code' and 'exited normally' are printed slightly
# differently between gdb versions, normalize to "Program exited...".
+# for hgtls the breakpoint p=... address might show var location.
sed -e '/Remote debugging using/,/vgdb launched process attached/d' \
-e '/filter_gdb BEGIN drop/,/filter_gdb END drop/d' \
-e 's/^\[?1034hReading symbols/Reading symbols/' \
@@ -102,6 +103,7 @@
-e 's/0x........ in \(main (argc=1, argv=0x........) at watchpoints.c:[24][3689]\)/\1/' \
-e 's/0x........ in \(main () at clean_after_fork.c:34\)/\1/' \
-e 's/\(^.*signal SIGFPE.*$\)/\1\nafter trap SIGFPE/' \
+ -e 's/\(^Breakpoint 1, tls_ptr (p=0x........\) <tests[0-9+]*>\() at tls.c:55\)/\1\2/' \
-e '/Id Target Id Frame/d' \
-e 's/^\([ \*] [1234] \) *Thread /\1Thread /' \
-e 's/VgTs_WaitSys) 0x/VgTs_WaitSys) 0x/' \
Modified: branches/BUF_REMOVAL/gdbserver_tests/hgtls.stdoutB.exp
======================...
[truncated message content] |