Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 25451 Details for
Bug 32966
Valgrind doesnt work with NPTL pthread implementation
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
part 2 of 3
2.1tocvs-2.patch (text/plain), 1.54 MB, created by
Christopher Rude
on 2004-02-11 21:29:18 UTC
(
hide
)
Description:
part 2 of 3
Filename:
MIME Type:
Creator:
Christopher Rude
Created:
2004-02-11 21:29:18 UTC
Size:
1.54 MB
patch
obsolete
>diff -ruN valgrind-2.1.0/coregrind/arch/x86-freebsd/vg_syscall.S valgrind/coregrind/arch/x86-freebsd/vg_syscall.S >--- valgrind-2.1.0/coregrind/arch/x86-freebsd/vg_syscall.S 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/arch/x86-freebsd/vg_syscall.S 2004-01-04 10:43:21.000000000 -0600 >@@ -0,0 +1,195 @@ >+ >+##--------------------------------------------------------------------## >+##--- Support for doing system calls. ---## >+##--- vg_syscall.S ---## >+##--------------------------------------------------------------------## >+ >+/* >+ This file is part of Valgrind, an extensible x86 protected-mode >+ emulator for monitoring program execution on x86-Unixes. >+ >+ Copyright (C) 2000-2004 Julian Seward >+ jseward@acm.org >+ >+ 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. >+*/ >+ >+#include "vg_constants.h" >+#include "vg_unistd.h" >+ >+.globl VG_(do_syscall) >+ >+/* >+ Perform a Linux syscall with int 0x80 >+ >+ Syscall args are passed on the stack >+ Int VG_(do_syscall)(Int syscall_no, ...) >+ >+ This has no effect on the virtual machine; the expectation is >+ that the syscall mechanism makes no useful changes to any >+ register except %eax, which is returned. >+ */ >+VG_(do_syscall): >+ pop %ecx >+ pop %eax >+ push %ecx >+ int $0x80 >+ push %ecx >+ jae 1f >+ movl $-1,%eax >+1: >+ ret >+ >+/* >+ Perform a FreeBSD syscall with int 0x80, returning error flag >+ >+ Syscall args are passed on the stack >+ Int VG_(do_syscall_err)(Int syscall_no, UInt edx, UInt* eflags, ...) >+ >+ This has no effect on the virtual machine; the expectation is >+ that the syscall mechanism makes no useful changes to any >+ register except %eax and %edx, which are returned. >+ */ >+.globl VG_(do_syscall_err) >+VG_(do_syscall_err): >+ movl 12(%esp),%ecx >+ andb $254,(%ecx) >+ movl (%esp),%eax >+ movl %eax,12(%esp) >+ movl 4(%esp),%eax >+ movl 8(%esp),%edx >+ addl $12,%esp >+ int $0x80 >+ jae 1f >+ orb $1,(%ecx) >+1: >+ movl (%esp),%ecx >+ push %ecx >+ push %ecx >+ push %ecx >+ ret >+ >+/* >+ Perform a clone system call. clone is strange because it has >+ fork()-like return-twice semantics, so it needs special >+ handling here. >+ >+ int VG_(clone)(int (*fn)(void *), void *child_stack, int flags, void *arg, >+ 0 4 8 12 >+ pid_t *child_tid, pid_t *parent_tid) >+ 16 20 >+ >+ */ >+.globl VG_(clone) >+VG_(clone): >+ ret >+ >+/* >+ * 8 12 16 20 >+ * rfork_thread(flags, stack_addr, start_fnc, start_arg); >+ * >+ * flags: Flags to rfork system call. See rfork(2). >+ * stack_addr: Top of stack for thread. >+ * start_fnc: Address of thread function to call in child. >+ * start_arg: Argument to pass to the thread function in child. >+ */ >+ >+.globl VG_(rfork_thread) >+VG_(rfork_thread): >+ pushl %ebp >+ movl %esp, %ebp >+ pushl %esi >+ >+ /* >+ * Push thread info onto the new thread's stack >+ */ >+ movl 12(%ebp), %esi # get stack addr >+ >+ subl $4, %esi >+ movl 20(%ebp), %eax # get start argument >+ movl %eax, (%esi) >+ >+ subl $4, %esi >+ movl 16(%ebp), %eax # get start thread address >+ movl %eax, (%esi) >+ >+ /* >+ * Prepare and execute the thread creation syscall >+ */ >+ pushl 8(%ebp) >+ pushl $0 >+ movl $__NR_rfork, %eax >+ int $0x80 >+ jb 2f >+ >+ /* >+ * Check to see if we are in the parent or child >+ */ >+ cmpl $0, %edx >+ jnz 1f >+ addl $8, %esp >+ popl %esi >+ movl %ebp, %esp >+ popl %ebp >+ ret >+ .p2align 2 >+ >+ /* >+ * If we are in the child (new thread), then >+ * set-up the call to the internal subroutine. If it >+ * returns, then call __exit. >+ */ >+1: >+ movl %esi,%esp >+ popl %eax >+ call *%eax >+ addl $4, %esp >+ >+ /* >+ * Exit system call >+ */ >+ pushl %eax >+ pushl $0 >+ movl $__NR_exit, %eax >+ int $0x80 >+ >+ /* >+ * Branch here if the thread creation fails: >+ */ >+2: >+ movl $-1,%eax >+ ret >+ >+.globl VG_(pipe) >+VG_(pipe): >+ mov $__NR_pipe,%eax >+ int $0x80 >+ jb 1f >+ movl 4(%esp),%ecx >+ movl %eax,(%ecx) >+ movl %edx,4(%ecx) >+ movl $0,%eax >+ ret >+1: >+ negl %eax >+ ret >+ >+ >+##--------------------------------------------------------------------## >+##--- end vg_syscall.S ---## >+##--------------------------------------------------------------------## >diff -ruN valgrind-2.1.0/coregrind/arch/x86-linux/.cvsignore valgrind/coregrind/arch/x86-linux/.cvsignore >--- valgrind-2.1.0/coregrind/arch/x86-linux/.cvsignore 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/arch/x86-linux/.cvsignore 2004-01-03 09:21:14.000000000 -0600 >@@ -0,0 +1,2 @@ >+Makefile.in >+Makefile >diff -ruN valgrind-2.1.0/coregrind/arch/x86-linux/CVS/Entries valgrind/coregrind/arch/x86-linux/CVS/Entries >--- valgrind-2.1.0/coregrind/arch/x86-linux/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/arch/x86-linux/CVS/Entries 2004-02-11 22:51:44.384064840 -0600 >@@ -0,0 +1,6 @@ >+/.cvsignore/1.1/Sat Jan 3 15:21:14 2004// >+/Makefile.am/1.1/Sat Jan 3 15:21:14 2004// >+/vg_libpthread.c/1.143/Sun Jan 4 16:43:21 2004// >+/vg_libpthread_unimp.c/1.43/Sun Jan 4 16:43:21 2004// >+/vg_syscall.S/1.11/Sun Jan 4 16:43:21 2004// >+D >diff -ruN valgrind-2.1.0/coregrind/arch/x86-linux/CVS/Repository valgrind/coregrind/arch/x86-linux/CVS/Repository >--- valgrind-2.1.0/coregrind/arch/x86-linux/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/arch/x86-linux/CVS/Repository 2004-02-11 22:51:44.093109072 -0600 >@@ -0,0 +1 @@ >+valgrind/coregrind/arch/x86-linux >diff -ruN valgrind-2.1.0/coregrind/arch/x86-linux/CVS/Root valgrind/coregrind/arch/x86-linux/CVS/Root >--- valgrind-2.1.0/coregrind/arch/x86-linux/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/arch/x86-linux/CVS/Root 2004-02-11 22:51:44.093109072 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/coregrind/arch/x86-linux/Makefile.am valgrind/coregrind/arch/x86-linux/Makefile.am >--- valgrind-2.1.0/coregrind/arch/x86-linux/Makefile.am 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/arch/x86-linux/Makefile.am 2004-01-03 09:21:14.000000000 -0600 >@@ -0,0 +1,2 @@ >+ >+ >diff -ruN valgrind-2.1.0/coregrind/arch/x86-linux/Makefile.in valgrind/coregrind/arch/x86-linux/Makefile.in >--- valgrind-2.1.0/coregrind/arch/x86-linux/Makefile.in 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/arch/x86-linux/Makefile.in 2004-02-11 22:52:31.578890136 -0600 >@@ -0,0 +1,297 @@ >+# Makefile.in generated by automake 1.8.2 from Makefile.am. >+# @configure_input@ >+ >+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, >+# 2003, 2004 Free Software Foundation, Inc. >+# This Makefile.in is free software; the Free Software Foundation >+# gives unlimited permission to copy and/or distribute it, >+# with or without modifications, as long as this notice is preserved. >+ >+# This program is distributed in the hope that it will be useful, >+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without >+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A >+# PARTICULAR PURPOSE. >+ >+@SET_MAKE@ >+srcdir = @srcdir@ >+top_srcdir = @top_srcdir@ >+VPATH = @srcdir@ >+pkgdatadir = $(datadir)/@PACKAGE@ >+pkglibdir = $(libdir)/@PACKAGE@ >+pkgincludedir = $(includedir)/@PACKAGE@ >+top_builddir = ../../.. >+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd >+INSTALL = @INSTALL@ >+install_sh_DATA = $(install_sh) -c -m 644 >+install_sh_PROGRAM = $(install_sh) -c >+install_sh_SCRIPT = $(install_sh) -c >+INSTALL_HEADER = $(INSTALL_DATA) >+transform = $(program_transform_name) >+NORMAL_INSTALL = : >+PRE_INSTALL = : >+POST_INSTALL = : >+NORMAL_UNINSTALL = : >+PRE_UNINSTALL = : >+POST_UNINSTALL = : >+host_triplet = @host@ >+subdir = coregrind/arch/x86-linux >+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in >+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >+am__aclocal_m4_deps = $(top_srcdir)/configure.in >+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ >+ $(ACLOCAL_M4) >+mkinstalldirs = $(mkdir_p) >+CONFIG_HEADER = $(top_builddir)/config.h >+CONFIG_CLEAN_FILES = >+SOURCES = >+DIST_SOURCES = >+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) >+ACLOCAL = @ACLOCAL@ >+AMDEP_FALSE = @AMDEP_FALSE@ >+AMDEP_TRUE = @AMDEP_TRUE@ >+AMTAR = @AMTAR@ >+AUTOCONF = @AUTOCONF@ >+AUTOHEADER = @AUTOHEADER@ >+AUTOMAKE = @AUTOMAKE@ >+AWK = @AWK@ >+CC = @CC@ >+CCAS = @CCAS@ >+CCASFLAGS = @CCASFLAGS@ >+CCDEPMODE = @CCDEPMODE@ >+CFLAGS = @CFLAGS@ >+CPP = @CPP@ >+CPPFLAGS = @CPPFLAGS@ >+CXX = @CXX@ >+CXXDEPMODE = @CXXDEPMODE@ >+CXXFLAGS = @CXXFLAGS@ >+CYGPATH_W = @CYGPATH_W@ >+DEFAULT_SUPP = @DEFAULT_SUPP@ >+DEFS = @DEFS@ >+DEPDIR = @DEPDIR@ >+ECHO_C = @ECHO_C@ >+ECHO_N = @ECHO_N@ >+ECHO_T = @ECHO_T@ >+EGREP = @EGREP@ >+EXEEXT = @EXEEXT@ >+GDB = @GDB@ >+INSTALL_DATA = @INSTALL_DATA@ >+INSTALL_PROGRAM = @INSTALL_PROGRAM@ >+INSTALL_SCRIPT = @INSTALL_SCRIPT@ >+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ >+LDFLAGS = @LDFLAGS@ >+LIBOBJS = @LIBOBJS@ >+LIBS = @LIBS@ >+LN_S = @LN_S@ >+LTLIBOBJS = @LTLIBOBJS@ >+MAINT = @MAINT@ >+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ >+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ >+MAKEINFO = @MAKEINFO@ >+OBJEXT = @OBJEXT@ >+PACKAGE = @PACKAGE@ >+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ >+PACKAGE_NAME = @PACKAGE_NAME@ >+PACKAGE_STRING = @PACKAGE_STRING@ >+PACKAGE_TARNAME = @PACKAGE_TARNAME@ >+PACKAGE_VERSION = @PACKAGE_VERSION@ >+PATH_SEPARATOR = @PATH_SEPARATOR@ >+PERL = @PERL@ >+PREFERRED_STACK_BOUNDARY = @PREFERRED_STACK_BOUNDARY@ >+RANLIB = @RANLIB@ >+SET_MAKE = @SET_MAKE@ >+SHELL = @SHELL@ >+STRIP = @STRIP@ >+VERSION = @VERSION@ >+VG_PLATFORM = @VG_PLATFORM@ >+ac_ct_CC = @ac_ct_CC@ >+ac_ct_CXX = @ac_ct_CXX@ >+ac_ct_RANLIB = @ac_ct_RANLIB@ >+ac_ct_STRIP = @ac_ct_STRIP@ >+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ >+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ >+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ >+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ >+am__include = @am__include@ >+am__leading_dot = @am__leading_dot@ >+am__quote = @am__quote@ >+bindir = @bindir@ >+build = @build@ >+build_alias = @build_alias@ >+build_cpu = @build_cpu@ >+build_os = @build_os@ >+build_vendor = @build_vendor@ >+datadir = @datadir@ >+exec_prefix = @exec_prefix@ >+host = @host@ >+host_alias = @host_alias@ >+host_cpu = @host_cpu@ >+host_os = @host_os@ >+host_vendor = @host_vendor@ >+includedir = @includedir@ >+infodir = @infodir@ >+install_sh = @install_sh@ >+libdir = @libdir@ >+libexecdir = @libexecdir@ >+localstatedir = @localstatedir@ >+mandir = @mandir@ >+mkdir_p = @mkdir_p@ >+oldincludedir = @oldincludedir@ >+prefix = @prefix@ >+program_transform_name = @program_transform_name@ >+sbindir = @sbindir@ >+sharedstatedir = @sharedstatedir@ >+sysconfdir = @sysconfdir@ >+target_alias = @target_alias@ >+all: all-am >+ >+.SUFFIXES: >+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) >+ @for dep in $?; do \ >+ case '$(am__configure_deps)' in \ >+ *$$dep*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ >+ && exit 0; \ >+ exit 1;; \ >+ esac; \ >+ done; \ >+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu coregrind/arch/x86-linux/Makefile'; \ >+ cd $(top_srcdir) && \ >+ $(AUTOMAKE) --gnu coregrind/arch/x86-linux/Makefile >+.PRECIOUS: Makefile >+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status >+ @case '$?' in \ >+ *config.status*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ >+ *) \ >+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ >+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ >+ esac; >+ >+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+ >+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+uninstall-info-am: >+tags: TAGS >+TAGS: >+ >+ctags: CTAGS >+CTAGS: >+ >+ >+distdir: $(DISTFILES) >+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ >+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ >+ list='$(DISTFILES)'; for file in $$list; do \ >+ case $$file in \ >+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ >+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ >+ esac; \ >+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ >+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ >+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ >+ dir="/$$dir"; \ >+ $(mkdir_p) "$(distdir)$$dir"; \ >+ else \ >+ dir=''; \ >+ fi; \ >+ if test -d $$d/$$file; then \ >+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ >+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ >+ fi; \ >+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ >+ else \ >+ test -f $(distdir)/$$file \ >+ || cp -p $$d/$$file $(distdir)/$$file \ >+ || exit 1; \ >+ fi; \ >+ done >+check-am: all-am >+check: check-am >+all-am: Makefile >+installdirs: >+install: install-am >+install-exec: install-exec-am >+install-data: install-data-am >+uninstall: uninstall-am >+ >+install-am: all-am >+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am >+ >+installcheck: installcheck-am >+install-strip: >+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ >+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ >+ `test -z '$(STRIP)' || \ >+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install >+mostlyclean-generic: >+ >+clean-generic: >+ >+distclean-generic: >+ -rm -f $(CONFIG_CLEAN_FILES) >+ >+maintainer-clean-generic: >+ @echo "This command is intended for maintainers to use" >+ @echo "it deletes files that may require special tools to rebuild." >+clean: clean-am >+ >+clean-am: clean-generic mostlyclean-am >+ >+distclean: distclean-am >+ -rm -f Makefile >+distclean-am: clean-am distclean-generic >+ >+dvi: dvi-am >+ >+dvi-am: >+ >+html: html-am >+ >+info: info-am >+ >+info-am: >+ >+install-data-am: >+ >+install-exec-am: >+ >+install-info: install-info-am >+ >+install-man: >+ >+installcheck-am: >+ >+maintainer-clean: maintainer-clean-am >+ -rm -f Makefile >+maintainer-clean-am: distclean-am maintainer-clean-generic >+ >+mostlyclean: mostlyclean-am >+ >+mostlyclean-am: mostlyclean-generic >+ >+pdf: pdf-am >+ >+pdf-am: >+ >+ps: ps-am >+ >+ps-am: >+ >+uninstall-am: uninstall-info-am >+ >+.PHONY: all all-am check check-am clean clean-generic distclean \ >+ distclean-generic distdir dvi dvi-am html html-am info info-am \ >+ install install-am install-data install-data-am install-exec \ >+ install-exec-am install-info install-info-am install-man \ >+ install-strip installcheck installcheck-am installdirs \ >+ maintainer-clean maintainer-clean-generic mostlyclean \ >+ mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ >+ uninstall-info-am >+ >+# Tell versions [3.59,3.63) of GNU make to not export all variables. >+# Otherwise a system limit (for SysV at least) may be exceeded. >+.NOEXPORT: >diff -ruN valgrind-2.1.0/coregrind/arch/x86-linux/vg_libpthread.c valgrind/coregrind/arch/x86-linux/vg_libpthread.c >--- valgrind-2.1.0/coregrind/arch/x86-linux/vg_libpthread.c 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/arch/x86-linux/vg_libpthread.c 2004-01-04 10:43:21.000000000 -0600 >@@ -0,0 +1,3005 @@ >+ >+/*--------------------------------------------------------------------*/ >+/*--- A replacement for the standard libpthread.so. ---*/ >+/*--- vg_libpthread.c ---*/ >+/*--------------------------------------------------------------------*/ >+ >+/* >+ This file is part of Valgrind, an extensible x86 protected-mode >+ emulator for monitoring program execution on x86-Unixes. >+ >+ Copyright (C) 2000-2004 Julian Seward >+ jseward@acm.org >+ >+ 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. >+*/ >+ >+/* ALL THIS CODE RUNS ON THE SIMULATED CPU. >+ >+ This is a replacement for the standard libpthread.so. It is loaded >+ as part of the client's image (if required) and directs pthread >+ calls through to Valgrind's request mechanism. >+ >+ A couple of caveats. >+ >+ 1. Since it's a binary-compatible replacement for an existing library, >+ we must take care to used exactly the same data layouts, etc, as >+ the standard pthread.so does. >+ >+ 2. Since this runs as part of the client, there are no specific >+ restrictions on what headers etc we can include, so long as >+ this libpthread.so does not end up having dependencies on .so's >+ which the real one doesn't. >+ >+ Later ... it appears we cannot call file-related stuff in libc here, >+ perhaps fair enough. Be careful what you call from here. Even exit() >+ doesn't work (gives infinite recursion and then stack overflow); hence >+ myexit(). Also fprintf doesn't seem safe. >+*/ >+ >+#include "valgrind.h" /* For the request-passing mechanism */ >+#include "vg_include.h" /* For the VG_USERREQ__* constants */ >+ >+#define __USE_UNIX98 >+#include <sys/types.h> >+#include <pthread.h> >+#undef __USE_UNIX98 >+ >+#include <unistd.h> >+#include <string.h> >+#include <sys/time.h> >+#include <sys/stat.h> >+#include <sys/poll.h> >+#include <stdio.h> >+#include <errno.h> >+ >+#include <stdlib.h> >+ >+# define strong_alias(name, aliasname) \ >+ extern __typeof (name) aliasname __attribute__ ((alias (#name))); >+ >+# define weak_alias(name, aliasname) \ >+ extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))); >+ >+ >+/* --------------------------------------------------------------------- >+ Forwardses. >+ ------------------------------------------------------------------ */ >+ >+#define WEAK __attribute__((weak)) >+ >+static >+__inline__ >+int is_kerror ( int res ) >+{ >+ if (res >= -4095 && res <= -1) >+ return 1; >+ else >+ return 0; >+} >+ >+ >+#ifdef GLIBC_2_3 >+ /* kludge by JRS (not from glibc) ... */ >+ typedef void* __locale_t; >+ >+ /* Copied from locale/locale.h in glibc-2.2.93 sources */ >+ /* This value can be passed to `uselocale' and may be returned by >+ it. Passing this value to any other function has undefined >+ behavior. */ >+# define LC_GLOBAL_LOCALE ((__locale_t) -1L) >+ extern __locale_t __uselocale ( __locale_t ); >+#endif >+ >+static >+void init_libc_tsd_keys ( void ); >+ >+ >+/* --------------------------------------------------------------------- >+ Helpers. We have to be pretty self-sufficient. >+ ------------------------------------------------------------------ */ >+ >+/* Number of times any given error message is printed. */ >+#define N_MOANS 3 >+ >+/* Extract from Valgrind the value of VG_(clo_trace_pthread_level). >+ Returns 0 (none) if not running on Valgrind. */ >+static >+int get_pt_trace_level ( void ) >+{ >+ int res; >+ VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */, >+ VG_USERREQ__GET_PTHREAD_TRACE_LEVEL, >+ 0, 0, 0, 0); >+ return res; >+} >+ >+/* Don't do anything if we're not under Valgrind */ >+static __inline__ >+void ensure_valgrind ( char* caller ) >+{ >+ if (!RUNNING_ON_VALGRIND) { >+ const char msg[] = "Warning: this libpthread.so should only be run with Valgrind\n"; >+ VG_(do_syscall)(__NR_write, 2, msg, sizeof(msg)-1); >+ VG_(do_syscall)(__NR_exit, 1); >+ } >+} >+ >+/* While we're at it ... hook our own startup function into this >+ game. */ >+ >+static >+__attribute__((noreturn)) >+void barf ( const char* str ) >+{ >+ char buf[1000]; >+ strcpy(buf, "\nvalgrind's libpthread.so: "); >+ strcat(buf, str); >+ strcat(buf, "\nPlease report this bug at: "); >+ strcat(buf, VG_BUGS_TO); >+ strcat(buf, "\n\n"); >+ VALGRIND_INTERNAL_PRINTF(buf); >+ _exit(1); >+ /* We have to persuade gcc into believing this doesn't return. */ >+ while (1) { }; >+} >+ >+ >+static void cat_n_send ( char* s1, char* s2, char* s3 ) >+{ >+ char buf[1000]; >+ if (get_pt_trace_level() >= 0) { >+ snprintf(buf, sizeof(buf), "%s%s%s", s1, s2, s3); >+ buf[sizeof(buf)-1] = '\0'; >+ VALGRIND_INTERNAL_PRINTF(buf); >+ } >+} >+ >+static void oh_dear ( char* fn, char* aux, char* s ) >+{ >+ cat_n_send ( "warning: Valgrind's ", fn, s ); >+ if (NULL != aux) >+ cat_n_send ( " ", aux, "" ); >+ cat_n_send ( " your program may misbehave as a result", "", "" ); >+} >+ >+static void ignored ( char* fn, char* aux ) >+{ >+ oh_dear ( fn, aux, " does nothing" ); >+} >+ >+static void kludged ( char* fn, char* aux ) >+{ >+ oh_dear ( fn, aux, " is incomplete" ); >+} >+ >+ >+__attribute__((noreturn)) >+void vgPlain_unimp ( char* fn ) >+{ >+ cat_n_send ( "valgrind's libpthread.so: UNIMPLEMENTED FUNCTION: ", fn, "" ); >+ barf("unimplemented function"); >+} >+ >+ >+static >+void my_assert_fail ( const Char* expr, const Char* file, Int line, const Char* fn ) >+{ >+ char buf[1000]; >+ static Bool entered = False; >+ if (entered) >+ _exit(2); >+ entered = True; >+ sprintf(buf, "\n%s: %s:%d (%s): Assertion `%s' failed.\n", >+ "valgrind", file, line, fn, expr ); >+ cat_n_send ( "", buf, "" ); >+ sprintf(buf, "Please report this bug at: %s\n\n", VG_BUGS_TO); >+ cat_n_send ( "", buf, "" ); >+ _exit(1); >+} >+ >+#define MY__STRING(__str) #__str >+ >+#define my_assert(expr) \ >+ ((void) ((expr) ? 0 : \ >+ (my_assert_fail (MY__STRING(expr), \ >+ __FILE__, __LINE__, \ >+ __PRETTY_FUNCTION__), 0))) >+ >+static >+void my_free ( void* ptr ) >+{ >+#if 0 >+ int res; >+ VALGRIND_MAGIC_SEQUENCE(res, (-1) /* default */, >+ VG_USERREQ__FREE, ptr, 0, 0, 0); >+ my_assert(res == 0); >+#else >+ free(ptr); >+#endif >+} >+ >+ >+static >+void* my_malloc ( int nbytes ) >+{ >+ void* res; >+#if 0 >+ VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */, >+ VG_USERREQ__MALLOC, nbytes, 0, 0, 0); >+#else >+ res = malloc(nbytes); >+#endif >+ my_assert(res != (void*)0); >+ return res; >+} >+ >+ >+ >+/* --------------------------------------------------------------------- >+ Pass pthread_ calls to Valgrind's request mechanism. >+ ------------------------------------------------------------------ */ >+ >+ >+/* --------------------------------------------------- >+ Ummm .. >+ ------------------------------------------------ */ >+ >+static >+void pthread_error ( const char* msg ) >+{ >+ int res; >+ VALGRIND_MAGIC_SEQUENCE(res, 0, >+ VG_USERREQ__PTHREAD_ERROR, >+ msg, 0, 0, 0); >+} >+ >+ >+/* --------------------------------------------------- >+ Here so it can be inlined without complaint. >+ ------------------------------------------------ */ >+ >+__inline__ >+pthread_t pthread_self(void) >+{ >+ int tid; >+ ensure_valgrind("pthread_self"); >+ VALGRIND_MAGIC_SEQUENCE(tid, 0 /* default */, >+ VG_USERREQ__PTHREAD_GET_THREADID, >+ 0, 0, 0, 0); >+ if (tid < 1 || tid >= VG_N_THREADS) >+ barf("pthread_self: invalid ThreadId"); >+ return tid; >+} >+ >+ >+/* --------------------------------------------------- >+ THREAD ATTRIBUTES >+ ------------------------------------------------ */ >+ >+int pthread_attr_init(pthread_attr_t *attr) >+{ >+ /* Just initialise the fields which we might look at. */ >+ attr->__detachstate = PTHREAD_CREATE_JOINABLE; >+ /* Linuxthreads sets this field to the value __getpagesize(), so I >+ guess the following is OK. */ >+ attr->__guardsize = VKI_BYTES_PER_PAGE; return 0; >+} >+ >+int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate) >+{ >+ if (detachstate != PTHREAD_CREATE_JOINABLE >+ && detachstate != PTHREAD_CREATE_DETACHED) { >+ pthread_error("pthread_attr_setdetachstate: " >+ "detachstate is invalid"); >+ return EINVAL; >+ } >+ attr->__detachstate = detachstate; >+ return 0; >+} >+ >+int pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate) >+{ >+ *detachstate = attr->__detachstate; >+ return 0; >+} >+ >+int pthread_attr_setinheritsched(pthread_attr_t *attr, int inherit) >+{ >+ static int moans = N_MOANS; >+ if (moans-- > 0) >+ ignored("pthread_attr_setinheritsched", NULL); >+ return 0; >+} >+ >+WEAK >+int pthread_attr_setstacksize (pthread_attr_t *__attr, >+ size_t __stacksize) >+{ >+ size_t limit; >+ char buf[1024]; >+ ensure_valgrind("pthread_attr_setstacksize"); >+ limit = VG_PTHREAD_STACK_SIZE - VG_AR_CLIENT_STACKBASE_REDZONE_SZB >+ - 1000; /* paranoia */ >+ if (__stacksize < limit) >+ return 0; >+ snprintf(buf, sizeof(buf), "pthread_attr_setstacksize: " >+ "requested size %d >= VG_PTHREAD_STACK_SIZE\n " >+ "edit vg_include.h and rebuild.", __stacksize); >+ buf[sizeof(buf)-1] = '\0'; /* Make sure it is zero terminated */ >+ barf(buf); >+} >+ >+ >+/* This is completely bogus. */ >+int pthread_attr_getschedparam(const pthread_attr_t *attr, >+ struct sched_param *param) >+{ >+ static int moans = N_MOANS; >+ if (moans-- > 0) >+ kludged("pthread_attr_getschedparam", NULL); >+# ifdef HAVE_SCHED_PRIORITY >+ if (param) param->sched_priority = 0; /* who knows */ >+# else >+ if (param) param->__sched_priority = 0; /* who knows */ >+# endif >+ return 0; >+} >+ >+int pthread_attr_setschedparam(pthread_attr_t *attr, >+ const struct sched_param *param) >+{ >+ static int moans = N_MOANS; >+ if (moans-- > 0) >+ ignored("pthread_attr_setschedparam", "(scheduling not changeable)"); >+ return 0; >+} >+ >+int pthread_attr_destroy(pthread_attr_t *attr) >+{ >+ static int moans = N_MOANS; >+ if (moans-- > 0) >+ ignored("pthread_attr_destroy", NULL); >+ return 0; >+} >+ >+/* These are no-ops, as with LinuxThreads. */ >+int pthread_attr_setscope ( pthread_attr_t *attr, int scope ) >+{ >+ ensure_valgrind("pthread_attr_setscope"); >+ if (scope == PTHREAD_SCOPE_SYSTEM) >+ return 0; >+ pthread_error("pthread_attr_setscope: " >+ "invalid or unsupported scope"); >+ if (scope == PTHREAD_SCOPE_PROCESS) >+ return ENOTSUP; >+ return EINVAL; >+} >+ >+int pthread_attr_getscope ( const pthread_attr_t *attr, int *scope ) >+{ >+ ensure_valgrind("pthread_attr_setscope"); >+ if (scope) >+ *scope = PTHREAD_SCOPE_SYSTEM; >+ return 0; >+} >+ >+ >+/* Pretty bogus. Avoid if possible. */ >+int pthread_getattr_np (pthread_t thread, pthread_attr_t *attr) >+{ >+ int detached; >+ size_t limit; >+ ensure_valgrind("pthread_getattr_np"); >+ kludged("pthread_getattr_np", NULL); >+ limit = VG_PTHREAD_STACK_SIZE - VG_AR_CLIENT_STACKBASE_REDZONE_SZB >+ - 1000; /* paranoia */ >+ attr->__detachstate = PTHREAD_CREATE_JOINABLE; >+ attr->__schedpolicy = SCHED_OTHER; >+ attr->__schedparam.sched_priority = 0; >+ attr->__inheritsched = PTHREAD_EXPLICIT_SCHED; >+ attr->__scope = PTHREAD_SCOPE_SYSTEM; >+ attr->__guardsize = VKI_BYTES_PER_PAGE; >+ attr->__stackaddr = NULL; >+ attr->__stackaddr_set = 0; >+ attr->__stacksize = limit; >+ VALGRIND_MAGIC_SEQUENCE(detached, (-1) /* default */, >+ VG_USERREQ__SET_OR_GET_DETACH, >+ 2 /* get */, thread, 0, 0); >+ my_assert(detached == 0 || detached == 1); >+ if (detached) >+ attr->__detachstate = PTHREAD_CREATE_DETACHED; >+ return 0; >+} >+ >+ >+/* Bogus ... */ >+WEAK >+int pthread_attr_getstackaddr ( const pthread_attr_t * attr, >+ void ** stackaddr ) >+{ >+ ensure_valgrind("pthread_attr_getstackaddr"); >+ kludged("pthread_attr_getstackaddr", "(it always sets stackaddr to zero)"); >+ if (stackaddr) >+ *stackaddr = NULL; >+ return 0; >+} >+ >+/* Not bogus (!) */ >+WEAK >+int pthread_attr_getstacksize ( const pthread_attr_t * _attr, >+ size_t * __stacksize ) >+{ >+ size_t limit; >+ ensure_valgrind("pthread_attr_getstacksize"); >+ limit = VG_PTHREAD_STACK_SIZE - VG_AR_CLIENT_STACKBASE_REDZONE_SZB >+ - 1000; /* paranoia */ >+ if (__stacksize) >+ *__stacksize = limit; >+ return 0; >+} >+ >+int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy) >+{ >+ if (policy != SCHED_OTHER && policy != SCHED_FIFO && policy != SCHED_RR) >+ return EINVAL; >+ attr->__schedpolicy = policy; >+ return 0; >+} >+ >+int pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy) >+{ >+ *policy = attr->__schedpolicy; >+ return 0; >+} >+ >+ >+/* This is completely bogus. We reject all attempts to change it from >+ VKI_BYTES_PER_PAGE. I don't have a clue what it's for so it seems >+ safest to be paranoid. */ >+WEAK >+int pthread_attr_setguardsize(pthread_attr_t *attr, size_t guardsize) >+{ >+ static int moans = N_MOANS; >+ >+ if (guardsize == VKI_BYTES_PER_PAGE) >+ return 0; >+ >+ if (moans-- > 0) >+ ignored("pthread_attr_setguardsize", >+ "(it ignores any guardsize != 4096)"); >+ >+ return 0; >+} >+ >+/* A straight copy of the LinuxThreads code. */ >+WEAK >+int pthread_attr_getguardsize(const pthread_attr_t *attr, size_t *guardsize) >+{ >+ *guardsize = attr->__guardsize; >+ return 0; >+} >+ >+/* Again, like LinuxThreads. */ >+ >+static int concurrency_current_level = 0; >+ >+WEAK >+int pthread_setconcurrency(int new_level) >+{ >+ if (new_level < 0) >+ return EINVAL; >+ else { >+ concurrency_current_level = new_level; >+ return 0; >+ } >+} >+ >+WEAK >+int pthread_getconcurrency(void) >+{ >+ return concurrency_current_level; >+} >+ >+ >+ >+/* --------------------------------------------------- >+ Helper functions for running a thread >+ and for clearing up afterwards. >+ ------------------------------------------------ */ >+ >+/* All exiting threads eventually pass through here, bearing the >+ return value, or PTHREAD_CANCELED, in ret_val. */ >+static >+__attribute__((noreturn)) >+void thread_exit_wrapper ( void* ret_val ) >+{ >+ int detached, res; >+ CleanupEntry cu; >+ pthread_key_t key; >+ void** specifics_ptr; >+ >+ /* Run this thread's cleanup handlers. */ >+ while (1) { >+ VALGRIND_MAGIC_SEQUENCE(res, (-1) /* default */, >+ VG_USERREQ__CLEANUP_POP, >+ &cu, 0, 0, 0); >+ if (res == -1) break; /* stack empty */ >+ my_assert(res == 0); >+ if (0) printf("running exit cleanup handler"); >+ cu.fn ( cu.arg ); >+ } >+ >+ /* Run this thread's key finalizers. Really this should be run >+ PTHREAD_DESTRUCTOR_ITERATIONS times. */ >+ for (key = 0; key < VG_N_THREAD_KEYS; key++) { >+ VALGRIND_MAGIC_SEQUENCE(res, (-2) /* default */, >+ VG_USERREQ__GET_KEY_D_AND_S, >+ key, &cu, 0, 0 ); >+ if (res == 0) { >+ /* valid key */ >+ if (cu.fn && cu.arg) >+ cu.fn /* destructor for key */ >+ ( cu.arg /* specific for key for this thread */ ); >+ continue; >+ } >+ my_assert(res == -1); >+ } >+ >+ /* Free up my specifics space, if any. */ >+ VALGRIND_MAGIC_SEQUENCE(specifics_ptr, 3 /* default */, >+ VG_USERREQ__PTHREAD_GETSPECIFIC_PTR, >+ pthread_self(), 0, 0, 0); >+ my_assert(specifics_ptr != (void**)3); >+ my_assert(specifics_ptr != (void**)1); /* 1 means invalid thread */ >+ if (specifics_ptr != NULL) >+ my_free(specifics_ptr); >+ >+ /* Decide on my final disposition. */ >+ VALGRIND_MAGIC_SEQUENCE(detached, (-1) /* default */, >+ VG_USERREQ__SET_OR_GET_DETACH, >+ 2 /* get */, pthread_self(), 0, 0); >+ my_assert(detached == 0 || detached == 1); >+ >+ if (detached) { >+ /* Detached; I just quit right now. */ >+ VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */, >+ VG_USERREQ__QUIT, 0, 0, 0, 0); >+ } else { >+ /* Not detached; so I wait for a joiner. */ >+ VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */, >+ VG_USERREQ__WAIT_JOINER, ret_val, 0, 0, 0); >+ } >+ /* NOTREACHED */ >+ barf("thread_exit_wrapper: still alive?!"); >+} >+ >+ >+/* This function is a wrapper function for running a thread. It runs >+ the root function specified in pthread_create, and then, should the >+ root function return a value, it arranges to run the thread's >+ cleanup handlers and exit correctly. */ >+ >+/* Struct used to convey info from pthread_create to thread_wrapper. >+ Must be careful not to pass to the child thread any pointers to >+ objects which might be on the parent's stack. */ >+typedef >+ struct { >+ int attr__detachstate; >+ void* (*root_fn) ( void* ); >+ void* arg; >+ } >+ NewThreadInfo; >+ >+ >+/* This is passed to the VG_USERREQ__APPLY_IN_NEW_THREAD and so must >+ not return. Note that this runs in the new thread, not the >+ parent. */ >+static >+__attribute__((noreturn)) >+void thread_wrapper ( NewThreadInfo* info ) >+{ >+ int attr__detachstate; >+ void* (*root_fn) ( void* ); >+ void* arg; >+ void* ret_val; >+ >+ attr__detachstate = info->attr__detachstate; >+ root_fn = info->root_fn; >+ arg = info->arg; >+ >+ /* Free up the arg block that pthread_create malloced. */ >+ my_free(info); >+ >+ /* Minimally observe the attributes supplied. */ >+ if (attr__detachstate != PTHREAD_CREATE_DETACHED >+ && attr__detachstate != PTHREAD_CREATE_JOINABLE) >+ pthread_error("thread_wrapper: invalid attr->__detachstate"); >+ if (attr__detachstate == PTHREAD_CREATE_DETACHED) >+ pthread_detach(pthread_self()); >+ >+# ifdef GLIBC_2_3 >+ /* Set this thread's locale to the global (default) locale. A hack >+ in support of glibc-2.3. This does the biz for the all new >+ threads; the root thread is done with a horrible hack in >+ init_libc_tsd_keys() below. >+ */ >+ __uselocale(LC_GLOBAL_LOCALE); >+# endif >+ >+ /* The root function might not return. But if it does we simply >+ move along to thread_exit_wrapper. All other ways out for the >+ thread (cancellation, or calling pthread_exit) lead there >+ too. */ >+ ret_val = root_fn(arg); >+ thread_exit_wrapper(ret_val); >+ /* NOTREACHED */ >+} >+ >+ >+/* --------------------------------------------------- >+ THREADs >+ ------------------------------------------------ */ >+ >+static void __valgrind_pthread_yield ( void ) >+{ >+ int res; >+ ensure_valgrind("pthread_yield"); >+ VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */, >+ VG_USERREQ__PTHREAD_YIELD, 0, 0, 0, 0); >+} >+ >+WEAK >+int pthread_yield ( void ) >+{ >+ __valgrind_pthread_yield(); >+ return 0; >+} >+ >+ >+int pthread_equal(pthread_t thread1, pthread_t thread2) >+{ >+ return thread1 == thread2 ? 1 : 0; >+} >+ >+ >+/* Bundle up the args into a malloc'd block and create a new thread >+ consisting of thread_wrapper() applied to said malloc'd block. */ >+int >+pthread_create (pthread_t *__restrict __thredd, >+ __const pthread_attr_t *__restrict __attr, >+ void *(*__start_routine) (void *), >+ void *__restrict __arg) >+{ >+ int tid_child; >+ NewThreadInfo* info; >+ >+ ensure_valgrind("pthread_create"); >+ >+ /* make sure the tsd keys, and hence locale info, are initialised >+ before we get into complications making new threads. */ >+ init_libc_tsd_keys(); >+ >+ /* Allocate space for the arg block. thread_wrapper will free >+ it. */ >+ info = my_malloc(sizeof(NewThreadInfo)); >+ my_assert(info != NULL); >+ >+ if (__attr) >+ info->attr__detachstate = __attr->__detachstate; >+ else >+ info->attr__detachstate = PTHREAD_CREATE_JOINABLE; >+ >+ info->root_fn = __start_routine; >+ info->arg = __arg; >+ VALGRIND_MAGIC_SEQUENCE(tid_child, VG_INVALID_THREADID /* default */, >+ VG_USERREQ__APPLY_IN_NEW_THREAD, >+ &thread_wrapper, info, 0, 0); >+ my_assert(tid_child != VG_INVALID_THREADID); >+ >+ if (__thredd) >+ *__thredd = tid_child; >+ return 0; /* success */ >+} >+ >+ >+int >+pthread_join (pthread_t __th, void **__thread_return) >+{ >+ int res; >+ ensure_valgrind("pthread_join"); >+ VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */, >+ VG_USERREQ__PTHREAD_JOIN, >+ __th, __thread_return, 0, 0); >+ return res; >+} >+ >+ >+void pthread_exit(void *retval) >+{ >+ ensure_valgrind("pthread_exit"); >+ /* Simple! */ >+ thread_exit_wrapper(retval); >+} >+ >+ >+int pthread_detach(pthread_t th) >+{ >+ int res; >+ ensure_valgrind("pthread_detach"); >+ /* First we enquire as to the current detach state. */ >+ VALGRIND_MAGIC_SEQUENCE(res, (-2) /* default */, >+ VG_USERREQ__SET_OR_GET_DETACH, >+ 2 /* get */, th, 0, 0); >+ if (res == -1) { >+ /* not found */ >+ pthread_error("pthread_detach: " >+ "invalid target thread"); >+ return ESRCH; >+ } >+ if (res == 1) { >+ /* already detached */ >+ pthread_error("pthread_detach: " >+ "target thread is already detached"); >+ return EINVAL; >+ } >+ if (res == 0) { >+ VALGRIND_MAGIC_SEQUENCE(res, (-2) /* default */, >+ VG_USERREQ__SET_OR_GET_DETACH, >+ 1 /* set */, th, 0, 0); >+ my_assert(res == 0); >+ return 0; >+ } >+ barf("pthread_detach"); >+} >+ >+ >+/* --------------------------------------------------- >+ CLEANUP STACKS >+ ------------------------------------------------ */ >+ >+void _pthread_cleanup_push (struct _pthread_cleanup_buffer *__buffer, >+ void (*__routine) (void *), >+ void *__arg) >+{ >+ int res; >+ CleanupEntry cu; >+ ensure_valgrind("_pthread_cleanup_push"); >+ cu.fn = __routine; >+ cu.arg = __arg; >+ VALGRIND_MAGIC_SEQUENCE(res, (-1) /* default */, >+ VG_USERREQ__CLEANUP_PUSH, >+ &cu, 0, 0, 0); >+ my_assert(res == 0); >+} >+ >+ >+void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *__buffer, >+ void (*__routine) (void *), >+ void *__arg) >+{ >+ /* As _pthread_cleanup_push, but first save the thread's original >+ cancellation type in __buffer and set it to Deferred. */ >+ int orig_ctype; >+ ensure_valgrind("_pthread_cleanup_push_defer"); >+ /* Set to Deferred, and put the old cancellation type in res. */ >+ my_assert(-1 != PTHREAD_CANCEL_DEFERRED); >+ my_assert(-1 != PTHREAD_CANCEL_ASYNCHRONOUS); >+ my_assert(sizeof(struct _pthread_cleanup_buffer) >= sizeof(int)); >+ VALGRIND_MAGIC_SEQUENCE(orig_ctype, (-1) /* default */, >+ VG_USERREQ__SET_CANCELTYPE, >+ PTHREAD_CANCEL_DEFERRED, 0, 0, 0); >+ my_assert(orig_ctype != -1); >+ *((int*)(__buffer)) = orig_ctype; >+ /* Now push the cleanup. */ >+ _pthread_cleanup_push(NULL, __routine, __arg); >+} >+ >+ >+void _pthread_cleanup_pop (struct _pthread_cleanup_buffer *__buffer, >+ int __execute) >+{ >+ int res; >+ CleanupEntry cu; >+ ensure_valgrind("_pthread_cleanup_push"); >+ cu.fn = cu.arg = NULL; /* paranoia */ >+ VALGRIND_MAGIC_SEQUENCE(res, (-1) /* default */, >+ VG_USERREQ__CLEANUP_POP, >+ &cu, 0, 0, 0); >+ if (res == 0) { >+ /* pop succeeded */ >+ if (__execute) { >+ cu.fn ( cu.arg ); >+ } >+ return; >+ } >+ if (res == -1) { >+ /* stack underflow */ >+ return; >+ } >+ barf("_pthread_cleanup_pop"); >+} >+ >+ >+void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *__buffer, >+ int __execute) >+{ >+ int orig_ctype, fake_ctype; >+ /* As _pthread_cleanup_pop, but after popping/running the handler, >+ restore the thread's original cancellation type from the first >+ word of __buffer. */ >+ _pthread_cleanup_pop(NULL, __execute); >+ orig_ctype = *((int*)(__buffer)); >+ my_assert(orig_ctype == PTHREAD_CANCEL_DEFERRED >+ || orig_ctype == PTHREAD_CANCEL_ASYNCHRONOUS); >+ my_assert(-1 != PTHREAD_CANCEL_DEFERRED); >+ my_assert(-1 != PTHREAD_CANCEL_ASYNCHRONOUS); >+ my_assert(sizeof(struct _pthread_cleanup_buffer) >= sizeof(int)); >+ VALGRIND_MAGIC_SEQUENCE(fake_ctype, (-1) /* default */, >+ VG_USERREQ__SET_CANCELTYPE, >+ orig_ctype, 0, 0, 0); >+ my_assert(fake_ctype == PTHREAD_CANCEL_DEFERRED); >+} >+ >+ >+/* --------------------------------------------------- >+ MUTEX ATTRIBUTES >+ ------------------------------------------------ */ >+ >+int __pthread_mutexattr_init(pthread_mutexattr_t *attr) >+{ >+ attr->__mutexkind = PTHREAD_MUTEX_ERRORCHECK_NP; >+ return 0; >+} >+ >+int __pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type) >+{ >+ switch (type) { >+# ifndef GLIBC_2_1 >+ case PTHREAD_MUTEX_TIMED_NP: >+ case PTHREAD_MUTEX_ADAPTIVE_NP: >+# endif >+# ifdef GLIBC_2_1 >+ case PTHREAD_MUTEX_FAST_NP: >+# endif >+ case PTHREAD_MUTEX_RECURSIVE_NP: >+ case PTHREAD_MUTEX_ERRORCHECK_NP: >+ attr->__mutexkind = type; >+ return 0; >+ default: >+ pthread_error("pthread_mutexattr_settype: " >+ "invalid type"); >+ return EINVAL; >+ } >+} >+ >+int __pthread_mutexattr_destroy(pthread_mutexattr_t *attr) >+{ >+ return 0; >+} >+ >+int __pthread_mutexattr_setpshared ( pthread_mutexattr_t* attr, int pshared) >+{ >+ if (pshared != PTHREAD_PROCESS_PRIVATE && pshared != PTHREAD_PROCESS_SHARED) >+ return EINVAL; >+ >+ /* For now it is not possible to shared a conditional variable. */ >+ if (pshared != PTHREAD_PROCESS_PRIVATE) >+ return ENOSYS; >+ >+ return 0; >+} >+ >+ >+/* --------------------------------------------------- >+ MUTEXes >+ ------------------------------------------------ */ >+ >+int __pthread_mutex_init(pthread_mutex_t *mutex, >+ const pthread_mutexattr_t *mutexattr) >+{ >+ mutex->__m_count = 0; >+ mutex->__m_owner = (_pthread_descr)VG_INVALID_THREADID; >+ mutex->__m_kind = PTHREAD_MUTEX_ERRORCHECK_NP; >+ if (mutexattr) >+ mutex->__m_kind = mutexattr->__mutexkind; >+ return 0; >+} >+ >+ >+int __pthread_mutex_lock(pthread_mutex_t *mutex) >+{ >+ int res; >+ >+ if (RUNNING_ON_VALGRIND) { >+ VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */, >+ VG_USERREQ__PTHREAD_MUTEX_LOCK, >+ mutex, 0, 0, 0); >+ return res; >+ } else { >+ /* Play at locking */ >+ if (0) >+ kludged("prehistoric lock", NULL); >+ mutex->__m_owner = (_pthread_descr)1; >+ mutex->__m_count = 1; >+ mutex->__m_kind |= VG_PTHREAD_PREHISTORY; >+ return 0; /* success */ >+ } >+} >+ >+ >+int __pthread_mutex_trylock(pthread_mutex_t *mutex) >+{ >+ int res; >+ >+ if (RUNNING_ON_VALGRIND) { >+ VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */, >+ VG_USERREQ__PTHREAD_MUTEX_TRYLOCK, >+ mutex, 0, 0, 0); >+ return res; >+ } else { >+ /* Play at locking */ >+ if (0) >+ kludged("prehistoric trylock", NULL); >+ mutex->__m_owner = (_pthread_descr)1; >+ mutex->__m_count = 1; >+ mutex->__m_kind |= VG_PTHREAD_PREHISTORY; >+ return 0; /* success */ >+ } >+} >+ >+ >+int __pthread_mutex_unlock(pthread_mutex_t *mutex) >+{ >+ int res; >+ >+ if (RUNNING_ON_VALGRIND) { >+ VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */, >+ VG_USERREQ__PTHREAD_MUTEX_UNLOCK, >+ mutex, 0, 0, 0); >+ return res; >+ } else { >+ /* Play at locking */ >+ if (0) >+ kludged("prehistoric unlock", NULL); >+ mutex->__m_owner = 0; >+ mutex->__m_count = 0; >+ mutex->__m_kind &= ~VG_PTHREAD_PREHISTORY; >+ return 0; /* success */ >+ } >+} >+ >+ >+int __pthread_mutex_destroy(pthread_mutex_t *mutex) >+{ >+ /* Valgrind doesn't hold any resources on behalf of the mutex, so no >+ need to involve it. */ >+ if (mutex->__m_count > 0) { >+ /* Oh, the horror. glibc's internal use of pthreads "knows" >+ that destroying a lock does an implicit unlock. Make it >+ explicit. */ >+ __pthread_mutex_unlock(mutex); >+ pthread_error("pthread_mutex_destroy: " >+ "mutex is still in use"); >+ return EBUSY; >+ } >+ mutex->__m_count = 0; >+ mutex->__m_owner = (_pthread_descr)VG_INVALID_THREADID; >+ mutex->__m_kind = PTHREAD_MUTEX_ERRORCHECK_NP; >+ return 0; >+} >+ >+ >+/* --------------------------------------------------- >+ CONDITION VARIABLES >+ ------------------------------------------------ */ >+ >+/* LinuxThreads supports no attributes for conditions. Hence ... */ >+ >+int pthread_condattr_init(pthread_condattr_t *attr) >+{ >+ return 0; >+} >+ >+int pthread_condattr_destroy(pthread_condattr_t *attr) >+{ >+ return 0; >+} >+ >+int pthread_cond_init( pthread_cond_t *cond, >+ const pthread_condattr_t *cond_attr) >+{ >+ cond->__c_waiting = (_pthread_descr)VG_INVALID_THREADID; >+ return 0; >+} >+ >+int pthread_cond_destroy(pthread_cond_t *cond) >+{ >+ /* should check that no threads are waiting on this CV */ >+ static int moans = N_MOANS; >+ if (moans-- > 0) >+ kludged("pthread_cond_destroy", >+ "(it doesn't check if the cond is waited on)" ); >+ return 0; >+} >+ >+/* --------------------------------------------------- >+ SCHEDULING >+ ------------------------------------------------ */ >+ >+/* This is completely bogus. */ >+int pthread_getschedparam(pthread_t target_thread, >+ int *policy, >+ struct sched_param *param) >+{ >+ static int moans = N_MOANS; >+ if (moans-- > 0) >+ kludged("pthread_getschedparam", NULL); >+ if (policy) *policy = SCHED_OTHER; >+# ifdef HAVE_SCHED_PRIORITY >+ if (param) param->sched_priority = 0; /* who knows */ >+# else >+ if (param) param->__sched_priority = 0; /* who knows */ >+# endif >+ return 0; >+} >+ >+int pthread_setschedparam(pthread_t target_thread, >+ int policy, >+ const struct sched_param *param) >+{ >+ static int moans = N_MOANS; >+ if (moans-- > 0) >+ ignored("pthread_setschedparam", "(scheduling not changeable)"); >+ return 0; >+} >+ >+int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) >+{ >+ int res; >+ ensure_valgrind("pthread_cond_wait"); >+ VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */, >+ VG_USERREQ__PTHREAD_COND_WAIT, >+ cond, mutex, 0, 0); >+ return res; >+} >+ >+int pthread_cond_timedwait ( pthread_cond_t *cond, >+ pthread_mutex_t *mutex, >+ const struct timespec *abstime ) >+{ >+ int res; >+ unsigned int ms_now, ms_end; >+ struct timeval timeval_now; >+ unsigned long long int ull_ms_now_after_1970; >+ unsigned long long int ull_ms_end_after_1970; >+ >+ ensure_valgrind("pthread_cond_timedwait"); >+ VALGRIND_MAGIC_SEQUENCE(ms_now, 0xFFFFFFFF /* default */, >+ VG_USERREQ__READ_MILLISECOND_TIMER, >+ 0, 0, 0, 0); >+ my_assert(ms_now != 0xFFFFFFFF); >+ res = gettimeofday(&timeval_now, NULL); >+ my_assert(res == 0); >+ >+ ull_ms_now_after_1970 >+ = 1000ULL * ((unsigned long long int)(timeval_now.tv_sec)) >+ + ((unsigned long long int)(timeval_now.tv_usec / 1000000)); >+ ull_ms_end_after_1970 >+ = 1000ULL * ((unsigned long long int)(abstime->tv_sec)) >+ + ((unsigned long long int)(abstime->tv_nsec / 1000000)); >+ if (ull_ms_end_after_1970 < ull_ms_now_after_1970) >+ ull_ms_end_after_1970 = ull_ms_now_after_1970; >+ ms_end >+ = ms_now + (unsigned int)(ull_ms_end_after_1970 - ull_ms_now_after_1970); >+ VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */, >+ VG_USERREQ__PTHREAD_COND_TIMEDWAIT, >+ cond, mutex, ms_end, 0); >+ return res; >+} >+ >+ >+int pthread_cond_signal(pthread_cond_t *cond) >+{ >+ int res; >+ ensure_valgrind("pthread_cond_signal"); >+ VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */, >+ VG_USERREQ__PTHREAD_COND_SIGNAL, >+ cond, 0, 0, 0); >+ return res; >+} >+ >+int pthread_cond_broadcast(pthread_cond_t *cond) >+{ >+ int res; >+ ensure_valgrind("pthread_cond_broadcast"); >+ VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */, >+ VG_USERREQ__PTHREAD_COND_BROADCAST, >+ cond, 0, 0, 0); >+ return res; >+} >+ >+ >+/* --------------------------------------------------- >+ CANCELLATION >+ ------------------------------------------------ */ >+ >+int pthread_setcancelstate(int state, int *oldstate) >+{ >+ int res; >+ ensure_valgrind("pthread_setcancelstate"); >+ if (state != PTHREAD_CANCEL_ENABLE >+ && state != PTHREAD_CANCEL_DISABLE) { >+ pthread_error("pthread_setcancelstate: " >+ "invalid state"); >+ return EINVAL; >+ } >+ my_assert(-1 != PTHREAD_CANCEL_ENABLE); >+ my_assert(-1 != PTHREAD_CANCEL_DISABLE); >+ VALGRIND_MAGIC_SEQUENCE(res, (-1) /* default */, >+ VG_USERREQ__SET_CANCELSTATE, >+ state, 0, 0, 0); >+ my_assert(res != -1); >+ if (oldstate) >+ *oldstate = res; >+ return 0; >+} >+ >+int pthread_setcanceltype(int type, int *oldtype) >+{ >+ int res; >+ ensure_valgrind("pthread_setcanceltype"); >+ if (type != PTHREAD_CANCEL_DEFERRED >+ && type != PTHREAD_CANCEL_ASYNCHRONOUS) { >+ pthread_error("pthread_setcanceltype: " >+ "invalid type"); >+ return EINVAL; >+ } >+ my_assert(-1 != PTHREAD_CANCEL_DEFERRED); >+ my_assert(-1 != PTHREAD_CANCEL_ASYNCHRONOUS); >+ VALGRIND_MAGIC_SEQUENCE(res, (-1) /* default */, >+ VG_USERREQ__SET_CANCELTYPE, >+ type, 0, 0, 0); >+ my_assert(res != -1); >+ if (oldtype) >+ *oldtype = res; >+ return 0; >+} >+ >+int pthread_cancel(pthread_t thread) >+{ >+ int res; >+ ensure_valgrind("pthread_cancel"); >+ VALGRIND_MAGIC_SEQUENCE(res, (-1) /* default */, >+ VG_USERREQ__SET_CANCELPEND, >+ thread, &thread_exit_wrapper, 0, 0); >+ my_assert(res != -1); >+ return res; >+} >+ >+static >+void __my_pthread_testcancel(void) >+{ >+ int res; >+ ensure_valgrind("__my_pthread_testcancel"); >+ VALGRIND_MAGIC_SEQUENCE(res, (-1) /* default */, >+ VG_USERREQ__TESTCANCEL, >+ 0, 0, 0, 0); >+ my_assert(res == 0); >+} >+ >+void pthread_testcancel ( void ) >+{ >+ __my_pthread_testcancel(); >+} >+ >+ >+/* Not really sure what this is for. I suspect for doing the POSIX >+ requirements for fork() and exec(). We do this internally anyway >+ whenever those syscalls are observed, so this could be superfluous, >+ but hey ... >+*/ >+void __pthread_kill_other_threads_np ( void ) >+{ >+ int res; >+ ensure_valgrind("__pthread_kill_other_threads_np"); >+ VALGRIND_MAGIC_SEQUENCE(res, (-1) /* default */, >+ VG_USERREQ__NUKE_OTHER_THREADS, >+ 0, 0, 0, 0); >+ my_assert(res == 0); >+} >+ >+ >+/* --------------------------------------------------- >+ SIGNALS >+ ------------------------------------------------ */ >+ >+#include <signal.h> >+ >+int pthread_sigmask(int how, const sigset_t *newmask, >+ sigset_t *oldmask) >+{ >+ int res; >+ >+ /* A bit subtle, because the scheduler expects newmask and oldmask >+ to be vki_sigset_t* rather than sigset_t*, and the two are >+ different. Fortunately the first 64 bits of a sigset_t are >+ exactly a vki_sigset_t, so we just pass the pointers through >+ unmodified. Haaaack! >+ >+ Also mash the how value so that the SIG_ constants from glibc >+ constants to VKI_ constants, so that the former do not have to >+ be included into vg_scheduler.c. */ >+ >+ ensure_valgrind("pthread_sigmask"); >+ >+ switch (how) { >+ case SIG_SETMASK: how = VKI_SIG_SETMASK; break; >+ case SIG_BLOCK: how = VKI_SIG_BLOCK; break; >+ case SIG_UNBLOCK: how = VKI_SIG_UNBLOCK; break; >+ default: pthread_error("pthread_sigmask: invalid how"); >+ return EINVAL; >+ } >+ >+ VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */, >+ VG_USERREQ__PTHREAD_SIGMASK, >+ how, newmask, oldmask, 0); >+ >+ /* The scheduler tells us of any memory violations. */ >+ return res == 0 ? 0 : EFAULT; >+} >+ >+int sigwait ( const sigset_t* set, int* sig ) >+{ >+ int res; >+ siginfo_t si; >+ >+ __my_pthread_testcancel(); >+ >+ si.si_signo = 0; >+ res = sigtimedwait(set, &si, NULL); >+ *sig = si.si_signo; >+ >+ return 0; /* always returns 0 */ >+} >+ >+ >+int pthread_kill(pthread_t thread, int signo) >+{ >+ int res; >+ ensure_valgrind("pthread_kill"); >+ VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */, >+ VG_USERREQ__PTHREAD_KILL, >+ thread, signo, 0, 0); >+ return res; >+} >+ >+ >+/* Copied verbatim from Linuxthreads */ >+/* Redefine raise() to send signal to calling thread only, >+ as per POSIX 1003.1c */ >+int raise (int sig) >+{ >+ int retcode = pthread_kill(pthread_self(), sig); >+ if (retcode == 0) { >+ return 0; >+ } else { >+ *(__errno_location()) = retcode; >+ return -1; >+ } >+} >+ >+ >+ >+/* --------------------------------------------------- >+ THREAD-SPECIFICs >+ ------------------------------------------------ */ >+ >+static >+int key_is_valid (pthread_key_t key) >+{ >+ int res; >+ VALGRIND_MAGIC_SEQUENCE(res, 2 /* default */, >+ VG_USERREQ__PTHREAD_KEY_VALIDATE, >+ key, 0, 0, 0); >+ my_assert(res != 2); >+ return res; >+} >+ >+ >+/* Returns NULL if thread is invalid. Otherwise, if the thread >+ already has a specifics area, return that. Otherwise allocate it >+ one. */ >+static >+void** get_or_allocate_specifics_ptr ( pthread_t thread ) >+{ >+ int res, i; >+ void** specifics_ptr; >+ ensure_valgrind("get_or_allocate_specifics_ptr"); >+ >+ /* Returns zero if the thread has no specific_ptr. One if thread >+ is invalid. Otherwise, the specific_ptr value. This is >+ allocated with my_malloc and so is aligned and cannot be >+ confused with 1 or 3. */ >+ VALGRIND_MAGIC_SEQUENCE(specifics_ptr, 3 /* default */, >+ VG_USERREQ__PTHREAD_GETSPECIFIC_PTR, >+ thread, 0, 0, 0); >+ my_assert(specifics_ptr != (void**)3); >+ >+ if (specifics_ptr == (void**)1) >+ return NULL; /* invalid thread */ >+ >+ if (specifics_ptr != NULL) >+ return specifics_ptr; /* already has a specifics ptr. */ >+ >+ /* None yet ... allocate a new one. Should never fail. */ >+ specifics_ptr = my_malloc( VG_N_THREAD_KEYS * sizeof(void*) ); >+ my_assert(specifics_ptr != NULL); >+ >+ VALGRIND_MAGIC_SEQUENCE(res, -1 /* default */, >+ VG_USERREQ__PTHREAD_SETSPECIFIC_PTR, >+ specifics_ptr, 0, 0, 0); >+ my_assert(res == 0); >+ >+ /* POSIX sez: "Upon thread creation, the value NULL shall be >+ associated with all defined keys in the new thread." This >+ allocation is in effect a delayed allocation of the specific >+ data for a thread, at its first-use. Hence we initialise it >+ here. */ >+ for (i = 0; i < VG_N_THREAD_KEYS; i++) { >+ specifics_ptr[i] = NULL; >+ } >+ >+ return specifics_ptr; >+} >+ >+ >+int __pthread_key_create(pthread_key_t *key, >+ void (*destr_function) (void *)) >+{ >+ void** specifics_ptr; >+ int res, i; >+ ensure_valgrind("pthread_key_create"); >+ >+ /* This writes *key if successful. It should never fail. */ >+ VALGRIND_MAGIC_SEQUENCE(res, 1 /* default */, >+ VG_USERREQ__PTHREAD_KEY_CREATE, >+ key, destr_function, 0, 0); >+ >+ if (res == 0) { >+ /* POSIX sez: "Upon key creation, the value NULL shall be >+ associated with the new key in all active threads." */ >+ for (i = 0; i < VG_N_THREADS; i++) { >+ specifics_ptr = get_or_allocate_specifics_ptr(i); >+ /* we get NULL if i is an invalid thread. */ >+ if (specifics_ptr != NULL) >+ specifics_ptr[*key] = NULL; >+ } >+ } >+ >+ return res; >+} >+ >+int pthread_key_delete(pthread_key_t key) >+{ >+ int res; >+ ensure_valgrind("pthread_key_delete"); >+ if (!key_is_valid(key)) >+ return EINVAL; >+ VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */, >+ VG_USERREQ__PTHREAD_KEY_DELETE, >+ key, 0, 0, 0); >+ my_assert(res == 0); >+ return 0; >+} >+ >+int __pthread_setspecific(pthread_key_t key, const void *pointer) >+{ >+ void** specifics_ptr; >+ ensure_valgrind("pthread_setspecific"); >+ >+ if (!key_is_valid(key)) >+ return EINVAL; >+ >+ specifics_ptr = get_or_allocate_specifics_ptr(pthread_self()); >+ specifics_ptr[key] = (void*)pointer; >+ return 0; >+} >+ >+void * __pthread_getspecific(pthread_key_t key) >+{ >+ void** specifics_ptr; >+ ensure_valgrind("pthread_getspecific"); >+ >+ if (!key_is_valid(key)) >+ return NULL; >+ >+ specifics_ptr = get_or_allocate_specifics_ptr(pthread_self()); >+ return specifics_ptr[key]; >+} >+ >+ >+#ifdef GLIBC_2_3 >+static >+void ** __pthread_getspecific_addr(pthread_key_t key) >+{ >+ void** specifics_ptr; >+ ensure_valgrind("pthread_getspecific_addr"); >+ >+ if (!key_is_valid(key)) >+ return NULL; >+ >+ specifics_ptr = get_or_allocate_specifics_ptr(pthread_self()); >+ return &(specifics_ptr[key]); >+} >+#endif >+ >+ >+/* --------------------------------------------------- >+ ONCEry >+ ------------------------------------------------ */ >+ >+/* This protects reads and writes of the once_control variable >+ supplied. It is never held whilst any particular initialiser is >+ running. */ >+static pthread_mutex_t once_masterlock = PTHREAD_MUTEX_INITIALIZER; >+ >+/* Initialiser needs to be run. */ >+#define P_ONCE_NOT_DONE ((PTHREAD_ONCE_INIT) + 0) >+ >+/* Initialiser currently running. */ >+#define P_ONCE_RUNNING ((PTHREAD_ONCE_INIT) + 1) >+ >+/* Initialiser has completed. */ >+#define P_ONCE_COMPLETED ((PTHREAD_ONCE_INIT) + 2) >+ >+int __pthread_once ( pthread_once_t *once_control, >+ void (*init_routine) (void) ) >+{ >+ int res; >+ int done; >+ >+# define TAKE_LOCK \ >+ res = __pthread_mutex_lock(&once_masterlock); \ >+ my_assert(res == 0); >+ >+# define RELEASE_LOCK \ >+ res = __pthread_mutex_unlock(&once_masterlock); \ >+ my_assert(res == 0); >+ >+ void cleanup(void *v) { >+ TAKE_LOCK; >+ *once_control = P_ONCE_NOT_DONE; >+ RELEASE_LOCK; >+ } >+ >+ ensure_valgrind("pthread_once"); >+ >+ /* Grab the lock transiently, so we can safely see what state this >+ once_control is in. */ >+ >+ TAKE_LOCK; >+ >+ switch (*once_control) { >+ >+ case P_ONCE_NOT_DONE: >+ /* Not started. Change state to indicate running, drop the >+ lock and run. */ >+ *once_control = P_ONCE_RUNNING; >+ _pthread_cleanup_push(NULL, cleanup, NULL); >+ RELEASE_LOCK; >+ init_routine(); >+ /* re-take the lock, and set state to indicate done. */ >+ TAKE_LOCK; >+ _pthread_cleanup_pop(NULL, False); >+ *once_control = P_ONCE_COMPLETED; >+ RELEASE_LOCK; >+ break; >+ >+ case P_ONCE_RUNNING: >+ /* This is the tricky case. The initialiser is running in >+ some other thread, but we have to delay this thread till >+ the other one completes. So we sort-of busy wait. In >+ fact it makes sense to yield now, because what we want to >+ happen is for the thread running the initialiser to >+ complete ASAP. */ >+ RELEASE_LOCK; >+ done = 0; >+ while (1) { >+ /* Let others run for a while. */ >+ __valgrind_pthread_yield(); >+ /* Grab the lock and see if we're done waiting. */ >+ TAKE_LOCK; >+ if (*once_control == P_ONCE_COMPLETED) >+ done = 1; >+ RELEASE_LOCK; >+ if (done) >+ break; >+ } >+ break; >+ >+ case P_ONCE_COMPLETED: >+ default: >+ /* Easy. It's already done. Just drop the lock. */ >+ RELEASE_LOCK; >+ break; >+ } >+ >+ return 0; >+ >+# undef TAKE_LOCK >+# undef RELEASE_LOCK >+} >+ >+#undef P_ONCE_NOT_DONE >+#undef P_ONCE_RUNNING >+#undef P_ONCE_COMPLETED >+ >+ >+/* --------------------------------------------------- >+ MISC >+ ------------------------------------------------ */ >+ >+static pthread_mutex_t pthread_atfork_lock >+ = PTHREAD_MUTEX_INITIALIZER; >+ >+int __pthread_atfork ( void (*prepare)(void), >+ void (*parent)(void), >+ void (*child)(void) ) >+{ >+ int n, res; >+ ForkHandlerEntry entry; >+ >+ ensure_valgrind("pthread_atfork"); >+ __pthread_mutex_lock(&pthread_atfork_lock); >+ >+ /* Fetch old counter */ >+ VALGRIND_MAGIC_SEQUENCE(n, -2 /* default */, >+ VG_USERREQ__GET_FHSTACK_USED, >+ 0, 0, 0, 0); >+ my_assert(n >= 0 && n < VG_N_FORKHANDLERSTACK); >+ if (n == VG_N_FORKHANDLERSTACK-1) >+ barf("pthread_atfork: VG_N_FORKHANDLERSTACK is too low; " >+ "increase and recompile"); >+ >+ /* Add entry */ >+ entry.prepare = *prepare; >+ entry.parent = *parent; >+ entry.child = *child; >+ VALGRIND_MAGIC_SEQUENCE(res, -2 /* default */, >+ VG_USERREQ__SET_FHSTACK_ENTRY, >+ n, &entry, 0, 0); >+ my_assert(res == 0); >+ >+ /* Bump counter */ >+ VALGRIND_MAGIC_SEQUENCE(res, -2 /* default */, >+ VG_USERREQ__SET_FHSTACK_USED, >+ n+1, 0, 0, 0); >+ my_assert(res == 0); >+ >+ __pthread_mutex_unlock(&pthread_atfork_lock); >+ return 0; >+} >+ >+ >+#ifdef GLIBC_2_3 >+/* This seems to be a hook which appeared in glibc-2.3.2. */ >+int __register_atfork ( void (*prepare)(void), >+ void (*parent)(void), >+ void (*child)(void) ) >+{ >+ return __pthread_atfork(prepare,parent,child); >+} >+#endif >+ >+WEAK >+void __pthread_initialize ( void ) >+{ >+ ensure_valgrind("__pthread_initialize"); >+} >+ >+ >+/* --------------------------------------------------- >+ LIBRARY-PRIVATE THREAD SPECIFIC STATE >+ ------------------------------------------------ */ >+ >+#include <resolv.h> >+static int thread_specific_errno[VG_N_THREADS]; >+static int thread_specific_h_errno[VG_N_THREADS]; >+static struct __res_state >+ thread_specific_res_state[VG_N_THREADS]; >+ >+#undef errno >+extern int errno; >+int* __errno_location ( void ) >+{ >+ int tid; >+ int *ret; >+ >+ ensure_valgrind("__errno_location"); >+ VALGRIND_MAGIC_SEQUENCE(tid, 1 /* default */, >+ VG_USERREQ__PTHREAD_GET_THREADID, >+ 0, 0, 0, 0); >+ /* 'cos I'm paranoid ... */ >+ if (tid < 1 || tid >= VG_N_THREADS) >+ barf("__errno_location: invalid ThreadId"); >+ if (tid == 1) >+ ret = &errno; >+ else >+ ret = &thread_specific_errno[tid]; >+ >+ return ret; >+} >+ >+#undef h_errno >+extern int h_errno; >+int* __h_errno_location ( void ) >+{ >+ int tid; >+ /* ensure_valgrind("__h_errno_location"); */ >+ VALGRIND_MAGIC_SEQUENCE(tid, 1 /* default */, >+ VG_USERREQ__PTHREAD_GET_THREADID, >+ 0, 0, 0, 0); >+ /* 'cos I'm paranoid ... */ >+ if (tid < 1 || tid >= VG_N_THREADS) >+ barf("__h_errno_location: invalid ThreadId"); >+ if (tid == 1) >+ return &h_errno; >+ return & thread_specific_h_errno[tid]; >+} >+ >+ >+#undef _res >+extern struct __res_state _res; >+struct __res_state* __res_state ( void ) >+{ >+ int tid; >+ /* ensure_valgrind("__res_state"); */ >+ VALGRIND_MAGIC_SEQUENCE(tid, 1 /* default */, >+ VG_USERREQ__PTHREAD_GET_THREADID, >+ 0, 0, 0, 0); >+ /* 'cos I'm paranoid ... */ >+ if (tid < 1 || tid >= VG_N_THREADS) >+ barf("__res_state: invalid ThreadId"); >+ if (tid == 1) >+ return & _res; >+ return & thread_specific_res_state[tid]; >+} >+ >+ >+/* --------------------------------------------------- >+ LIBC-PRIVATE SPECIFIC DATA >+ ------------------------------------------------ */ >+ >+/* Relies on assumption that initial private data is NULL. This >+ should be fixed somehow. */ >+ >+/* The allowable keys (indices) (all 3 of them). >+ From sysdeps/pthread/bits/libc-tsd.h >+*/ >+/* as per glibc anoncvs HEAD of 20021001. */ >+enum __libc_tsd_key_t { _LIBC_TSD_KEY_MALLOC = 0, >+ _LIBC_TSD_KEY_DL_ERROR, >+ _LIBC_TSD_KEY_RPC_VARS, >+ _LIBC_TSD_KEY_LOCALE, >+ _LIBC_TSD_KEY_CTYPE_B, >+ _LIBC_TSD_KEY_CTYPE_TOLOWER, >+ _LIBC_TSD_KEY_CTYPE_TOUPPER, >+ _LIBC_TSD_KEY_N }; >+ >+/* Auto-initialising subsystem. libc_specifics_inited is set >+ after initialisation. libc_specifics_inited_mx guards it. */ >+static int libc_specifics_inited = 0; >+static pthread_mutex_t libc_specifics_inited_mx = PTHREAD_MUTEX_INITIALIZER; >+ >+ >+/* These are the keys we must initialise the first time. */ >+static pthread_key_t libc_specifics_keys[_LIBC_TSD_KEY_N]; >+ >+ >+/* Initialise the keys, if they are not already initialised. */ >+static >+void init_libc_tsd_keys ( void ) >+{ >+ int res, i; >+ pthread_key_t k; >+ >+ /* Don't fall into deadlock if we get called again whilst we still >+ hold the lock, via the __uselocale() call herein. */ >+ if (libc_specifics_inited != 0) >+ return; >+ >+ /* Take the lock. */ >+ res = __pthread_mutex_lock(&libc_specifics_inited_mx); >+ if (res != 0) barf("init_libc_tsd_keys: lock"); >+ >+ /* Now test again, to be sure there is no mistake. */ >+ if (libc_specifics_inited != 0) { >+ res = __pthread_mutex_unlock(&libc_specifics_inited_mx); >+ if (res != 0) barf("init_libc_tsd_keys: unlock(1)"); >+ return; >+ } >+ >+ /* Actually do the initialisation. */ >+ /* printf("INIT libc specifics\n"); */ >+ for (i = 0; i < _LIBC_TSD_KEY_N; i++) { >+ res = __pthread_key_create(&k, NULL); >+ if (res != 0) barf("init_libc_tsd_keys: create"); >+ libc_specifics_keys[i] = k; >+ } >+ >+ /* Signify init done. */ >+ libc_specifics_inited = 1; >+ >+# ifdef GLIBC_2_3 >+ /* Set the initialising thread's locale to the global (default) >+ locale. A hack in support of glibc-2.3. This does the biz for >+ the root thread. For all other threads we run this in >+ thread_wrapper(), which does the real work of >+ pthread_create(). */ >+ /* assert that we are the root thread. I don't know if this is >+ really a valid assertion to make; if it breaks I'll reconsider >+ it. */ >+ my_assert(pthread_self() == 1); >+ __uselocale(LC_GLOBAL_LOCALE); >+# endif >+ >+ /* Unlock and return. */ >+ res = __pthread_mutex_unlock(&libc_specifics_inited_mx); >+ if (res != 0) barf("init_libc_tsd_keys: unlock"); >+} >+ >+ >+static int >+libc_internal_tsd_set ( enum __libc_tsd_key_t key, >+ const void * pointer ) >+{ >+ int res; >+ /* printf("SET SET SET key %d ptr %p\n", key, pointer); */ >+ if (key < _LIBC_TSD_KEY_MALLOC || key >= _LIBC_TSD_KEY_N) >+ barf("libc_internal_tsd_set: invalid key"); >+ init_libc_tsd_keys(); >+ res = __pthread_setspecific(libc_specifics_keys[key], pointer); >+ if (res != 0) barf("libc_internal_tsd_set: setspecific failed"); >+ return 0; >+} >+ >+static void * >+libc_internal_tsd_get ( enum __libc_tsd_key_t key ) >+{ >+ void* v; >+ /* printf("GET GET GET key %d\n", key); */ >+ if (key < _LIBC_TSD_KEY_MALLOC || key >= _LIBC_TSD_KEY_N) >+ barf("libc_internal_tsd_get: invalid key"); >+ init_libc_tsd_keys(); >+ v = __pthread_getspecific(libc_specifics_keys[key]); >+ /* if (v == NULL) barf("libc_internal_tsd_set: getspecific failed"); */ >+ return v; >+} >+ >+ >+int (*__libc_internal_tsd_set) >+ (enum __libc_tsd_key_t key, const void * pointer) >+ = libc_internal_tsd_set; >+ >+void* (*__libc_internal_tsd_get) >+ (enum __libc_tsd_key_t key) >+ = libc_internal_tsd_get; >+ >+ >+#ifdef GLIBC_2_3 >+/* This one was first spotted be me in the glibc-2.2.93 sources. */ >+static void** >+libc_internal_tsd_address ( enum __libc_tsd_key_t key ) >+{ >+ void** v; >+ /* printf("ADDR ADDR ADDR key %d\n", key); */ >+ if (key < _LIBC_TSD_KEY_MALLOC || key >= _LIBC_TSD_KEY_N) >+ barf("libc_internal_tsd_address: invalid key"); >+ init_libc_tsd_keys(); >+ v = __pthread_getspecific_addr(libc_specifics_keys[key]); >+ return v; >+} >+ >+void ** (*__libc_internal_tsd_address) >+ (enum __libc_tsd_key_t key) >+ = libc_internal_tsd_address; >+#endif >+ >+ >+/* --------------------------------------------------------------------- >+ These are here (I think) because they are deemed cancellation >+ points by POSIX. For the moment we'll simply pass the call along >+ to the corresponding thread-unaware (?) libc routine. >+ ------------------------------------------------------------------ */ >+ >+#ifdef GLIBC_2_1 >+extern >+int __sigaction >+ (int signum, >+ const struct sigaction *act, >+ struct sigaction *oldact); >+#else >+extern >+int __libc_sigaction >+ (int signum, >+ const struct sigaction *act, >+ struct sigaction *oldact); >+#endif >+int sigaction(int signum, >+ const struct sigaction *act, >+ struct sigaction *oldact) >+{ >+ __my_pthread_testcancel(); >+# ifdef GLIBC_2_1 >+ return __sigaction(signum, act, oldact); >+# else >+ return __libc_sigaction(signum, act, oldact); >+# endif >+} >+ >+extern >+int __libc_accept(int fd, struct sockaddr *addr, socklen_t *len); >+ >+WEAK int __accept(int fd, struct sockaddr *addr, socklen_t *len) >+{ >+ __my_pthread_testcancel(); >+ return __libc_accept(fd, addr, len); >+} >+strong_alias(__accept, accept); >+ >+extern >+int __libc_connect(int sockfd, >+ const struct sockaddr *serv_addr, >+ socklen_t addrlen); >+WEAK >+int connect(int sockfd, >+ const struct sockaddr *serv_addr, >+ socklen_t addrlen) >+{ >+ __my_pthread_testcancel(); >+ return __libc_connect(sockfd, serv_addr, addrlen); >+} >+ >+ >+extern >+int __libc_fcntl(int fd, int cmd, long arg); >+WEAK >+int fcntl(int fd, int cmd, long arg) >+{ >+ __my_pthread_testcancel(); >+ return __libc_fcntl(fd, cmd, arg); >+} >+ >+ >+extern >+ssize_t __libc_write(int fd, const void *buf, size_t count); >+WEAK >+ssize_t write(int fd, const void *buf, size_t count) >+{ >+ __my_pthread_testcancel(); >+ return __libc_write(fd, buf, count); >+} >+ >+ >+extern >+ssize_t __libc_read(int fd, void *buf, size_t count); >+WEAK >+ssize_t read(int fd, void *buf, size_t count) >+{ >+ __my_pthread_testcancel(); >+ return __libc_read(fd, buf, count); >+} >+ >+extern >+int __libc_open64(const char *pathname, int flags, mode_t mode); >+/* WEAK */ >+int open64(const char *pathname, int flags, mode_t mode) >+{ >+ return __libc_open64(pathname, flags, mode); >+} >+ >+extern >+int __libc_open(const char *pathname, int flags, mode_t mode); >+/* WEAK */ >+int open(const char *pathname, int flags, mode_t mode) >+{ >+ return __libc_open(pathname, flags, mode); >+} >+ >+extern >+int __libc_close(int fd); >+WEAK >+int close(int fd) >+{ >+ __my_pthread_testcancel(); >+ return __libc_close(fd); >+} >+ >+ >+extern >+pid_t __libc_waitpid(pid_t pid, int *status, int options); >+WEAK >+pid_t waitpid(pid_t pid, int *status, int options) >+{ >+ __my_pthread_testcancel(); >+ return __libc_waitpid(pid, status, options); >+} >+ >+ >+extern >+int __libc_nanosleep(const struct timespec *req, struct timespec *rem); >+WEAK >+int __nanosleep(const struct timespec *req, struct timespec *rem) >+{ >+ __my_pthread_testcancel(); >+ return __libc_nanosleep(req, rem); >+} >+ >+extern >+int __libc_pause(void); >+WEAK >+int __pause(void) >+{ >+ __my_pthread_testcancel(); >+ return __libc_pause(); >+} >+ >+ >+extern >+int __libc_fsync(int fd); >+WEAK >+int fsync(int fd) >+{ >+ __my_pthread_testcancel(); >+ return __libc_fsync(fd); >+} >+ >+ >+extern >+off_t __libc_lseek(int fildes, off_t offset, int whence); >+WEAK >+off_t lseek(int fildes, off_t offset, int whence) >+{ >+ __my_pthread_testcancel(); >+ return __libc_lseek(fildes, offset, whence); >+} >+ >+ >+extern >+__off64_t __libc_lseek64(int fildes, __off64_t offset, int whence); >+WEAK >+__off64_t lseek64(int fildes, __off64_t offset, int whence) >+{ >+ __my_pthread_testcancel(); >+ return __libc_lseek64(fildes, offset, whence); >+} >+ >+ >+extern >+ssize_t __libc_pread64 (int __fd, void *__buf, size_t __nbytes, >+ __off64_t __offset); >+ssize_t __pread64 (int __fd, void *__buf, size_t __nbytes, >+ __off64_t __offset) >+{ >+ __my_pthread_testcancel(); >+ return __libc_pread64(__fd, __buf, __nbytes, __offset); >+} >+ >+ >+extern >+ssize_t __libc_pwrite64 (int __fd, const void *__buf, size_t __nbytes, >+ __off64_t __offset); >+ssize_t __pwrite64 (int __fd, const void *__buf, size_t __nbytes, >+ __off64_t __offset) >+{ >+ __my_pthread_testcancel(); >+ return __libc_pwrite64(__fd, __buf, __nbytes, __offset); >+} >+ >+ >+extern >+ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset); >+WEAK >+ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset) >+{ >+ __my_pthread_testcancel(); >+ return __libc_pwrite(fd, buf, count, offset); >+} >+ >+ >+extern >+ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset); >+WEAK >+ssize_t pread(int fd, void *buf, size_t count, off_t offset) >+{ >+ __my_pthread_testcancel(); >+ return __libc_pread(fd, buf, count, offset); >+} >+ >+extern >+int __libc_recv(int s, void *msg, size_t len, int flags); >+WEAK >+int recv(int s, void *msg, size_t len, int flags) >+{ >+ __my_pthread_testcancel(); >+ return __libc_recv(s, msg, len, flags); >+} >+ >+extern >+int __libc_send(int s, const void *msg, size_t len, int flags); >+WEAK >+int send(int s, const void *msg, size_t len, int flags) >+{ >+ __my_pthread_testcancel(); >+ return __libc_send(s, msg, len, flags); >+} >+ >+ >+extern >+int __libc_sendmsg(int s, const struct msghdr *msg, int flags); >+WEAK >+int sendmsg(int s, const struct msghdr *msg, int flags) >+{ >+ __my_pthread_testcancel(); >+ return __libc_sendmsg(s, msg, flags); >+} >+ >+ >+extern >+int __libc_recvmsg(int s, struct msghdr *msg, int flags); >+WEAK >+int recvmsg(int s, struct msghdr *msg, int flags) >+{ >+ __my_pthread_testcancel(); >+ return __libc_recvmsg(s, msg, flags); >+} >+ >+ >+extern >+int __libc_recvfrom(int s, void *buf, size_t len, int flags, >+ struct sockaddr *from, socklen_t *fromlen); >+WEAK >+int recvfrom(int s, void *buf, size_t len, int flags, >+ struct sockaddr *from, socklen_t *fromlen) >+{ >+ __my_pthread_testcancel(); >+ return __libc_recvfrom(s, buf, len, flags, from, fromlen); >+} >+ >+ >+extern >+int __libc_sendto(int s, const void *msg, size_t len, int flags, >+ const struct sockaddr *to, socklen_t tolen); >+WEAK >+int sendto(int s, const void *msg, size_t len, int flags, >+ const struct sockaddr *to, socklen_t tolen) >+{ >+ __my_pthread_testcancel(); >+ return __libc_sendto(s, msg, len, flags, to, tolen); >+} >+ >+ >+extern >+int __libc_system(const char* str); >+WEAK >+int system(const char* str) >+{ >+ __my_pthread_testcancel(); >+ return __libc_system(str); >+} >+ >+ >+extern >+pid_t __libc_wait(int *status); >+WEAK >+pid_t wait(int *status) >+{ >+ __my_pthread_testcancel(); >+ return __libc_wait(status); >+} >+ >+ >+extern >+int __libc_msync(const void *start, size_t length, int flags); >+WEAK >+int msync(const void *start, size_t length, int flags) >+{ >+ __my_pthread_testcancel(); >+ return __libc_msync(start, length, flags); >+} >+ >+strong_alias(close, __close) >+strong_alias(fcntl, __fcntl) >+strong_alias(lseek, __lseek) >+strong_alias(open, __open) >+strong_alias(open64, __open64) >+strong_alias(read, __read) >+strong_alias(wait, __wait) >+strong_alias(write, __write) >+strong_alias(connect, __connect) >+strong_alias(send, __send) >+ >+weak_alias (__pread64, pread64) >+weak_alias (__pwrite64, pwrite64) >+weak_alias(__nanosleep, nanosleep) >+weak_alias(__pause, pause) >+ >+ >+extern >+void __libc_longjmp(jmp_buf env, int val) __attribute((noreturn)); >+/* not weak: WEAK */ >+void longjmp(jmp_buf env, int val) >+{ >+ __libc_longjmp(env, val); >+} >+ >+ >+extern void __libc_siglongjmp (sigjmp_buf env, int val) >+ __attribute__ ((noreturn)); >+void siglongjmp(sigjmp_buf env, int val) >+{ >+ kludged("siglongjmp", "(it ignores cleanup handlers)"); >+ __libc_siglongjmp(env, val); >+} >+ >+ >+/*--- fork and its helper ---*/ >+ >+static >+void run_fork_handlers ( int what ) >+{ >+ ForkHandlerEntry entry; >+ int n_h, n_handlers, i, res; >+ >+ my_assert(what == 0 || what == 1 || what == 2); >+ >+ /* Fetch old counter */ >+ VALGRIND_MAGIC_SEQUENCE(n_handlers, -2 /* default */, >+ VG_USERREQ__GET_FHSTACK_USED, >+ 0, 0, 0, 0); >+ my_assert(n_handlers >= 0 && n_handlers < VG_N_FORKHANDLERSTACK); >+ >+ /* Prepare handlers (what == 0) are called in opposite order of >+ calls to pthread_atfork. Parent and child handlers are called >+ in the same order as calls to pthread_atfork. */ >+ if (what == 0) >+ n_h = n_handlers - 1; >+ else >+ n_h = 0; >+ >+ for (i = 0; i < n_handlers; i++) { >+ VALGRIND_MAGIC_SEQUENCE(res, -2 /* default */, >+ VG_USERREQ__GET_FHSTACK_ENTRY, >+ n_h, &entry, 0, 0); >+ my_assert(res == 0); >+ switch (what) { >+ case 0: if (entry.prepare) entry.prepare(); >+ n_h--; break; >+ case 1: if (entry.parent) entry.parent(); >+ n_h++; break; >+ case 2: if (entry.child) entry.child(); >+ n_h++; break; >+ default: barf("run_fork_handlers: invalid what"); >+ } >+ } >+ >+ if (what != 0 /* prepare */) { >+ /* Empty out the stack. */ >+ VALGRIND_MAGIC_SEQUENCE(res, -2 /* default */, >+ VG_USERREQ__SET_FHSTACK_USED, >+ 0, 0, 0, 0); >+ my_assert(res == 0); >+ } >+} >+ >+extern >+pid_t __libc_fork(void); >+pid_t __fork(void) >+{ >+ pid_t pid; >+ __my_pthread_testcancel(); >+ __pthread_mutex_lock(&pthread_atfork_lock); >+ >+ run_fork_handlers(0 /* prepare */); >+ pid = __libc_fork(); >+ if (pid == 0) { >+ /* I am the child */ >+ run_fork_handlers(2 /* child */); >+ __pthread_mutex_unlock(&pthread_atfork_lock); >+ __pthread_mutex_init(&pthread_atfork_lock, NULL); >+ } else { >+ /* I am the parent */ >+ run_fork_handlers(1 /* parent */); >+ __pthread_mutex_unlock(&pthread_atfork_lock); >+ } >+ return pid; >+} >+ >+ >+pid_t __vfork(void) >+{ >+ return __fork(); >+} >+ >+ >+ >+/* --------------------------------------------------------------------- >+ Hacky implementation of semaphores. >+ ------------------------------------------------------------------ */ >+ >+#include <semaphore.h> >+ >+/* This is a terrible way to do the remapping. Plan is to import an >+ AVL tree at some point. */ >+ >+typedef >+ struct { >+ pthread_mutex_t se_mx; >+ pthread_cond_t se_cv; >+ int count; >+ int waiters; >+ } >+ vg_sem_t; >+ >+static pthread_mutex_t se_remap_mx = PTHREAD_MUTEX_INITIALIZER; >+ >+static int se_remap_used = 0; >+static sem_t* se_remap_orig[VG_N_SEMAPHORES]; >+static vg_sem_t se_remap_new[VG_N_SEMAPHORES]; >+ >+static vg_sem_t* se_remap ( sem_t* orig ) >+{ >+ int res, i; >+ res = __pthread_mutex_lock(&se_remap_mx); >+ my_assert(res == 0); >+ >+ for (i = 0; i < se_remap_used; i++) { >+ if (se_remap_orig[i] == orig) >+ break; >+ } >+ if (i == se_remap_used) { >+ if (se_remap_used == VG_N_SEMAPHORES) { >+ res = pthread_mutex_unlock(&se_remap_mx); >+ my_assert(res == 0); >+ barf("VG_N_SEMAPHORES is too low. Increase and recompile."); >+ } >+ se_remap_used++; >+ se_remap_orig[i] = orig; >+ /* printf("allocated semaphore %d\n", i); */ >+ } >+ res = __pthread_mutex_unlock(&se_remap_mx); >+ my_assert(res == 0); >+ return &se_remap_new[i]; >+} >+ >+static void se_unmap( sem_t* orig ) >+{ >+ int res, i; >+ res = __pthread_mutex_lock(&se_remap_mx); >+ my_assert(res == 0); >+ >+ for (i = 0; i < se_remap_used; i++) { >+ if (se_remap_orig[i] == orig) >+ break; >+ } >+ if (i == se_remap_used) { >+ res = pthread_mutex_unlock(&se_remap_mx); >+ my_assert(res == 0); >+ barf("se_unmap: unmapping invalid semaphore"); >+ } else { >+ se_remap_orig[i] = se_remap_orig[--se_remap_used]; >+ se_remap_orig[se_remap_used] = 0; >+ memset(&se_remap_new[se_remap_used], 0, >+ sizeof(se_remap_new[se_remap_used])); >+ } >+ res = pthread_mutex_unlock(&se_remap_mx); >+ my_assert(res == 0); >+} >+ >+int sem_init(sem_t *sem, int pshared, unsigned int value) >+{ >+ int res; >+ vg_sem_t* vg_sem; >+ ensure_valgrind("sem_init"); >+ if (pshared != 0) { >+ pthread_error("sem_init: unsupported pshared value"); >+ *(__errno_location()) = ENOSYS; >+ return -1; >+ } >+ vg_sem = se_remap(sem); >+ res = pthread_mutex_init(&vg_sem->se_mx, NULL); >+ my_assert(res == 0); >+ res = pthread_cond_init(&vg_sem->se_cv, NULL); >+ my_assert(res == 0); >+ vg_sem->count = value; >+ return 0; >+} >+ >+ >+int sem_wait ( sem_t* sem ) >+{ >+ int res; >+ vg_sem_t* vg_sem; >+ ensure_valgrind("sem_wait"); >+ vg_sem = se_remap(sem); >+ res = __pthread_mutex_lock(&vg_sem->se_mx); >+ my_assert(res == 0); >+ while (vg_sem->count == 0) { >+ ++vg_sem->waiters; >+ res = pthread_cond_wait(&vg_sem->se_cv, &vg_sem->se_mx); >+ --vg_sem->waiters; >+ my_assert(res == 0); >+ } >+ vg_sem->count--; >+ res = __pthread_mutex_unlock(&vg_sem->se_mx); >+ my_assert(res == 0); >+ return 0; >+} >+ >+int sem_post ( sem_t* sem ) >+{ >+ int res; >+ vg_sem_t* vg_sem; >+ ensure_valgrind("sem_post"); >+ vg_sem = se_remap(sem); >+ res = __pthread_mutex_lock(&vg_sem->se_mx); >+ my_assert(res == 0); >+ if (vg_sem->count == 0) { >+ vg_sem->count++; >+ res = pthread_cond_broadcast(&vg_sem->se_cv); >+ my_assert(res == 0); >+ } else { >+ vg_sem->count++; >+ } >+ res = __pthread_mutex_unlock(&vg_sem->se_mx); >+ my_assert(res == 0); >+ return 0; >+} >+ >+ >+int sem_trywait ( sem_t* sem ) >+{ >+ int ret, res; >+ vg_sem_t* vg_sem; >+ ensure_valgrind("sem_trywait"); >+ vg_sem = se_remap(sem); >+ res = __pthread_mutex_lock(&vg_sem->se_mx); >+ my_assert(res == 0); >+ if (vg_sem->count > 0) { >+ vg_sem->count--; >+ ret = 0; >+ } else { >+ ret = -1; >+ *(__errno_location()) = EAGAIN; >+ } >+ res = __pthread_mutex_unlock(&vg_sem->se_mx); >+ my_assert(res == 0); >+ return ret; >+} >+ >+ >+int sem_getvalue(sem_t* sem, int * sval) >+{ >+ int res; >+ vg_sem_t* vg_sem; >+ ensure_valgrind("sem_getvalue"); >+ vg_sem = se_remap(sem); >+ res = __pthread_mutex_lock(&vg_sem->se_mx); >+ my_assert(res == 0); >+ *sval = vg_sem->count; >+ res = __pthread_mutex_unlock(&vg_sem->se_mx); >+ my_assert(res == 0); >+ return 0; >+} >+ >+ >+int sem_destroy(sem_t * sem) >+{ >+ /* if someone waiting on this semaphore, errno = EBUSY, return -1 */ >+ vg_sem_t* vg_sem; >+ int res; >+ ensure_valgrind("sem_destroy"); >+ vg_sem = se_remap(sem); >+ res = __pthread_mutex_lock(&vg_sem->se_mx); >+ my_assert(res == 0); >+ if (vg_sem->waiters > 0) >+ { >+ *(__errno_location()) = EBUSY; >+ res = __pthread_mutex_unlock(&vg_sem->se_mx); >+ my_assert(res == 0); >+ return -1; >+ } >+ res = pthread_cond_destroy(&vg_sem->se_cv); >+ my_assert(res == 0); >+ res = __pthread_mutex_unlock(&vg_sem->se_mx); >+ my_assert(res == 0); >+ res = pthread_mutex_destroy(&vg_sem->se_mx); >+ my_assert(res == 0); >+ se_unmap(sem); >+ return 0; >+} >+ >+ >+int sem_timedwait(sem_t* sem, const struct timespec *abstime) >+{ >+ int res; >+ vg_sem_t* vg_sem; >+ ensure_valgrind("sem_timedwait"); >+ vg_sem = se_remap(sem); >+ res = __pthread_mutex_lock(&vg_sem->se_mx); >+ my_assert(res == 0); >+ while ( vg_sem->count == 0 && res != ETIMEDOUT ) { >+ ++vg_sem->waiters; >+ res = pthread_cond_timedwait(&vg_sem->se_cv, &vg_sem->se_mx, abstime); >+ --vg_sem->waiters; >+ } >+ if ( vg_sem->count > 0 ) { >+ vg_sem->count--; >+ res = __pthread_mutex_unlock(&vg_sem->se_mx); >+ my_assert(res == 0 ); >+ return 0; >+ } else { >+ res = __pthread_mutex_unlock(&vg_sem->se_mx); >+ my_assert(res == 0 ); >+ *(__errno_location()) = ETIMEDOUT; >+ return -1; >+ } >+} >+ >+ >+/* --------------------------------------------------------------------- >+ Reader-writer locks. >+ ------------------------------------------------------------------ */ >+ >+typedef >+ struct { >+ int initted; /* != 0 --> in use; sanity check only */ >+ int prefer_w; /* != 0 --> prefer writer */ >+ int nwait_r; /* # of waiting readers */ >+ int nwait_w; /* # of waiting writers */ >+ pthread_cond_t cv_r; /* for signalling readers */ >+ pthread_cond_t cv_w; /* for signalling writers */ >+ pthread_mutex_t mx; >+ int status; >+ /* allowed range for status: >= -1. -1 means 1 writer currently >+ active, >= 0 means N readers currently active. */ >+ } >+ vg_rwlock_t; >+ >+ >+static pthread_mutex_t rw_remap_mx = PTHREAD_MUTEX_INITIALIZER; >+ >+static int rw_remap_used = 0; >+static pthread_rwlock_t* rw_remap_orig[VG_N_RWLOCKS]; >+static vg_rwlock_t rw_remap_new[VG_N_RWLOCKS]; >+ >+ >+static >+void init_vg_rwlock ( vg_rwlock_t* vg_rwl ) >+{ >+ int res = 0; >+ vg_rwl->initted = 1; >+ vg_rwl->prefer_w = 1; >+ vg_rwl->nwait_r = 0; >+ vg_rwl->nwait_w = 0; >+ vg_rwl->status = 0; >+ res = pthread_mutex_init(&vg_rwl->mx, NULL); >+ res |= pthread_cond_init(&vg_rwl->cv_r, NULL); >+ res |= pthread_cond_init(&vg_rwl->cv_w, NULL); >+ my_assert(res == 0); >+} >+ >+ >+/* Take the address of a LinuxThreads rwlock_t and return the shadow >+ address of our version. Further, if the LinuxThreads version >+ appears to have been statically initialised, do the same to the one >+ we allocate here. The pthread_rwlock_t.__rw_readers field is set >+ to zero by PTHREAD_RWLOCK_INITIALIZER, so we take zero as meaning >+ uninitialised and non-zero meaning initialised. >+*/ >+static vg_rwlock_t* rw_remap ( pthread_rwlock_t* orig ) >+{ >+ int res, i; >+ vg_rwlock_t* vg_rwl; >+ res = __pthread_mutex_lock(&rw_remap_mx); >+ my_assert(res == 0); >+ >+ for (i = 0; i < rw_remap_used; i++) { >+ if (rw_remap_orig[i] == orig) >+ break; >+ } >+ if (i == rw_remap_used) { >+ if (rw_remap_used == VG_N_RWLOCKS) { >+ res = __pthread_mutex_unlock(&rw_remap_mx); >+ my_assert(res == 0); >+ barf("VG_N_RWLOCKS is too low. Increase and recompile."); >+ } >+ rw_remap_used++; >+ rw_remap_orig[i] = orig; >+ rw_remap_new[i].initted = 0; >+ if (0) printf("allocated rwlock %d\n", i); >+ } >+ res = __pthread_mutex_unlock(&rw_remap_mx); >+ my_assert(res == 0); >+ vg_rwl = &rw_remap_new[i]; >+ >+ /* Initialise the shadow, if required. */ >+ if (orig->__rw_readers == 0) { >+ orig->__rw_readers = 1; >+ init_vg_rwlock(vg_rwl); >+ if (orig->__rw_kind == PTHREAD_RWLOCK_PREFER_READER_NP) >+ vg_rwl->prefer_w = 0; >+ } >+ >+ return vg_rwl; >+} >+ >+ >+int pthread_rwlock_init ( pthread_rwlock_t* orig, >+ const pthread_rwlockattr_t* attr ) >+{ >+ vg_rwlock_t* rwl; >+ if (0) printf ("pthread_rwlock_init\n"); >+ /* Force the remapper to initialise the shadow. */ >+ orig->__rw_readers = 0; >+ /* Install the lock preference; the remapper needs to know it. */ >+ orig->__rw_kind = PTHREAD_RWLOCK_DEFAULT_NP; >+ if (attr) >+ orig->__rw_kind = attr->__lockkind; >+ rwl = rw_remap ( orig ); >+ return 0; >+} >+ >+ >+static >+void pthread_rwlock_rdlock_CANCEL_HDLR ( void* rwl_v ) >+{ >+ vg_rwlock_t* rwl = (vg_rwlock_t*)rwl_v; >+ rwl->nwait_r--; >+ pthread_mutex_unlock (&rwl->mx); >+} >+ >+ >+int pthread_rwlock_rdlock ( pthread_rwlock_t* orig ) >+{ >+ int res; >+ vg_rwlock_t* rwl; >+ if (0) printf ("pthread_rwlock_rdlock\n"); >+ rwl = rw_remap ( orig ); >+ res = __pthread_mutex_lock(&rwl->mx); >+ my_assert(res == 0); >+ if (!rwl->initted) { >+ res = __pthread_mutex_unlock(&rwl->mx); >+ my_assert(res == 0); >+ return EINVAL; >+ } >+ if (rwl->status < 0) { >+ my_assert(rwl->status == -1); >+ rwl->nwait_r++; >+ pthread_cleanup_push( pthread_rwlock_rdlock_CANCEL_HDLR, rwl ); >+ while (1) { >+ if (rwl->status == 0) break; >+ res = pthread_cond_wait(&rwl->cv_r, &rwl->mx); >+ my_assert(res == 0); >+ } >+ pthread_cleanup_pop(0); >+ rwl->nwait_r--; >+ } >+ my_assert(rwl->status >= 0); >+ rwl->status++; >+ res = __pthread_mutex_unlock(&rwl->mx); >+ my_assert(res == 0); >+ return 0; >+} >+ >+ >+int pthread_rwlock_tryrdlock ( pthread_rwlock_t* orig ) >+{ >+ int res; >+ vg_rwlock_t* rwl; >+ if (0) printf ("pthread_rwlock_tryrdlock\n"); >+ rwl = rw_remap ( orig ); >+ res = __pthread_mutex_lock(&rwl->mx); >+ my_assert(res == 0); >+ if (!rwl->initted) { >+ res = __pthread_mutex_unlock(&rwl->mx); >+ my_assert(res == 0); >+ return EINVAL; >+ } >+ if (rwl->status == -1) { >+ /* Writer active; we have to give up. */ >+ res = __pthread_mutex_unlock(&rwl->mx); >+ my_assert(res == 0); >+ return EBUSY; >+ } >+ /* Success */ >+ my_assert(rwl->status >= 0); >+ rwl->status++; >+ res = __pthread_mutex_unlock(&rwl->mx); >+ my_assert(res == 0); >+ return 0; >+} >+ >+ >+static >+void pthread_rwlock_wrlock_CANCEL_HDLR ( void* rwl_v ) >+{ >+ vg_rwlock_t* rwl = (vg_rwlock_t*)rwl_v; >+ rwl->nwait_w--; >+ pthread_mutex_unlock (&rwl->mx); >+} >+ >+ >+int pthread_rwlock_wrlock ( pthread_rwlock_t* orig ) >+{ >+ int res; >+ vg_rwlock_t* rwl; >+ if (0) printf ("pthread_rwlock_wrlock\n"); >+ rwl = rw_remap ( orig ); >+ res = __pthread_mutex_lock(&rwl->mx); >+ my_assert(res == 0); >+ if (!rwl->initted) { >+ res = __pthread_mutex_unlock(&rwl->mx); >+ my_assert(res == 0); >+ return EINVAL; >+ } >+ if (rwl->status != 0) { >+ rwl->nwait_w++; >+ pthread_cleanup_push( pthread_rwlock_wrlock_CANCEL_HDLR, rwl ); >+ while (1) { >+ if (rwl->status == 0) break; >+ res = pthread_cond_wait(&rwl->cv_w, &rwl->mx); >+ my_assert(res == 0); >+ } >+ pthread_cleanup_pop(0); >+ rwl->nwait_w--; >+ } >+ my_assert(rwl->status == 0); >+ rwl->status = -1; >+ res = __pthread_mutex_unlock(&rwl->mx); >+ my_assert(res == 0); >+ return 0; >+} >+ >+ >+int pthread_rwlock_trywrlock ( pthread_rwlock_t* orig ) >+{ >+ int res; >+ vg_rwlock_t* rwl; >+ if (0) printf ("pthread_wrlock_trywrlock\n"); >+ rwl = rw_remap ( orig ); >+ res = __pthread_mutex_lock(&rwl->mx); >+ my_assert(res == 0); >+ if (!rwl->initted) { >+ res = __pthread_mutex_unlock(&rwl->mx); >+ my_assert(res == 0); >+ return EINVAL; >+ } >+ if (rwl->status != 0) { >+ /* Reader(s) or a writer active; we have to give up. */ >+ res = __pthread_mutex_unlock(&rwl->mx); >+ my_assert(res == 0); >+ return EBUSY; >+ } >+ /* Success */ >+ my_assert(rwl->status == 0); >+ rwl->status = -1; >+ res = __pthread_mutex_unlock(&rwl->mx); >+ my_assert(res == 0); >+ return 0; >+} >+ >+ >+int pthread_rwlock_unlock ( pthread_rwlock_t* orig ) >+{ >+ int res; >+ vg_rwlock_t* rwl; >+ if (0) printf ("pthread_rwlock_unlock\n"); >+ rwl = rw_remap ( orig ); >+ rwl = rw_remap ( orig ); >+ res = __pthread_mutex_lock(&rwl->mx); >+ my_assert(res == 0); >+ if (!rwl->initted) { >+ res = __pthread_mutex_unlock(&rwl->mx); >+ my_assert(res == 0); >+ return EINVAL; >+ } >+ if (rwl->status == 0) { >+ res = __pthread_mutex_unlock(&rwl->mx); >+ my_assert(res == 0); >+ return EPERM; >+ } >+ my_assert(rwl->status != 0); >+ if (rwl->status == -1) { >+ rwl->status = 0; >+ } else { >+ my_assert(rwl->status > 0); >+ rwl->status--; >+ } >+ >+ my_assert(rwl->status >= 0); >+ >+ if (rwl->prefer_w) { >+ >+ /* Favour waiting writers, if any. */ >+ if (rwl->nwait_w > 0) { >+ /* Writer(s) are waiting. */ >+ if (rwl->status == 0) { >+ /* We can let a writer in. */ >+ res = pthread_cond_signal(&rwl->cv_w); >+ my_assert(res == 0); >+ } else { >+ /* There are still readers active. Do nothing; eventually >+ they will disappear, at which point a writer will be >+ admitted. */ >+ } >+ } >+ else >+ /* No waiting writers. */ >+ if (rwl->nwait_r > 0) { >+ /* Let in a waiting reader. */ >+ res = pthread_cond_signal(&rwl->cv_r); >+ my_assert(res == 0); >+ } >+ >+ } else { >+ >+ /* Favour waiting readers, if any. */ >+ if (rwl->nwait_r > 0) { >+ /* Reader(s) are waiting; let one in. */ >+ res = pthread_cond_signal(&rwl->cv_r); >+ my_assert(res == 0); >+ } >+ else >+ /* No waiting readers. */ >+ if (rwl->nwait_w > 0 && rwl->status == 0) { >+ /* We have waiting writers and no active readers; let a >+ writer in. */ >+ res = pthread_cond_signal(&rwl->cv_w); >+ my_assert(res == 0); >+ } >+ } >+ >+ res = __pthread_mutex_unlock(&rwl->mx); >+ my_assert(res == 0); >+ return 0; >+} >+ >+ >+int pthread_rwlock_destroy ( pthread_rwlock_t *orig ) >+{ >+ int res; >+ vg_rwlock_t* rwl; >+ if (0) printf ("pthread_rwlock_destroy\n"); >+ rwl = rw_remap ( orig ); >+ res = __pthread_mutex_lock(&rwl->mx); >+ my_assert(res == 0); >+ if (!rwl->initted) { >+ res = __pthread_mutex_unlock(&rwl->mx); >+ my_assert(res == 0); >+ return EINVAL; >+ } >+ if (rwl->status != 0 || rwl->nwait_r > 0 || rwl->nwait_w > 0) { >+ res = __pthread_mutex_unlock(&rwl->mx); >+ my_assert(res == 0); >+ return EBUSY; >+ } >+ rwl->initted = 0; >+ res = __pthread_mutex_unlock(&rwl->mx); >+ my_assert(res == 0); >+ return 0; >+} >+ >+ >+/* Copied directly from LinuxThreads. */ >+int >+pthread_rwlockattr_init (pthread_rwlockattr_t *attr) >+{ >+ attr->__lockkind = 0; >+ attr->__pshared = PTHREAD_PROCESS_PRIVATE; >+ >+ return 0; >+} >+ >+/* Copied directly from LinuxThreads. */ >+int >+pthread_rwlockattr_destroy (pthread_rwlockattr_t *attr) >+{ >+ return 0; >+} >+ >+/* Copied directly from LinuxThreads. */ >+int >+pthread_rwlockattr_setpshared (pthread_rwlockattr_t *attr, int pshared) >+{ >+ if (pshared != PTHREAD_PROCESS_PRIVATE && pshared != PTHREAD_PROCESS_SHARED) >+ return EINVAL; >+ >+ /* For now it is not possible to shared a conditional variable. */ >+ if (pshared != PTHREAD_PROCESS_PRIVATE) >+ return ENOSYS; >+ >+ attr->__pshared = pshared; >+ >+ return 0; >+} >+ >+ >+ >+/* --------------------------------------------------------------------- >+ Manage the allocation and use of RT signals. The Valgrind core >+ uses one. glibc needs us to implement this to make RT signals >+ work; things just seem to crash if we don't. >+ ------------------------------------------------------------------ */ >+int __libc_current_sigrtmin (void) >+{ >+ int res; >+ >+ VALGRIND_MAGIC_SEQUENCE(res, 0, >+ VG_USERREQ__GET_SIGRT_MIN, >+ 0, 0, 0, 0); >+ >+ return res; >+} >+ >+int __libc_current_sigrtmax (void) >+{ >+ int res; >+ >+ VALGRIND_MAGIC_SEQUENCE(res, 0, >+ VG_USERREQ__GET_SIGRT_MAX, >+ 0, 0, 0, 0); >+ >+ return res; >+} >+ >+int __libc_allocate_rtsig (int high) >+{ >+ int res; >+ >+ VALGRIND_MAGIC_SEQUENCE(res, 0, >+ VG_USERREQ__ALLOC_RTSIG, >+ high, 0, 0, 0); >+ >+ return res; >+} >+ >+/* --------------------------------------------------------------------- >+ B'stard. >+ ------------------------------------------------------------------ */ >+strong_alias(__pthread_mutex_lock, pthread_mutex_lock) >+strong_alias(__pthread_mutex_trylock, pthread_mutex_trylock) >+strong_alias(__pthread_mutex_unlock, pthread_mutex_unlock) >+strong_alias(__pthread_mutexattr_init, pthread_mutexattr_init) >+ weak_alias(__pthread_mutexattr_settype, pthread_mutexattr_settype) >+ weak_alias(__pthread_mutexattr_setpshared, pthread_mutexattr_setpshared) >+strong_alias(__pthread_mutex_init, pthread_mutex_init) >+strong_alias(__pthread_mutexattr_destroy, pthread_mutexattr_destroy) >+strong_alias(__pthread_mutex_destroy, pthread_mutex_destroy) >+strong_alias(__pthread_once, pthread_once) >+strong_alias(__pthread_atfork, pthread_atfork) >+strong_alias(__pthread_key_create, pthread_key_create) >+strong_alias(__pthread_getspecific, pthread_getspecific) >+strong_alias(__pthread_setspecific, pthread_setspecific) >+ >+#ifndef GLIBC_2_1 >+strong_alias(sigaction, __sigaction) >+#endif >+ >+weak_alias(__fork, fork) >+weak_alias(__vfork, vfork) >+weak_alias (__pthread_kill_other_threads_np, pthread_kill_other_threads_np) >+ >+/*--------------------------------------------------*/ >+ >+weak_alias(pthread_rwlock_rdlock, __pthread_rwlock_rdlock) >+weak_alias(pthread_rwlock_unlock, __pthread_rwlock_unlock) >+weak_alias(pthread_rwlock_wrlock, __pthread_rwlock_wrlock) >+ >+weak_alias(pthread_rwlock_destroy, __pthread_rwlock_destroy) >+weak_alias(pthread_rwlock_init, __pthread_rwlock_init) >+weak_alias(pthread_rwlock_tryrdlock, __pthread_rwlock_tryrdlock) >+weak_alias(pthread_rwlock_trywrlock, __pthread_rwlock_trywrlock) >+ >+ >+/* I've no idea what these are, but they get called quite a lot. >+ Anybody know? */ >+ >+#ifndef __UCLIBC__ >+#undef _IO_flockfile >+void _IO_flockfile ( _IO_FILE * file ) >+{ >+ pthread_mutex_lock(file->_lock); >+} >+weak_alias(_IO_flockfile, flockfile); >+ >+#undef _IO_funlockfile >+void _IO_funlockfile ( _IO_FILE * file ) >+{ >+ pthread_mutex_unlock(file->_lock); >+} >+weak_alias(_IO_funlockfile, funlockfile); >+#endif >+ >+ >+/* This doesn't seem to be needed to simulate libpthread.so's external >+ interface, but many people complain about its absence. */ >+ >+strong_alias(__pthread_mutexattr_settype, __pthread_mutexattr_setkind_np) >+weak_alias(__pthread_mutexattr_setkind_np, pthread_mutexattr_setkind_np) >+ >+/* POSIX spinlocks, taken from glibc linuxthreads/sysdeps/i386 */ >+ >+typedef volatile int pthread_spinlock_t; /* Huh? Guarded by __USE_XOPEN2K */ >+ >+int pthread_spin_init(pthread_spinlock_t *lock, int pshared) >+{ >+ /* We can ignore the `pshared' parameter. Since we are busy-waiting >+ all processes which can access the memory location `lock' points >+ to can use the spinlock. */ >+ *lock = 1; >+ return 0; >+} >+ >+int pthread_spin_lock(pthread_spinlock_t *lock) >+{ >+ asm volatile >+ ("\n" >+ "1:\n\t" >+ "lock; decl %0\n\t" >+ "js 2f\n\t" >+ ".section .text.spinlock,\"ax\"\n" >+ "2:\n\t" >+ "cmpl $0,%0\n\t" >+ "rep; nop\n\t" >+ "jle 2b\n\t" >+ "jmp 1b\n\t" >+ ".previous" >+ : "=m" (*lock)); >+ return 0; >+} >+ >+int pthread_spin_unlock(pthread_spinlock_t *lock) >+{ >+ asm volatile >+ ("movl $1,%0" >+ : "=m" (*lock)); >+ return 0; >+} >+ >+int pthread_spin_destroy(pthread_spinlock_t *lock) >+{ >+ /* Nothing to do. */ >+ return 0; >+} >+ >+int pthread_spin_trylock(pthread_spinlock_t *lock) >+{ >+ int oldval; >+ >+ asm volatile >+ ("xchgl %0,%1" >+ : "=r" (oldval), "=m" (*lock) >+ : "0" (0)); >+ return oldval > 0 ? 0 : EBUSY; >+} >+ >+/*--------------------------------------------------------------------*/ >+/*--- end vg_libpthread.c ---*/ >+/*--------------------------------------------------------------------*/ >diff -ruN valgrind-2.1.0/coregrind/arch/x86-linux/vg_libpthread_unimp.c valgrind/coregrind/arch/x86-linux/vg_libpthread_unimp.c >--- valgrind-2.1.0/coregrind/arch/x86-linux/vg_libpthread_unimp.c 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/arch/x86-linux/vg_libpthread_unimp.c 2004-01-04 10:43:21.000000000 -0600 >@@ -0,0 +1,272 @@ >+ >+/*--------------------------------------------------------------------*/ >+/*--- Give dummy bindings for everything the real libpthread.so ---*/ >+/*--- binds. vg_libpthread_unimp.c ---*/ >+/*--------------------------------------------------------------------*/ >+ >+/* >+ This file is part of Valgrind, an extensible x86 protected-mode >+ emulator for monitoring program execution on x86-Unixes. >+ >+ Copyright (C) 2000-2004 Julian Seward >+ jseward@acm.org >+ >+ 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. >+*/ >+ >+/* --------------------------------------------------------------------- >+ ALL THIS CODE RUNS ON THE SIMULATED CPU. >+ Give a binding for everything the real libpthread.so binds. >+ ------------------------------------------------------------------ */ >+ >+#include "vg_include.h" /* For GLIBC_2_3, or not, as the case may be */ >+ >+extern void vgPlain_unimp ( char* ); >+#define unimp(str) vgPlain_unimp(str) >+ >+//void _IO_flockfile ( void ) { unimp("_IO_flockfile"); } >+void _IO_ftrylockfile ( void ) { unimp("_IO_ftrylockfile"); } >+//void _IO_funlockfile ( void ) { unimp("_IO_funlockfile"); } >+//void __close ( void ) { unimp("__close"); } >+//void __connect ( void ) { unimp("__connect"); } >+//void __errno_location ( void ) { unimp("__errno_location"); } >+//void __fcntl ( void ) { unimp("__fcntl"); } >+//void __fork ( void ) { unimp("__fork"); } >+//void __h_errno_location ( void ) { unimp("__h_errno_location"); } >+//void __libc_allocate_rtsig ( void ) { unimp("__libc_allocate_rtsig"); } >+//void __libc_current_sigrtmax ( void ) { unimp("__libc_current_sigrtmax"); } >+//void __libc_current_sigrtmin ( void ) { unimp("__libc_current_sigrtmin"); } >+//void __lseek ( void ) { unimp("__lseek"); } >+//void __open ( void ) { unimp("__open"); } >+//void __open64 ( void ) { unimp("__open64"); } >+//void __pread64 ( void ) { unimp("__pread64"); } >+//void __pthread_atfork ( void ) { unimp("__pthread_atfork"); } >+//void __pthread_getspecific ( void ) { unimp("__pthread_getspecific"); } >+//void __pthread_key_create ( void ) { unimp("__pthread_key_create"); } >+//void __pthread_kill_other_threads_np ( void ) { unimp("__pthread_kill_other_threads_np"); } >+//void __pthread_mutex_destroy ( void ) { unimp("__pthread_mutex_destroy"); } >+//void __pthread_mutex_init ( void ) { unimp("__pthread_mutex_init"); } >+//void __pthread_mutex_lock ( void ) { unimp("__pthread_mutex_lock"); } >+//void __pthread_mutex_trylock ( void ) { unimp("__pthread_mutex_trylock"); } >+//void __pthread_mutex_unlock ( void ) { unimp("__pthread_mutex_unlock"); } >+//void __pthread_mutexattr_destroy ( void ) { unimp("__pthread_mutexattr_destroy"); } >+//void __pthread_mutexattr_init ( void ) { unimp("__pthread_mutexattr_init"); } >+//void __pthread_mutexattr_settype ( void ) { unimp("__pthread_mutexattr_settype"); } >+//void __pthread_once ( void ) { unimp("__pthread_once"); } >+//void __pthread_setspecific ( void ) { unimp("__pthread_setspecific"); } >+//void __pwrite64 ( void ) { unimp("__pwrite64"); } >+//void __read ( void ) { unimp("__read"); } >+//void __res_state ( void ) { unimp("__res_state"); } >+//void __send ( void ) { unimp("__send"); } >+//void __sigaction ( void ) { unimp("__sigaction"); } >+//--//void __vfork ( void ) { unimp("__vfork"); } >+//void __wait ( void ) { unimp("__wait"); } >+//void __write ( void ) { unimp("__write"); } >+//void _pthread_cleanup_pop ( void ) { unimp("_pthread_cleanup_pop"); } >+//void _pthread_cleanup_pop_restore ( void ) { unimp("_pthread_cleanup_pop_restore"); } >+//void _pthread_cleanup_push ( void ) { unimp("_pthread_cleanup_push"); } >+//void _pthread_cleanup_push_defer ( void ) { unimp("_pthread_cleanup_push_defer"); } >+//void longjmp ( void ) { unimp("longjmp"); } >+//void pthread_atfork ( void ) { unimp("pthread_atfork"); } >+//void pthread_attr_destroy ( void ) { unimp("pthread_attr_destroy"); } >+//void pthread_attr_getdetachstate ( void ) { unimp("pthread_attr_getdetachstate"); } >+void pthread_attr_getinheritsched ( void ) { unimp("pthread_attr_getinheritsched"); } >+//void pthread_attr_getschedparam ( void ) { unimp("pthread_attr_getschedparam"); } >+//void pthread_attr_getschedpolicy ( void ) { unimp("pthread_attr_getschedpolicy"); } >+//void pthread_attr_getscope ( void ) { unimp("pthread_attr_getscope"); } >+ >+//void pthread_attr_setdetachstate ( void ) { unimp("pthread_attr_setdetachstate"); } >+//void pthread_attr_setinheritsched ( void ) { unimp("pthread_attr_setinheritsched"); } >+//void pthread_attr_setschedparam ( void ) { unimp("pthread_attr_setschedparam"); } >+//void pthread_attr_setschedpolicy ( void ) { unimp("pthread_attr_setschedpolicy"); } >+//void pthread_attr_setscope ( void ) { unimp("pthread_attr_setscope"); } >+void pthread_barrier_destroy ( void ) { unimp("pthread_barrier_destroy"); } >+void pthread_barrier_init ( void ) { unimp("pthread_barrier_init"); } >+void pthread_barrier_wait ( void ) { unimp("pthread_barrier_wait"); } >+void pthread_barrierattr_destroy ( void ) { unimp("pthread_barrierattr_destroy"); } >+void pthread_barrierattr_init ( void ) { unimp("pthread_barrierattr_init"); } >+void pthread_barrierattr_setpshared ( void ) { unimp("pthread_barrierattr_setpshared"); } >+//void pthread_cancel ( void ) { unimp("pthread_cancel"); } >+//void pthread_cond_broadcast ( void ) { unimp("pthread_cond_broadcast"); } >+//void pthread_cond_destroy ( void ) { unimp("pthread_cond_destroy"); } >+//void pthread_cond_init ( void ) { unimp("pthread_cond_init"); } >+//void pthread_cond_signal ( void ) { unimp("pthread_cond_signal"); } >+//void pthread_cond_timedwait ( void ) { unimp("pthread_cond_timedwait"); } >+//void pthread_cond_wait ( void ) { unimp("pthread_cond_wait"); } >+//void pthread_condattr_destroy ( void ) { unimp("pthread_condattr_destroy"); } >+void pthread_condattr_getpshared ( void ) { unimp("pthread_condattr_getpshared"); } >+//void pthread_condattr_init ( void ) { unimp("pthread_condattr_init"); } >+void pthread_condattr_setpshared ( void ) { unimp("pthread_condattr_setpshared"); } >+//void pthread_detach ( void ) { unimp("pthread_detach"); } >+//void pthread_equal ( void ) { unimp("pthread_equal"); } >+//void pthread_exit ( void ) { unimp("pthread_exit"); } >+//void pthread_getattr_np ( void ) { unimp("pthread_getattr_np"); } >+void pthread_getcpuclockid ( void ) { unimp("pthread_getcpuclockid"); } >+//void pthread_getschedparam ( void ) { unimp("pthread_getschedparam"); } >+//void pthread_getspecific ( void ) { unimp("pthread_getspecific"); } >+//void pthread_join ( void ) { unimp("pthread_join"); } >+//void pthread_key_create ( void ) { unimp("pthread_key_create"); } >+//void pthread_key_delete ( void ) { unimp("pthread_key_delete"); } >+//void pthread_kill ( void ) { unimp("pthread_kill"); } >+//void pthread_mutex_destroy ( void ) { unimp("pthread_mutex_destroy"); } >+//void pthread_mutex_init ( void ) { unimp("pthread_mutex_init"); } >+//void pthread_mutex_lock ( void ) { unimp("pthread_mutex_lock"); } >+void pthread_mutex_timedlock ( void ) { unimp("pthread_mutex_timedlock"); } >+//void pthread_mutex_trylock ( void ) { unimp("pthread_mutex_trylock"); } >+//void pthread_mutex_unlock ( void ) { unimp("pthread_mutex_unlock"); } >+//void pthread_mutexattr_destroy ( void ) { unimp("pthread_mutexattr_destroy"); } >+//void pthread_mutexattr_init ( void ) { unimp("pthread_mutexattr_init"); } >+//void pthread_once ( void ) { unimp("pthread_once"); } >+//void pthread_rwlock_destroy ( void ) { unimp("pthread_rwlock_destroy"); } >+//void pthread_rwlock_init ( void ) { unimp("pthread_rwlock_init"); } >+//void pthread_rwlock_rdlock ( void ) { unimp("pthread_rwlock_rdlock"); } >+void pthread_rwlock_timedrdlock ( void ) { unimp("pthread_rwlock_timedrdlock"); } >+void pthread_rwlock_timedwrlock ( void ) { unimp("pthread_rwlock_timedwrlock"); } >+//void pthread_rwlock_tryrdlock ( void ) { unimp("pthread_rwlock_tryrdlock"); } >+//void pthread_rwlock_trywrlock ( void ) { unimp("pthread_rwlock_trywrlock"); } >+//void pthread_rwlock_unlock ( void ) { unimp("pthread_rwlock_unlock"); } >+//void pthread_rwlock_wrlock ( void ) { unimp("pthread_rwlock_wrlock"); } >+//void pthread_rwlockattr_destroy ( void ) { unimp("pthread_rwlockattr_destroy"); } >+void pthread_rwlockattr_getkind_np ( void ) { unimp("pthread_rwlockattr_getkind_np"); } >+void pthread_rwlockattr_getpshared ( void ) { unimp("pthread_rwlockattr_getpshared"); } >+//void pthread_rwlockattr_init ( void ) { unimp("pthread_rwlockattr_init"); } >+void pthread_rwlockattr_setkind_np ( void ) { unimp("pthread_rwlockattr_setkind_np"); } >+//void pthread_rwlockattr_setpshared ( void ) { unimp("pthread_rwlockattr_setpshared"); } >+//void pthread_self ( void ) { unimp("pthread_self"); } >+//void pthread_setcancelstate ( void ) { unimp("pthread_setcancelstate"); } >+//void pthread_setcanceltype ( void ) { unimp("pthread_setcanceltype"); } >+//void pthread_setschedparam ( void ) { unimp("pthread_setschedparam"); } >+//void pthread_setspecific ( void ) { unimp("pthread_setspecific"); } >+//void pthread_sigmask ( void ) { unimp("pthread_sigmask"); } >+//void pthread_testcancel ( void ) { unimp("pthread_testcancel"); } >+//void raise ( void ) { unimp("raise"); } >+void sem_close ( void ) { unimp("sem_close"); } >+void sem_open ( void ) { unimp("sem_open"); } >+//void sem_timedwait ( void ) { unimp("sem_timedwait"); } >+void sem_unlink ( void ) { unimp("sem_unlink"); } >+//void sigaction ( void ) { unimp("sigaction"); } >+//void siglongjmp ( void ) { unimp("siglongjmp"); } >+//void sigwait ( void ) { unimp("sigwait"); } >+ >+void __pthread_clock_gettime ( void ) { unimp("__pthread_clock_gettime"); } >+void __pthread_clock_settime ( void ) { unimp("__pthread_clock_settime"); } >+#ifdef GLIBC_2_3 >+/* Needed for Red Hat 8.0 */ >+__asm__(".symver __pthread_clock_gettime," >+ "__pthread_clock_gettime@GLIBC_PRIVATE"); >+__asm__(".symver __pthread_clock_settime," >+ "__pthread_clock_settime@GLIBC_PRIVATE"); >+#endif >+ >+ >+#if 0 >+void pthread_create@@GLIBC_2.1 ( void ) { unimp("pthread_create@@GLIBC_2.1"); } >+void pthread_create@GLIBC_2.0 ( void ) { unimp("pthread_create@GLIBC_2.0"); } >+ >+void sem_wait@@GLIBC_2.1 ( void ) { unimp("sem_wait@@GLIBC_2.1"); } >+void sem_wait@GLIBC_2.0 ( void ) { unimp("sem_wait@GLIBC_2.0"); } >+ >+void sem_trywait@@GLIBC_2.1 ( void ) { unimp("sem_trywait@@GLIBC_2.1"); } >+void sem_trywait@GLIBC_2.0 ( void ) { unimp("sem_trywait@GLIBC_2.0"); } >+ >+void sem_post@@GLIBC_2.1 ( void ) { unimp("sem_post@@GLIBC_2.1"); } >+void sem_post@GLIBC_2.0 ( void ) { unimp("sem_post@GLIBC_2.0"); } >+ >+void sem_destroy@@GLIBC_2.1 ( void ) { unimp("sem_destroy@@GLIBC_2.1"); } >+void sem_destroy@GLIBC_2.0 ( void ) { unimp("sem_destroy@GLIBC_2.0"); } >+void sem_getvalue@@GLIBC_2.1 ( void ) { unimp("sem_getvalue@@GLIBC_2.1"); } >+void sem_getvalue@GLIBC_2.0 ( void ) { unimp("sem_getvalue@GLIBC_2.0"); } >+void sem_init@@GLIBC_2.1 ( void ) { unimp("sem_init@@GLIBC_2.1"); } >+void sem_init@GLIBC_2.0 ( void ) { unimp("sem_init@GLIBC_2.0"); } >+ >+void pthread_attr_init@@GLIBC_2.1 ( void ) { unimp("pthread_attr_init@@GLIBC_2.1"); } >+void pthread_attr_init@GLIBC_2.0 ( void ) { unimp("pthread_attr_init@GLIBC_2.0"); } >+#endif >+ >+ >+ >+# define strong_alias(name, aliasname) \ >+ extern __typeof (name) aliasname __attribute__ ((alias (#name))); >+ >+# define weak_alias(name, aliasname) \ >+ extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))); >+ >+//weak_alias(pthread_rwlock_destroy, __pthread_rwlock_destroy) >+//weak_alias(pthread_rwlock_init, __pthread_rwlock_init) >+//weak_alias(pthread_rwlock_tryrdlock, __pthread_rwlock_tryrdlock) >+//weak_alias(pthread_rwlock_trywrlock, __pthread_rwlock_trywrlock) >+//weak_alias(pthread_rwlock_wrlock, __pthread_rwlock_wrlock) >+weak_alias(_IO_ftrylockfile, ftrylockfile) >+ >+//__attribute__((weak)) void pread ( void ) { vgPlain_unimp("pread"); } >+//__attribute__((weak)) void pwrite ( void ) { vgPlain_unimp("pwrite"); } >+//__attribute__((weak)) void msync ( void ) { vgPlain_unimp("msync"); } >+//__attribute__((weak)) void pause ( void ) { vgPlain_unimp("pause"); } >+//__attribute__((weak)) void recvfrom ( void ) { vgPlain_unimp("recvfrom"); } >+//__attribute__((weak)) void recvmsg ( void ) { vgPlain_unimp("recvmsg"); } >+//__attribute__((weak)) void sendmsg ( void ) { vgPlain_unimp("sendmsg"); } >+__attribute__((weak)) void tcdrain ( void ) { vgPlain_unimp("tcdrain"); } >+//--//__attribute__((weak)) void vfork ( void ) { vgPlain_unimp("vfork"); } >+ >+//__attribute__((weak)) void pthread_attr_getguardsize ( void ) >+// { vgPlain_unimp("pthread_attr_getguardsize"); } >+__attribute__((weak)) void pthread_attr_getstack ( void ) >+ { vgPlain_unimp("pthread_attr_getstack"); } >+__attribute__((weak)) void pthread_attr_getstackaddr ( void ) >+ { vgPlain_unimp("pthread_attr_getstackaddr"); } >+__attribute__((weak)) void pthread_attr_getstacksize ( void ) >+ { vgPlain_unimp("pthread_attr_getstacksize"); } >+//__attribute__((weak)) void pthread_attr_setguardsize ( void ) >+// { vgPlain_unimp("pthread_attr_setguardsize"); } >+__attribute__((weak)) void pthread_attr_setstack ( void ) >+ { vgPlain_unimp("pthread_attr_setstack"); } >+__attribute__((weak)) void pthread_attr_setstackaddr ( void ) >+ { vgPlain_unimp("pthread_attr_setstackaddr"); } >+//__attribute__((weak)) void pthread_attr_setstacksize ( void ) >+// { vgPlain_unimp("pthread_attr_setstacksize"); } >+//__attribute__((weak)) void pthread_getconcurrency ( void ) >+// { vgPlain_unimp("pthread_getconcurrency"); } >+//__attribute__((weak)) void pthread_kill_other_threads_np ( void ) >+// { vgPlain_unimp("pthread_kill_other_threads_np"); } >+__attribute__((weak)) void pthread_mutexattr_getkind_np ( void ) >+ { vgPlain_unimp("pthread_mutexattr_getkind_np"); } >+__attribute__((weak)) void pthread_mutexattr_getpshared ( void ) >+ { vgPlain_unimp("pthread_mutexattr_getpshared"); } >+__attribute__((weak)) void pthread_mutexattr_gettype ( void ) >+ { vgPlain_unimp("pthread_mutexattr_gettype"); } >+__attribute__((weak)) void pthread_mutexattr_setkind_np ( void ) >+ { vgPlain_unimp("pthread_mutexattr_setkind_np"); } >+//__attribute__((weak)) void pthread_mutexattr_setpshared ( void ) >+// { vgPlain_unimp("pthread_mutexattr_setpshared"); } >+//__attribute__((weak)) void pthread_setconcurrency ( void ) >+// { vgPlain_unimp("pthread_setconcurrency"); } >+//__attribute__((weak)) void pthread_spin_destroy ( void ) >+// { vgPlain_unimp("pthread_spin_destroy"); } >+//__attribute__((weak)) void pthread_spin_init ( void ) >+// { vgPlain_unimp("pthread_spin_init"); } >+//__attribute__((weak)) void pthread_spin_lock ( void ) >+// { vgPlain_unimp("pthread_spin_lock"); } >+//__attribute__((weak)) void pthread_spin_trylock ( void ) >+// { vgPlain_unimp("pthread_spin_trylock"); } >+//__attribute__((weak)) void pthread_spin_unlock ( void ) >+// { vgPlain_unimp("pthread_spin_unlock"); } >+ >+ >+/*--------------------------------------------------------------------*/ >+/*--- end vg_libpthread_unimp.c ---*/ >+/*--------------------------------------------------------------------*/ >diff -ruN valgrind-2.1.0/coregrind/arch/x86-linux/vg_syscall.S valgrind/coregrind/arch/x86-linux/vg_syscall.S >--- valgrind-2.1.0/coregrind/arch/x86-linux/vg_syscall.S 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/arch/x86-linux/vg_syscall.S 2004-01-04 10:43:21.000000000 -0600 >@@ -0,0 +1,118 @@ >+ >+##--------------------------------------------------------------------## >+##--- Support for doing system calls. ---## >+##--- vg_syscall.S ---## >+##--------------------------------------------------------------------## >+ >+/* >+ This file is part of Valgrind, an extensible x86 protected-mode >+ emulator for monitoring program execution on x86-Unixes. >+ >+ Copyright (C) 2000-2004 Julian Seward >+ jseward@acm.org >+ >+ 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. >+*/ >+ >+#include "vg_constants.h" >+#include "vg_unistd.h" >+ >+.globl VG_(do_syscall) >+ >+/* >+ Perform a Linux syscall with int 0x80 >+ >+ Syscall args are passed on the stack >+ Int VG_(do_syscall)(Int syscall_no, ...) >+ >+ This has no effect on the virtual machine; the expectation is >+ that the syscall mechanism makes no useful changes to any >+ register except %eax, which is returned. >+ */ >+VG_(do_syscall): >+ push %esi >+ push %edi >+ push %ebx >+ push %ebp >+ movl 16+ 4(%esp),%eax >+ movl 16+ 8(%esp),%ebx >+ movl 16+12(%esp),%ecx >+ movl 16+16(%esp),%edx >+ movl 16+20(%esp),%esi >+ movl 16+24(%esp),%edi >+ movl 16+28(%esp),%ebp >+ int $0x80 >+ popl %ebp >+ popl %ebx >+ popl %edi >+ popl %esi >+ ret >+ >+/* >+ Perform a clone system call. clone is strange because it has >+ fork()-like return-twice semantics, so it needs special >+ handling here. >+ >+ int VG_(clone)(int (*fn)(void *), void *child_stack, int flags, void *arg, >+ 0 4 8 12 >+ pid_t *child_tid, pid_t *parent_tid) >+ 16 20 >+ >+ */ >+.globl VG_(clone) >+VG_(clone): >+#define FSZ (4+4+4) /* frame size = retaddr+ebx+edi */ >+ push %ebx >+ push %edi >+ /* set up child stack with function and arg */ >+ movl 4+FSZ(%esp), %ecx /* child stack */ >+ movl 12+FSZ(%esp), %ebx /* fn arg */ >+ movl 0+FSZ(%esp), %eax /* fn */ >+ lea -8(%ecx), %ecx /* make space on stack */ >+ movl %ebx, 4(%ecx) /* fn arg */ >+ movl %eax, 0(%ecx) /* fn */ >+ >+ /* get other args to clone */ >+ movl 8+FSZ(%esp), %ebx /* flags */ >+ movl 20+FSZ(%esp), %edx /* parent tid * */ >+ movl 16+FSZ(%esp), %edi /* child tid * */ >+ movl $__NR_clone, %eax >+ int $0x80 >+ testl %eax, %eax >+ jnz 1f >+ >+ /* CHILD - call thread function */ >+ popl %eax >+ call *%eax >+ >+ /* exit with result */ >+ movl %eax, %ebx >+ movl $__NR_exit, %eax >+ int $0x80 >+ >+ /* Hm, exit returned */ >+ ud2 >+ >+1: /* PARENT or ERROR */ >+ pop %edi >+ pop %ebx >+ ret >+ >+##--------------------------------------------------------------------## >+##--- end vg_syscall.S ---## >+##--------------------------------------------------------------------## >diff -ruN valgrind-2.1.0/coregrind/demangle/.cvsignore valgrind/coregrind/demangle/.cvsignore >--- valgrind-2.1.0/coregrind/demangle/.cvsignore 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/demangle/.cvsignore 2002-09-23 06:36:28.000000000 -0500 >@@ -0,0 +1,2 @@ >+Makefile.in >+Makefile >diff -ruN valgrind-2.1.0/coregrind/demangle/CVS/Entries valgrind/coregrind/demangle/CVS/Entries >--- valgrind-2.1.0/coregrind/demangle/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/demangle/CVS/Entries 2004-02-11 22:51:45.228936400 -0600 >@@ -0,0 +1,11 @@ >+/.cvsignore/1.1/Mon Sep 23 11:36:28 2002// >+/Makefile.am/1.11/Thu Jun 12 14:12:55 2003// >+/ansidecl.h/1.1.1.1/Fri Mar 22 01:29:43 2002// >+/cp-demangle.c/1.5/Fri Jul 4 16:14:15 2003// >+/cplus-dem.c/1.5/Fri Jul 4 16:14:15 2003// >+/demangle.h/1.1.1.1/Fri Mar 22 01:29:43 2002// >+/dyn-string.c/1.4/Mon Feb 24 10:49:08 2003// >+/dyn-string.h/1.1.1.1/Fri Mar 22 01:29:43 2002// >+/safe-ctype.c/1.2/Mon Feb 24 10:49:08 2003// >+/safe-ctype.h/1.1.1.1/Fri Mar 22 01:29:43 2002// >+D >diff -ruN valgrind-2.1.0/coregrind/demangle/CVS/Repository valgrind/coregrind/demangle/CVS/Repository >--- valgrind-2.1.0/coregrind/demangle/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/demangle/CVS/Repository 2004-02-11 22:51:44.385064688 -0600 >@@ -0,0 +1 @@ >+valgrind/coregrind/demangle >diff -ruN valgrind-2.1.0/coregrind/demangle/CVS/Root valgrind/coregrind/demangle/CVS/Root >--- valgrind-2.1.0/coregrind/demangle/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/demangle/CVS/Root 2004-02-11 22:51:44.384064840 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/coregrind/demangle/Makefile.in valgrind/coregrind/demangle/Makefile.in >--- valgrind-2.1.0/coregrind/demangle/Makefile.in 2003-12-14 09:50:13.000000000 -0600 >+++ valgrind/coregrind/demangle/Makefile.in 2004-02-11 22:52:31.787858368 -0600 >@@ -1,8 +1,8 @@ >-# Makefile.in generated by automake 1.7.6 from Makefile.am. >+# Makefile.in generated by automake 1.8.2 from Makefile.am. > # @configure_input@ > >-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 >-# Free Software Foundation, Inc. >+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, >+# 2003, 2004 Free Software Foundation, Inc. > # This Makefile.in is free software; the Free Software Foundation > # gives unlimited permission to copy and/or distribute it, > # with or without modifications, as long as this notice is preserved. >@@ -14,6 +14,9 @@ > > @SET_MAKE@ > >+ >+SOURCES = $(libdemangle_a_SOURCES) >+ > srcdir = @srcdir@ > top_srcdir = @top_srcdir@ > VPATH = @srcdir@ >@@ -21,7 +24,6 @@ > pkglibdir = $(libdir)/@PACKAGE@ > pkgincludedir = $(includedir)/@PACKAGE@ > top_builddir = ../.. >- > am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd > INSTALL = @INSTALL@ > install_sh_DATA = $(install_sh) -c -m 644 >@@ -36,6 +38,40 @@ > PRE_UNINSTALL = : > POST_UNINSTALL = : > host_triplet = @host@ >+subdir = coregrind/demangle >+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ >+ $(srcdir)/Makefile.in >+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >+am__aclocal_m4_deps = $(top_srcdir)/configure.in >+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ >+ $(ACLOCAL_M4) >+mkinstalldirs = $(mkdir_p) >+CONFIG_HEADER = $(top_builddir)/config.h >+CONFIG_CLEAN_FILES = >+AR = ar >+ARFLAGS = cru >+LIBRARIES = $(noinst_LIBRARIES) >+libdemangle_a_AR = $(AR) $(ARFLAGS) >+libdemangle_a_LIBADD = >+am_libdemangle_a_OBJECTS = cp-demangle.$(OBJEXT) cplus-dem.$(OBJEXT) \ >+ dyn-string.$(OBJEXT) safe-ctype.$(OBJEXT) >+libdemangle_a_OBJECTS = $(am_libdemangle_a_OBJECTS) >+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) >+depcomp = $(SHELL) $(top_srcdir)/depcomp >+am__depfiles_maybe = depfiles >+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/cp-demangle.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/cplus-dem.Po ./$(DEPDIR)/dyn-string.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/safe-ctype.Po >+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ >+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) >+CCLD = $(CC) >+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ >+SOURCES = $(libdemangle_a_SOURCES) >+DIST_SOURCES = $(libdemangle_a_SOURCES) >+HEADERS = $(noinst_HEADERS) >+ETAGS = etags >+CTAGS = ctags >+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) > ACLOCAL = @ACLOCAL@ > AMDEP_FALSE = @AMDEP_FALSE@ > AMDEP_TRUE = @AMDEP_TRUE@ >@@ -92,6 +128,7 @@ > SHELL = @SHELL@ > STRIP = @STRIP@ > VERSION = @VERSION@ >+VG_PLATFORM = @VG_PLATFORM@ > ac_ct_CC = @ac_ct_CC@ > ac_ct_CXX = @ac_ct_CXX@ > ac_ct_RANLIB = @ac_ct_RANLIB@ >@@ -123,6 +160,7 @@ > libexecdir = @libexecdir@ > localstatedir = @localstatedir@ > mandir = @mandir@ >+mkdir_p = @mkdir_p@ > oldincludedir = @oldincludedir@ > prefix = @prefix@ > program_transform_name = @program_transform_name@ >@@ -130,62 +168,51 @@ > sharedstatedir = @sharedstatedir@ > sysconfdir = @sysconfdir@ > target_alias = @target_alias@ >- > AM_CPPFLAGS = -I$(top_srcdir)/coregrind -I$(top_srcdir)/include > AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer -g >- > noinst_HEADERS = \ > ansidecl.h \ > dyn-string.h \ > demangle.h \ > safe-ctype.h > >- > noinst_LIBRARIES = libdemangle.a >- > libdemangle_a_SOURCES = \ > cp-demangle.c cplus-dem.c dyn-string.c safe-ctype.c > >-subdir = coregrind/demangle >-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs >-CONFIG_HEADER = $(top_builddir)/config.h >-CONFIG_CLEAN_FILES = >-LIBRARIES = $(noinst_LIBRARIES) >- >-libdemangle_a_AR = $(AR) cru >-libdemangle_a_LIBADD = >-am_libdemangle_a_OBJECTS = cp-demangle.$(OBJEXT) cplus-dem.$(OBJEXT) \ >- dyn-string.$(OBJEXT) safe-ctype.$(OBJEXT) >-libdemangle_a_OBJECTS = $(am_libdemangle_a_OBJECTS) >- >-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) >-depcomp = $(SHELL) $(top_srcdir)/depcomp >-am__depfiles_maybe = depfiles >-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/cp-demangle.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/cplus-dem.Po ./$(DEPDIR)/dyn-string.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/safe-ctype.Po >-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ >- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) >-CCLD = $(CC) >-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ >-DIST_SOURCES = $(libdemangle_a_SOURCES) >-HEADERS = $(noinst_HEADERS) >- >-DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in >-SOURCES = $(libdemangle_a_SOURCES) >- > all: all-am > > .SUFFIXES: > .SUFFIXES: .c .o .obj >-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) >+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) >+ @for dep in $?; do \ >+ case '$(am__configure_deps)' in \ >+ *$$dep*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ >+ && exit 0; \ >+ exit 1;; \ >+ esac; \ >+ done; \ >+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu coregrind/demangle/Makefile'; \ > cd $(top_srcdir) && \ > $(AUTOMAKE) --gnu coregrind/demangle/Makefile >-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status >- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) >- >-AR = ar >+.PRECIOUS: Makefile >+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status >+ @case '$?' in \ >+ *config.status*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ >+ *) \ >+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ >+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ >+ esac; >+ >+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+ >+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh > > clean-noinstLIBRARIES: > -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) >@@ -195,7 +222,7 @@ > $(RANLIB) libdemangle.a > > mostlyclean-compile: >- -rm -f *.$(OBJEXT) core *.core >+ -rm -f *.$(OBJEXT) > > distclean-compile: > -rm -f *.tab.c >@@ -205,40 +232,23 @@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dyn-string.Po@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/safe-ctype.Po@am__quote@ > >-distclean-depend: >- -rm -rf ./$(DEPDIR) >- > .c.o: >-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ >-@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ >-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ >-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ >-@am__fastdepCC_TRUE@ fi >+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ >+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi > @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >-@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< >+@am__fastdepCC_FALSE@ $(COMPILE) -c $< > > .c.obj: >-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ >-@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ >-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ >-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ >-@am__fastdepCC_TRUE@ fi >+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ >+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi > @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >-@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` >+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` > uninstall-info-am: > >-ETAGS = etags >-ETAGSFLAGS = >- >-CTAGS = ctags >-CTAGSFLAGS = >- >-tags: TAGS >- > ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) > list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ > unique=`for i in $$list; do \ >@@ -247,6 +257,7 @@ > $(AWK) ' { files[$$0] = 1; } \ > END { for (i in files) print i; }'`; \ > mkid -fID $$unique >+tags: TAGS > > TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ > $(TAGS_FILES) $(LISP) >@@ -261,7 +272,6 @@ > test -z "$(ETAGS_ARGS)$$tags$$unique" \ > || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ > $$tags $$unique >- > ctags: CTAGS > CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ > $(TAGS_FILES) $(LISP) >@@ -284,10 +294,6 @@ > > distclean-tags: > -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags >-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) >- >-top_distdir = ../.. >-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) > > distdir: $(DISTFILES) > @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ >@@ -301,7 +307,7 @@ > dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ > if test "$$dir" != "$$file" && test "$$dir" != "."; then \ > dir="/$$dir"; \ >- $(mkinstalldirs) "$(distdir)$$dir"; \ >+ $(mkdir_p) "$(distdir)$$dir"; \ > else \ > dir=''; \ > fi; \ >@@ -319,7 +325,6 @@ > check-am: all-am > check: check-am > all-am: Makefile $(LIBRARIES) $(HEADERS) >- > installdirs: > install: install-am > install-exec: install-exec-am >@@ -332,7 +337,7 @@ > installcheck: installcheck-am > install-strip: > $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ >- INSTALL_STRIP_FLAG=-s \ >+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ > `test -z '$(STRIP)' || \ > echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install > mostlyclean-generic: >@@ -340,7 +345,7 @@ > clean-generic: > > distclean-generic: >- -rm -f Makefile $(CONFIG_CLEAN_FILES) >+ -rm -f $(CONFIG_CLEAN_FILES) > > maintainer-clean-generic: > @echo "This command is intended for maintainers to use" >@@ -350,14 +355,17 @@ > clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am > > distclean: distclean-am >- >-distclean-am: clean-am distclean-compile distclean-depend \ >- distclean-generic distclean-tags >+ -rm -rf ./$(DEPDIR) >+ -rm -f Makefile >+distclean-am: clean-am distclean-compile distclean-generic \ >+ distclean-tags > > dvi: dvi-am > > dvi-am: > >+html: html-am >+ > info: info-am > > info-am: >@@ -373,7 +381,8 @@ > installcheck-am: > > maintainer-clean: maintainer-clean-am >- >+ -rm -rf ./$(DEPDIR) >+ -rm -f Makefile > maintainer-clean-am: distclean-am maintainer-clean-generic > > mostlyclean: mostlyclean-am >@@ -392,8 +401,8 @@ > > .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ > clean-noinstLIBRARIES ctags distclean distclean-compile \ >- distclean-depend distclean-generic distclean-tags distdir dvi \ >- dvi-am info info-am install install-am install-data \ >+ distclean-generic distclean-tags distdir dvi dvi-am html \ >+ html-am info info-am install install-am install-data \ > install-data-am install-exec install-exec-am install-info \ > install-info-am install-man install-strip installcheck \ > installcheck-am installdirs maintainer-clean \ >diff -ruN valgrind-2.1.0/coregrind/docs/.cvsignore valgrind/coregrind/docs/.cvsignore >--- valgrind-2.1.0/coregrind/docs/.cvsignore 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/docs/.cvsignore 2002-09-23 06:36:29.000000000 -0500 >@@ -0,0 +1,2 @@ >+Makefile.in >+Makefile >diff -ruN valgrind-2.1.0/coregrind/docs/CVS/Entries valgrind/coregrind/docs/CVS/Entries >--- valgrind-2.1.0/coregrind/docs/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/docs/CVS/Entries 2004-02-11 22:51:45.552887152 -0600 >@@ -0,0 +1,6 @@ >+/.cvsignore/1.1/Mon Sep 23 11:36:29 2002// >+/Makefile.am/1.4/Fri Nov 14 17:47:52 2003// >+/coregrind_core.html/1.26/Sun Feb 1 17:29:59 2004// >+/coregrind_intro.html/1.8/Wed Jan 21 13:59:23 2004// >+/coregrind_tools.html/1.1/Fri Nov 14 17:47:52 2003// >+D >diff -ruN valgrind-2.1.0/coregrind/docs/CVS/Repository valgrind/coregrind/docs/CVS/Repository >--- valgrind-2.1.0/coregrind/docs/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/docs/CVS/Repository 2004-02-11 22:51:45.228936400 -0600 >@@ -0,0 +1 @@ >+valgrind/coregrind/docs >diff -ruN valgrind-2.1.0/coregrind/docs/CVS/Root valgrind/coregrind/docs/CVS/Root >--- valgrind-2.1.0/coregrind/docs/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/docs/CVS/Root 2004-02-11 22:51:45.228936400 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/coregrind/docs/Makefile.in valgrind/coregrind/docs/Makefile.in >--- valgrind-2.1.0/coregrind/docs/Makefile.in 2003-12-14 09:50:13.000000000 -0600 >+++ valgrind/coregrind/docs/Makefile.in 2004-02-11 22:52:31.933836176 -0600 >@@ -1,8 +1,8 @@ >-# Makefile.in generated by automake 1.7.6 from Makefile.am. >+# Makefile.in generated by automake 1.8.2 from Makefile.am. > # @configure_input@ > >-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 >-# Free Software Foundation, Inc. >+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, >+# 2003, 2004 Free Software Foundation, Inc. > # This Makefile.in is free software; the Free Software Foundation > # gives unlimited permission to copy and/or distribute it, > # with or without modifications, as long as this notice is preserved. >@@ -21,7 +21,6 @@ > pkglibdir = $(libdir)/@PACKAGE@ > pkgincludedir = $(includedir)/@PACKAGE@ > top_builddir = ../.. >- > am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd > INSTALL = @INSTALL@ > install_sh_DATA = $(install_sh) -c -m 644 >@@ -36,6 +35,21 @@ > PRE_UNINSTALL = : > POST_UNINSTALL = : > host_triplet = @host@ >+subdir = coregrind/docs >+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in >+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >+am__aclocal_m4_deps = $(top_srcdir)/configure.in >+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ >+ $(ACLOCAL_M4) >+mkinstalldirs = $(mkdir_p) >+CONFIG_HEADER = $(top_builddir)/config.h >+CONFIG_CLEAN_FILES = >+SOURCES = >+DIST_SOURCES = >+am__installdirs = $(DESTDIR)$(docdir) >+docDATA_INSTALL = $(INSTALL_DATA) >+DATA = $(doc_DATA) >+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) > ACLOCAL = @ACLOCAL@ > AMDEP_FALSE = @AMDEP_FALSE@ > AMDEP_TRUE = @AMDEP_TRUE@ >@@ -92,6 +106,7 @@ > SHELL = @SHELL@ > STRIP = @STRIP@ > VERSION = @VERSION@ >+VG_PLATFORM = @VG_PLATFORM@ > ac_ct_CC = @ac_ct_CC@ > ac_ct_CXX = @ac_ct_CXX@ > ac_ct_RANLIB = @ac_ct_RANLIB@ >@@ -123,6 +138,7 @@ > libexecdir = @libexecdir@ > localstatedir = @localstatedir@ > mandir = @mandir@ >+mkdir_p = @mkdir_p@ > oldincludedir = @oldincludedir@ > prefix = @prefix@ > program_transform_name = @program_transform_name@ >@@ -131,32 +147,44 @@ > sysconfdir = @sysconfdir@ > target_alias = @target_alias@ > docdir = $(datadir)/doc/valgrind >- > doc_DATA = coregrind_core.html coregrind_intro.html coregrind_tools.html >- > EXTRA_DIST = $(doc_DATA) >-subdir = coregrind/docs >-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs >-CONFIG_HEADER = $(top_builddir)/config.h >-CONFIG_CLEAN_FILES = >-DIST_SOURCES = >-DATA = $(doc_DATA) >- >-DIST_COMMON = Makefile.am Makefile.in > all: all-am > > .SUFFIXES: >-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) >+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) >+ @for dep in $?; do \ >+ case '$(am__configure_deps)' in \ >+ *$$dep*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ >+ && exit 0; \ >+ exit 1;; \ >+ esac; \ >+ done; \ >+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu coregrind/docs/Makefile'; \ > cd $(top_srcdir) && \ > $(AUTOMAKE) --gnu coregrind/docs/Makefile >-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status >- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) >+.PRECIOUS: Makefile >+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status >+ @case '$?' in \ >+ *config.status*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ >+ *) \ >+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ >+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ >+ esac; >+ >+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+ >+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh > uninstall-info-am: >-docDATA_INSTALL = $(INSTALL_DATA) > install-docDATA: $(doc_DATA) > @$(NORMAL_INSTALL) >- $(mkinstalldirs) $(DESTDIR)$(docdir) >+ $(mkdir_p) $(DESTDIR)$(docdir) > @list='$(doc_DATA)'; for p in $$list; do \ > if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ > f="`echo $$p | sed -e 's|^.*/||'`"; \ >@@ -177,10 +205,6 @@ > ctags: CTAGS > CTAGS: > >-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) >- >-top_distdir = ../.. >-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) > > distdir: $(DISTFILES) > @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ >@@ -194,7 +218,7 @@ > dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ > if test "$$dir" != "$$file" && test "$$dir" != "."; then \ > dir="/$$dir"; \ >- $(mkinstalldirs) "$(distdir)$$dir"; \ >+ $(mkdir_p) "$(distdir)$$dir"; \ > else \ > dir=''; \ > fi; \ >@@ -212,9 +236,8 @@ > check-am: all-am > check: check-am > all-am: Makefile $(DATA) >- > installdirs: >- $(mkinstalldirs) $(DESTDIR)$(docdir) >+ $(mkdir_p) $(DESTDIR)$(docdir) > install: install-am > install-exec: install-exec-am > install-data: install-data-am >@@ -226,7 +249,7 @@ > installcheck: installcheck-am > install-strip: > $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ >- INSTALL_STRIP_FLAG=-s \ >+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ > `test -z '$(STRIP)' || \ > echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install > mostlyclean-generic: >@@ -234,7 +257,7 @@ > clean-generic: > > distclean-generic: >- -rm -f Makefile $(CONFIG_CLEAN_FILES) >+ -rm -f $(CONFIG_CLEAN_FILES) > > maintainer-clean-generic: > @echo "This command is intended for maintainers to use" >@@ -244,13 +267,15 @@ > clean-am: clean-generic mostlyclean-am > > distclean: distclean-am >- >+ -rm -f Makefile > distclean-am: clean-am distclean-generic > > dvi: dvi-am > > dvi-am: > >+html: html-am >+ > info: info-am > > info-am: >@@ -266,7 +291,7 @@ > installcheck-am: > > maintainer-clean: maintainer-clean-am >- >+ -rm -f Makefile > maintainer-clean-am: distclean-am maintainer-clean-generic > > mostlyclean: mostlyclean-am >@@ -284,13 +309,14 @@ > uninstall-am: uninstall-docDATA uninstall-info-am > > .PHONY: all all-am check check-am clean clean-generic distclean \ >- distclean-generic distdir dvi dvi-am info info-am install \ >- install-am install-data install-data-am install-docDATA \ >- install-exec install-exec-am install-info install-info-am \ >- install-man install-strip installcheck installcheck-am \ >- installdirs maintainer-clean maintainer-clean-generic \ >- mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ >- uninstall-am uninstall-docDATA uninstall-info-am >+ distclean-generic distdir dvi dvi-am html html-am info info-am \ >+ install install-am install-data install-data-am \ >+ install-docDATA install-exec install-exec-am install-info \ >+ install-info-am install-man install-strip installcheck \ >+ installcheck-am installdirs maintainer-clean \ >+ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ >+ pdf-am ps ps-am uninstall uninstall-am uninstall-docDATA \ >+ uninstall-info-am > > # Tell versions [3.59,3.63) of GNU make to not export all variables. > # Otherwise a system limit (for SysV at least) may be exceeded. >diff -ruN valgrind-2.1.0/coregrind/docs/coregrind_core.html valgrind/coregrind/docs/coregrind_core.html >--- valgrind-2.1.0/coregrind/docs/coregrind_core.html 2003-11-27 05:43:53.000000000 -0600 >+++ valgrind/coregrind/docs/coregrind_core.html 2004-02-01 11:29:59.000000000 -0600 >@@ -1,9 +1,9 @@ > > > <a name="core"></a> >-<h2>2 Using and understanding the Valgrind core services</h2> >+<h2>2 Using and understanding the Valgrind core</h2> > >-This section describes the core services, flags and behaviours. That >+This section describes the Valgrind core services, flags and behaviours. That > means it is relevant regardless of what particular tool you are using. > A point of terminology: most references to "valgrind" in the rest of > this section (Section 2) refer to the valgrind core services. >@@ -14,30 +14,26 @@ > > Valgrind is designed to be as non-intrusive as possible. It works > directly with existing executables. You don't need to recompile, >-relink, or otherwise modify, the program to be checked. Simply place >-the word <code>valgrind</code> at the start of the command line >-normally used to run the program, and tell it what tool you want to >-use. >+relink, or otherwise modify, the program to be checked. > >-<p> >-So, for example, if you want to run the command <code>ls -l</code> >-using the heavyweight memory-checking tool, issue the command: >-<code>valgrind --tool=memcheck ls -l</code>. The <code>--tool=</code> >-parameter tells the core which tool is to be used. >- >-<p> >-To preserve compatibility with the 1.0.X series, if you do not specify >-a tool, the default is to use Memcheck. That means the above >-example simplifies to: <code>valgrind ls -l</code>. >+Simply put <code>valgrind --tool=<i>tool_name</i></code> at the start of >+the command line normally used to run the program. For example, >+if want to run the command <code>ls -l</code> >+using the heavyweight memory-checking tool Memcheck, issue the command: >+ >+ <blockquote> >+ <code>valgrind --tool=memcheck ls -l</code>. >+ </blockquote> > > <p>Regardless of which tool is in use, Valgrind takes control of your > program before it starts. Debugging information is read from the >-executable and associated libraries, so that error messages can be >-phrased in terms of source code locations (if that is appropriate). >+executable and associated libraries, so that error messages and other >+outputs can be phrased in terms of source code locations (if that is >+appropriate) > > <p> > Your program is then run on a synthetic x86 CPU provided by the >-valgrind core. As new code is executed for the first time, the core >+Valgrind core. As new code is executed for the first time, the core > hands the code to the selected tool. The tool adds its own > instrumentation code to this and hands the result back to the core, > which coordinates the continued execution of this instrumented code. >@@ -48,8 +44,8 @@ > memory access and every value computed, increasing the size of the > code at least 12 times, and making it run 25-50 times slower than > natively. At the other end of the spectrum, the ultra-trivial "none" >-tool adds no instrumentation at all and causes in total "only" about a >-4 times slowdown. >+tool (a.k.a. Nulgrind) adds no instrumentation at all and causes in total >+"only" about a 4 times slowdown. > > <p> > Valgrind simulates every single instruction your program executes. >@@ -59,29 +55,23 @@ > X client libraries, Qt, if you work with KDE, and so on. > > <p> >-If -- as is usually the case -- you're using one of the >-error-detection tools, valgrind will often detect errors in >-libraries, for example the GNU C or X11 libraries, which you have to >-use. Since you're probably using valgrind to debug your own >-application, and not those libraries, you don't want to see those >-errors and probably can't fix them anyway. >- >-<p> >-So, rather than swamping you with errors in which you are not >-interested, Valgrind allows you to selectively suppress errors, by >-recording them in a suppressions file which is read when Valgrind >-starts up. The build mechanism attempts to select suppressions which >-give reasonable behaviour for the libc and XFree86 versions detected >-on your machine. To make it easier to write suppressions, you can use >-the <code>--gen-suppressions=yes</code> option which tells Valgrind to >-print out a suppression for each error that appears, which you can >-then copy into a suppressions file. >- >-<p> >-Different tools report different kinds of errors. The suppression >-mechanism therefore allows you to say which tool or tool(s) each >-suppression applies to. >- >+If you're using one of the error-detection tools, Valgrind will often >+detect errors in libraries, for example the GNU C or X11 libraries, >+which you have to use. You might not be interested in these errors, >+since you probably have noo control over that code. Therefore, Valgrind >+allows you to selectively suppress errors, by recording them in a >+suppressions file which is read when Valgrind starts up. The build >+mechanism attempts to select suppressions which give reasonable >+behaviour for the libc and XFree86 versions detected on your machine. >+To make it easier to write suppressions, you can use the >+<code>--gen-suppressions=yes</code> option which tells Valgrind to print >+out a suppression for each error that appears, which you can then copy >+into a suppressions file. >+ >+<p> >+Different error-checking tools report different kinds of errors. The >+suppression mechanism therefore allows you to say which tool or tool(s) >+each suppression applies to. > > > <a name="started"></a> >@@ -89,7 +79,7 @@ > > First off, consider whether it might be beneficial to recompile your > application and supporting libraries with debugging info enabled (the >-<code>-g</code> flag). Without debugging info, the best valgrind >+<code>-g</code> flag). Without debugging info, the best Valgrind tools > will be able to do is guess which function a particular piece of code > belongs to, which makes both error messages and profiling output > nearly useless. With <code>-g</code>, you'll hopefully get messages >@@ -100,7 +90,7 @@ > C++, is <code>-fno-inline</code>. That makes it easier to see the > function-call chain, which can help reduce confusion when navigating > around large C++ apps. For whatever it's worth, debugging >-OpenOffice.org with Valgrind is a bit easier when using this flag. >+OpenOffice.org with Memcheck is a bit easier when using this flag. > > <p> > You don't have to do this, but doing so helps Valgrind produce more >@@ -109,8 +99,8 @@ > or some other debugger. > > <p> >-This paragraph applies only if you plan to use Memcheck >-(which is the default): On rare occasions, optimisation levels >+This paragraph applies only if you plan to use Memcheck: >+On rare occasions, optimisation levels > at <code>-O2</code> and above have been observed to generate code which > fools Memcheck into wrongly reporting uninitialised value > errors. We have looked in detail into fixing this, and unfortunately >@@ -132,7 +122,7 @@ > > <p> > When you're ready to roll, just run your application as you would >-normally, but place <code>valgrind --tool=the-selected-tool</code> in >+normally, but place <code>valgrind --tool=<i>tool_name</i></code> in > front of your usual command-line invocation. Note that you should run > the real (machine-code) executable here. If your application is > started by, for example, a shell or perl script, you'll need to modify >@@ -147,7 +137,7 @@ > <a name="comment"></a> > <h3>2.3 The commentary</h3> > >-Valgrind writes a commentary, a stream of text, detailing error >+Valgrind tools write a commentary, a stream of text, detailing error > reports and other significant events. All lines in the commentary > have following form:<br> > <pre> >@@ -159,14 +149,13 @@ > to differentiate commentaries from different processes which have > become merged together, for whatever reason. > >-<p>By default, Valgrind writes only essential messages to the commentary, >+<p>By default, Valgrind tools write only essential messages to the commentary, > so as to avoid flooding you with information of secondary importance. > If you want more information about what is happening, re-run, passing > the <code>-v</code> flag to Valgrind. > > <p> >-Version 2 of valgrind gives significantly more flexibility than 1.0.X >-does about where that stream is sent to. You have three options: >+You can direct the commentary to three different places: > > <ul> > <li>The default: send it to a file descriptor, which is by default 2 >@@ -195,9 +184,8 @@ > defined by the constant <code>VG_CLO_DEFAULT_LOGPORT</code> > in the sources. > <p> >- Note, unfortunately, that you have to use an IP address here -- >- for technical reasons, valgrind's core itself can't use the GNU C >- library, and this makes it difficult to do hostname-to-IP lookups. >+ Note, unfortunately, that you have to use an IP address here, rather >+ than a hostname. > <p> > Writing to a network socket is pretty useless if you don't have > something listening at the other end. We provide a simple >@@ -221,12 +209,12 @@ > <li><code>portnumber</code>: changes the port it listens on from > the default (1500). The specified port must be in the range > 1024 to 65535. The same restriction applies to port numbers >- specified by a <code>--logsocket=</code> to valgrind itself. >+ specified by a <code>--logsocket=</code> to Valgrind itself. > </ul> > <p> > If a valgrinded process fails to connect to a listener, for > whatever reason (the listener isn't running, invalid or >- unreachable host or port, etc), valgrind switches back to writing >+ unreachable host or port, etc), Valgrind switches back to writing > the commentary to stderr. The same goes for any process which > loses an established connection to a listener. In other words, > killing the listener doesn't kill the processes sending data to >@@ -235,7 +223,7 @@ > <p> > Here is an important point about the relationship between the > commentary and profiling output from tools. The commentary contains a >-mix of messages from the valgrind core and the selected tool. If the >+mix of messages from the Valgrind core and the selected tool. If the > tool reports errors, it will report them to the commentary. However, > if the tool does profiling, the profile data will be written to a file > of some kind, depending on the tool, and independent of what >@@ -311,7 +299,7 @@ > > <p> > To avoid this cutoff you can use the <code>--error-limit=no</code> >-flag. Then valgrind will always show errors, regardless of how many >+flag. Then Valgrind will always show errors, regardless of how many > there are. Use this flag carefully, since it may have a dire effect > on performance. > >@@ -386,7 +374,7 @@ > </pre> > (Nb: no spaces are allowed). > <p> >- Recall that valgrind-2.0.X is a modular system, in which >+ Recall that Valgrind-2.0.X is a modular system, in which > different instrumentation tools can observe your program whilst > it is running. Since different tools detect different kinds of > errors, it is necessary to say which tool(s) the suppression is >@@ -478,20 +466,15 @@ > <h3>2.6 Command-line flags for the Valgrind core</h3> > > >-As mentioned above, valgrind's core accepts a common set of flags. >+As mentioned above, Valgrind's core accepts a common set of flags. > The tools also accept tool-specific flags, which are documented > seperately for each tool. > > You invoke Valgrind like this: > <pre> >- valgrind [options-for-Valgrind] your-prog [options for your-prog] >+ valgrind --tool=<i>tool_name</i> [options-for-Valgrind] your-prog [options for your-prog] > </pre> > >-<p>Note that Valgrind also reads options from the environment variable >-<code>$VALGRIND_OPTS</code>, and processes them before the command-line >-options. Options for the valgrind core may be freely mixed with those >-for the selected tool. >- > <p>Valgrind's default settings succeed in giving reasonable behaviour > in most cases. We group the available options by rough categories. > >@@ -512,8 +495,12 @@ > <p>Show help for all options, both for the core and for the > selected tool. </li><br><p> > >+ <li><code>--help-debug</code><br> >+ <p>Same as <code>--help</code>, but also lists debugging options which >+ usually are only of use to developers.</li><br><p> >+ > <li><code>--version</code><br> <p>Show the version number of the >- valgrind core. Tools can have their own version numbers. There >+ Valgrind core. Tools can have their own version numbers. There > is a scheme in place to ensure that tools only execute when the > core version is one they are known to work with. This was done > to minimise the chances of strange problems arising from >@@ -558,7 +545,7 @@ > <p>Specifies that Valgrind should send all of its messages to > the specified port at the specified IP address. The port may be > omitted, in which case port 1500 is used. If a connection >- cannot be made to the specified socket, valgrind falls back to >+ cannot be made to the specified socket, Valgrind falls back to > writing output to the standard error (stderr). This option is > intended to be used in conjunction with the > <code>valgrind-listener</code> program. For further details, >@@ -603,7 +590,7 @@ > </li><br><p> > > <li><code>--error-limit=yes</code> [default]<br> >- <code>--error-limit=no</code> <p>When enabled, valgrind stops >+ <code>--error-limit=no</code> <p>When enabled, Valgrind stops > reporting errors after 30000 in total, or 300 different ones, > have been seen. This is to stop the error tracking machinery > from becoming a huge performance overhead in programs with many >@@ -633,7 +620,7 @@ > <br> > <code>---- Print suppression ? --- [Return/N/n/Y/y/C/c] ----</code> > <p> >- The prompt's behaviour is the same as for the <code>--gdb-attach</code> >+ The prompt's behaviour is the same as for the <code>--db-attach</code> > option. > <p> > If you choose to, Valgrind will print out a suppression for this error. >@@ -663,28 +650,28 @@ > socket details. > <br><p> > >- <li><code>--gdb-attach=no</code> [default]<br> >- <code>--gdb-attach=yes</code> >+ <li><code>--db-attach=no</code> [default]<br> >+ <code>--db-attach=yes</code> > <p>When enabled, Valgrind will pause after every error shown, > and print the line > <br> >- <code>---- Attach to GDB ? --- [Return/N/n/Y/y/C/c] ----</code> >+ <code>---- Attach to debugger ? --- [Return/N/n/Y/y/C/c] ----</code> > <p> > Pressing <code>Ret</code>, or <code>N</code> <code>Ret</code> > or <code>n</code> <code>Ret</code>, causes Valgrind not to >- start GDB for this error. >+ start a debugger for this error. > <p> > <code>Y</code> <code>Ret</code> > or <code>y</code> <code>Ret</code> causes Valgrind to >- start GDB, for the program at this point. When you have >- finished with GDB, quit from it, and the program will continue. >- Trying to continue from inside GDB doesn't work. >+ start a debugger, for the program at this point. When you have >+ finished with the debugger, quit from it, and the program will continue. >+ Trying to continue from inside the debugger doesn't work. > <p> > <code>C</code> <code>Ret</code> > or <code>c</code> <code>Ret</code> causes Valgrind not to >- start GDB, and not to ask again. >+ start a debugger, and not to ask again. > <p> >- <code>--gdb-attach=yes</code> conflicts with >+ <code>--db-attach=yes</code> conflicts with > <code>--trace-children=yes</code>. You can't use them together. > Valgrind refuses to start up in this situation. 1 May 2002: > this is a historical relic which could be easily fixed if it >@@ -695,16 +682,21 @@ > socket, I guess this option doesn't make any sense. Caveat emptor. > </li><br><p> > >- <li><code>--gdb-path=/path/to/gdb</code> >- <p>This specifies how Valgrind will invoke GDB. By default, it >- will use whatever GDB is detected at build time, >+ <li><code>--db-command=<command></code> [default: gdb -nw %f %p]<br> >+ <p>This specifies how Valgrind will invoke the debugger. By >+ default it will use whatever GDB is detected at build time, > which is usually <code>/usr/bin/gdb</code>. Using this command, >- you can specify some alternative path to the GDB you want to >- use. >+ you can specify some alternative command to invoke the debugger >+ you want to use. >+ <p> >+ The command string given can include one or instances of the >+ %p and %f expansions. Each instance of %p expands to the PID of >+ the process to be debugged and each instance of %f expands to >+ the path to the executable for the process to be debugged. > </li><br><p> > > <li><code>--input-fd=<number></code> [default=0, stdin]<br> >- <p>When using <code>--gdb-attach=yes</code> and >+ <p>When using <code>--db-attach=yes</code> and > <code>--gen-suppressions=yes</code>, Valgrind will stop > so as to read keyboard input from you, when each error occurs. > By default it reads from the standard input (stdin), which is >@@ -719,14 +711,11 @@ > and Addrcheck), the following options apply. > <ul> > <li><code>--alignment=<number></code> [default: 4]<br> <p>By >- default valgrind's <code>malloc</code>, <code>realloc</code>, >+ default Valgrind's <code>malloc</code>, <code>realloc</code>, > etc, return 4-byte aligned addresses. These are suitable for > any accesses on x86 processors. > Some programs might however assume that <code>malloc</code> et >- al return 8- or more aligned memory. >- These programs are broken and should be fixed, but >- if this is impossible for whatever reason the alignment can be >- increased using this parameter. The supplied value must be >+ al return 8- or more aligned memory. The supplied value must be > between 4 and 4096 inclusive, and must be a power of two.</li><br><p> > > <li><code>--sloppy-malloc=no</code> [default]<br> >@@ -777,7 +766,7 @@ > segmentation faults. This is particularly noticeable on Red Hat > 7.1. So this flag is provided in order to inhibit the run of > <code>__libc_freeres</code>. If your program seems to run fine >- on valgrind, but segfaults at exit, you may find that >+ on Valgrind, but segfaults at exit, you may find that > <code>--run-libc-freeres=no</code> fixes that, although at the > cost of possibly falsely reporting space leaks in > <code>libc.so</code>. >@@ -889,9 +878,9 @@ > > <li><code>--profile=no</code><br> > <code>--profile=yes</code> [default] >- <p>When enabled, does crude internal profiling of valgrind >+ <p>When enabled, does crude internal profiling of Valgrind > itself. This is not for profiling your programs. Rather it is >- to allow the developers to assess where valgrind is spending >+ to allow the developers to assess where Valgrind is spending > its time. The tools must be built for profiling for this to > work. > </li><br><p> >@@ -935,13 +924,6 @@ > </li><br> > <p> > >- <li><code>--stop-after=<number></code> >- [default: infinity, more or less] >- <p>After <number> basic blocks have been executed, shut down >- Valgrind and switch back to running the client on the real CPU. >- </li><br> >- <p> >- > <li><code>--dump-error=<number></code> [default: inactive] > <p>After the program has exited, show gory details of the > translation of the basic block containing the <number>'th >@@ -952,6 +934,33 @@ > <p> > </ul> > >+<h4>Setting default options</h4> >+ >+<p>Note that Valgrind also reads options from three places: >+<ul> >+<li>The file <code>~/.valgrindrc</code> >+<li>The environment variable <code>$VALGRIND_OPTS</code> >+<li>The file <code>./.valgrindrc</code> >+</ul> >+These are processed in the given order, before the command-line options. >+Options processed later override those processed earlier; for example, >+options in <code>./.valgrindrc</code> will take precedence over those in >+<code>~/.valgrindrc</code>. The first two are particularly useful for >+setting the default tool to use. >+<p> >+Any tool-specific options put in <code>$VALGRIND_OPTS</code> or the >+<code>.valgrindrc</code> files should be prefixed with the tool name and >+a colon. For example, if you want Memcheck to always do leak checking, >+you can put the following entry in <code>~/.valgrindrc</code>: >+ >+<pre> >+ --memcheck:leak-check=yes >+</pre> >+ >+This will be ignored if any tool other than Memcheck is run. >+Without the <code>memcheck:</code> part, this will cause problems if you >+select other tools that don't understand <code>--leak-check=yes</code>. >+ > > <a name="clientreq"></a> > <h3>2.7 The Client Request mechanism</h3> >@@ -993,7 +1002,7 @@ > of code in the specified address range. Useful if you are > debugging a JITter or some other dynamic code generation system. > After this call, attempts to execute code in the invalidated >- address range will cause valgrind to make new translations of that >+ address range will cause Valgrind to make new translations of that > code, which is probably the semantics you want. Note that this is > implemented naively, and involves checking all 200191 entries in > the translation table to see if any of them overlap the specified >@@ -1077,7 +1086,7 @@ > if you have some kind of concurrency, critical race, locking, or > similar, bugs. > <p> >-As of the valgrind-1.0 release, the state of pthread support was as follows: >+As of the Valgrind-1.0 release, the state of pthread support was as follows: > <ul> > <li>Mutexes, condition variables, thread-specific data, > <code>pthread_once</code>, reader-writer locks, semaphores, >@@ -1163,7 +1172,7 @@ > > <p>The translator/instrumentor has a lot of assertions in it. They > are permanently enabled, and I have no plans to disable them. If one >-of these breaks, please mail me! >+of these breaks, please mail us! > > <p>If you get an assertion failure on the expression > <code>chunkSane(ch)</code> in <code>vg_free()</code> in >@@ -1186,13 +1195,9 @@ > a kernel 2.2.X or 2.4.X system, subject to the following constraints: > > <ul> >- <li>No MMX, SSE, SSE2, 3DNow instructions. If the translator >- encounters these, Valgrind will simply give up. It may be >- possible to add support for them at a later time. Intel added a >- few instructions such as "cmov" to the integer instruction set >- on Pentium and later processors, and these are supported. >- Nevertheless it's safest to think of Valgrind as implementing >- the 486 instruction set.</li> >+ <li>No support for 3DNow instructions. If the translator encounters >+ these, Valgrind will generate a SIGILL when the instruction is >+ executed.</li> > <p> > > <li>Pthreads support is improving, but there are still significant >@@ -1214,7 +1219,12 @@ > > <li>If your program does its own memory management, rather than > using malloc/new/free/delete, it should still work, but >- Valgrind's error checking won't be so effective.</li> >+ Valgrind's error checking won't be so effective. >+ If you describe your program's memory management scheme >+ using "client requests" (Section 3.7 of this manual), >+ Memcheck can do better. Nevertheless, using malloc/new >+ and free/delete is still the best approach. >+ </li> > <p> > > <li>Valgrind's signal simulation is not as robust as it could be. >@@ -1238,7 +1248,7 @@ > <li>x86 instructions, and system calls, have been implemented on > demand. So it's possible, although unlikely, that a program > will fall over with a message to that effect. If this happens, >- please mail me ALL the details printed out, so I can try and >+ please report ALL the details printed out, so we can try and > implement the missing feature.</li> > <p> > >@@ -1247,11 +1257,6 @@ > approach to FPU emulation.</li> > <p> > >- <li>You can't Valgrind-ize statically linked binaries. Valgrind >- relies on the dynamic-link mechanism to gain control at >- startup.</li> >- <p> >- > <li>Memory consumption of your program is majorly increased whilst > running under Valgrind. This is due to the large amount of > administrative information maintained behind the scenes. Another >@@ -1483,16 +1488,10 @@ > ==25832== 223 translations, 3626 bytes in, 56801 bytes out. > </pre> > <p>The GCC folks fixed this about a week before gcc-3.0 shipped. >-<hr width="100%"> > <p> > >-</body> >-</html> >- >- >-<h2>Misc text looking for a home</h2> >- >-<h4>2.6.6 Warning messages you might see</h4> >+<a name="warnings"></a> >+<h3>2.15 Warning messages you might see</h3> > > Most of these only appear if you run in verbose mode (enabled by > <code>-v</code>): >@@ -1554,3 +1553,9 @@ > Diagnostic message, mostly for benefit of the valgrind > developers, to do with memory permissions. > </ul> >+ >+</body> >+</html> >+ >+ >+ >diff -ruN valgrind-2.1.0/coregrind/docs/coregrind_intro.html valgrind/coregrind/docs/coregrind_intro.html >--- valgrind-2.1.0/coregrind/docs/coregrind_intro.html 2003-11-14 11:47:52.000000000 -0600 >+++ valgrind/coregrind/docs/coregrind_intro.html 2004-01-21 07:59:23.000000000 -0600 >@@ -39,26 +39,6 @@ > lying undetected for long periods, then causing occasional, > difficult-to-diagnose crashes. > <p> >-<li><b>Cachegrind</b> is a cache profiler. It performs detailed simulation of >- the I1, D1 and L2 caches in your CPU and so can accurately >- pinpoint the sources of cache misses in your code. If you desire, >- it will show the number of cache misses, memory references and >- instructions accruing to each line of source code, with >- per-function, per-module and whole-program summaries. If you ask >- really nicely it will even show counts for each individual x86 >- instruction. >- <p> >- Cachegrind auto-detects your machine's cache configuration >- using the <code>CPUID</code> instruction, and so needs no further >- configuration info, in most cases. >- <p> >- Cachegrind is nicely complemented by Josef Weidendorfer's >- amazing KCacheGrind visualisation tool (<A >- HREF="http://kcachegrind.sourceforge.net"> >- http://kcachegrind.sourceforge.net</A>), a KDE application which >- presents these profiling results in a graphical and >- easier-to-understand form. >-<p> > <li><b>Addrcheck</b> is a lightweight version of > Memcheck. It is identical to Memcheck except > for the single detail that it does not do any uninitialised-value >@@ -84,6 +64,26 @@ > to run KDE for long periods at a time like this, collecting up > all the addressing errors that appear. > <p> >+<li><b>Cachegrind</b> is a cache profiler. It performs detailed simulation of >+ the I1, D1 and L2 caches in your CPU and so can accurately >+ pinpoint the sources of cache misses in your code. If you desire, >+ it will show the number of cache misses, memory references and >+ instructions accruing to each line of source code, with >+ per-function, per-module and whole-program summaries. If you ask >+ really nicely it will even show counts for each individual x86 >+ instruction. >+ <p> >+ Cachegrind auto-detects your machine's cache configuration >+ using the <code>CPUID</code> instruction, and so needs no further >+ configuration info, in most cases. >+ <p> >+ Cachegrind is nicely complemented by Josef Weidendorfer's >+ amazing KCacheGrind visualisation tool (<A >+ HREF="http://kcachegrind.sourceforge.net"> >+ http://kcachegrind.sourceforge.net</A>), a KDE application which >+ presents these profiling results in a graphical and >+ easier-to-understand form. >+<p> > <li><b>Helgrind</b> finds data races in multithreaded programs. > Helgrind looks for > memory locations which are accessed by more than one (POSIX >@@ -104,7 +104,7 @@ > </ul> > > A number of minor tools (<b>corecheck</b>, <b>lackey</b> and >-<b>none</b>) are also supplied. These aren't particularly useful -- >+<b>Nulgrind</b>) are also supplied. These aren't particularly useful -- > they exist to illustrate how to create simple tools and to help the > valgrind developers in various ways. > >@@ -119,7 +119,7 @@ > attempted to ensure that it works on machines with kernel 2.2 or 2.4 > and glibc 2.1.X, 2.2.X or 2.3.1. This should cover the vast majority > of modern Linux installations. Note that glibc-2.3.2+, with the >-NPTL (next generation posix threads?) package won't work. We hope to >+NPTL (Native Posix Threads Library) package won't work. We hope to > be able to fix this, but it won't be easy. > > >@@ -137,42 +137,26 @@ > <a name="intro-navigation"></a> > <h3>1.2 How to navigate this manual</h3> > >-Valgrind is structured as a set of core services supporting a number >-of profiling and debugging tools. This manual is structured >-similarly. Below, we continue with a description of the valgrind >-core, how to use it, and the flags it supports. >- >-<p> >-The tools each have their own chapters in this manual. You only need >-to read the documentation for the core services and for the tool(s) >-you actually use, although you may find it helpful to be at least a >-little bit familar with what all tools do. If you want to write a new >-tool, read <A HREF="coregrind_tools.html">this</A>. >- >-<p> >-If you're new to all this, you're most likely to be using the Memcheck >-tool, since that's the one selected by default. So, read the rest of >-this page, and the section Memcheck. >+The Valgrind distribution consists of the Valgrind core, upon which are >+built Valgrind tools, which do different kinds of debugging and >+profiling. This manual is structured similarly. >+ >+<p> >+First, we describe the Valgrind core, how to use it, and the flags it >+supports. Then, each tool has its own chapter in this manual. You only >+need to read the documentation for the core and for the tool(s) you >+actually use, although you may find it helpful to be at least a little >+bit familar with what all tools do. If you're new to all this, you >+probably want to run the Memcheck tool. If you want to write a new tool, >+read <A HREF="coregrind_tools.html">this</A>. > > <p> > Be aware that the core understands some command line flags, and the > tools have their own flags which they know about. This means > there is no central place describing all the flags that are accepted > -- you have to read the flags documentation both for >-<A HREF="coregrind_core.html#core">valgrind's core</A> >+<A HREF="coregrind_core.html#core">Valgrind's core</A> > and for the tool you want to use. > > <p> >-<a name="intro-migrating"></a> >-<h4>1.2.1 For users migrating from valgrind-1.0.X</h4> >-<p> >-Valgrind-2.0.X is a major redesign of the 1.0.X series. You should at >-least be familiar with the concept of the core/tool division, >-as explained above in the Introduction. Having said that, we've tried >-to make the command line handling and behaviour as >-backwards-compatible as we can. In particular, just running >-<code>valgrind [args-for-valgrind] my_prog [args-for-my-prog]</code> >-should work pretty much as before. >- >-<p> > >diff -ruN valgrind-2.1.0/coregrind/dosyms valgrind/coregrind/dosyms >--- valgrind-2.1.0/coregrind/dosyms 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/dosyms 2002-12-14 20:05:02.000000000 -0600 >@@ -0,0 +1,31 @@ >+#!/bin/sh >+ >+# A simple script to help me ensure that my libpthread.so looks >+# from the outside, to the linker, identical to the original. >+ >+nm /lib/libpthread.so.0 | grep " T " | cut -c 10- > orig-T >+nm /lib/libpthread.so.0 | grep " D " | cut -c 10- > orig-D >+nm /lib/libpthread.so.0 | grep " W " | cut -c 10- > orig-W >+nm /lib/libpthread.so.0 | grep " U " | cut -c 10- > orig-U >+ >+nm ./libpthread.so | grep " T " | cut -c 10- > mine-T >+nm ./libpthread.so | grep " D " | cut -c 10- > mine-D >+nm ./libpthread.so | grep " W " | cut -c 10- > mine-W >+nm ./libpthread.so | grep " U " | cut -c 10- > mine-U >+ >+echo ========================== TEXT orig vs mine ========================= >+sdiff -w 80 orig-T mine-T >+echo >+ >+echo ========================== WEAK orig vs mine ========================= >+sdiff -w 80 orig-W mine-W >+echo >+ >+echo ========================== DATA orig vs mine ========================= >+sdiff -w 80 orig-D mine-D >+echo >+ >+echo ========================== UNDF orig vs mine ========================= >+sdiff -w 80 orig-U mine-U >+echo >+ >diff -ruN valgrind-2.1.0/coregrind/gen_toolint.pl valgrind/coregrind/gen_toolint.pl >--- valgrind-2.1.0/coregrind/gen_toolint.pl 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/gen_toolint.pl 2004-01-04 07:08:56.000000000 -0600 >@@ -0,0 +1,292 @@ >+#!/usr/bin/perl >+ >+# This file is part of Valgrind, an extensible x86 protected-mode >+# emulator for monitoring program execution on x86-Unixes. >+# >+# Copyright (C) 2000-2004 Julian Seward >+# jseward@acm.org >+# >+# 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. >+ >+use strict; >+use warnings; >+ >+my $output = shift @ARGV; >+my $indent = ""; >+my $headerguard; >+my $include; >+my $passcomment = 1; >+my $pre; >+my $post; >+my $generate; >+ >+my $struct = "VG_(tool_interface)"; >+ >+my %pfxmap = ("track" => "SK_", >+ "tool" => "SK_", >+ "malloc"=> "SK_", >+ ); >+ >+sub getargnames(@) { >+ my @args = @_; >+ my @ret; >+ >+ foreach my $a (@args) { >+ my @pieces = split /\s+/, $a; >+ my $name = pop @pieces; >+ push @ret, $name unless $name eq "void"; >+ } >+ return @ret; >+} >+ >+sub getargtypes(@) { >+ my @args = @_; >+ my @ret; >+ >+ foreach my $a (@args) { >+ my @pieces = split /\s+/, $a; >+ pop @pieces; >+ push @ret, (join " ", @pieces); >+ } >+ @ret = "void" if ($#ret == -1); >+ return @ret; >+} >+ >+# Different output modes >+if ($output eq "callwrap") { >+ $include = "vg_include.h"; >+ $generate = sub ($$$@) { >+ my ($pfx, $ret, $func, @args) = @_; >+ my $args = join ", ", @args; >+ my $argnames = join ", ", getargnames(@args); >+ print "$ret $pfxmap{$pfx}($func)($args)\n{\n"; >+ print " return (*$struct.${pfx}_$func)($argnames);\n"; >+ print "}\n"; >+ } >+} elsif ($output eq "proto") { >+ $include = "vg_include.h"; >+ $generate = sub ($$$@) { >+ my ($pfx, $ret, $func, @args) = @_; >+ my $args = join ', ', @args; >+ >+ print "$ret $pfxmap{$pfx}($func)($args);\n"; >+ print "Bool VG_(defined_$func)(void);\n"; >+ } >+} elsif ($output eq "toolproto") { >+ $generate = sub ($$$@) { >+ my ($pfx, $ret, $func, @args) = @_; >+ my $args = join ', ', @args; >+ >+ print "$ret $pfxmap{$pfx}($func)($args);\n"; >+ } >+} elsif ($output eq "missingfuncs") { >+ $include = "vg_include.h"; >+ $generate = sub ($$$@) { >+ my ($pfx, $ret, $func, @args) = @_; >+ my $args = join ", ", @args; >+ >+ print "static $ret missing_${pfx}_$func($args) {\n"; >+ print " VG_(missing_tool_func)(\"${pfx}_$func\");\n"; >+ print "}\n"; >+ print "Bool VG_(defined_$func)(void) {\n"; >+ print " return $struct.${pfx}_$func != missing_${pfx}_$func;\n"; >+ print "}\n\n"; >+ }; >+ $indent = " "; >+} elsif ($output eq "struct") { >+ $include = "vg_include.h"; >+ $pre = sub () { >+ print "typedef struct {\n"; >+ }; >+ $post = sub () { >+ print "} VgToolInterface;\n\n"; >+ print "extern VgToolInterface $struct;\n" >+ }; >+ $generate = sub ($$$@) { >+ my ($pfx, $ret, $func, @args) = @_; >+ my $args = join ", ", @args; >+ >+ print "$indent$ret (*${pfx}_$func)($args);\n"; >+ }; >+ $indent = " "; >+ $headerguard=$output; >+} elsif ($output eq "structdef") { >+ $include = "vg_toolint.h"; >+ $pre = sub () { >+ print "VgToolInterface $struct = {\n"; >+ }; >+ $post = sub () { >+ print "};\n"; >+ }; >+ $generate = sub ($$$@) { >+ my ($pfx, $ret, $func, @args) = @_; >+ >+ print "$indent.${pfx}_$func = missing_${pfx}_$func,\n" >+ }; >+ $indent = " "; >+} elsif ($output eq "initfunc") { >+ $include = "vg_skin.h"; >+ $generate = sub ($$$@) { >+ my ($pfx, $ret, $func, @args) = @_; >+ my $args = join ", ", @args; >+ my $argnames = join ", ", getargnames(@args); >+ >+ print <<EOF; >+void VG_(init_$func)($ret (*func)($args)) >+{ >+ if (func == NULL) >+ func = missing_${pfx}_$func; >+ if (VG_(defined_$func)()) >+ VG_(printf)("Warning tool is redefining $func\\n"); >+ if (func == SK_($func)) >+ VG_(printf)("Warning tool is defining $func recursively\\n"); >+ $struct.${pfx}_$func = func; >+} >+EOF >+ } >+} elsif ($output eq "initproto") { >+ $generate = sub ($$$@) { >+ my ($pfx, $ret, $func, @args) = @_; >+ my $args = join ', ', @args; >+ print "void VG_(init_$func)($ret (*func)($args));\n"; >+ }; >+ $headerguard=$output; >+} elsif ($output eq "initdlsym") { >+ $pre = sub () { >+ print <<EOF; >+#include <dlfcn.h> >+void VG_(tool_init_dlsym)(void *dlhandle) >+{ >+ void *ret; >+ >+EOF >+ }; >+ $post = sub () { >+ print "}\n"; >+ }; >+ $generate = sub ($$$@) { >+ my ($pfx, $ret, $func, @args) = @_; >+ my $args = join ", ", getargtypes(@args); >+ >+ print <<EOF; >+ ret = dlsym(dlhandle, "vgSkin_$func"); >+ if (ret != NULL) >+ VG_(init_$func)(($ret (*)($args))ret); >+ >+EOF >+ }; >+ >+ $passcomment = 0; >+} >+ >+die "Unknown output format \"$output\"" unless defined $generate; >+ >+print "/* Generated by \"gen_toolint.pl $output\" */\n"; >+ >+print <<EOF if defined $headerguard; >+ >+#ifndef VG_toolint_$headerguard >+#define VG_toolint_$headerguard >+ >+EOF >+ >+print <<EOF if defined $include; >+#include \"$include\" >+EOF >+ >+&$pre() if defined $pre; # preamble >+ >+my $state = "idle"; >+ >+my $buf; >+my $lines; >+my $prefix; >+ >+while(<STDIN>) { >+ # skip simple comments >+ next if (/^#[^#]/); >+ >+ if (/^:/) { >+ s/^://; >+ chomp; >+ $prefix=$_; >+ next; >+ } >+ >+ # look for inserted comments >+ if (/^##/) { >+ if ($state eq "idle") { >+ $state = "comment"; >+ $lines = 1; >+ $_ =~ s,^## ,/* ,; >+ $buf = $_; >+ next; >+ } elsif ($state eq "comment") { >+ $lines++; >+ $_ =~ s,^## , ,; >+ print $indent.$buf if $passcomment; >+ $buf = $_; >+ next; >+ } >+ next; >+ } >+ >+ # blank lines in a comment are part of the comment >+ if (/^\s*$/) { >+ if ($state eq "comment") { >+ $lines++; >+ print $indent.$buf if $passcomment; >+ $buf = "\n"; >+ } else { >+ print "\n" if $passcomment; >+ } >+ next; >+ } >+ >+ # coming out of a comment >+ if ($state eq "comment") { >+ chomp $buf; >+ >+ if ($passcomment) { >+ if ($lines == 1) { >+ print "$indent$buf */\n"; >+ } else { >+ print "$indent$buf\n$indent */\n"; >+ } >+ } >+ $buf = ""; >+ $state = "idle"; >+ } >+ >+ chomp; >+ my @func = split /,\s*/; >+ >+ my $rettype = shift @func; >+ my $funcname = shift @func; >+ >+ @func = "void" if scalar @func == 0; >+ >+ &$generate ($prefix, $rettype, $funcname, @func); >+} >+ >+&$post() if defined $post; # postamble >+ >+print <<EOF if defined $headerguard; >+ >+#endif /* VG_toolint_$headerguard */ >+EOF >diff -ruN valgrind-2.1.0/coregrind/stage1.c valgrind/coregrind/stage1.c >--- valgrind-2.1.0/coregrind/stage1.c 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/stage1.c 2004-01-24 12:18:52.000000000 -0600 >@@ -0,0 +1,215 @@ >+ >+/*--------------------------------------------------------------------*/ >+/*--- Startup: preliminaries stage1.c ---*/ >+/*--------------------------------------------------------------------*/ >+ >+/* >+ This file is part of Valgrind, an extensible x86 protected-mode >+ emulator for monitoring program execution on x86-Unixes. >+ >+ Copyright (C) 2000-2004 Julian Seward >+ jseward@acm.org >+ >+ 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. >+*/ >+ >+#define _FILE_OFFSET_BITS 64 >+ >+#include <stdio.h> >+#include <elf.h> >+#include <string.h> >+#include <stdlib.h> >+#include <assert.h> >+#include <signal.h> >+#include <fcntl.h> >+#include <errno.h> >+ >+#include "vg_include.h" >+ >+#include "ume.h" >+#include "ume_arch.h" >+#include "ume_archdefs.h" >+ >+static int stack[SIGSTKSZ*4]; >+static int our_argc; >+ >+/* Where we expect to find all our aux files (namely, stage2) */ >+static const char *valgrind_lib = VG_LIBDIR; >+ >+/* stage2's name */ >+static const char stage2[] = "stage2"; >+ >+/* Modify the auxv the kernel gave us to make it look like we were >+ execed as the shared object. >+ >+ This also inserts a new entry into the auxv table so we can >+ communicate some extra information to stage2 (namely, the fd of the >+ padding file, so it can identiry and remove the padding later). >+*/ >+static void *fix_auxv(void *v_init_esp, const struct exeinfo *info) >+{ >+ struct ume_auxv *auxv; >+ int *newesp; >+ int seen; >+ int delta; >+ int i; >+ static const int new_entries = 2; >+ >+ /* make sure we're running on the private stack */ >+ assert(&delta >= stack && &delta < &stack[sizeof(stack)/sizeof(*stack)]); >+ >+ /* find the beginning of the AUXV table */ >+ auxv = find_auxv(v_init_esp); >+ >+ /* Work out how we should move things to make space for the new >+ auxv entry. It seems that ld.so wants a 16-byte aligned stack on >+ entry, so make sure that's the case. */ >+ newesp = (int *)(((unsigned long)v_init_esp - new_entries * sizeof(*auxv)) & ~0xf); >+ delta = (char *)v_init_esp - (char *)newesp; >+ >+ memmove(newesp, v_init_esp, (char *)auxv - (char *)v_init_esp); >+ >+ v_init_esp = (void *)newesp; >+ auxv -= delta/sizeof(*auxv); >+ >+ /* stage2 needs this so it can clean up the padding we leave in >+ place when we start it */ >+ auxv[0].a_type = AT_UME_PADFD; >+ auxv[0].u.a_val = as_getpadfd(); >+ >+ /* This will be needed by valgrind itself so that it can >+ subsequently execve() children. This needs to be done here >+ because /proc/self/exe will go away once we unmap stage1. */ >+ auxv[1].a_type = AT_UME_EXECFD; >+ auxv[1].u.a_val = open("/proc/self/exe", O_RDONLY); >+ >+ /* make sure the rest are sane */ >+ for(i = new_entries; i < delta/sizeof(*auxv); i++) { >+ auxv[i].a_type = AT_IGNORE; >+ auxv[i].u.a_val = 0; >+ } >+ >+ /* OK, go through and patch up the auxv entries to match the new >+ executable */ >+ seen = 0; >+ for(; auxv->a_type != AT_NULL; auxv++) { >+ if (0) >+ printf("doing auxv %p %4x: %d %p\n", auxv, auxv->a_type, auxv->u.a_val, auxv->u.a_ptr); >+ >+ switch(auxv->a_type) { >+ case AT_PHDR: >+ seen |= 1; >+ auxv->u.a_val = info->phdr; >+ break; >+ >+ case AT_PHNUM: >+ seen |= 2; >+ auxv->u.a_val = info->phnum; >+ break; >+ >+ case AT_BASE: >+ seen |= 4; >+ auxv->u.a_val = info->interp_base; >+ break; >+ >+ case AT_ENTRY: >+ seen |= 8; >+ auxv->u.a_val = info->entry; >+ break; >+ } >+ } >+ >+ /* If we didn't see all the entries we need to fix up, then we >+ can't make the new executable viable. */ >+ if (seen != 0xf) { >+ fprintf(stderr, "fix_auxv: we didn't see enough auxv entries (seen=%x)\n", seen); >+ exit(1); >+ } >+ >+ return v_init_esp; >+} >+ >+static void hoops(void) >+{ >+ int err; >+ struct exeinfo info; >+ extern char _end; >+ int *esp; >+ char buf[strlen(valgrind_lib) + sizeof(stage2) + 16]; >+ >+ info.exe_base = PGROUNDUP(&_end); >+ info.exe_end = PGROUNDDN(ume_exec_esp); >+ >+ /* XXX FIXME: how can stage1 know where stage2 wants things placed? >+ Options: >+ - we could look for a symbol >+ - it could have a special PHDR (v. ELF specific) >+ - something else? >+ */ >+ info.map_base = 0xb0000000; >+ info.setbrk = 1; /* ask do_exec to move the brk-base */ >+ info.argv = NULL; >+ >+ snprintf(buf, sizeof(buf), "%s/%s", valgrind_lib, stage2); >+ >+ err = do_exec(buf, &info); >+ >+ if (err != 0) { >+ fprintf(stderr, "failed to load %s: %s\n", >+ buf, strerror(err)); >+ exit(1); >+ } >+ >+ /* Make sure stage2's dynamic linker can't tromp on the lower part >+ of the address space. */ >+ as_pad(0, (void *)info.map_base); >+ >+ esp = fix_auxv(ume_exec_esp, &info); >+ >+ if (0) { >+ int prmap(void *start, void *end, const char *perm, off_t off, int maj, int min, int ino) { >+ printf("mapping %10p-%10p %s %02x:%02x %d\n", >+ start, end, perm, maj, min, ino); >+ return 1; >+ } >+ printf("---------- launch stage 2 ----------\n"); >+ printf("eip=%p esp=%p\n", (void *)info.init_eip, esp); >+ foreach_map(prmap); >+ } >+ >+ ume_go(info.init_eip, (addr_t)esp); >+} >+ >+int main(int argc, char **argv) >+{ >+ const char *cp = getenv(VALGRINDLIB); >+ >+ if (cp != NULL) >+ valgrind_lib = cp; >+ >+ assert(ume_exec_esp != NULL); >+ >+ our_argc = argc; >+ >+ /* move onto another stack so we can play with the main one */ >+ ume_go((addr_t)hoops, (addr_t)stack + sizeof(stack)); >+} >+ >+/*--------------------------------------------------------------------*/ >+/*--- end stage1.c ---*/ >+/*--------------------------------------------------------------------*/ >diff -ruN valgrind-2.1.0/coregrind/toolfuncs.def valgrind/coregrind/toolfuncs.def >--- valgrind-2.1.0/coregrind/toolfuncs.def 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/toolfuncs.def 2003-12-15 20:14:00.000000000 -0600 >@@ -0,0 +1,302 @@ >+# Tool interface functions >+# The format for an interface function definition is: >+# return_type, func_name, type arg, type arg >+# If the function has no arguments, specify no arguments (rather than void) >+# >+# Comments starting with "##" are turned into C comments in the output >+# >+# Lines starting with : set the prefix >+ >+## These are the parameterised functions in the core. The default definitions >+## are overridden by LD_PRELOADed skin version. At the very least, a skin >+## must define the fundamental template functions. Depending on what needs >+## are set, extra template functions will be used too. Functions are >+## grouped under the needs that govern their use. >+ >+:tool >+## ------------------------------------------------------------------ >+## Fundamental template functions >+ >+## Do initialisation that can only be done after command line processing. >+void, post_clo_init >+ >+## Instrument a basic block. Must be a true function, ie. the same input >+## always results in the same output, because basic blocks can be >+## retranslated. Unless you're doing something really strange... >+## 'orig_addr' is the address of the first instruction in the block. >+UCodeBlock*, instrument, UCodeBlock* cb, Addr orig_addr >+ >+## Finish up, print out any results, etc. `exitcode' is program's exit >+## code. The shadow (if the `shadow_regs' need is set) can be found with >+## VG_(get_shadow_archreg)(R_EBX), since %ebx holds the argument to the >+## exit() syscall. >+void, fini, Int exitcode >+ >+ >+## ------------------------------------------------------------------ >+## VG_(needs).core_errors >+ >+## (none needed) >+ >+## ------------------------------------------------------------------ >+## VG_(needs).skin_errors >+ >+## Identify if two errors are equal, or equal enough. `res' indicates how >+## close is "close enough". `res' should be passed on as necessary, eg. if >+## the Error's `extra' part contains an ExeContext, `res' should be >+## passed to VG_(eq_ExeContext)() if the ExeContexts are considered. Other >+## than that, probably don't worry about it unless you have lots of very >+## similar errors occurring. >+Bool, eq_SkinError, VgRes res, Error* e1, Error* e2 >+ >+## Print error context. >+void, pp_SkinError, Error* err >+ >+## Should fill in any details that could be postponed until after the >+## decision whether to ignore the error (ie. details not affecting the >+## result of SK_(eq_SkinError)()). This saves time when errors are ignored. >+## Yuk. >+ >+## Return value: must be the size of the `extra' part in bytes -- used by >+## the core to make a copy. >+UInt, update_extra, Error* err >+ >+## Return value indicates recognition. If recognised, must set skind using >+## VG_(set_supp_kind)(). >+Bool, recognised_suppression, Char* name, Supp* su >+ >+## Read any extra info for this suppression kind. Most likely for filling >+## in the `extra' and `string' parts (with VG_(set_supp_{extra, string})()) >+## of a suppression if necessary. Should return False if a syntax error >+## occurred, True otherwise. >+Bool, read_extra_suppression_info, Int fd, Char* buf, Int nBuf, Supp* su >+ >+## This should just check the kinds match and maybe some stuff in the >+## `string' and `extra' field if appropriate (using VG_(get_supp_*)() to >+## get the relevant suppression parts). >+Bool, error_matches_suppression, Error* err, Supp* su >+ >+## This should return the suppression name, for --gen-suppressions, or NULL >+## if that error type cannot be suppressed. This is the inverse of >+## SK_(recognised_suppression)(). >+Char*, get_error_name, Error* err >+ >+## This should print any extra info for the error, for --gen-suppressions, >+## including the newline. This is the inverse of >+## SK_(read_extra_suppression_info)(). >+void, print_extra_suppression_info, Error* err >+ >+ >+## ------------------------------------------------------------------ >+## VG_(needs).basic_block_discards >+ >+## Should discard any information that pertains to specific basic blocks >+## or instructions within the address range given. >+void, discard_basic_block_info, Addr a, UInt size >+ >+ >+## ------------------------------------------------------------------ >+## VG_(needs).shadow_regs >+ >+## No functions must be defined, but the post_reg[s]_write_* events should >+## be tracked. >+ >+## ------------------------------------------------------------------ >+## VG_(needs).command_line_options >+ >+## Return True if option was recognised. Presumably sets some state to >+## record the option as well. >+Bool, process_cmd_line_option, Char* argv >+ >+## Print out command line usage for options for normal skin operation. >+void, print_usage >+ >+## Print out command line usage for options for debugging the skin. >+void, print_debug_usage >+ >+## ------------------------------------------------------------------ >+## VG_(needs).client_requests >+ >+## If using client requests, the number of the first request should be equal >+## to VG_USERREQ_SKIN_BASE('X', 'Y'), where 'X' and 'Y' form a suitable two >+## character identification for the string. The second and subsequent >+## requests should follow. >+ >+## This function should use the VG_IS_SKIN_USERREQ macro (in >+## include/valgrind.h) to first check if it's a request for this skin. Then >+## should handle it if it's recognised (and return True), or return False if >+## not recognised. arg_block[0] holds the request number, any further args >+## from the request are in arg_block[1..]. 'ret' is for the return value... >+## it should probably be filled, if only with 0. >+Bool, handle_client_request, ThreadId tid, UInt* arg_block, UInt* ret >+ >+ >+## ------------------------------------------------------------------ >+## VG_(needs).extends_UCode >+ >+## 'X' prefix indicates eXtended UCode. >+Int, get_Xreg_usage, UInstr* u, Tag tag, Int* regs, Bool* isWrites >+void, emit_XUInstr, UInstr* u, RRegSet regs_live_before >+Bool, sane_XUInstr, Bool beforeRA, Bool beforeLiveness, UInstr* u >+Char *, name_XUOpcode, Opcode opc >+void, pp_XUInstr, UInstr* u >+ >+ >+## ------------------------------------------------------------------ >+## VG_(needs).syscall_wrapper >+ >+## If either of the pre_ functions malloc() something to return, the >+## corresponding post_ function had better free() it! >+ >+void *, pre_syscall, ThreadId tid, UInt syscallno, Bool is_blocking >+void, post_syscall, ThreadId tid, UInt syscallno, void* pre_result, Int res, Bool is_blocking >+ >+ >+## --------------------------------------------------------------------- >+## VG_(needs).sanity_checks >+ >+## Can be useful for ensuring a skin's correctness. SK_(cheap_sanity_check) >+## is called very frequently; SK_(expensive_sanity_check) is called less >+## frequently and can be more involved. >+Bool, cheap_sanity_check >+Bool, expensive_sanity_check >+ >+ >+## ================================================================================ >+## Event tracking functions >+:track >+ >+## Events happening in core to track. To be notified, pass a callback >+## function to the appropriate function. To ignore an event, don't do >+## anything (default is for events to be ignored). >+ >+## Note that most events aren't passed a ThreadId. To find out the ThreadId >+## of the affected thread, use VG_(get_current_or_recent_tid)(). For the >+## ones passed a ThreadId, use that instead, since >+## VG_(get_current_or_recent_tid)() might not give the right ThreadId in >+## that case. >+ >+## Memory events (Nb: to track heap allocation/freeing, a skin must replace >+## malloc() et al. See above how to do this.) >+ >+## These ones occur at startup, upon some signals, and upon some syscalls >+void, new_mem_startup, Addr a, UInt len, Bool rr, Bool ww, Bool xx >+void, new_mem_stack_signal, Addr a, UInt len >+void, new_mem_brk, Addr a, UInt len >+void, new_mem_mmap, Addr a, UInt len, Bool rr, Bool ww, Bool xx >+ >+void, copy_mem_remap, Addr from, Addr to, UInt len >+void, change_mem_mprotect, Addr a, UInt len, Bool rr, Bool ww, Bool xx >+void, die_mem_stack_signal, Addr a, UInt len >+void, die_mem_brk, Addr a, UInt len >+void, die_mem_munmap, Addr a, UInt len >+ >+## These ones are called when %esp changes. A skin could track these itself >+## (except for ban_mem_stack) but it's much easier to use the core's help. >+ >+## The specialised ones are called in preference to the general one, if they >+## are defined. These functions are called a lot if they are used, so >+## specialising can optimise things significantly. If any of the >+## specialised cases are defined, the general case must be defined too. >+ >+## Nb: they must all use the __attribute__((regparm(n))) attribute. >+void, new_mem_stack_4, Addr new_ESP >+void, new_mem_stack_8, Addr new_ESP >+void, new_mem_stack_12, Addr new_ESP >+void, new_mem_stack_16, Addr new_ESP >+void, new_mem_stack_32, Addr new_ESP >+void, new_mem_stack, Addr a, UInt len >+ >+void, die_mem_stack_4, Addr die_ESP >+void, die_mem_stack_8, Addr die_ESP >+void, die_mem_stack_12, Addr die_ESP >+void, die_mem_stack_16, Addr die_ESP >+void, die_mem_stack_32, Addr die_ESP >+void, die_mem_stack, Addr a, UInt len >+ >+## Used for redzone at end of thread stacks >+void, ban_mem_stack, Addr a, UInt len >+ >+## These ones occur around syscalls, signal handling, etc >+void, pre_mem_read, CorePart part, ThreadId tid, Char* s, Addr a, UInt size >+void, pre_mem_read_asciiz, CorePart part, ThreadId tid, Char* s, Addr a >+void, pre_mem_write, CorePart part, ThreadId tid, Char* s, Addr a, UInt size >+## Not implemented yet -- have to add in lots of places, which is a >+## pain. Won't bother unless/until there's a need. >+## void (*post_mem_read) ( ThreadState* tst, Char* s, Addr a, UInt size ); >+void, post_mem_write, Addr a, UInt size >+ >+ >+## Register events -- if `shadow_regs' need is set, all should probably be >+## used. Use VG_(set_thread_shadow_archreg)() to set the shadow of the >+## changed register. >+ >+## Use VG_(set_shadow_archreg)() to set the eight general purpose regs, >+## and use VG_(set_shadow_eflags)() to set eflags. >+void, post_regs_write_init, void >+ >+## Use VG_(set_thread_shadow_archreg)() to set the shadow regs for these >+## events. >+void, post_reg_write_syscall_return, ThreadId tid, UInt reg >+void, post_reg_write_deliver_signal, ThreadId tid, UInt reg >+void, post_reg_write_pthread_return, ThreadId tid, UInt reg >+void, post_reg_write_clientreq_return, ThreadId tid, UInt reg >+## This one is called for malloc() et al if they are replaced by a skin. >+void, post_reg_write_clientcall_return, ThreadId tid, UInt reg, Addr f >+ >+ >+## Scheduler events (not exhaustive) >+void, thread_run, ThreadId tid >+ >+ >+## Thread events (not exhaustive) >+ >+## Called during thread create, before the new thread has run any >+## instructions (or touched any memory). >+void, post_thread_create, ThreadId tid, ThreadId child >+void, post_thread_join, ThreadId joiner, ThreadId joinee >+ >+ >+## Mutex events (not exhaustive) >+## "void *mutex" is really a pthread_mutex * >+ >+## Called before a thread can block while waiting for a mutex (called >+## regardless of whether the thread will block or not). >+void, pre_mutex_lock, ThreadId tid, void* mutex >+## Called once the thread actually holds the mutex (always paired with >+## pre_mutex_lock). >+void, post_mutex_lock, ThreadId tid, void* mutex >+## Called after a thread has released a mutex (no need for a corresponding >+## pre_mutex_unlock, because unlocking can't block). >+void, post_mutex_unlock, ThreadId tid, void* mutex >+ >+## Signal events (not exhaustive) >+ >+## ... pre_send_signal, post_send_signal ... >+ >+## Called before a signal is delivered; `alt_stack' indicates if it is >+## delivered on an alternative stack. >+void, pre_deliver_signal, ThreadId tid, Int sigNo, Bool alt_stack >+## Called after a signal is delivered. Nb: unfortunately, if the signal >+## handler longjmps, this won't be called. >+void, post_deliver_signal, ThreadId tid, Int sigNo >+ >+ >+## Others... condition variable... >+## ... >+ >+## Shadow memory management >+void, init_shadow_page, Addr p >+ >+## ================================================================================ >+## malloc and friends >+:malloc >+void*, malloc, Int n >+void*, __builtin_new, Int n >+void*, __builtin_vec_new, Int n >+void*, memalign, Int align, Int n >+void*, calloc, Int nmemb, Int n >+void, free, void* p >+void, __builtin_delete, void* p >+void, __builtin_vec_delete, void* p >+void*, realloc, void* p, Int size >diff -ruN valgrind-2.1.0/coregrind/ume.c valgrind/coregrind/ume.c >--- valgrind-2.1.0/coregrind/ume.c 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/ume.c 2004-01-24 12:18:52.000000000 -0600 >@@ -0,0 +1,704 @@ >+ >+/*--------------------------------------------------------------------*/ >+/*--- User-mode execve() ume.c ---*/ >+/*--------------------------------------------------------------------*/ >+ >+/* >+ This file is part of Valgrind, an extensible x86 protected-mode >+ emulator for monitoring program execution on x86-Unixes. >+ >+ Copyright (C) 2000-2004 Julian Seward >+ jseward@acm.org >+ >+ 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. >+*/ >+ >+/* >+ User-mode exec >+ >+ This bootstraps Valgrind. This code decides on the layout of the >+ client and Valgrind address spaces, loads valgrind.so and the >+ skin.so into the valgrind part, loads the client executable (and the >+ dynamic linker, if necessary) into the client part, and calls into >+ Valgrind proper. >+ >+ The code is careful not to allow spurious mappings to appear in the >+ wrong parts of the address space. In particular, to make sure >+ dlopen puts things in the right place, it will pad out the forbidden >+ chunks of address space so that dlopen is forced to put things where >+ we want them. >+ >+ The memory map it creates is: >+ >+ CLIENT_BASE +-------------------------+ >+ | client address space | >+ : : >+ : : >+ | client stack | >+ client_end +-------------------------+ >+ | redzone | >+ shadow_base +-------------------------+ >+ | | >+ : shadow memory for skins : >+ | (may be 0 sized) | >+ shadow_end +-------------------------+ >+ : gap (may be 0 sized) : >+ valgrind_base +-------------------------+ >+ | valgrind .so files | >+ | and mappings | >+ valgrind_mmap_end - >+ | kickstart executable | >+ - - >+ | valgrind heap vvvvvvvvv| >+ valgrind_end - - >+ | valgrind stack ^^^^^^^^^| >+ +-------------------------+ >+ : kernel : >+ */ >+ >+#define _GNU_SOURCE >+#define _FILE_OFFSET_BITS 64 >+ >+#include "vg_include.h" >+ >+#include <stddef.h> >+#include <sys/mman.h> >+#include <fcntl.h> >+#include <errno.h> >+#include <elf.h> >+#include <stdio.h> >+#include <string.h> >+#include <stdlib.h> >+#include <unistd.h> >+#include <sys/stat.h> >+#include <dlfcn.h> >+#include <assert.h> >+ >+#include "ume.h" >+ >+static int padfile = -1; >+static struct stat padstat; >+ >+extern int kickstart_base; /* linker created */ >+ >+void foreach_map(int (*fn)(void *start, void *end, >+ const char *perm, off_t offset, >+ int maj, int min, int ino)) >+{ >+ static char buf[10240]; >+ char *bufptr = buf; >+ int ret, fd; >+ >+ fd = open("/proc/self/maps", O_RDONLY); >+ >+ if (fd == -1) { >+ perror("open /proc/self/maps"); >+ return; >+ } >+ >+ ret = read(fd, buf, sizeof(buf)); >+ >+ if (ret == -1) { >+ perror("read /proc/self/maps"); >+ close(fd); >+ return; >+ } >+ close(fd); >+ >+ if (ret == sizeof(buf)) { >+ fprintf(stderr, "buf too small\n"); >+ return; >+ } >+ >+ while(bufptr && bufptr < buf+ret) { >+ char perm[5]; >+ off_t offset; >+ int maj, min; >+ int ino; >+ void *segstart, *segend; >+ >+ sscanf(bufptr, "%p-%p %s %Lx %x:%x %d", >+ &segstart, &segend, perm, &offset, &maj, &min, &ino); >+ bufptr = strchr(bufptr, '\n'); >+ if (bufptr != NULL) >+ bufptr++; /* skip \n */ >+ >+ if (!(*fn)(segstart, segend, perm, offset, maj, min, ino)) >+ break; >+ } >+} >+ >+/* pad all the empty spaces in a range of address space to stop >+ interlopers */ >+void as_pad(void *start, void *end) >+{ >+ char buf[1024]; >+ char *addr; >+ >+ int fillgap(void *segstart, void *segend, const char *perm, off_t off, >+ int maj, int min, int ino) { >+ if (segstart >= end) >+ return 0; >+ >+ if ((char *)segstart > addr) >+ mmap(addr, (char *)segstart-addr, PROT_NONE, MAP_FIXED|MAP_PRIVATE, >+ padfile, 0); >+ addr = segend; >+ >+ return 1; >+ } >+ >+ if (padfile == -1) { >+ int seq = 1; >+ do { >+ sprintf(buf, "/tmp/.pad.%d.%d", getpid(), seq++); >+ padfile = open(buf, O_RDWR|O_CREAT|O_EXCL, 0); >+ unlink(buf); >+ if (padfile == -1 && errno != EEXIST) >+ exit(44); >+ } while(padfile == -1); >+ fstat(padfile, &padstat); >+ } >+ >+ addr = start; >+ >+ foreach_map(fillgap); >+ >+ if (addr < (char *)end) >+ mmap(addr, (char *)end-addr, PROT_NONE, MAP_FIXED|MAP_PRIVATE, >+ padfile, 0); >+} >+ >+/* remove padding from a range of address space - padding is always a >+ mapping of padfile*/ >+void as_unpad(void *start, void *end) >+{ >+ int killpad(void *segstart, void *segend, const char *perm, off_t off, >+ int maj, int min, int ino) { >+ void *b, *e; >+ >+ if (padstat.st_dev != makedev(maj, min) || padstat.st_ino != ino) >+ return 1; >+ >+ if (segend <= start || segstart >= end) >+ return 1; >+ >+ if (segstart <= start) >+ b = start; >+ else >+ b = segstart; >+ >+ if (segend >= end) >+ e = end; >+ else >+ e = segend; >+ >+ munmap(b, (char *)e-(char *)b); >+ >+ return 1; >+ } >+ >+ if (padfile == -1) /* no padfile, no padding */ >+ return; >+ >+ foreach_map(killpad); >+} >+ >+void as_closepadfile(void) >+{ >+ /* don't unpad */ >+ close(padfile); >+ padfile = -1; >+} >+ >+int as_getpadfd(void) >+{ >+ return padfile; >+} >+ >+void as_setpadfd(int fd) >+{ >+ as_closepadfile(); >+ padfile = fd; >+ fstat(padfile, &padstat); >+} >+ >+struct ume_auxv *find_auxv(int *esp) >+{ >+ esp++; /* skip argc */ >+ >+ while(*esp != 0) /* skip argv */ >+ esp++; >+ esp++; >+ >+ while(*esp != 0) /* skip env */ >+ esp++; >+ esp++; >+ >+ return (struct ume_auxv *)esp; >+} >+ >+ >+struct elfinfo *readelf(int fd, const char *filename) >+{ >+ struct elfinfo *e = malloc(sizeof(*e)); >+ int phsz; >+ >+ e->fd = fd; >+ >+ if (pread(fd, &e->e, sizeof(e->e), 0) != sizeof(e->e)) { >+ fprintf(stderr, "%s: can't read elf header: %s\n", >+ filename, strerror(errno)); >+ return NULL; >+ } >+ >+ if (memcmp(&e->e.e_ident[0], ELFMAG, SELFMAG) != 0) { >+ fprintf(stderr, "%s: bad ELF magic\n", >+ filename); >+ return NULL; >+ } >+ if (e->e.e_ident[EI_CLASS] != ELFCLASS32) { >+ fprintf(stderr, "Can only handle 32-bit executables\n"); >+ return NULL; >+ } >+ if (e->e.e_ident[EI_DATA] != ELFDATA2LSB) { >+ fprintf(stderr, "Expecting little-endian\n"); >+ return NULL; >+ } >+ if (!(e->e.e_type == ET_EXEC || e->e.e_type == ET_DYN)) { >+ fprintf(stderr, "need executable\n"); >+ return NULL; >+ } >+ >+ if (e->e.e_machine != EM_386) { >+ fprintf(stderr, "need x86\n"); >+ return NULL; >+ } >+ >+ if (e->e.e_phentsize != sizeof(ESZ(Phdr))) { >+ fprintf(stderr, "sizeof Phdr wrong\n"); >+ return NULL; >+ } >+ >+ phsz = sizeof(ESZ(Phdr)) * e->e.e_phnum; >+ e->p = malloc(phsz); >+ >+ if (pread(fd, e->p, phsz, e->e.e_phoff) != phsz) { >+ fprintf(stderr, "can't read phdr: %s\n", strerror(errno)); >+ return NULL; >+ } >+ >+ return e; >+} >+ >+#define REMAINS(x, a) ((x) & ((a)-1)) >+ >+/* Map an ELF file. Returns the brk address. */ >+ESZ(Addr) mapelf(struct elfinfo *e, ESZ(Addr) base, int setbrk) >+{ >+ int i; >+ ESZ(Addr) elfbrk = 0; >+ >+ for(i = 0; i < e->e.e_phnum; i++) { >+ ESZ(Phdr) *ph = &e->p[i]; >+ ESZ(Addr) addr, brkaddr; >+ ESZ(Word) memsz; >+ >+ if (ph->p_type != PT_LOAD) >+ continue; >+ >+ addr = ph->p_vaddr+base; >+ memsz = ph->p_memsz; >+ brkaddr = addr+memsz; >+ >+ if (brkaddr > elfbrk) >+ elfbrk = brkaddr; >+ } >+ >+ if (setbrk) { >+ /* sneaking up on the brk limit works better than actually >+ jumping directly there. Unfortunately, setting the brk is >+ tested against the datasize rlimit, even though we're not >+ actually using any memory. */ >+ char *b = sbrk(0); >+ char *initb = (char *)PGROUNDUP(b); >+ >+ while(b < (char *)elfbrk) { >+ unsigned delta = (char *)elfbrk - b; >+ static const unsigned limit = 256*1024*1024; >+ char *bb; >+ >+ if (delta > limit) >+ delta = limit; >+ //printf("elfbrk=%p b=%p delta=%u\n", elfbrk, b, delta); >+ bb = sbrk(delta); >+ if (bb != b) { >+ fprintf(stderr, "sbrk failed while adjusting brk base: " >+ "perhaps we hit the datasize ulimit?\n"); >+ return 0; >+ } >+ b += delta; >+ } >+ munmap(initb, (char *)PGROUNDDN(elfbrk)-initb); >+ } >+ >+ for(i = 0; i < e->e.e_phnum; i++) { >+ ESZ(Phdr) *ph = &e->p[i]; >+ ESZ(Addr) addr, bss, brkaddr; >+ ESZ(Off) off; >+ ESZ(Word) filesz; >+ ESZ(Word) memsz; >+ ESZ(Word) align; >+ unsigned prot = 0; >+ >+ if (ph->p_type != PT_LOAD) >+ continue; >+ >+ if (ph->p_flags & PF_X) >+ prot |= PROT_EXEC; >+ if (ph->p_flags & PF_W) >+ prot |= PROT_WRITE; >+ if (ph->p_flags & PF_R) >+ prot |= PROT_READ; >+ >+ align = ph->p_align; >+ >+ addr = ph->p_vaddr+base; >+ off = ph->p_offset; >+ filesz = ph->p_filesz; >+ bss = addr+filesz; >+ memsz = ph->p_memsz; >+ brkaddr = addr+memsz; >+ >+ mmap((char *)ROUNDDN(addr, align), ROUNDUP(bss, align)-ROUNDDN(addr, align), >+ prot, MAP_FIXED|MAP_PRIVATE, e->fd, ROUNDDN(off, align)); >+ >+ /* if memsz > filesz, then we need to fill the remainder with zeroed pages */ >+ if (memsz > filesz) { >+ UInt bytes; >+ >+ bytes = ROUNDUP(brkaddr, align)-ROUNDUP(bss, align); >+ if (bytes > 0) >+ mmap((char *)ROUNDUP(bss, align), bytes, >+ prot, MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE, -1, 0); >+ >+ bytes = bss & (VKI_BYTES_PER_PAGE - 1); >+ if (bytes > 0) { >+ bytes = VKI_BYTES_PER_PAGE - bytes; >+ memset((char *)bss, 0, bytes); >+ } >+ } >+ } >+ >+ return elfbrk; >+} >+ >+ >+static int do_exec_inner(const char *exe, struct exeinfo *info); >+ >+ >+static int match_ELF(const char *hdr, int len) >+{ >+ ESZ(Ehdr) *e = (ESZ(Ehdr) *)hdr; >+ return (len > sizeof(*e)) && memcmp(&e->e_ident[0], ELFMAG, SELFMAG) == 0; >+} >+ >+static int load_ELF(char *hdr, int len, int fd, const char *name, struct exeinfo *info) >+{ >+ struct elfinfo *e; >+ struct elfinfo *interp = NULL; >+ ESZ(Addr) minaddr = ~0; >+ ESZ(Addr) maxaddr = 0; >+ ESZ(Addr) interp_addr = 0; >+ ESZ(Word) interp_size = 0; >+ int i; >+ void *entry; >+ >+ e = readelf(fd, name); >+ >+ if (e == NULL) >+ return ENOEXEC; >+ >+ info->phnum = e->e.e_phnum; >+ info->entry = e->e.e_entry; >+ >+ for(i = 0; i < e->e.e_phnum; i++) { >+ ESZ(Phdr) *ph = &e->p[i]; >+ >+ switch(ph->p_type) { >+ case PT_PHDR: >+ info->phdr = ph->p_vaddr; >+ break; >+ >+ case PT_LOAD: >+ if (ph->p_vaddr < minaddr) >+ minaddr = ph->p_vaddr; >+ if (ph->p_vaddr+ph->p_memsz > maxaddr) >+ maxaddr = ph->p_vaddr+ph->p_memsz; >+ break; >+ >+ case PT_INTERP: { >+ char *buf = malloc(ph->p_filesz+1); >+ int j; >+ int intfd; >+ int baseaddr_set; >+ >+ pread(fd, buf, ph->p_filesz, ph->p_offset); >+ buf[ph->p_filesz] = '\0'; >+ >+ intfd = open(buf, O_RDONLY); >+ if (intfd == -1) { >+ perror("open interp"); >+ exit(1); >+ } >+ >+ interp = readelf(intfd, buf); >+ if (interp == NULL) { >+ fprintf(stderr, "Can't read interpreter\n"); >+ return 1; >+ } >+ free(buf); >+ >+ baseaddr_set = 0; >+ for(j = 0; j < interp->e.e_phnum; j++) { >+ ESZ(Phdr) *iph = &interp->p[j]; >+ ESZ(Addr) end; >+ >+ if (iph->p_type != PT_LOAD) >+ continue; >+ >+ if (!baseaddr_set) { >+ interp_addr = iph->p_vaddr; >+ baseaddr_set = 1; >+ } >+ >+ /* assumes that all segments in the interp are close */ >+ end = (iph->p_vaddr - interp_addr) + iph->p_memsz; >+ >+ if (end > interp_size) >+ interp_size = end; >+ } >+ break; >+ } >+ } >+ } >+ >+ if (info->exe_base != info->exe_end) { >+ if (minaddr >= maxaddr || >+ (minaddr < info->exe_base || >+ maxaddr > info->exe_end)) { >+ fprintf(stderr, "Executable is mapped outside of range %p-%p\n", >+ (void *)info->exe_base, (void *)info->exe_end); >+ return ENOMEM; >+ } >+ } >+ >+ info->brkbase = mapelf(e, 0, info->setbrk); /* map the executable */ >+ >+ if (info->brkbase == 0) >+ return ENOMEM; >+ >+ if (interp != NULL) { >+ /* reserve a chunk of address space for interpreter */ >+ char *base = (char *)info->exe_base; >+ char *baseoff; >+ int flags = MAP_PRIVATE|MAP_ANONYMOUS; >+ >+ if (info->map_base != 0) { >+ base = (char *)info->map_base; >+ flags |= MAP_FIXED; >+ } >+ >+ base = mmap(base, interp_size, PROT_NONE, flags, -1, 0); >+ >+ baseoff = base - interp_addr; >+ >+ mapelf(interp, (ESZ(Addr))baseoff, 0); >+ >+ close(interp->fd); >+ free(interp); >+ >+ entry = baseoff + interp->e.e_entry; >+ info->interp_base = (ESZ(Addr))base; >+ } else >+ entry = (void *)e->e.e_entry; >+ >+ info->exe_base = minaddr; >+ info->exe_end = maxaddr; >+ >+ info->init_eip = (addr_t)entry; >+ >+ free(e); >+ >+ return 0; >+} >+ >+ >+static int match_script(const char *hdr, Int len) >+{ >+ return (len > 2) && memcmp(hdr, "#!", 2) == 0; >+} >+ >+static int load_script(char *hdr, int len, int fd, const char *name, struct exeinfo *info) >+{ >+ char *interp; >+ char *const end = hdr+len; >+ char *cp; >+ char *arg = NULL; >+ int eol; >+ >+ interp = hdr + 2; >+ while(interp < end && (*interp == ' ' || *interp == '\t')) >+ interp++; >+ >+ if (*interp != '/') >+ return ENOEXEC; /* absolute path only for interpreter */ >+ >+ /* skip over interpreter name */ >+ for(cp = interp; cp < end && *cp != ' ' && *cp != '\t' && *cp != '\n'; cp++) >+ ; >+ >+ eol = (*cp == '\n'); >+ >+ *cp++ = '\0'; >+ >+ if (!eol && cp < end) { >+ /* skip space before arg */ >+ while (cp < end && (*cp == '\t' || *cp == ' ')) >+ cp++; >+ >+ /* arg is from here to eol */ >+ arg = cp; >+ while (cp < end && *cp != '\n') >+ cp++; >+ *cp = '\0'; >+ } >+ >+ info->argv0 = strdup(interp); >+ assert(NULL != info->argv0); >+ if (arg != NULL && *arg != '\0') { >+ info->argv1 = strdup(arg); >+ assert(NULL != info->argv1); >+ } >+ >+ if (info->argv && info->argv[0] != NULL) >+ info->argv[0] = (char *)name; >+ >+ if (0) >+ printf("#! script: argv0=\"%s\" argv1=\"%s\"\n", >+ info->argv0, info->argv1); >+ >+ return do_exec_inner(interp, info); >+} >+ >+struct binfmt { >+ int (*match)(const char *hdr, int len); >+ int (*load) ( char *hdr, int len, int fd, const char *name, struct exeinfo *); >+}; >+ >+static const struct binfmt formats[] = { >+ { match_ELF, load_ELF }, >+ { match_script, load_script }, >+}; >+ >+ >+static int do_exec_inner(const char *exe, struct exeinfo *info) >+{ >+ int fd; >+ char buf[VKI_BYTES_PER_PAGE]; >+ int bufsz; >+ int i; >+ int ret; >+ struct stat st; >+ >+ fd = open(exe, O_RDONLY); >+ if (fd == -1) { >+ if (0) >+ fprintf(stderr, "Can't open executable %s: %s\n", >+ exe, strerror(errno)); >+ return errno; >+ } >+ >+ if (fstat(fd, &st) == -1) >+ return errno; >+ else { >+ uid_t uid = geteuid(); >+ gid_t gid = getegid(); >+ gid_t groups[32]; >+ int ngrp = getgroups(32, groups); >+ >+ if (st.st_mode & (S_ISUID | S_ISGID)) { >+ fprintf(stderr, "Can't execute suid/sgid executable %s\n", exe); >+ return EACCES; >+ } >+ >+ if (uid == st.st_uid) { >+ if (!(st.st_mode & S_IXUSR)) >+ return EACCES; >+ } else { >+ int grpmatch = 0; >+ >+ if (gid == st.st_gid) >+ grpmatch = 1; >+ else >+ for(i = 0; i < ngrp; i++) >+ if (groups[i] == st.st_gid) { >+ grpmatch = 1; >+ break; >+ } >+ >+ if (grpmatch) { >+ if (!(st.st_mode & S_IXGRP)) >+ return EACCES; >+ } else if (!(st.st_mode & S_IXOTH)) >+ return EACCES; >+ } >+ } >+ >+ bufsz = pread(fd, buf, sizeof(buf), 0); >+ if (bufsz < 0) { >+ fprintf(stderr, "Can't read executable header: %s\n", >+ strerror(errno)); >+ close(fd); >+ return errno; >+ } >+ >+ ret = ENOEXEC; >+ for(i = 0; i < sizeof(formats)/sizeof(*formats); i++) { >+ if ((formats[i].match)(buf, bufsz)) { >+ ret = (formats[i].load)(buf, bufsz, fd, exe, info); >+ break; >+ } >+ } >+ >+ close(fd); >+ >+ return ret; >+} >+ >+int do_exec(const char *exe, struct exeinfo *info) >+{ >+ info->argv0 = NULL; >+ info->argv1 = NULL; >+ >+ return do_exec_inner(exe, info); >+} >+ >+/*--------------------------------------------------------------------*/ >+/*--- end ume.c ---*/ >+/*--------------------------------------------------------------------*/ >diff -ruN valgrind-2.1.0/coregrind/ume.h valgrind/coregrind/ume.h >--- valgrind-2.1.0/coregrind/ume.h 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/ume.h 2004-01-24 12:18:52.000000000 -0600 >@@ -0,0 +1,103 @@ >+ >+/* >+ This file is part of Valgrind, an extensible x86 protected-mode >+ emulator for monitoring program execution on x86-Unixes. >+ >+ Copyright (C) 2000-2004 Julian Seward >+ jseward@acm.org >+ >+ 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 _COREGRIND_UME_H >+#define _COREGRIND_UME_H >+ >+#include <elf.h> >+#include <sys/types.h> >+ >+#if ELFSZ == 64 >+#define ESZ(x) Elf64_##x >+#elif ELFSZ == 32 >+#define ESZ(x) Elf32_##x >+#else >+#error ELFSZ needs to ==32 or ==64 >+#endif >+ >+/* Integer type the same size as a pointer */ >+typedef ESZ(Addr) addr_t; >+ >+struct exeinfo >+{ >+ int setbrk; /* INPUT: if true, set the brk segment base */ >+ addr_t map_base; /* INPUT: if non-zero, base address of mappings */ >+ >+ addr_t exe_base; /* INOUT: lowest (allowed) address of exe */ >+ addr_t exe_end; /* INOUT: highest (allowed) address */ >+ >+ addr_t phdr; /* address phdr was mapped at */ >+ int phnum; /* number of phdrs */ >+ addr_t interp_base; /* where interpreter (ld.so) was mapped */ >+ addr_t entry; /* entrypoint in main executable */ >+ addr_t init_eip; /* initial eip */ >+ addr_t brkbase; /* base address of brk segment */ >+ >+ /* these are the extra args added by #! scripts */ >+ char *argv0; /* INPUT: the interpreter name */ >+ char *argv1; /* INPUT: the args for the interpreter */ >+ >+ char **argv; /* INPUT: the original argv */ >+}; >+ >+int do_exec(const char *exe, struct exeinfo *info); >+ >+void foreach_map(int (*fn)(void *start, void *end, >+ const char *perm, off_t offset, >+ int maj, int min, int ino)); >+void as_pad(void *start, void *end); >+void as_unpad(void *start, void *end); >+void as_closepadfile(void); >+int as_getpadfd(void); >+void as_setpadfd(int); >+ >+struct elfinfo >+{ >+ ESZ(Ehdr) e; >+ ESZ(Phdr) *p; >+ int fd; >+}; >+ >+struct elfinfo *readelf(int fd, const char *filename); >+ESZ(Addr) mapelf(struct elfinfo *e, ESZ(Addr) base, int setbrk); >+ >+struct ume_auxv >+{ >+ int a_type; >+ union { >+ void *a_ptr; >+ int a_val; >+ void (*a_fcn)(void); >+ } u; >+}; >+ >+struct ume_auxv *find_auxv(int *orig_esp); >+ >+/* Our private auxv entries */ >+#define AT_UME_PADFD 0xff01 /* padding file fd */ >+#define AT_UME_EXECFD 0xff02 /* stage1 executable fd */ >+ >+#endif /* _COREGRIND_UME_H */ >diff -ruN valgrind-2.1.0/coregrind/ume_arch.h valgrind/coregrind/ume_arch.h >--- valgrind-2.1.0/coregrind/ume_arch.h 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/ume_arch.h 2004-01-03 21:46:11.000000000 -0600 >@@ -0,0 +1,36 @@ >+ >+/* >+ This file is part of Valgrind, an extensible x86 protected-mode >+ emulator for monitoring program execution on x86-Unixes. >+ >+ Copyright (C) 2000-2004 Julian Seward >+ jseward@acm.org >+ >+ 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 UME_ARCH >+#define UME_ARCH >+ >+#include "ume.h" >+ >+void ume_go(addr_t eip, addr_t esp) __attribute__((noreturn)); >+ >+extern void *ume_exec_esp; /* esp on entry at exec time */ >+ >+#endif /* UME_ARCH */ >diff -ruN valgrind-2.1.0/coregrind/valgrind.in valgrind/coregrind/valgrind.in >--- valgrind-2.1.0/coregrind/valgrind.in 2003-12-05 10:39:42.000000000 -0600 >+++ valgrind/coregrind/valgrind.in 1969-12-31 18:00:00.000000000 -0600 >@@ -1,175 +0,0 @@ >-#!/bin/sh >-##--------------------------------------------------------------------## >-##--- The startup script. valgrind ---## >-##--------------------------------------------------------------------## >- >-# This file is part of Valgrind, an extensible x86 protected-mode >-# emulator for monitoring program execution on x86-Unixes. >-# >-# Copyright (C) 2002-2003 Julian Seward >-# jseward@acm.org >-# >-# 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. >- >- >-# Should point to the installation directory >-prefix="@prefix@" >-exec_prefix="@exec_prefix@" >-VALGRIND="@libdir@/valgrind" >- >-# Other stuff ... >-version="@VERSION@" >-emailto="jseward@acm.org" >- >-# The default name of the suppressions file >-vgsupp="--suppressions=$VALGRIND/default.supp" >- >-# Valgrind options >-vgopts= >- >-# Tool to use, chosen by --tool=<foo>, defaults to Memcheck >-tool=memcheck >- >-# --in-place=<dir> arg, for using non-installed version >-in_place_arg= >- >-# Default core+tool to use are the installed ones >-coredir=$VALGRIND >-tooldir=$VALGRIND >- >-# Collect up args for Valgrind. Only some are intercepted here; >-# the rest are passed to vg_main.c. Allow --skin for backwards compatibility. >-while [ $# != 0 ] >-do >- arg=$1 >- case "$arg" in >- --version) echo "valgrind-$version"; exit 1 ;; >- --tool=*) tool=`echo $arg | sed 's/--tool=//'`; shift;; >- --skin=*) tool=`echo $arg | sed 's/--skin=//'`; shift;; >- --in-place=*) in_place_arg=$arg; shift;; >- -*) vgopts="$vgopts $arg"; shift;; >- *) break;; >- esac >-done >- >- >-# If running uninstalled version in-place... >-if [ z"$in_place_arg" != z ]; then >- in_place_dir=`echo $in_place_arg | sed 's/--in-place=//'` >- tooldir="$in_place_dir/$tool" >- coredir="$in_place_dir/coregrind/.in_place" >- vgsupp="--suppressions=$in_place_dir/default.supp" >-fi >- >-# Setup tool shared object. >-tool_so="vgskin_${tool}.so" >-if [ ! -r "$tooldir/$tool_so" ] ; then >- echo >- echo "Tool error:" >- echo " The shared library \`$tool_so' for the chosen" >- echo " tool \`$tool' could not be found in" >- echo " $tooldir" >- echo >- exit 1 >-fi >- >-VG_ARGS="$VALGRIND_OPTS $vgsupp $vgopts" >- >-export VG_ARGS >- >-# Red Hat Linux 9 uses NPTL, which has a kernel interface >-# unlike the linuxthreads interface valgrind expects. We can >-# tell the dynamic loader to disable this interface using >-# an environment variable. >- >-if getconf GNU_LIBPTHREAD_VERSION 2>/dev/null | grep -qi NPTL 2>/dev/null; then >- LD_ASSUME_KERNEL=2.4.1 >- export LD_ASSUME_KERNEL >-fi >- >-# Check that the program looks ok >-is_prog=0 >- >-if [ $# != 0 ] ; then >- >- # Ensure the program exists. Ignore any error messages from 'which'. >- which_prog=`which $1 2> /dev/null` >- if [ z$which_prog = z ] && (echo "$1" | grep -q '/'); then >- which_prog=$1 >- fi >- >- if [ z$which_prog = z ]; then >- echo "$0: '$1' not found in \$PATH, aborting." >- exit >- fi >- >- if [ $# != 0 ] ; then >- case `file -L "$which_prog"` in # must follow symlinks, hence -L >- # Ensure the program isn't statically linked. >- *"statically linked"*) >- echo "\`$which_prog' is statically linked" >- echo "Valgrind only works on dynamically linked executables; your" >- echo "program must rely on at least one shared object for Valgrind" >- echo "to work with it. Read FAQ #5 for more information." >- exit 1 ;; >- # Ensure that there are no setuid or gid flags >- *:\ set?id\ ELF*) >- echo "\`$which_prog' is suid/sgid." >- echo "Valgrind can't handle these executables, as it" >- echo "requires the LD_PRELOAD feature in order to work." >- echo "" >- echo "Remove those flags and try again." >- echo "" >- exit 1 >- ;; >- esac >- fi >- >- is_prog=1 >-fi >- >-# A bit subtle. The LD_PRELOAD added entry must be absolute >-# and not depend on LD_LIBRARY_PATH. This is so that we can >-# mess with LD_LIBRARY_PATH for child processes, which makes >-# libpthread.so fall out of visibility, independently of >-# whether valgrind.so is visible. >- >-LD_LIBRARY_PATH=$coredir:$LD_LIBRARY_PATH >-export LD_LIBRARY_PATH >- >-# Insert tool .so before valgrind.so to override template functions. >-LD_PRELOAD=$tooldir/$tool_so:$coredir/valgrind.so:$LD_PRELOAD >-export LD_PRELOAD >-#LD_DEBUG=files >-#LD_DEBUG=symbols >-#export LD_DEBUG >- >-# Actually run the program, under Valgrind's control >-if [ $is_prog = 1 ] ; then >- exec "$@" >-else >- # If no command given, act like -h was given so vg_main.c prints out the >- # usage string. And pass to 'exec' the name of any program -- it doesn't >- # matter which -- because it won't be run anyway (we use 'true'). >- VG_ARGS="$VG_ARGS -h" >- exec true >-fi >- >-##--------------------------------------------------------------------## >-##--- end valgrind ---## >-##--------------------------------------------------------------------## >diff -ruN valgrind-2.1.0/coregrind/valgrind.vs valgrind/coregrind/valgrind.vs >--- valgrind-2.1.0/coregrind/valgrind.vs 2003-10-15 06:21:43.000000000 -0500 >+++ valgrind/coregrind/valgrind.vs 2003-12-15 20:05:11.000000000 -0600 >@@ -1,9 +1,10 @@ >-VALGRIND_2.0 { >+{ > global: > vgPlain_*; > vgSkin_*; > vgProf_*; > vgOff_*; >+ > local: > *; # default to hidden > }; >diff -ruN valgrind-2.1.0/coregrind/vg_constants.h valgrind/coregrind/vg_constants.h >--- valgrind-2.1.0/coregrind/vg_constants.h 2003-04-15 09:57:39.000000000 -0500 >+++ valgrind/coregrind/vg_constants.h 2004-01-26 15:11:51.000000000 -0600 >@@ -8,7 +8,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -48,6 +48,7 @@ > scheduler. */ > #define VG_TRC_EBP_JMP_SYSCALL 19 /* EBP and TRC */ > #define VG_TRC_EBP_JMP_CLIENTREQ 23 /* EBP and TRC */ >+#define VG_TRC_EBP_JMP_YIELD 27 /* EBP and TRC */ > > #define VG_TRC_INNER_FASTMISS 31 /* TRC only; means fast-cache miss. */ > #define VG_TRC_INNER_COUNTERZERO 29 /* TRC only; means bb ctr == 0 */ >@@ -65,6 +66,9 @@ > /* Offset of code in a TCEntry */ > #define VG_CODE_OFFSET (8 + VG_MAX_JUMPS * 2) > >+/* Client address space segment limit descriptor entry */ >+#define VG_POINTERCHECK_SEGIDX 1 >+ > /* Debugging hack for assembly code ... sigh. */ > #if 0 > #define OYNK(nnn) pushal; pushl $nnn; call VG_(oynk) ; addl $4,%esp; popal >@@ -90,6 +94,93 @@ > /* Assembly code stubs make this request */ > #define VG_USERREQ__SIGNAL_RETURNS 0x4001 > >+/* >+ 0 - standard feature flags >+ 1 - Intel extended flags >+ 2 - Valgrind internal flags >+ 3 - AMD-specific flags >+ */ >+#define VG_N_FEATURE_WORDS 4 >+ >+#define VG_X86_FEAT 0 >+#define VG_EXT_FEAT 1 >+#define VG_INT_FEAT 2 >+#define VG_AMD_FEAT 3 >+ >+/* CPU features (generic) */ >+#define VG_X86_FEAT_FPU (VG_X86_FEAT*32 + 0) >+#define VG_X86_FEAT_VME (VG_X86_FEAT*32 + 1) >+#define VG_X86_FEAT_DE (VG_X86_FEAT*32 + 2) >+#define VG_X86_FEAT_PSE (VG_X86_FEAT*32 + 3) >+#define VG_X86_FEAT_TSC (VG_X86_FEAT*32 + 4) >+#define VG_X86_FEAT_MSR (VG_X86_FEAT*32 + 5) >+#define VG_X86_FEAT_PAE (VG_X86_FEAT*32 + 6) >+#define VG_X86_FEAT_MCE (VG_X86_FEAT*32 + 7) >+#define VG_X86_FEAT_CX8 (VG_X86_FEAT*32 + 8) >+#define VG_X86_FEAT_APIC (VG_X86_FEAT*32 + 9) >+#define VG_X86_FEAT_SEP (VG_X86_FEAT*32 + 11) >+#define VG_X86_FEAT_MTRR (VG_X86_FEAT*32 + 12) >+#define VG_X86_FEAT_PGE (VG_X86_FEAT*32 + 13) >+#define VG_X86_FEAT_MCA (VG_X86_FEAT*32 + 14) >+#define VG_X86_FEAT_CMOV (VG_X86_FEAT*32 + 15) >+#define VG_X86_FEAT_PAT (VG_X86_FEAT*32 + 16) >+#define VG_X86_FEAT_PSE36 (VG_X86_FEAT*32 + 17) >+#define VG_X86_FEAT_CLFSH (VG_X86_FEAT*32 + 19) >+#define VG_X86_FEAT_DS (VG_X86_FEAT*32 + 21) >+#define VG_X86_FEAT_ACPI (VG_X86_FEAT*32 + 22) >+#define VG_X86_FEAT_MMX (VG_X86_FEAT*32 + 23) >+#define VG_X86_FEAT_FXSR (VG_X86_FEAT*32 + 24) >+#define VG_X86_FEAT_SSE (VG_X86_FEAT*32 + 25) >+#define VG_X86_FEAT_SSE2 (VG_X86_FEAT*32 + 26) >+#define VG_X86_FEAT_SS (VG_X86_FEAT*32 + 27) >+#define VG_X86_FEAT_HT (VG_X86_FEAT*32 + 28) >+#define VG_X86_FEAT_TM (VG_X86_FEAT*32 + 29) >+#define VG_X86_FEAT_IA64 (VG_X86_FEAT*32 + 30) >+#define VG_X86_FEAT_PBE (VG_X86_FEAT*32 + 31) >+ >+/* Intel extended feature word */ >+#define VG_X86_FEAT_SSE3 (VG_EXT_FEAT*32 + 0) >+#define VG_X86_FEAT_MON (VG_EXT_FEAT*32 + 3) >+#define VG_X86_FEAT_DSCPL (VG_EXT_FEAT*32 + 4) >+#define VG_X86_FEAT_EST (VG_EXT_FEAT*32 + 7) >+#define VG_X86_FEAT_TM2 (VG_EXT_FEAT*32 + 8) >+#define VG_X86_FEAT_CNXTID (VG_EXT_FEAT*32 + 10) >+ >+/* Used internally to mark whether CPUID is even implemented */ >+#define VG_X86_FEAT_CPUID (VG_INT_FEAT*32 + 0) >+ >+/* AMD special features */ >+#define VG_AMD_FEAT_SYSCALL (VG_AMD_FEAT*32 + 11) >+#define VG_AMD_FEAT_NXP (VG_AMD_FEAT*32 + 20) >+#define VG_AMD_FEAT_MMXEXT (VG_AMD_FEAT*32 + 22) >+#define VG_AMD_FEAT_FFXSR (VG_AMD_FEAT*32 + 25) >+#define VG_AMD_FEAT_LONGMODE (VG_AMD_FEAT*32 + 29) >+#define VG_AMD_FEAT_3DNOWEXT (VG_AMD_FEAT*32 + 30) >+#define VG_AMD_FEAT_3DNOW (VG_AMD_FEAT*32 + 31) >+ >+/* Various environment variables we pay attention to */ >+ >+/* The directory we look for all our auxillary files in */ >+#define VALGRINDLIB "VALGRINDLIB" >+ >+/* Additional command-line arguments; they are overridden by actual >+ command-line option. Each argument is separated by spaces. There >+ is no quoting mechanism. >+ */ >+#define VALGRINDOPTS "VALGRIND_OPTS" >+ >+/* If this variable is present in the environment, then valgrind will >+ not parse the command line for options at all; all options come >+ from this variable. Arguments are terminated by ^A (\001). There >+ is no quoting mechanism. >+ >+ This variable is not expected to be set by anything other than >+ Valgrind itself, as part of its handling of execve with >+ --trace-children=yes. This variable should not be present in the >+ client environment. >+ */ >+#define VALGRINDCLO "_VALGRIND_CLO" >+ > #endif /* ndef __VG_CONSTANTS_H */ > > /*--------------------------------------------------------------------*/ >diff -ruN valgrind-2.1.0/coregrind/vg_default.c valgrind/coregrind/vg_default.c >--- valgrind-2.1.0/coregrind/vg_default.c 2003-11-14 11:47:52.000000000 -0600 >+++ valgrind/coregrind/vg_default.c 2004-01-26 08:51:40.000000000 -0600 >@@ -9,7 +9,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Nicholas Nethercote >+ Copyright (C) 2000-2004 Nicholas Nethercote > njn25@cam.ac.uk > > This program is free software; you can redistribute it and/or >@@ -31,10 +31,6 @@ > */ > > >-/* These functions aren't intended to be run. Replacement functions used by >- * the chosen tool are substituted by compiling the tool into a .so and >- * LD_PRELOADing it. Nasty :) */ >- > #include "vg_include.h" > > /* --------------------------------------------------------------------- >@@ -44,8 +40,8 @@ > /* If the tool fails to define one or more of the required functions, > * make it very clear what went wrong! */ > >-static __attribute__ ((noreturn)) >-void fund_panic ( const Char* fn ) >+__attribute__ ((noreturn)) >+void VG_(missing_tool_func) ( const Char* fn ) > { > VG_(printf)( > "\nTool error:\n" >@@ -56,17 +52,6 @@ > } > > static __attribute__ ((noreturn)) >-void non_fund_panic ( const Char* fn ) >-{ >- VG_(printf)( >- "\nTool error:\n" >- " The tool you have selected is missing the function `%s'\n" >- " required by one of its needs.\n\n", >- fn); >- VG_(skin_panic)("Missing tool function"); >-} >- >-static __attribute__ ((noreturn)) > void malloc_panic ( const Char* fn ) > { > VG_(printf)( >@@ -77,82 +62,6 @@ > VG_(skin_panic)("Missing tool function"); > } > >-#define FUND(proto) \ >-__attribute__((weak)) \ >-proto \ >-{ \ >- fund_panic(__PRETTY_FUNCTION__); \ >-} >- >-#define NON_FUND(proto) \ >-__attribute__((weak)) \ >-proto \ >-{ \ >- non_fund_panic(__PRETTY_FUNCTION__); \ >-} >- >-#define MALLOC(proto) \ >-__attribute__((weak)) \ >-proto \ >-{ \ >- malloc_panic(__PRETTY_FUNCTION__); \ >-} >- >-/* --------------------------------------------------------------------- >- Default functions >- ------------------------------------------------------------------ */ >- >-/* Fundamental template functions */ >-FUND( void SK_(pre_clo_init) (void) ); >-FUND( void SK_(post_clo_init)(void) ); >-FUND( UCodeBlock* SK_(instrument) (UCodeBlock* cb, Addr not_used) ); >-FUND( void SK_(fini) (Int exitcode) ); >- >-/* For error reporting and suppression handling */ >-NON_FUND( Bool SK_(eq_SkinError)(VgRes res, Error* e1, Error* e2) ); >-NON_FUND( void SK_(pp_SkinError)(Error* err) ); >-NON_FUND( UInt SK_(update_extra)(Error* err) ); >-NON_FUND( Bool SK_(recognised_suppression)(Char* name, Supp* su) ); >-NON_FUND( Bool SK_(read_extra_suppression_info)(Int fd, Char* buf, Int nBuf, >- Supp* su) ); >-NON_FUND( Bool SK_(error_matches_suppression)(Error* err, Supp* su) ); >-NON_FUND( Char* SK_(get_error_name)(Error* err) ); >-NON_FUND( void SK_(print_extra_suppression_info)(Error* err) ); >- >-/* For throwing out basic block level info when code is invalidated */ >-NON_FUND( void SK_(discard_basic_block_info)(Addr a, UInt size) ); >- >-/* For throwing out basic block level info when code is invalidated */ >-NON_FUND( void SK_(written_shadow_regs_values)(UInt* gen_reg, UInt* eflags) ); >- >-/* Command line arg handling functions */ >-NON_FUND( Bool SK_(process_cmd_line_option)(Char* argv) ); >-NON_FUND( void SK_(print_usage)(void) ); >-NON_FUND( void SK_(print_debug_usage)(void) ); >- >-/* Client request template function */ >-NON_FUND( Bool SK_(handle_client_request)(ThreadId tid, UInt* arg_block, >- UInt *ret) ); >- >-/* UCode extension */ >-NON_FUND( void SK_(emit_XUInstr) (UInstr* u, RRegSet regs_live_before) ); >-NON_FUND( Bool SK_(sane_XUInstr) (Bool beforeRA, Bool beforeLiveness, >- UInstr* u) ); >-NON_FUND( Char* SK_(name_XUOpcode) (Opcode opc) ); >-NON_FUND( void SK_(pp_XUInstr) (UInstr* u) ); >-NON_FUND( Int SK_(get_Xreg_usage)(UInstr* u, Tag tag, Int* regs, >- Bool* isWrites) ); >- >-/* Syscall wrapping */ >-NON_FUND( void* SK_(pre_syscall) (ThreadId tid, UInt syscallno, >- Bool is_blocking) ); >-NON_FUND( void SK_(post_syscall)(ThreadId tid, UInt syscallno, >- void* pre_result, Int res, Bool is_blocking) ); >- >-/* Sanity checks */ >-NON_FUND( Bool SK_(cheap_sanity_check)(void) ); >-NON_FUND( Bool SK_(expensive_sanity_check)(void) ); >- > /*------------------------------------------------------------*/ > /*--- Replacing malloc et al ---*/ > /*------------------------------------------------------------*/ >@@ -188,15 +97,6 @@ > malloc_panic(__PRETTY_FUNCTION__); > } > >-MALLOC( void* SK_(__builtin_new) ( Int size ) ); >-MALLOC( void* SK_(__builtin_vec_new)( Int size ) ); >-MALLOC( void* SK_(memalign) ( Int align, Int size ) ); >-MALLOC( void* SK_(calloc) ( Int nmemb, Int size ) ); >- >-MALLOC( void SK_(__builtin_delete) ( void* p ) ); >-MALLOC( void SK_(__builtin_vec_delete) ( void* p ) ); >-MALLOC( void* SK_(realloc) ( void* p, Int new_size ) ); >- > /*--------------------------------------------------------------------*/ > /*--- end vg_defaults.c ---*/ > /*--------------------------------------------------------------------*/ >diff -ruN valgrind-2.1.0/coregrind/vg_demangle.c valgrind/coregrind/vg_demangle.c >--- valgrind-2.1.0/coregrind/vg_demangle.c 2003-04-15 09:57:40.000000000 -0500 >+++ valgrind/coregrind/vg_demangle.c 2004-01-04 10:43:19.000000000 -0600 >@@ -8,7 +8,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >diff -ruN valgrind-2.1.0/coregrind/vg_dispatch.S valgrind/coregrind/vg_dispatch.S >--- valgrind-2.1.0/coregrind/vg_dispatch.S 2003-04-15 09:57:40.000000000 -0500 >+++ valgrind/coregrind/vg_dispatch.S 2004-01-24 12:18:52.000000000 -0600 >@@ -8,7 +8,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -76,6 +76,16 @@ > pushl %edi > pushl %ebp > >+ /* check to see if we're doing pointer checking */ >+ movb VG_(clo_pointercheck), %al >+ testb %al,%al >+ jz 1f >+ >+ pushl %fs /* save %fs */ >+ mov $(VG_POINTERCHECK_SEGIDX << 3) + 7, %eax /* load new %fs */ >+ movw %ax,%fs >+ >+1: > /* Set up the baseBlock pointer */ > movl $VG_(baseBlock), %ebp > >@@ -99,8 +109,8 @@ > > If %ebp has any other value, we panic. > */ >- cmpl $VG_(baseBlock), %ebp >- jnz dispatch_exceptional >+ /*cmpl $VG_(baseBlock), %ebp*/ >+ /*jnz dispatch_exceptional*/ > /* fall into main loop */ > > >@@ -137,7 +147,14 @@ > jmp run_innerloop_exit > > run_innerloop_exit: >- popl %ebp >+ movb VG_(clo_pointercheck), %bl >+ testb %bl,%bl >+ jz 1f >+ >+ /* restore %fs */ >+ popl %fs >+ >+1: popl %ebp > popl %edi > popl %esi > popl %edx >@@ -152,32 +169,13 @@ > */ > dispatch_exceptional: > /* this is jumped to only, not fallen-through from above */ >- cmpl $VG_TRC_EBP_JMP_SYSCALL, %ebp >- jz dispatch_syscall >- cmpl $VG_TRC_EBP_JMP_CLIENTREQ, %ebp >- jz dispatch_clientreq > cmpl $VG_TRC_INNER_COUNTERZERO, %ebp > jz counter_is_zero >- >- /* ebp has an invalid value ... crap out. */ >- pushl $panic_msg_ebp >- call VG_(core_panic) >- /* (never returns) */ > >-dispatch_syscall: > /* save %eax in %EIP and defer to sched */ >- movl $VG_(baseBlock), %ebp > movl VGOFF_(m_eip), %esi >- movl %eax, (%ebp, %esi, 4) >- movl $VG_TRC_EBP_JMP_SYSCALL, %eax >- jmp run_innerloop_exit >- >-dispatch_clientreq: >- /* save %eax in %EIP and defer to sched */ >- movl $VG_(baseBlock), %ebp >- movl VGOFF_(m_eip), %esi >- movl %eax, (%ebp, %esi, 4) >- movl $VG_TRC_EBP_JMP_CLIENTREQ, %eax >+ movl %eax, VG_(baseBlock)(,%esi, 4) >+ movl %ebp, %eax > jmp run_innerloop_exit > > >diff -ruN valgrind-2.1.0/coregrind/vg_dummy_profile.c valgrind/coregrind/vg_dummy_profile.c >--- valgrind-2.1.0/coregrind/vg_dummy_profile.c 2003-11-14 11:47:52.000000000 -0600 >+++ valgrind/coregrind/vg_dummy_profile.c 2004-01-04 10:43:19.000000000 -0600 >@@ -9,7 +9,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >diff -ruN valgrind-2.1.0/coregrind/vg_dwarf.c valgrind/coregrind/vg_dwarf.c >--- valgrind-2.1.0/coregrind/vg_dwarf.c 2003-12-13 18:12:24.000000000 -0600 >+++ valgrind/coregrind/vg_dwarf.c 2004-01-04 10:43:19.000000000 -0600 >@@ -6,7 +6,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >diff -ruN valgrind-2.1.0/coregrind/vg_errcontext.c valgrind/coregrind/vg_errcontext.c >--- valgrind-2.1.0/coregrind/vg_errcontext.c 2003-11-14 11:47:52.000000000 -0600 >+++ valgrind/coregrind/vg_errcontext.c 2004-01-26 10:48:06.000000000 -0600 >@@ -7,7 +7,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -111,7 +111,7 @@ > } > } > >-/* Figure out if we want to attach for GDB for this error, possibly >+/* Figure out if we want to perform a given action for this error, possibly > by asking the user. */ > Bool VG_(is_action_requested) ( Char* action, Bool* clo ) > { >@@ -191,7 +191,7 @@ > vg_assert( tid < VG_N_THREADS ); > } > >-void VG_(gen_suppression)(Error* err) >+static void gen_suppression(Error* err) > { > Int i; > UChar buf[M_VG_ERRTXT]; >@@ -247,30 +247,19 @@ > } > > static >-void do_actions_on_error(Error* err, Bool allow_GDB_attach) >+void do_actions_on_error(Error* err, Bool allow_db_attach) > { >- /* Perhaps we want a GDB attach at this point? */ >- if (allow_GDB_attach && >- VG_(is_action_requested)( "Attach to GDB", & VG_(clo_GDB_attach) )) >+ /* Perhaps we want a debugger attach at this point? */ >+ if (allow_db_attach && >+ VG_(is_action_requested)( "Attach to debugger", & VG_(clo_db_attach) )) > { >- Addr m_eip, m_esp, m_ebp; >- >- if (VG_(is_running_thread)( err->tid )) { >- m_eip = VG_(baseBlock)[VGOFF_(m_eip)]; >- m_esp = VG_(baseBlock)[VGOFF_(m_esp)]; >- m_ebp = VG_(baseBlock)[VGOFF_(m_ebp)]; >- } else { >- ThreadState* tst = & VG_(threads)[ err->tid ]; >- m_eip = tst->m_eip; >- m_esp = tst->m_esp; >- m_ebp = tst->m_ebp; >- } >- VG_(swizzle_esp_then_start_GDB)( m_eip, m_esp, m_ebp ); >+ VG_(printf)("starting debugger\n"); >+ VG_(start_debugger)( err->tid ); > } > /* Or maybe we want to generate the error's suppression? */ > if (VG_(is_action_requested)( "Print suppression", > & VG_(clo_gen_suppressions) )) { >- VG_(gen_suppression)(err); >+ gen_suppression(err); > } > } > >@@ -423,7 +412,7 @@ > pp_Error(p, False); > is_first_shown_context = False; > vg_n_errs_shown++; >- do_actions_on_error(p, /*allow_GDB_attach*/True); >+ do_actions_on_error(p, /*allow_db_attach*/True); > } else { > vg_n_errs_suppressed++; > p->supp->count++; >@@ -431,7 +420,7 @@ > } > > /* Second top-level entry point to the error management subsystem, for >- errors that the skin want to report immediately, eg. because they're >+ errors that the tool wants to report immediately, eg. because they're > guaranteed to only happen once. This avoids all the recording and > comparing stuff. But they can be suppressed; returns True if it is > suppressed. Bool `print_error' dictates whether to print the error. >@@ -439,7 +428,7 @@ > */ > Bool VG_(unique_error) ( ThreadId tid, ErrorKind ekind, Addr a, Char* s, > void* extra, ExeContext* where, Bool print_error, >- Bool allow_GDB_attach, Bool count_error ) >+ Bool allow_db_attach, Bool count_error ) > { > Error err; > >@@ -464,7 +453,7 @@ > pp_Error(&err, False); > is_first_shown_context = False; > } >- do_actions_on_error(&err, allow_GDB_attach); >+ do_actions_on_error(&err, allow_db_attach); > > return False; > >@@ -638,9 +627,9 @@ > } > > >-/* Look for "skin" in a string like "skin1,skin2,skin3" */ >+/* Look for "tool" in a string like "tool1,tool2,tool3" */ > static __inline__ >-Bool skin_name_present(Char *name, Char *names) >+Bool tool_name_present(Char *name, Char *names) > { > Bool found; > Char *s = NULL; /* Shut gcc up */ >@@ -664,7 +653,7 @@ > Int fd, i; > Bool eof; > Char buf[N_BUF+1]; >- Char* skin_names; >+ Char* tool_names; > Char* supp_name; > > fd = VG_(open)( filename, VKI_O_RDONLY, 0 ); >@@ -675,7 +664,7 @@ > } > > while (True) { >- /* Assign and initialise the two suppression halves (core and skin) */ >+ /* Assign and initialise the two suppression halves (core and tool) */ > Supp* supp; > supp = VG_(arena_malloc)(VG_AR_CORE, sizeof(Supp)); > supp->count = 0; >@@ -704,11 +693,11 @@ > } > buf[i] = '\0'; /* Replace ':', splitting into two strings */ > >- skin_names = & buf[0]; >+ tool_names = & buf[0]; > supp_name = & buf[i+1]; > > /* Is it a core suppression? */ >- if (VG_(needs).core_errors && skin_name_present("core", skin_names)) >+ if (VG_(needs).core_errors && tool_name_present("core", tool_names)) > { > if (VG_STREQ(supp_name, "PThread")) > supp->skind = PThreadSupp; >@@ -716,9 +705,9 @@ > goto syntax_error; > } > >- /* Is it a skin suppression? */ >+ /* Is it a tool suppression? */ > else if (VG_(needs).skin_errors && >- skin_name_present(VG_(details).name, skin_names)) >+ tool_name_present(VG_(details).name, tool_names)) > { > if (SK_(recognised_suppression)(supp_name, supp)) > { >diff -ruN valgrind-2.1.0/coregrind/vg_execontext.c valgrind/coregrind/vg_execontext.c >--- valgrind-2.1.0/coregrind/vg_execontext.c 2003-09-16 02:41:42.000000000 -0500 >+++ valgrind/coregrind/vg_execontext.c 2004-01-20 19:27:26.000000000 -0600 >@@ -8,7 +8,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -319,6 +319,21 @@ > *esp = tst->m_esp; > *stack_highest_word = tst->stack_highest_word; > } >+ >+ /* Nasty little hack to deal with sysinfo syscalls - if libc is >+ using the sysinfo page for syscalls (the TLS version does), then >+ eip will always appear to be in that page when doing a syscall, >+ not the actual libc function doing the syscall. This check sees >+ if EIP is within the syscall code, and pops the return address >+ off the stack so that eip is placed within the library function >+ calling the syscall. This makes stack backtraces much more >+ useful. */ >+ if (*eip >= VG_(client_trampoline_code)+VG_(tramp_syscall_offset) && >+ *eip < VG_(client_trampoline_code)+VG_(trampoline_code_length) && >+ VG_(is_addressable)(*esp, sizeof(Addr))) { >+ *eip = *(Addr *)*esp; >+ *esp += sizeof(Addr); >+ } > } > > ExeContext* VG_(get_ExeContext) ( ThreadId tid ) >diff -ruN valgrind-2.1.0/coregrind/vg_from_ucode.c valgrind/coregrind/vg_from_ucode.c >--- valgrind-2.1.0/coregrind/vg_from_ucode.c 2003-10-19 03:18:51.000000000 -0500 >+++ valgrind/coregrind/vg_from_ucode.c 2004-02-11 17:33:27.000000000 -0600 >@@ -8,7 +8,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -80,6 +80,29 @@ > UPD_Both, /* both are current */ > } eflags_state; > >+/* ia32 static prediction is very simple. Other implementations are >+ more complex, so we get the condition anyway. */ >+static JumpPred static_pred(Condcode cond, Int forward) >+{ >+ if (cond == CondAlways) >+ return JP_TAKEN; >+ >+ return forward ? JP_NOT_TAKEN : JP_TAKEN; >+} >+ >+static const Char *predstr(JumpPred p) >+{ >+ if (!VG_(clo_branchpred)) >+ return ""; >+ >+ switch(p) { >+ default: >+ case JP_NONE: return ""; >+ case JP_TAKEN: return ",pt"; >+ case JP_NOT_TAKEN: return ",pn"; >+ } >+} >+ > /* single site for resetting state */ > static void reset_state(void) > { >@@ -215,6 +238,19 @@ > VG_(emitB) ( (l >> 24) & 0x000000FF ); > } > >+/* This bit is ORd onto the size to indicate that it's a client >+ pointer which needs bounds checking. */ >+#define DO_BOUNDSCHECK (1<<8) >+ >+/* If the user asks for it, generate bounds checks on application >+ pointer dereferences, in the form of a segment override. */ >+static __inline__ void boundscheck() >+{ >+ if (VG_(clo_pointercheck)) >+ VG_(emitB)(0x64); /* %fs prefix - see vg_dispatch.S */ >+} >+ >+ > static void emit_get_eflags ( void ) > { > Int off = 4 * VGOFF_(m_eflags); >@@ -771,6 +807,12 @@ > void VG_(emit_movv_reg_offregmem) ( Int sz, Int reg, Int off, Int areg ) > { > VG_(new_emit)(False, FlagsEmpty, FlagsEmpty); >+ >+ if (sz & DO_BOUNDSCHECK) { >+ boundscheck(); >+ sz &= ~DO_BOUNDSCHECK; >+ } >+ > if (sz == 2) VG_(emitB) ( 0x66 ); > VG_(emitB) ( 0x89 ); /* MOV Gv, Ev */ > VG_(emit_amode_offregmem_reg) ( off, areg, reg ); >@@ -782,6 +824,12 @@ > static void emit_movv_regmem_reg ( Int sz, Int reg1, Int reg2 ) > { > VG_(new_emit)(False, FlagsEmpty, FlagsEmpty); >+ >+ if (sz & DO_BOUNDSCHECK) { >+ boundscheck(); >+ sz &= ~DO_BOUNDSCHECK; >+ } >+ > if (sz == 2) VG_(emitB) ( 0x66 ); > VG_(emitB) ( 0x8B ); /* MOV Ev, Gv */ > emit_amode_regmem_reg ( reg1, reg2 ); >@@ -793,6 +841,12 @@ > static void emit_movv_reg_regmem ( Int sz, Int reg1, Int reg2 ) > { > VG_(new_emit)(False, FlagsEmpty, FlagsEmpty); >+ >+ if (sz & DO_BOUNDSCHECK) { >+ boundscheck(); >+ sz &= ~DO_BOUNDSCHECK; >+ } >+ > if (sz == 2) VG_(emitB) ( 0x66 ); > VG_(emitB) ( 0x89 ); /* MOV Gv, Ev */ > emit_amode_regmem_reg ( reg2, reg1 ); >@@ -1205,9 +1259,13 @@ > nameIReg(1,reg1), nameIReg(1,reg2)); > } > >-static void emit_movb_reg_regmem ( Int reg1, Int reg2 ) >+static void emit_movb_reg_regmem ( Bool bounds, Int reg1, Int reg2 ) > { > VG_(new_emit)(False, FlagsEmpty, FlagsEmpty); >+ >+ if (bounds) >+ boundscheck(); >+ > VG_(emitB) ( 0x88 ); /* MOV G1, E1 */ > emit_amode_regmem_reg ( reg2, reg1 ); > if (dis) >@@ -1290,9 +1348,11 @@ > /*--- zero-extended load emitters ---*/ > /*----------------------------------------------------*/ > >-void VG_(emit_movzbl_offregmem_reg) ( Int off, Int regmem, Int reg ) >+void VG_(emit_movzbl_offregmem_reg) ( Bool bounds, Int off, Int regmem, Int reg ) > { > VG_(new_emit)(False, FlagsEmpty, FlagsEmpty); >+ if (bounds) >+ boundscheck(); > VG_(emitB) ( 0x0F ); VG_(emitB) ( 0xB6 ); /* MOVZBL */ > VG_(emit_amode_offregmem_reg) ( off, regmem, reg ); > if (dis) >@@ -1300,9 +1360,13 @@ > off, nameIReg(4,regmem), nameIReg(4,reg)); > } > >-static void emit_movzbl_regmem_reg ( Int reg1, Int reg2 ) >+static void emit_movzbl_regmem_reg ( Bool bounds, Int reg1, Int reg2 ) > { > VG_(new_emit)(False, FlagsEmpty, FlagsEmpty); >+ >+ if (bounds) >+ boundscheck(); >+ > VG_(emitB) ( 0x0F ); VG_(emitB) ( 0xB6 ); /* MOVZBL */ > emit_amode_regmem_reg ( reg1, reg2 ); > if (dis) >@@ -1310,9 +1374,13 @@ > nameIReg(4,reg2)); > } > >-void VG_(emit_movzwl_offregmem_reg) ( Int off, Int areg, Int reg ) >+void VG_(emit_movzwl_offregmem_reg) ( Bool bounds, Int off, Int areg, Int reg ) > { > VG_(new_emit)(False, FlagsEmpty, FlagsEmpty); >+ >+ if (bounds) >+ boundscheck(); >+ > VG_(emitB) ( 0x0F ); VG_(emitB) ( 0xB7 ); /* MOVZWL */ > VG_(emit_amode_offregmem_reg) ( off, areg, reg ); > if (dis) >@@ -1320,9 +1388,13 @@ > off, nameIReg(4,areg), nameIReg(4,reg)); > } > >-void VG_( emit_movzwl_regmem_reg ) ( Int reg1, Int reg2 ) >+void VG_( emit_movzwl_regmem_reg ) ( Bool bounds, Int reg1, Int reg2 ) > { > VG_(new_emit)(False, FlagsEmpty, FlagsEmpty); >+ >+ if (bounds) >+ boundscheck(); >+ > VG_(emitB) ( 0x0F ); VG_(emitB) ( 0xB7 ); /* MOVZWL */ > emit_amode_regmem_reg ( reg1, reg2 ); > if (dis) >@@ -1394,6 +1466,9 @@ > Int reg ) > { > VG_(new_emit)(True, uses_sflags, sets_sflags); >+ >+ boundscheck(); /* assume all FPU ops are the client's */ >+ > VG_(emitB) ( first_byte ); > emit_amode_regmem_reg ( reg, second_byte_masked >> 3 ); > if (dis) >@@ -1409,6 +1484,9 @@ > Int ireg ) > { > VG_(new_emit)(True, uses_sflags, sets_sflags); >+ >+ boundscheck(); >+ > VG_(emitB) ( 0x0F ); > VG_(emitB) ( first_byte ); > second_byte &= 0x38; /* mask out mod and rm fields */ >@@ -1427,6 +1505,9 @@ > Int ireg ) > { > VG_(new_emit)(True, uses_sflags, sets_sflags); >+ >+ boundscheck(); >+ > VG_(emitB) ( first_byte ); > VG_(emitB) ( second_byte ); > third_byte &= 0x38; /* mask out mod and rm fields */ >@@ -1437,6 +1518,78 @@ > nameIReg(4,ireg) ); > } > >+static void emit_SSE2e1 ( FlagSet uses_sflags, >+ FlagSet sets_sflags, >+ UChar first_byte, >+ UChar second_byte, >+ UChar third_byte, >+ UChar fourth_byte, >+ Int ireg ) >+{ >+ VG_(new_emit)(True, uses_sflags, sets_sflags); >+ VG_(emitB) ( first_byte ); >+ VG_(emitB) ( second_byte ); >+ third_byte &= 0x38; /* mask out mod and rm fields */ >+ third_byte |= 0xC0; /* set top two bits: mod = 11b */ >+ third_byte |= (ireg & 7); /* patch in our ireg */ >+ VG_(emitB) ( third_byte ); >+ VG_(emitB) ( fourth_byte ); >+ if (dis) >+ VG_(printf)( >+ "\n\t\tsse2e1--0x%x:0x%x:0x%x:0x%x-(%s)\n", >+ (UInt)first_byte, (UInt)second_byte, >+ (UInt)third_byte, (UInt)fourth_byte, >+ nameIReg(4,ireg) >+ ); >+} >+ >+static void emit_SSE2g1 ( FlagSet uses_sflags, >+ FlagSet sets_sflags, >+ UChar first_byte, >+ UChar second_byte, >+ UChar third_byte, >+ UChar fourth_byte, >+ Int ireg ) >+{ >+ VG_(new_emit)(True, uses_sflags, sets_sflags); >+ VG_(emitB) ( first_byte ); >+ VG_(emitB) ( second_byte ); >+ third_byte &= 0xC7; /* mask out reg field */ >+ third_byte |= 0xC0; /* set top two bits: mod = 11b */ >+ third_byte |= ((ireg & 7) << 3); /* patch in our ireg */ >+ VG_(emitB) ( third_byte ); >+ VG_(emitB) ( fourth_byte ); >+ if (dis) >+ VG_(printf)( >+ "\n\t\tsse2g1_reg_wr--0x%x:0x%x:0x%x:0x%x-(%s)\n", >+ (UInt)first_byte, (UInt)second_byte, >+ (UInt)third_byte, (UInt)fourth_byte, >+ nameIReg(4,ireg) >+ ); >+} >+ >+static void emit_SSE2g ( FlagSet uses_sflags, >+ FlagSet sets_sflags, >+ UChar first_byte, >+ UChar second_byte, >+ UChar third_byte, >+ Int ireg ) >+{ >+ VG_(new_emit)(True, uses_sflags, sets_sflags); >+ VG_(emitB) ( first_byte ); >+ VG_(emitB) ( second_byte ); >+ third_byte &= 0xC7; /* mask out reg field */ >+ third_byte |= 0xC0; /* set top two bits: mod = 11b */ >+ third_byte |= ((ireg & 7) << 3); /* patch in our ireg */ >+ VG_(emitB) ( third_byte ); >+ if (dis) >+ VG_(printf)( >+ "\n\t\tsse2g--0x%x:0x%x:0x%x-(%s)\n", >+ (UInt)first_byte, (UInt)second_byte, (UInt)third_byte, >+ nameIReg(4,ireg) >+ ); >+} >+ > static void emit_SSE2a1 ( FlagSet uses_sflags, > FlagSet sets_sflags, > UChar first_byte, >@@ -1446,6 +1599,9 @@ > Int ireg ) > { > VG_(new_emit)(True, uses_sflags, sets_sflags); >+ >+ boundscheck(); >+ > VG_(emitB) ( first_byte ); > VG_(emitB) ( second_byte ); > third_byte &= 0x38; /* mask out mod and rm fields */ >@@ -1467,6 +1623,9 @@ > Int ireg ) > { > VG_(new_emit)(True, uses_sflags, sets_sflags); >+ >+ boundscheck(); >+ > VG_(emitB) ( first_byte ); > VG_(emitB) ( second_byte ); > VG_(emitB) ( third_byte ); >@@ -1593,6 +1752,9 @@ > Int ireg ) > { > VG_(new_emit)(True, uses_sflags, sets_sflags); >+ >+ boundscheck(); >+ > VG_(emitB) ( first_byte ); > VG_(emitB) ( second_byte ); > VG_(emitB) ( third_byte ); >@@ -1870,8 +2032,9 @@ > > static inline Int mk_tgt(Int state, Int addr) > { >- vg_assert(state == TGT_UNDEF >- || state == TGT_FORWARD || state == TGT_BACKWARD); >+ vg_assert(state == TGT_UNDEF || >+ state == TGT_FORWARD || >+ state == TGT_BACKWARD); > vg_assert((addr & 0xffff0000) == 0); > > return state | addr; >@@ -1930,26 +2093,38 @@ > /* Emit a jump short with an 8-bit signed offset. Note that the > offset is that which should be added to %eip once %eip has been > advanced over this insn. */ >-void VG_(emit_jcondshort_delta) ( Bool simd_flags, Condcode cond, Int delta ) >+void VG_(emit_jcondshort_delta) ( Bool simd_flags, Condcode cond, Int delta, JumpPred pred ) > { > vg_assert(delta >= -128 && delta <= 127); > VG_(new_emit)(simd_flags, FlagsOSZCP, FlagsEmpty); >+ >+ if (VG_(clo_branchpred) && >+ pred != JP_NONE && >+ pred != static_pred(cond, delta > 0)) >+ VG_(emitB)(pred == JP_TAKEN ? 0x3e : 0x2e); >+ > VG_(emitB) ( 0x70 + (UInt)cond ); > VG_(emitB) ( (UChar)delta ); > if (dis) >- VG_(printf)( "\n\t\tj%s-8\t%%eip+%d\n", >- VG_(name_UCondcode)(cond), delta ); >+ VG_(printf)( "\n\t\tj%s-8%s\t%%eip+%d\n", >+ VG_(name_UCondcode)(cond), predstr(pred), delta ); > } > > /* Same as above, but defers emitting the delta */ >-void VG_(emit_jcondshort_target) ( Bool simd, Condcode cond, Int *tgt ) >+void VG_(emit_jcondshort_target) ( Bool simd, Condcode cond, Int *tgt, JumpPred pred ) > { > VG_(new_emit)(simd, FlagsOSZCP, FlagsEmpty); >+ >+ if (VG_(clo_branchpred) && >+ pred != JP_NONE && >+ pred != static_pred(cond, tgt_state(*tgt) != TGT_BACKWARD)) >+ VG_(emitB)(pred == JP_TAKEN ? 0x3e : 0x2e); >+ > VG_(emitB) ( 0x70 + (UInt)cond ); > VG_(emit_target_delta) (tgt); > if (dis) >- VG_(printf)( "\n\t\tj%s-8\t%%eip+(%d)\n", >- VG_(name_UCondcode)(cond), tgt_addr(*tgt) ); >+ VG_(printf)( "\n\t\tj%s-8%s\t%%eip+(%d)\n", >+ VG_(name_UCondcode)(cond), predstr(pred), tgt_addr(*tgt) ); > } > > >@@ -2067,13 +2242,13 @@ > dispatch loop. We still need to keep it the same size as the > call sequence. */ > VG_(emitB) ( 0xC3 ); /* ret */ >- VG_(emitB) ( 0x90 ); /* nop */ >- VG_(emitB) ( 0x90 ); /* nop */ >- VG_(emitB) ( 0x90 ); /* nop */ >- VG_(emitB) ( 0x90 ); /* nop */ >+ VG_(emitB) ( 0x8d ); /* 4 byte nop (lea 0x0(%esi,1),%esi) */ >+ VG_(emitB) ( 0x74 ); >+ VG_(emitB) ( 0x26 ); >+ VG_(emitB) ( 0x00 ); > > if (dis) >- VG_(printf)("\n\t\tret; nop; nop; nop; nop\n"); >+ VG_(printf)("\n\t\tret; nop4\n"); > > if (0 && VG_(clo_verbosity)) > VG_(message)(Vg_DebugMsg, "too many chained jumps in basic-block"); >@@ -2087,7 +2262,7 @@ > VG_(emitB) ( 0x90 ); /* NOP */ > > if (dis) >- VG_(printf)("\n\t\tud2; ud2; nop\n"); >+ VG_(printf)("\n\t\tud2; ud2; nop /* call VG_(patchme) */\n"); > } > } > >@@ -2449,6 +2624,9 @@ > case JmpClientReq: > VG_(emit_movv_lit_reg) ( 4, VG_TRC_EBP_JMP_CLIENTREQ, R_EBP ); > break; >+ case JmpYield: >+ VG_(emit_movv_lit_reg) ( 4, VG_TRC_EBP_JMP_YIELD, R_EBP ); >+ break; > default: > VG_(core_panic)("load_ebp_from_JmpKind"); > } >@@ -2547,12 +2725,12 @@ > > if (cond == CondLE) { > /* test Z */ >- VG_(emit_jcondshort_target)(False, CondS, &tgt_jump); >+ VG_(emit_jcondshort_target)(False, CondS, &tgt_jump, JP_NONE); > /* test OF != SF */ > cond = CondP; > } else { > /* test Z */ >- VG_(emit_jcondshort_target)(False, CondS, &tgt2); >+ VG_(emit_jcondshort_target)(False, CondS, &tgt2, JP_NONE); > /* test OF == SF */ > cond = CondNP; > } >@@ -2634,7 +2812,7 @@ > } > } > >- VG_(emit_jcondshort_target) ( simd, cond, &tgt ); >+ VG_(emit_jcondshort_target) ( simd, cond, &tgt, JP_NONE ); > > VG_(target_forward)(&tgt_jump); > synth_jmp_lit ( addr, JmpBoring ); >@@ -2653,7 +2831,7 @@ > > VG_(emit_cmpl_zero_reg) ( False, reg ); > >- VG_(emit_jcondshort_target) ( False, CondNZ, &tgt ); >+ VG_(emit_jcondshort_target) ( False, CondNZ, &tgt, JP_NONE ); > synth_jmp_lit ( addr, JmpBoring ); > > VG_(target_forward)(&tgt); >@@ -2670,10 +2848,10 @@ > > static void synth_mov_regmem_reg ( Int size, Int reg1, Int reg2 ) > { >- switch (size) { >- case 4: emit_movv_regmem_reg ( 4, reg1, reg2 ); break; >- case 2: VG_(emit_movzwl_regmem_reg) ( reg1, reg2 ); break; >- case 1: emit_movzbl_regmem_reg ( reg1, reg2 ); break; >+ switch (size & ~DO_BOUNDSCHECK) { >+ case 4: emit_movv_regmem_reg ( size, reg1, reg2 ); break; >+ case 2: VG_(emit_movzwl_regmem_reg) ( size & DO_BOUNDSCHECK, reg1, reg2 ); break; >+ case 1: emit_movzbl_regmem_reg ( size & DO_BOUNDSCHECK, reg1, reg2 ); break; > default: VG_(core_panic)("synth_mov_regmem_reg"); > } > } >@@ -2681,10 +2859,10 @@ > > static void synth_mov_offregmem_reg ( Int size, Int off, Int areg, Int reg ) > { >- switch (size) { >+ switch (size & ~DO_BOUNDSCHECK) { > case 4: VG_(emit_movv_offregmem_reg) ( 4, off, areg, reg ); break; >- case 2: VG_(emit_movzwl_offregmem_reg) ( off, areg, reg ); break; >- case 1: VG_(emit_movzbl_offregmem_reg) ( off, areg, reg ); break; >+ case 2: VG_(emit_movzwl_offregmem_reg) ( size & DO_BOUNDSCHECK, off, areg, reg ); break; >+ case 1: VG_(emit_movzbl_offregmem_reg) ( size & DO_BOUNDSCHECK, off, areg, reg ); break; > default: VG_(core_panic)("synth_mov_offregmem_reg"); > } > } >@@ -2713,17 +2891,17 @@ > static void synth_mov_reg_memreg ( Int size, Int reg1, Int reg2 ) > { > Int s1; >- switch (size) { >- case 4: emit_movv_reg_regmem ( 4, reg1, reg2 ); break; >- case 2: emit_movv_reg_regmem ( 2, reg1, reg2 ); break; >+ switch (size & ~DO_BOUNDSCHECK) { >+ case 4: >+ case 2: emit_movv_reg_regmem ( size, reg1, reg2 ); break; > case 1: if (reg1 < 4) { >- emit_movb_reg_regmem ( reg1, reg2 ); >+ emit_movb_reg_regmem ( size & DO_BOUNDSCHECK, reg1, reg2 ); > } > else { > /* Choose a swap reg which is < 4 and not reg1 or reg2. */ > for (s1 = 0; s1 == reg1 || s1 == reg2; s1++) ; > emit_swapl_reg_reg ( s1, reg1 ); >- emit_movb_reg_regmem ( s1, reg2 ); >+ emit_movb_reg_regmem ( size & DO_BOUNDSCHECK, s1, reg2 ); > emit_swapl_reg_reg ( s1, reg1 ); > } > break; >@@ -3167,7 +3345,7 @@ > > VG_(init_target)(&tgt); > >- VG_(emit_jcondshort_target) ( True, invertCondition(cond), &tgt); >+ VG_(emit_jcondshort_target) ( True, invertCondition(cond), &tgt, JP_NONE); > emit_movl_reg_reg ( src, dst ); > > VG_(target_forward)(&tgt); >@@ -3473,14 +3651,14 @@ > case STORE: { > vg_assert(u->tag1 == RealReg); > vg_assert(u->tag2 == RealReg); >- synth_mov_reg_memreg ( u->size, u->val1, u->val2 ); >+ synth_mov_reg_memreg ( u->size | DO_BOUNDSCHECK, u->val1, u->val2 ); > break; > } > > case LOAD: { > vg_assert(u->tag1 == RealReg); > vg_assert(u->tag2 == RealReg); >- synth_mov_regmem_reg ( u->size, u->val1, u->val2 ); >+ synth_mov_regmem_reg ( u->size | DO_BOUNDSCHECK, u->val1, u->val2 ); > break; > } > >@@ -3969,7 +4147,8 @@ > > case SSE2a_MemWr: > case SSE2a_MemRd: >- vg_assert(u->size == 4 || u->size == 16); >+ vg_assert(u->size == 4 || u->size == 8 >+ || u->size == 16 || u->size == 512); > vg_assert(u->tag1 == Lit16); > vg_assert(u->tag2 == Lit16); > vg_assert(u->tag3 == RealReg); >@@ -3984,8 +4163,61 @@ > u->val3 ); > break; > >+ case SSE2g_RegWr: >+ vg_assert(u->size == 4); >+ vg_assert(u->tag1 == Lit16); >+ vg_assert(u->tag2 == Lit16); >+ vg_assert(u->tag3 == RealReg); >+ vg_assert(!anyFlagUse(u)); >+ if (!(*sselive)) { >+ emit_get_sse_state(); >+ *sselive = True; >+ } >+ emit_SSE2g ( u->flags_r, u->flags_w, >+ (u->val1 >> 8) & 0xFF, >+ u->val1 & 0xFF, >+ u->val2 & 0xFF, >+ u->val3 ); >+ break; >+ >+ case SSE2g1_RegWr: >+ vg_assert(u->size == 4); >+ vg_assert(u->tag1 == Lit16); >+ vg_assert(u->tag2 == Lit16); >+ vg_assert(u->tag3 == RealReg); >+ vg_assert(!anyFlagUse(u)); >+ if (!(*sselive)) { >+ emit_get_sse_state(); >+ *sselive = True; >+ } >+ emit_SSE2g1 ( u->flags_r, u->flags_w, >+ (u->val1 >> 8) & 0xFF, >+ u->val1 & 0xFF, >+ u->val2 & 0xFF, >+ u->lit32 & 0xFF, >+ u->val3 ); >+ break; >+ >+ case SSE2e1_RegRd: >+ vg_assert(u->size == 2); >+ vg_assert(u->tag1 == Lit16); >+ vg_assert(u->tag2 == Lit16); >+ vg_assert(u->tag3 == RealReg); >+ vg_assert(!anyFlagUse(u)); >+ if (!(*sselive)) { >+ emit_get_sse_state(); >+ *sselive = True; >+ } >+ emit_SSE2e1 ( u->flags_r, u->flags_w, >+ (u->val1 >> 8) & 0xFF, >+ u->val1 & 0xFF, >+ u->val2 & 0xFF, >+ u->lit32 & 0xFF, >+ u->val3 ); >+ break; >+ > case SSE2a1_MemRd: >- vg_assert(u->size == 4 || u->size == 16); >+ vg_assert(u->size == 4 || u->size == 8 || u->size == 16); > vg_assert(u->tag1 == Lit16); > vg_assert(u->tag2 == Lit16); > vg_assert(u->tag3 == RealReg); >@@ -4088,7 +4320,7 @@ > break; > > case SSE3a1_MemRd: >- vg_assert(u->size == 16); >+ vg_assert(u->size == 8 || u->size == 16); > vg_assert(u->tag1 == Lit16); > vg_assert(u->tag2 == Lit16); > vg_assert(u->tag3 == RealReg); >@@ -4102,7 +4334,7 @@ > u->val1 & 0xFF, > (u->val2 >> 8) & 0xFF, > u->val2 & 0xFF, >- (u->lit32 >> 8) & 0xFF, >+ u->lit32 & 0xFF, > u->val3 ); > break; > >@@ -4219,16 +4451,19 @@ > > if (dis) VG_(printf)("Generated x86 code:\n"); > >- /* Generate decl VG_(dispatch_ctr) and drop into dispatch if we hit >+ /* Generate subl $1, VG_(dispatch_ctr) and drop into dispatch if we hit > zero. We have to do this regardless of whether we're t-chaining >- or not. */ >+ or not. (The ia32 optimisation guide recommends sub over dec.) */ > VG_(init_target)(&tgt); > VG_(new_emit)(False, FlagsEmpty, FlagsOSZAP); >- VG_(emitB) (0xFF); /* decl */ >- emit_amode_litmem_reg((Addr)&VG_(dispatch_ctr), 1); >+ VG_(emitB) (0x83); /* subl */ >+ emit_amode_litmem_reg((Addr)&VG_(dispatch_ctr), 5); >+ VG_(emitB) (0x01); >+ > if (dis) >- VG_(printf)("\n\t\tdecl (%p)\n", &VG_(dispatch_ctr)); >- VG_(emit_jcondshort_target)(False, CondNZ, &tgt); >+ VG_(printf)("\n\t\tsubl $1, (%p)\n", &VG_(dispatch_ctr)); >+ >+ VG_(emit_jcondshort_target)(False, CondNZ, &tgt, JP_TAKEN); > VG_(emit_movv_lit_reg) ( 4, VG_TRC_INNER_COUNTERZERO, R_EBP ); > emit_ret(); > VG_(target_forward)(&tgt); >diff -ruN valgrind-2.1.0/coregrind/vg_hashtable.c valgrind/coregrind/vg_hashtable.c >--- valgrind-2.1.0/coregrind/vg_hashtable.c 2003-09-30 10:35:12.000000000 -0500 >+++ valgrind/coregrind/vg_hashtable.c 2004-01-04 10:43:19.000000000 -0600 >@@ -7,7 +7,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >diff -ruN valgrind-2.1.0/coregrind/vg_helpers.S valgrind/coregrind/vg_helpers.S >--- valgrind-2.1.0/coregrind/vg_helpers.S 2003-09-27 15:15:00.000000000 -0500 >+++ valgrind/coregrind/vg_helpers.S 2004-02-11 17:33:27.000000000 -0600 >@@ -1,4 +1,3 @@ >- > ##--------------------------------------------------------------------## > ##--- Support routines for the JITter output. ---## > ##--- vg_helpers.S ---## >@@ -8,7 +7,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -38,9 +37,18 @@ > to the request. In both cases we use the user request mechanism. > You need to to read the definition of VALGRIND_MAGIC_SEQUENCE > in valgrind.h to make sense of this. >-*/ >-.global VG_(signalreturn_bogusRA) >-VG_(signalreturn_bogusRA): >+ >+ This isn't used in-place. It is copied into the client address space >+ at an arbitary address. Therefore, this code must be completely >+ position-independent. >+*/ >+.global VG_(trampoline_code_start) >+.global VG_(trampoline_code_length) >+.global VG_(tramp_sigreturn_offset) >+.global VG_(tramp_syscall_offset) >+ >+VG_(trampoline_code_start): >+sigreturn_start: > subl $20, %esp # allocate arg block > movl %esp, %edx # %edx == &_zzq_args[0] > movl $VG_USERREQ__SIGNAL_RETURNS, 0(%edx) # request >@@ -57,16 +65,23 @@ > roll $13, %eax > roll $19, %eax > # should never get here >- pushl $signalreturn_bogusRA_panic_msg >- call VG_(core_panic) >- >-.data >-signalreturn_bogusRA_panic_msg: >-.ascii "vg_signalreturn_bogusRA: VG_USERREQ__SIGNAL_RETURNS was missed" >-.byte 0 >-.text >- >+ ud2 > >+ # We can point our sysinfo stuff here >+ .align 16 >+syscall_start: >+ int $0x80 >+ ret >+tramp_code_end: >+ >+.data >+VG_(trampoline_code_length): >+ .long tramp_code_end - VG_(trampoline_code_start) >+VG_(tramp_sigreturn_offset): >+ .long sigreturn_start - VG_(trampoline_code_start) >+VG_(tramp_syscall_offset): >+ .long syscall_start - VG_(trampoline_code_start) >+.text > > > /* ------------------ REAL CPU HELPERS ------------------ */ >@@ -79,6 +94,7 @@ > * integer multiplication > * setting and getting obscure eflags > * double-length shifts >+ * eight byte compare and exchange > > All routines use a standard calling convention designed for > calling from translations, in which the incoming args are >@@ -174,53 +190,44 @@ > dummy, replaced by %EDX value > RA <- %esp > >- For simulating the cpuid instruction, we will >- issue a "real" cpuid instruction and then mask out >- the bits of the features we do not support currently (3dnow mostly). >- >- Dirk Mueller <mueller@kde.org> >- >- http://www.sandpile.org/ia32/cpuid.htm >- >- references: >- >- pre-MMX pentium: >- >- <werner> cpuid words (0): 0x1 0x756e6547 0x6c65746e 0x49656e69 >- <werner> cpuid words (1): 0x52b 0x0 0x0 0x1bf >+ We save registers and package up the args so we can call a C helper >+ for all this. > */ > .global VG_(helper_CPUID) > VG_(helper_CPUID): >+ pushl %ebp >+ movl %esp,%ebp > pushl %eax > pushl %ebx > pushl %ecx > pushl %edx >- movl 32(%esp), %eax >- >- cmpl $0x80000001, %eax >- je cpuid_no3dnow >- >- cpuid >- jmp cpuid__99 >- >-cpuid_no3dnow: >- cpuid >+ pushl %esi >+ pushl %edi >+ pushf > >- andl $0x3fffffff, %edx >+ lea 2*4(%ebp),%eax /* &edx */ >+ pushl %eax >+ addl $4,%eax /* &ecx */ >+ pushl %eax >+ addl $4,%eax /* &ebx */ >+ pushl %eax >+ addl $4,%eax /* &eax */ >+ pushl %eax >+ pushl (%eax) /* eax */ > >-cpuid__99: >- movl %edx, 20(%esp) >- movl %ecx, 24(%esp) >- movl %ebx, 28(%esp) >- movl %eax, 32(%esp) >+ call VG_(helperc_CPUID) >+ addl $20,%esp > >+ popf >+ popl %edi >+ popl %esi > popl %edx > popl %ecx > popl %ebx > popl %eax >+ popl %ebp > ret > >- > /* Fetch the FPU status register. > On entry: > dummy, replaced by result >@@ -308,13 +315,66 @@ > ret > > >+/* Similarly, do %ax = AAS(%ax). */ >+.global VG_(helper_AAS) >+VG_(helper_AAS): >+ pushl %eax >+ movl 8(%esp), %eax >+ aas >+ movl %eax, 8(%esp) >+ popl %eax >+ ret >+ >+ >+/* Similarly, do %ax = AAA(%ax). */ >+.global VG_(helper_AAA) >+VG_(helper_AAA): >+ pushl %eax >+ movl 8(%esp), %eax >+ aaa >+ movl %eax, 8(%esp) >+ popl %eax >+ ret >+ >+ >+/* Similarly, do %ax = AAD(%ax). */ >+.global VG_(helper_AAD) >+VG_(helper_AAD): >+ pushl %eax >+ movl 8(%esp), %eax >+ aad >+ movl %eax, 8(%esp) >+ popl %eax >+ ret >+ >+ >+/* Similarly, do %ax = AAM(%ax). */ >+.global VG_(helper_AAM) >+VG_(helper_AAM): >+ pushl %eax >+ movl 8(%esp), %eax >+ aam >+ movl %eax, 8(%esp) >+ popl %eax >+ ret >+ >+ > /* Bit scan forwards/reverse. Sets flags (??). > On entry: > value, replaced by result > RA <- %esp > */ >-.global VG_(helper_bsr) >-VG_(helper_bsr): >+.global VG_(helper_bsrw) >+VG_(helper_bsrw): >+ pushl %eax >+ movw 12(%esp), %ax >+ bsrw 8(%esp), %ax >+ movw %ax, 12(%esp) >+ popl %eax >+ ret >+ >+.global VG_(helper_bsrl) >+VG_(helper_bsrl): > pushl %eax > movl 12(%esp), %eax > bsrl 8(%esp), %eax >@@ -322,8 +382,17 @@ > popl %eax > ret > >-.global VG_(helper_bsf) >-VG_(helper_bsf): >+.global VG_(helper_bsfw) >+VG_(helper_bsfw): >+ pushl %eax >+ movw 12(%esp), %ax >+ bsfw 8(%esp), %ax >+ movw %ax, 12(%esp) >+ popl %eax >+ ret >+ >+.global VG_(helper_bsfl) >+VG_(helper_bsfl): > pushl %eax > movl 12(%esp), %eax > bsfl 8(%esp), %eax >@@ -441,7 +510,7 @@ > popl %eax > ret > >-/* Clear/set the carry flag. */ >+/* Clear/set/complement the carry flag. */ > .global VG_(helper_CLC) > VG_(helper_CLC): > clc >@@ -452,6 +521,11 @@ > stc > ret > >+.global VG_(helper_CMC) >+VG_(helper_CMC): >+ cmc >+ ret >+ > /* Signed 32-to-64 multiply. */ > .globl VG_(helper_imul_32_64) > VG_(helper_imul_32_64): >@@ -615,6 +689,29 @@ > ret > > >+/* Eight byte compare and exchange. */ >+.globl VG_(helper_cmpxchg8b) >+VG_(helper_cmpxchg8b): >+ pushl %eax >+ pushl %ebx >+ pushl %ecx >+ pushl %edx >+ movl 20(%esp), %eax >+ movl 24(%esp), %edx >+ movl 28(%esp), %ebx >+ movl 32(%esp), %ecx >+ cmpxchg8b 36(%esp) >+ movl %eax, 20(%esp) >+ movl %edx, 24(%esp) >+ movl %ebx, 28(%esp) >+ movl %ecx, 32(%esp) >+ popl %edx >+ popl %ecx >+ popl %ebx >+ popl %eax >+ ret >+ >+ > /* Undefined instruction (generates SIGILL) */ > .globl VG_(helper_undefined_instruction) > VG_(helper_undefined_instruction): >diff -ruN valgrind-2.1.0/coregrind/vg_include.h valgrind/coregrind/vg_include.h >--- valgrind-2.1.0/coregrind/vg_include.h 2003-11-26 20:16:40.000000000 -0600 >+++ valgrind/coregrind/vg_include.h 2004-02-11 17:33:27.000000000 -0600 >@@ -9,7 +9,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -49,6 +49,9 @@ > #include "vg_skin.h" > #include "valgrind.h" > >+#undef SK_ >+#define SK_(x) vgSkinInternal_##x >+ > /* Total number of spill slots available for allocation, if a TempReg > doesn't make it into a RealReg. Just bomb the entire system if > this value is too small; we don't expect it will ever get >@@ -105,14 +108,9 @@ > give finer interleaving but much increased scheduling overheads. */ > #define VG_SCHEDULING_QUANTUM 50000 > >-/* Maximum FD Valgrind can use for its internal file descriptors. */ >-#define VG_MAX_SAFE_FD 1024 /* usual ulimit */ >- >-/* Maximum allowed application-visible file descriptor. Valgrind's >- internal fds hide above this (starting at VG_MAX_FD+1). This is >- derived from the default fd limit (1024) minus the 2 fds per thread >- and a small number of extra fds. */ >-#define VG_MAX_FD (VG_MAX_SAFE_FD - (VG_N_THREADS*2 + 4)) >+/* Number of file descriptors that Valgrind tries to reserve for >+ it's own use - two per thread plues a small number of extras. */ >+#define VG_N_RESERVED_FDS (VG_N_THREADS*2 + 4) > > /* Stack size for a thread. We try and check that they do not go > beyond it. */ >@@ -137,6 +135,14 @@ > #define VG_STACK_SIZE_W 10000 > #define VG_SIGSTACK_SIZE_W 10000 > >+/* Useful macros */ >+/* a - alignment - must be a power of 2 */ >+#define ROUNDDN(p, a) ((Addr)(p) & ~((a)-1)) >+#define ROUNDUP(p, a) ROUNDDN((p)+(a)-1, (a)) >+#define PGROUNDDN(p) ROUNDDN(p, VKI_BYTES_PER_PAGE) >+#define PGROUNDUP(p) ROUNDUP(p, VKI_BYTES_PER_PAGE) >+ >+ > /* --------------------------------------------------------------------- > Basic types > ------------------------------------------------------------------ */ >@@ -157,6 +163,9 @@ > /* The max number of suppression files. */ > #define VG_CLO_MAX_SFILES 10 > >+/* Default debugger command. */ >+#define VG_CLO_DEFAULT_DBCOMMAND GDB_PATH " -nw %f %p" >+ > /* Describes where logging output is to be sent. */ > typedef > enum { >@@ -171,12 +180,15 @@ > /* pgrp of process (global to all threads) */ > extern Int VG_(main_pgrp); > >+/* Maximum allowed application-visible file descriptor */ >+extern Int VG_(max_fd); >+ > /* Should we stop collecting errors if too many appear? default: YES */ > extern Bool VG_(clo_error_limit); >-/* Enquire about whether to attach to GDB at errors? default: NO */ >-extern Bool VG_(clo_GDB_attach); >-/* The path to GDB? default: whatever ./configure found */ >-extern Char* VG_(clo_GDB_path); >+/* Enquire about whether to attach to a debugger at errors? default: NO */ >+extern Bool VG_(clo_db_attach); >+/* The debugger command? default: whatever gdb ./configure found */ >+extern Char* VG_(clo_db_command); > /* Enquire about generating a suppression for each error? default: NO */ > extern Bool VG_(clo_gen_suppressions); > /* Sanity-check level: 0 = none, 1 (default), > 1 = expensive. */ >@@ -231,8 +243,6 @@ > /* DEBUG: print pthread (mutex etc) events? default: 0 (none), 1 > (some), 2 (all) */ > extern Int VG_(clo_trace_pthread_level); >-/* Stop after this many basic blocks. default: Infinity. */ >-extern ULong VG_(clo_stop_after); > /* Display gory details for the k'th most popular error. default: > Infinity. */ > extern Int VG_(clo_dump_error); >@@ -259,9 +269,13 @@ > extern Bool VG_(clo_run_libc_freeres); > /* Use the basic-block chaining optimisation? Default: YES */ > extern Bool VG_(clo_chain_bb); >+/* Generate branch-prediction hints? */ >+extern Bool VG_(clo_branchpred); > /* Continue stack traces below main()? Default: NO */ > extern Bool VG_(clo_show_below_main); >- >+/* Test each client pointer dereference to check it's within the >+ client address space bounds */ >+extern Bool VG_(clo_pointercheck); > > /* --------------------------------------------------------------------- > Debugging and profiling stuff >@@ -319,96 +333,15 @@ > Bool syscall_wrapper; > Bool sanity_checks; > Bool data_syms; >+ Bool shadow_memory; > } > VgNeeds; > > extern VgNeeds VG_(needs); > >-/* Events happening in core to track. To be notified, assign a function >- to the function pointer. To ignore an event, don't do anything >- (default assignment is to NULL in which case the call is skipped). */ >-typedef >- struct { >- /* Memory events */ >- void (*new_mem_startup)( Addr a, UInt len, Bool rr, Bool ww, Bool xx ); >- void (*new_mem_stack_signal) ( Addr a, UInt len ); >- void (*new_mem_brk) ( Addr a, UInt len ); >- void (*new_mem_mmap) ( Addr a, UInt len, Bool rr, Bool ww, Bool xx ); >- >- void (*copy_mem_remap) ( Addr from, Addr to, UInt len ); >- void (*change_mem_mprotect) ( Addr a, UInt len, Bool rr, Bool ww, Bool xx ); >- void (*die_mem_stack_signal) ( Addr a, UInt len ); >- void (*die_mem_brk) ( Addr a, UInt len ); >- void (*die_mem_munmap) ( Addr a, UInt len ); >- >- void (*new_mem_stack_4) ( Addr new_ESP ); >- void (*new_mem_stack_8) ( Addr new_ESP ); >- void (*new_mem_stack_12) ( Addr new_ESP ); >- void (*new_mem_stack_16) ( Addr new_ESP ); >- void (*new_mem_stack_32) ( Addr new_ESP ); >- void (*new_mem_stack) ( Addr a, UInt len ); >- >- void (*die_mem_stack_4) ( Addr die_ESP ); >- void (*die_mem_stack_8) ( Addr die_ESP ); >- void (*die_mem_stack_12) ( Addr die_ESP ); >- void (*die_mem_stack_16) ( Addr die_ESP ); >- void (*die_mem_stack_32) ( Addr die_ESP ); >- void (*die_mem_stack) ( Addr a, UInt len ); >- >- void (*ban_mem_stack) ( Addr a, UInt len ); >- >- void (*pre_mem_read) ( CorePart part, ThreadId tid, >- Char* s, Addr a, UInt size ); >- void (*pre_mem_read_asciiz) ( CorePart part, ThreadId tid, >- Char* s, Addr a ); >- void (*pre_mem_write) ( CorePart part, ThreadId tid, >- Char* s, Addr a, UInt size ); >- /* Not implemented yet -- have to add in lots of places, which is a >- pain. Won't bother unless/until there's a need. */ >- /* void (*post_mem_read) ( ThreadState* tst, Char* s, >- Addr a, UInt size ); */ >- void (*post_mem_write) ( Addr a, UInt size ); >- >- >- /* Register events */ >- void (*post_regs_write_init) ( void ); >- void (*post_reg_write_syscall_return) ( ThreadId tid, UInt reg ); >- void (*post_reg_write_deliver_signal) ( ThreadId tid, UInt reg ); >- void (*post_reg_write_pthread_return) ( ThreadId tid, UInt reg ); >- void (*post_reg_write_clientreq_return) ( ThreadId tid, UInt reg ); >- void (*post_reg_write_clientcall_return) ( ThreadId tid, UInt reg, >- Addr f ); >- >- >- /* Scheduler events (not exhaustive) */ >- void (*thread_run) ( ThreadId tid ); >- >- >- /* Thread events (not exhaustive) */ >- void (*post_thread_create) ( ThreadId tid, ThreadId child ); >- void (*post_thread_join) ( ThreadId joiner, ThreadId joinee ); >- >- >- /* Mutex events (not exhaustive) */ >- void (*pre_mutex_lock) ( ThreadId tid, >- void* /*pthread_mutex_t* */ mutex ); >- void (*post_mutex_lock) ( ThreadId tid, >- void* /*pthread_mutex_t* */ mutex ); >- void (*post_mutex_unlock) ( ThreadId tid, >- void* /*pthread_mutex_t* */ mutex ); >- >- /* Signal events (not exhaustive) */ >- void (* pre_deliver_signal) ( ThreadId tid, Int sigNo, Bool alt_stack ); >- void (*post_deliver_signal) ( ThreadId tid, Int sigNo ); >- >- >- /* Others... condition variable... */ >- /* ... */ >- } >- VgTrackEvents; >- >-extern VgTrackEvents VG_(track_events); >+extern void VG_(tool_init_dlsym)(void *dlhandle); > >+#include "vg_toolint.h" > > /* --------------------------------------------------------------------- > Exports of vg_needs.c >@@ -423,7 +356,7 @@ > /* Allocation arenas. > > CORE for the core's general use. >- SKIN for the skin to use (and the only one it uses). >+ TOOL for the tool to use (and the only one it uses). > SYMTAB for Valgrind's symbol table storage. > JITTER for small storage during translation. > CLIENT for the client's mallocs/frees, if the skin replaces glibc's >@@ -440,7 +373,7 @@ > #define VG_N_ARENAS 9 > > #define VG_AR_CORE 0 >-#define VG_AR_SKIN 1 >+#define VG_AR_TOOL 1 > #define VG_AR_SYMTAB 2 > #define VG_AR_JITTER 3 > #define VG_AR_CLIENT 4 >@@ -550,6 +483,19 @@ > > /* Denote the finish of VG_(__libc_freeres_wrapper). */ > #define VG_USERREQ__LIBC_FREERES_DONE 0x3029 >+#define VG_USERREQ__REGISTER_LIBC_FREERES 0x302A >+ >+/* Allocate RT signals */ >+#define VG_USERREQ__GET_SIGRT_MIN 0x302B >+#define VG_USERREQ__GET_SIGRT_MAX 0x302C >+#define VG_USERREQ__ALLOC_RTSIG 0x302D >+ >+/* Hook for replace_malloc.o to get malloc functions */ >+#define VG_USERREQ__GET_MALLOCFUNCS 0x3030 >+ >+/* Hook for interface to vg_inject.so */ >+#define VG_USERREQ__REGISTER_REDIRECT_SYM 0x3031 >+#define VG_USERREQ__REGISTER_REDIRECT_ADDR 0x3032 > > /* Cosmetic ... */ > #define VG_USERREQ__GET_PTHREAD_TRACE_LEVEL 0x3101 >@@ -566,9 +512,23 @@ > */ > > >-/* The scheduler does need to know the address of it so it can be >- called at program exit. */ >-extern void VG_(__libc_freeres_wrapper)( void ); >+struct vg_mallocfunc_info { >+ /* things vg_replace_malloc.o needs to know about */ >+ Addr sk_malloc; >+ Addr sk_calloc; >+ Addr sk_realloc; >+ Addr sk_memalign; >+ Addr sk___builtin_new; >+ Addr sk___builtin_vec_new; >+ Addr sk_free; >+ Addr sk___builtin_delete; >+ Addr sk___builtin_vec_delete; >+ >+ Addr arena_payload_szB; >+ >+ Bool clo_sloppy_malloc; >+ Bool clo_trace_malloc; >+}; > > __attribute__((weak)) > int >@@ -665,11 +625,19 @@ > VG_(allocate_LDT_for_thread) ( VgLdtEntry* parent_ldt ); > extern void > VG_(deallocate_LDT_for_thread) ( VgLdtEntry* ldt ); >+extern void >+ VG_(clear_TLS_for_thread) ( VgLdtEntry* tls ); > > /* Simulate the modify_ldt syscall. */ > extern Int VG_(sys_modify_ldt) ( ThreadId tid, > Int func, void* ptr, UInt bytecount ); > >+/* Simulate the {get,set}_thread_area syscalls. */ >+extern Int VG_(sys_set_thread_area) ( ThreadId tid, >+ struct vki_modify_ldt_ldt_s* info ); >+extern Int VG_(sys_get_thread_area) ( ThreadId tid, >+ struct vki_modify_ldt_ldt_s* info ); >+ > /* Called from generated code. Given a segment selector and a virtual > address, return a linear address, and do limit checks too. */ > extern Addr VG_(do_useseg) ( UInt seg_selector, Addr virtual_addr ); >@@ -805,8 +773,8 @@ > */ > vki_ksigset_t sig_mask; > >- /* Effective signal mask. This is the mask which is currently >- applying; it may be different from sig_mask while a signal >+ /* Effective signal mask. This is the mask which currently >+ applies; it may be different from sig_mask while a signal > handler is running. > */ > vki_ksigset_t eff_sig_mask; >@@ -844,11 +812,15 @@ > deallocate this at thread exit. */ > VgLdtEntry* ldt; > >+ /* TLS table. This consists of a small number (currently 3) of >+ entries from the Global Descriptor Table. */ >+ VgLdtEntry tls[VKI_GDT_TLS_ENTRIES]; >+ > /* Saved machine context. Note the FPU state, %EIP and segment > registers are not shadowed. > > Although the segment registers are 16 bits long, storage >- management here, in VG_(baseBlock) and in VG_(m_state_static) is >+ management here and in VG_(baseBlock) is > simplified if we pretend they are 32 bits. */ > UInt m_cs; > UInt m_ss; >@@ -936,8 +908,6 @@ > even if we wait for a long time */ > VgSrc_ExitSyscall, /* client called exit(). This is the normal > route out. */ >- VgSrc_BbsDone, /* In a debugging run, the specified number of >- bbs has been completed. */ > VgSrc_FatalSig /* Killed by the default action of a fatal > signal */ > } >@@ -1087,10 +1057,6 @@ > /* Skins use VG_(strdup)() which doesn't expose ArenaId */ > extern Char* VG_(arena_strdup) ( ArenaId aid, const Char* s); > >-/* Skins shouldn't need these...(?) */ >-extern void VG_(start_rdtsc_calibration) ( void ); >-extern void VG_(end_rdtsc_calibration) ( void ); >- > extern Int VG_(fcntl) ( Int fd, Int cmd, Int arg ); > extern Int VG_(select)( Int n, > vki_fd_set* readfds, >@@ -1101,6 +1067,13 @@ > extern Int VG_(nanosleep)( const struct vki_timespec *req, > struct vki_timespec *rem ); > >+/* system/mman.h */ >+extern void* VG_(mmap)( void* start, UInt length, >+ UInt prot, UInt flags, UInt fd, UInt offset ); >+extern Int VG_(munmap)( void* start, Int length ); >+extern Int VG_(mprotect)( void *start, Int length, UInt prot ); >+ >+ > /* Move an fd into the Valgrind-safe range */ > Int VG_(safe_fd)(Int oldfd); > >@@ -1109,6 +1082,11 @@ > /* --- Connecting over the network --- */ > extern Int VG_(connect_via_socket)( UChar* str ); > >+/* Environment manipulations */ >+extern Char **VG_(env_clone) ( Char **oldenv ); >+extern Char* VG_(env_getenv) ( Char **env, Char* varname ); >+extern Char **VG_(env_setenv) ( Char ***envp, const Char* varname, const Char *val ); >+extern void VG_(env_unsetenv) ( Char **env, const Char *varname ); > > /* --------------------------------------------------------------------- > Exports of vg_message.c >@@ -1154,6 +1132,8 @@ > Exports of vg_to_ucode.c > ------------------------------------------------------------------ */ > >+Bool VG_(cpu_has_feature)(UInt feat); >+ > extern Int VG_(disBB) ( UCodeBlock* cb, Addr eip0 ); > > /* --------------------------------------------------------------------- >@@ -1301,8 +1281,6 @@ > > extern Bool VG_(is_action_requested) ( Char* action, Bool* clo ); > >-extern void VG_(gen_suppression) ( Error* err ); >- > extern UInt VG_(n_errs_found); > > /* --------------------------------------------------------------------- >@@ -1318,7 +1296,8 @@ > it's read from the buffer filled by VG_(read_procselfmaps_contents)(). */ > extern > void VG_(parse_procselfmaps) ( >- void (*record_mapping)( Addr, UInt, Char, Char, Char, UInt, UChar* ) >+ void (*record_mapping)( Addr addr, UInt len, Char rr, Char ww, Char xx, >+ UInt dev, UInt ino, ULong foff, const UChar *filename ) > ); > > >@@ -1326,27 +1305,26 @@ > Exports of vg_symtab2.c > ------------------------------------------------------------------ */ > >+typedef struct _Segment Segment; >+ >+extern Bool VG_(is_object_file) ( const void *hdr ); > extern void VG_(mini_stack_dump) ( Addr eips[], UInt n_eips ); >-extern void VG_(read_all_symbols) ( void ); >-extern void VG_(read_seg_symbols) ( Addr start, UInt size, >- Char rr, Char ww, Char xx, >- UInt foffset, UChar* filename ); >+extern SegInfo * VG_(read_seg_symbols) ( Segment *seg ); > extern void VG_(unload_symbols) ( Addr start, UInt length ); >+extern void VG_(symtab_incref) ( SegInfo * ); >+extern void VG_(symtab_decref) ( SegInfo *, Addr a, UInt len ); > > extern Bool VG_(get_fnname_nodemangle)( Addr a, Char* fnname, Int n_fnname ); >-extern Int VG_(setup_code_redirect_table) ( void ); >- >-typedef >- struct { >- Addr entry_pt_orig; >- Addr entry_pt_subst; >- } >- CodeRedirect; > >-#define VG_N_CODE_REDIRECTS 10 >-extern CodeRedirect VG_(code_redirect_table)[VG_N_CODE_REDIRECTS]; >-/* Table is terminated by a NULL entry_pt_orig field. */ >+/* Set up some default redirects */ >+extern void VG_(setup_code_redirect_table) ( void ); > >+/* Redirection machinery */ >+extern void VG_(add_redirect_sym)(const Char *from_lib, const Char *from_sym, >+ const Char *to_lib, const Char *to_sym); >+extern void VG_(add_redirect_addr)(const Char *from_lib, const Char *from_sym, >+ Addr to_addr); >+extern Addr VG_(code_redirect) (Addr orig); > > /* --------------------------------------------------------------------- > Exports of vg_main.c >@@ -1354,7 +1332,7 @@ > > /* Is this a SSE/SSE2-capable CPU? If so, we had better save/restore > the SSE state all over the place. This is set up very early, in >- vg_startup.S. We have to determine it early since we can't even >+ main(). We have to determine it early since we can't even > correctly snapshot the startup machine state without it. */ > extern Bool VG_(have_ssestate); > >@@ -1365,26 +1343,30 @@ > /* Sanity checks which may be done at any time. The scheduler decides when. */ > extern void VG_(do_sanity_checks) ( Bool force_expensive ); > >-/* A structure used as an intermediary when passing the simulated >- CPU's state to some assembly fragments, particularly system calls. >- Stuff is copied from baseBlock to here, the assembly magic runs, >- and then the inverse copy is done. Alignment: the SSE state must >- be 16-byte aligned. We ask for the whole struct to be 16-byte >- aligned, and the SSE state starts at the 6+8+1+1th == 16th word, >- so it too must be 16-byte aligned. Consequence: change this struct >- only _very carefully_ ! See also above comment re masking MXCSR. >-*/ >-__attribute__ ((aligned (16))) >-extern UInt VG_(m_state_static) [6 /* segment regs, Intel order */ >- + 8 /* int regs, in Intel order */ >- + 1 /* %eflags */ >- + 1 /* %eip */ >- + VG_SIZE_OF_SSESTATE_W /* SSE state */ >- ]; >- >-/* Handy fns for doing the copy back and forth. */ >-extern void VG_(copy_baseBlock_to_m_state_static) ( void ); >-extern void VG_(copy_m_state_static_to_baseBlock) ( void ); >+/* Address space */ >+extern Addr VG_(client_base); /* client address space limits */ >+extern Addr VG_(client_end); >+extern Addr VG_(client_mapbase); /* base of mappings */ >+extern Addr VG_(clstk_base); /* client stack range */ >+extern Addr VG_(clstk_end); >+extern Addr VG_(client_trampoline_code); >+ >+extern Addr VG_(brk_base); /* start of brk */ >+extern Addr VG_(brk_limit); /* current brk */ >+extern Addr VG_(shadow_base); /* skin's shadow memory */ >+extern Addr VG_(shadow_end); >+extern Addr VG_(valgrind_base); /* valgrind's address range */ >+extern Addr VG_(valgrind_mmap_end); >+extern Addr VG_(valgrind_end); >+ >+/* stage1 executable file descriptor */ >+extern Int VG_(vgexecfd); >+ >+/* client executable file descriptor */ >+extern Int VG_(clexecfd); >+ >+/* Path to all our library/aux files */ >+extern const Char *VG_(libdir); > > /* Determine if %esp adjustment must be noted */ > extern Bool VG_(need_to_handle_esp_assignment) ( void ); >@@ -1394,36 +1376,27 @@ > extern void VG_(unimplemented) ( Char* msg ) > __attribute__((__noreturn__)); > >-/* The stack on which Valgrind runs. We can't use the same stack as the >- simulatee -- that's an important design decision. */ >-extern UInt VG_(stack)[VG_STACK_SIZE_W]; >- > /* Similarly, we have to ask for signals to be delivered on an alternative > stack, since it is possible, although unlikely, that we'll have to run > client code from inside the Valgrind-installed signal handler. If this > happens it will be done by vg_deliver_signal_immediately(). */ > extern UInt VG_(sigstack)[VG_SIGSTACK_SIZE_W]; > >-/* Holds client's %esp at the point we gained control. From this the >- client's argc, argv and envp are deduced. */ >-extern Addr VG_(esp_at_startup); >+/* Valgrind's argc and argv */ >+extern Int VG_(vg_argc); >+extern Char **VG_(vg_argv); > > /* Indicates presence, and holds address of client's sysinfo page, a > feature of some modern kernels used to provide vsyscalls, etc. */ > extern Bool VG_(sysinfo_page_exists); > extern Addr VG_(sysinfo_page_addr); > >-/* Remove valgrind.so and skin's .so from a LD_PRELOAD=... string so child >- processes don't get traced into. Also mess up $libdir/valgrind so that >- our libpthread.so disappears from view. */ >-void VG_(mash_LD_PRELOAD_and_LD_LIBRARY_PATH) ( Char* ld_preload_str, >- Char* ld_library_path_str ); >- >-/* Something of a function looking for a home ... start up GDB. This >- is called from VG_(swizzle_esp_then_start_GDB) and so runs on the >- *client's* stack. This is necessary to give GDB the illusion that >- the client program really was running on the real cpu. */ >-extern void VG_(start_GDB_whilst_on_client_stack) ( void ); >+/* Walk through a colon separated list variable, removing entries >+ which match pattern. */ >+extern void VG_(mash_colon_env)(Char *varp, const Char *pattern); >+ >+/* Something of a function looking for a home ... start up debugger. */ >+extern void VG_(start_debugger) ( Int tid ); > > /* VG_(bbs_done) in include/vg_skin.h */ > >@@ -1433,9 +1406,6 @@ > /* Counts downwards in vg_run_innerloop. */ > extern UInt VG_(dispatch_ctr); > >-/* Is the client running on the simulated CPU or the real one? */ >-extern Bool VG_(running_on_simd_CPU); /* Initially False */ >- > /* This is the ThreadId of the last thread the scheduler ran. */ > extern ThreadId VG_(last_run_tid); > >@@ -1499,27 +1469,71 @@ > UInt VG_(insertDflag)(UInt eflags, Int d); > Int VG_(extractDflag)(UInt eflags); > >-/* start address and size of the initial stack */ >-extern Addr VG_(foundstack_start); >-extern UInt VG_(foundstack_size); >- >- > /* --------------------------------------------------------------------- > Exports of vg_memory.c > ------------------------------------------------------------------ */ > >-extern void VG_(init_memory) ( void ); >-extern void VG_(new_exeseg_startup) ( Addr a, UInt len, Char rr, Char ww, >- Char xx, UInt foffset, >- UChar* filename ); >-extern void VG_(new_exeseg_mmap) ( Addr a, UInt len ); >-extern void VG_(remove_if_exeseg) ( Addr a, UInt len ); >+/* A Segment is mapped piece of client memory. This covers all kinds >+ of mapped memory (exe, brk, mmap, .so, shm, stack, etc) >+ >+ We try to encode everything we know about a particular segment here. >+*/ >+#define SF_FIXED (1 << 0) /* client asked for MAP_FIXED */ >+#define SF_SHARED (1 << 1) /* shared */ >+#define SF_SHM (1 << 2) /* SYSV SHM (also SF_SHARED) */ >+#define SF_MMAP (1 << 3) /* mmap memory */ >+#define SF_FILE (1 << 4) /* mapping is backed by a file */ >+#define SF_STACK (1 << 5) /* is a stack */ >+#define SF_GROWDOWN (1 << 6) /* segment grows down */ >+#define SF_GROWUP (1 << 7) /* segment grows up */ >+#define SF_EXEC (1 << 8) /* segment created by exec */ >+#define SF_DYNLIB (1 << 9) /* mapped from dynamic library */ >+#define SF_NOSYMS (1 << 10) /* don't load syms, even if present */ >+#define SF_BRK (1 << 11) /* brk segment */ >+#define SF_CORE (1 << 12) /* allocated by core on behalf of the client */ >+#define SF_VALGRIND (1 << 13) /* a valgrind-internal mapping - not in client*/ >+#define SF_CODE (1 << 14) /* segment contains cached code */ >+ >+struct _Segment { >+ UInt prot; /* VKI_PROT_* */ >+ UInt flags; /* SF_* */ >+ >+ Addr addr; /* mapped addr (page aligned) */ >+ UInt len; /* size of mapping (page aligned) */ >+ >+ /* These are valid if (flags & SF_FILE) */ >+ ULong offset; /* file offset */ >+ const Char *filename; /* filename (NULL if unknown) */ >+ UInt dev; /* device */ >+ UInt ino; /* inode */ >+ >+ SegInfo *symtab; /* symbol table */ >+}; >+ >+/* segment mapped from a file descriptor */ >+extern void VG_(map_fd_segment) (Addr addr, UInt len, UInt prot, UInt flags, >+ Int fd, ULong off, const Char *filename); >+ >+/* segment mapped from a file */ >+extern void VG_(map_file_segment)(Addr addr, UInt len, UInt prot, UInt flags, >+ UInt dev, UInt ino, ULong off, const Char *filename); >+ >+/* simple segment */ >+extern void VG_(map_segment) (Addr addr, UInt len, UInt prot, UInt flags); >+ >+extern void VG_(unmap_range) (Addr addr, UInt len); >+extern void VG_(mprotect_range)(Addr addr, UInt len, UInt prot); >+extern Addr VG_(find_map_space)(Addr base, UInt len, Bool for_client); >+ >+extern Segment *VG_(find_segment)(Addr a); >+extern Segment *VG_(next_segment)(Segment *); >+ >+extern Bool VG_(seg_contains)(const Segment *s, Addr ptr, UInt size); >+extern Bool VG_(seg_overlaps)(const Segment *s, Addr ptr, UInt size); > > extern __attribute__((regparm(1))) > void VG_(unknown_esp_update) ( Addr new_ESP ); > >-extern Bool VG_(is_addressable)(Addr p, Int sz); >- > /* --------------------------------------------------------------------- > Exports of vg_proxylwp.c > ------------------------------------------------------------------ */ >@@ -1536,7 +1550,7 @@ > extern void VG_(proxy_sigack) ( ThreadId tid, const vki_ksigset_t *); > extern void VG_(proxy_abort_syscall) ( ThreadId tid ); > extern void VG_(proxy_waitsig) ( void ); >-extern void VG_(proxy_wait_sys) (ThreadId tid); >+extern void VG_(proxy_wait_sys) (ThreadId tid, Bool restart); > > extern void VG_(proxy_shutdown) ( void ); /* shut down the syscall workers */ > extern Int VG_(proxy_resfd) ( void ); /* FD something can select on to know >@@ -1551,15 +1565,18 @@ > extern void VG_(proxy_handlesig)( const vki_ksiginfo_t *siginfo, > const struct vki_sigcontext *sigcontext ); > >+/* Get the PID/TID of the ProxyLWP. */ >+extern Int VG_(proxy_id)(ThreadId tid); >+ > > /* --------------------------------------------------------------------- > Exports of vg_syscalls.c > ------------------------------------------------------------------ */ > >-extern void VG_(init_dataseg_end_for_brk) ( void ); >+extern Char *VG_(resolve_filename)(Int fd); > > extern Bool VG_(pre_syscall) ( ThreadId tid ); >-extern void VG_(post_syscall)( ThreadId tid ); >+extern void VG_(post_syscall)( ThreadId tid, Bool restart ); > extern void VG_(restart_syscall) ( ThreadId tid ); > > extern Bool VG_(is_kerror) ( Int res ); >@@ -1603,17 +1620,6 @@ > Int *child_tid, Int *parent_tid); > > /* --------------------------------------------------------------------- >- Exports of vg_startup.S >- ------------------------------------------------------------------ */ >- >-extern void VG_(switch_to_real_CPU) ( void ); >- >-extern void VG_(swizzle_esp_then_start_GDB) ( Addr m_eip_at_error, >- Addr m_esp_at_error, >- Addr m_ebp_at_error ); >- >- >-/* --------------------------------------------------------------------- > Exports of vg_dispatch.S > ------------------------------------------------------------------ */ > >@@ -1650,6 +1656,7 @@ > > extern void VG_(helper_CLC); > extern void VG_(helper_STC); >+extern void VG_(helper_CMC); > > extern void VG_(helper_shldl); > extern void VG_(helper_shldw); >@@ -1662,30 +1669,43 @@ > extern void VG_(helper_RDTSC); > extern void VG_(helper_CPUID); > >-extern void VG_(helper_bsf); >-extern void VG_(helper_bsr); >+extern void VG_(helper_bsfw); >+extern void VG_(helper_bsfl); >+extern void VG_(helper_bsrw); >+extern void VG_(helper_bsrl); > > extern void VG_(helper_fstsw_AX); > extern void VG_(helper_SAHF); > extern void VG_(helper_LAHF); > extern void VG_(helper_DAS); > extern void VG_(helper_DAA); >+extern void VG_(helper_AAS); >+extern void VG_(helper_AAA); >+extern void VG_(helper_AAD); >+extern void VG_(helper_AAM); >+ >+extern void VG_(helper_cmpxchg8b); > > extern void VG_(helper_undefined_instruction); > >-/* NOT A FUNCTION; this is a bogus RETURN ADDRESS. */ >-extern void VG_(signalreturn_bogusRA)( void ); >+/* Information about trampoline code (for signal return and syscalls) */ >+extern const Char VG_(trampoline_code_start); >+extern const Int VG_(trampoline_code_length); >+extern const Int VG_(tramp_sigreturn_offset); >+extern const Int VG_(tramp_syscall_offset); > > /* --------------------------------------------------------------------- > Things relating to the used skin > ------------------------------------------------------------------ */ > >-#define VG_TRACK(fn, args...) \ >- do { \ >- if (VG_(track_events).fn) \ >- VG_(track_events).fn(args); \ >- } while (0) >+#define VG_TRACK(fn, args...) \ >+ do { \ >+ if (VG_(defined_##fn)()) \ >+ SK_(fn)(args); \ >+ } while(0) > >+__attribute__ ((noreturn)) >+extern void VG_(missing_tool_func) ( const Char* fn ); > > /* --------------------------------------------------------------------- > The state of the simulated CPU. >@@ -1757,6 +1777,9 @@ > /* This thread's LDT pointer. */ > extern Int VGOFF_(ldt); > >+/* This thread's TLS pointer. */ >+extern Int VGOFF_(tls); >+ > /* Nb: Most helper offsets are in include/vg_skin.h, for use by skins */ > > extern Int VGOFF_(helper_undefined_instruction); >diff -ruN valgrind-2.1.0/coregrind/vg_instrument.c valgrind/coregrind/vg_instrument.c >--- valgrind-2.1.0/coregrind/vg_instrument.c 2003-04-15 09:57:41.000000000 -0500 >+++ valgrind/coregrind/vg_instrument.c 2004-01-04 10:43:19.000000000 -0600 >@@ -8,7 +8,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Nicholas Nethercote >+ Copyright (C) 2000-2004 Nicholas Nethercote > njn25@cam.ac.uk > > This program is free software; you can redistribute it and/or >diff -ruN valgrind-2.1.0/coregrind/vg_intercept.c valgrind/coregrind/vg_intercept.c >--- valgrind-2.1.0/coregrind/vg_intercept.c 2003-11-20 10:20:54.000000000 -0600 >+++ valgrind/coregrind/vg_intercept.c 2004-01-04 10:43:19.000000000 -0600 >@@ -8,7 +8,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -33,138 +33,43 @@ > /* --------------------------------------------------------------------- > ALL THE CODE IN THIS FILE RUNS ON THE SIMULATED CPU. It is > intended for various reasons as drop-in replacements for libc >- functions. These functions have global visibility (obviously) and >- have no prototypes in vg_include.h, since they are not intended to >- be called from within Valgrind. >+ functions. These functions are not called directly - they're the >+ targets of code redirection. They're named the same as the library >+ functions they replace so that messages printing their names are >+ sensible, but the we don't really require the dynamic linker to find >+ them. > ------------------------------------------------------------------ */ > >-/* General idea (2003-Apr-26) is that master implementations of >- selected functions are done as VGR_(fnname). Then we route >- all calls to the master, both here and in vg_libpthread.c. >- This means we no longer have to rely on the semantics of weak >- symbols, which seems to have changed in glibc >= 2.3.2 in such >- a way as to make the previous interception scheme stop working. >-*/ >- > #include "valgrind.h" > #include "vg_include.h" >-#include "vg_kerneliface.h" >- >-/* This has some nasty duplication of stuff from vg_libpthread.c */ >- >-#include <errno.h> >-#include <sys/types.h> >-#include <stdio.h> >-#include <sys/ipc.h> >-#include <sys/msg.h> >-#ifdef KERNEL_2_6 >-#include <linux/compiler.h> >-#endif >-#include <asm/ipc.h> /* for ipc_kludge */ >-#include <sys/poll.h> >-#include <sys/socket.h> >-#include <sys/uio.h> >-#ifdef HAVE_SYS_TIME_H >-#include <sys/time.h> >-#endif >- >-/* --------------------------------------------------------------- */ >- >-/* Just start up Valgrind if it's not already going. VG_(startup)() >- detects and ignores second and subsequent calls. */ >+#include <unistd.h> >+#include <signal.h> > >-/* We need this guy -- it's in valgrind.so. */ >-extern void VG_(startup) ( void ); >+static void init(void) __attribute__((constructor)); >+static int init_done; > >-static __inline__ >-void ensure_valgrind ( char* caller ) >+int raise(int sig) > { >- VG_(startup)(); >-} >+ if (!init_done) >+ init(); > >-static __inline__ >-int is_kerror ( int res ) >-{ >- if (res >= -4095 && res <= -1) >- return 1; >- else >- return 0; >+ return kill(getpid(), sig); > } >+int __libc_raise(int) __attribute__((alias("raise"), visibility("protected"))); >+int __GI_raise(int) __attribute__((alias("raise"), visibility("protected"))); > >-/* --------------------------------------------------------------- */ >- >-/* Extract from Valgrind the value of VG_(clo_trace_pthread_level). >- Returns 0 (none) if not running on Valgrind. */ >-static >-int get_pt_trace_level ( void ) >+/* Don't alias, so there's no chance that "gsignal" will appear in a >+ message instead of "raise" */ >+int gsignal(int sig) > { >- int res; >- VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */, >- VG_USERREQ__GET_PTHREAD_TRACE_LEVEL, >- 0, 0, 0, 0); >- return res; >+ return raise(sig); > } > >-static >-void cat_n_send ( char* pre, char* msg ) >-{ >- char buf[1000]; >- if (get_pt_trace_level() >= 0) { >- snprintf(buf, sizeof(buf), "%s%s", pre, msg ); >- buf[sizeof(buf)-1] = '\0'; >- VALGRIND_NON_SIMD_CALL2(VG_(message), Vg_UserMsg, buf); >- } >-} >- >-static >-void my_exit ( int arg ) >-{ >- VG_(do_syscall)(__NR_exit_group, arg); >- VG_(do_syscall)(__NR_exit, arg); >-} >- >-static >-void my_assert_fail ( const Char* expr, const Char* file, Int line, const Char* fn ) >-{ >- char buf[1000]; >- static Bool entered = False; >- if (entered) >- my_exit(2); >- entered = True; >- sprintf(buf, "\n%s: %s:%d (%s): Assertion `%s' failed.\n", >- "valgrind", file, line, fn, expr ); >- cat_n_send ( "", buf ); >- sprintf(buf, "Please report this bug at: %s\n\n", VG_BUGS_TO); >- my_exit(1); >-} >- >-#define MY__STRING(__str) #__str >- >-#define my_assert(expr) \ >- ((void) ((expr) ? 0 : \ >- (my_assert_fail (MY__STRING(expr), \ >- __FILE__, __LINE__, \ >- __PRETTY_FUNCTION__), 0))) >- >-/* --------------------------------------------------------------- */ >- >-static __inline__ >-void __my_pthread_testcancel(void) >-{ >- int res; >- ensure_valgrind("__my_pthread_testcancel"); >- VALGRIND_MAGIC_SEQUENCE(res, (-1) /* default */, >- VG_USERREQ__TESTCANCEL, >- 0, 0, 0, 0); >- my_assert(res == 0); >-} >- >- > /* --------------------------------------------------------------------- > Hook for running __libc_freeres once the program exits. > ------------------------------------------------------------------ */ > >-void VG_(__libc_freeres_wrapper)( void ) >+static void VGINJ_(__libc_freeres_wrapper)( void ) > { > int res; > #ifndef __UCLIBC__ >@@ -174,18 +79,45 @@ > VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */, > VG_USERREQ__LIBC_FREERES_DONE, 0, 0, 0, 0); > /*NOTREACHED*/ >- vg_assert(12345+54321 == 999999); >+ *(int *)0 = 'x'; > } > >-/* --------------------------------------------------------------------- >- Useful for skins that want to replace certain functions >- ------------------------------------------------------------------ */ >+static const struct { >+ const char *fromlib, *fromsym; >+ const void *toaddr; >+} redirects[] = { >+#define _S(x) #x >+#define S(x) _S(x) >+#define E(l, pfx, s) { "soname:" l, pfx #s, (void *)s } >+#define R(l, s) \ >+ E(l, "", s), \ >+ E(l, "__", s), \ >+ E(l, "__libc_", s), \ >+ E(l, "__GI_", s) >+ >+ R("libc.so.6", raise), >+ R("libc.so.6", gsignal), >+#undef R >+}; > >-Bool VG_(is_running_on_simd_CPU)(void) >+static void init(void) > { >- return VG_(running_on_simd_CPU); >-} >+ int i; >+ int res; > >+ if (init_done) >+ return; >+ init_done = 1; >+ >+ VALGRIND_MAGIC_SEQUENCE(res, -1, VG_USERREQ__REGISTER_LIBC_FREERES, >+ (Addr)VGINJ_(__libc_freeres_wrapper), 0, 0, 0); >+ >+ for(i = 0; i < sizeof(redirects)/sizeof(*redirects); i++) { >+ VALGRIND_MAGIC_SEQUENCE(res, -1, VG_USERREQ__REGISTER_REDIRECT_ADDR, >+ redirects[i].fromlib, redirects[i].fromsym, >+ redirects[i].toaddr, 0); >+ } >+} > > > /*--------------------------------------------------------------------*/ >diff -ruN valgrind-2.1.0/coregrind/vg_ldt.c valgrind/coregrind/vg_ldt.c >--- valgrind-2.1.0/coregrind/vg_ldt.c 2003-07-04 11:14:14.000000000 -0500 >+++ valgrind/coregrind/vg_ldt.c 2004-01-20 19:27:26.000000000 -0600 >@@ -7,7 +7,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -121,6 +121,24 @@ > > > >+/* Clear a TLS array. */ >+void VG_(clear_TLS_for_thread) ( VgLdtEntry* tls ) >+{ >+ VgLdtEntry* tlsp; >+ >+ if (0) >+ VG_(printf)("clear_TLS_for_thread\n" ); >+ >+ for (tlsp = tls; tlsp < tls + VKI_GDT_TLS_ENTRIES; tlsp++) { >+ tlsp->LdtEnt.Words.word1 = 0; >+ tlsp->LdtEnt.Words.word2 = 0; >+ } >+ >+ return; >+} >+ >+ >+ > /* Fish the base field out of an VgLdtEntry. This is the only part we > are particularly interested in. */ > >@@ -151,9 +169,9 @@ > */ > Addr VG_(do_useseg) ( UInt seg_selector, Addr virtual_addr ) > { >- Addr base; >- UInt limit; >- VgLdtEntry* the_ldt; >+ UInt table; >+ Addr base; >+ UInt limit; > > if (0) > VG_(printf)("do_useseg: seg_selector = %p, vaddr = %p\n", >@@ -161,31 +179,48 @@ > > seg_selector &= 0x0000FFFF; > >- /* Sanity check the segment selector. Ensure that TI=1 (LDT) and >- that RPL=11b (least privilege). These form the bottom 3 bits >- of the selector. */ >- vg_assert((seg_selector & 7) == 7); >+ /* Sanity check the segment selector. Ensure that RPL=11b (least >+ privilege). This forms the bottom 2 bits of the selector. */ >+ vg_assert((seg_selector & 3) == 3); >+ >+ /* Extract the table number */ >+ table = (seg_selector & 4) >> 2; > >- /* convert it onto a table index */ >+ /* Convert the segment selector onto a table index */ > seg_selector >>= 3; >- vg_assert(seg_selector >= 0 && seg_selector < 8192); > >- /* Come up with a suitable LDT entry. We look at the thread's LDT, >- which is pointed to by a VG_(baseBlock) entry. If null, we will >- use an implied zero-entry -- although this usually implies the >- program is in deep trouble, since it is using LDT entries which >- it probably hasn't set up. */ >- the_ldt = (VgLdtEntry*)VG_(baseBlock)[VGOFF_(ldt)]; >- if (the_ldt == NULL) { >- base = 0; >- limit = 0; >- VG_(message)( >- Vg_UserMsg, >- "Warning: segment-override prefix encountered, but thread has no LDT" >- ); >+ if (table == 0) { >+ VgLdtEntry* the_tls; >+ >+ vg_assert(seg_selector >= VKI_GDT_TLS_MIN && seg_selector < VKI_GDT_TLS_MAX); >+ >+ /* Come up with a suitable GDT entry. We look at the thread's TLS >+ array, which is pointed to by a VG_(baseBlock) entry. */ >+ the_tls = (VgLdtEntry*)VG_(baseBlock)[VGOFF_(tls)]; >+ base = (Addr)wine_ldt_get_base ( &the_tls[seg_selector-VKI_GDT_TLS_MIN] ); >+ limit = (UInt)wine_ldt_get_limit ( &the_tls[seg_selector-VKI_GDT_TLS_MIN] ); > } else { >- base = (Addr)wine_ldt_get_base ( &the_ldt[seg_selector] ); >- limit = (UInt)wine_ldt_get_limit ( &the_ldt[seg_selector] ); >+ VgLdtEntry* the_ldt; >+ >+ vg_assert(seg_selector >= 0 && seg_selector < 8192); >+ >+ /* Come up with a suitable LDT entry. We look at the thread's LDT, >+ which is pointed to by a VG_(baseBlock) entry. If null, we will >+ use an implied zero-entry -- although this usually implies the >+ program is in deep trouble, since it is using LDT entries which >+ it probably hasn't set up. */ >+ the_ldt = (VgLdtEntry*)VG_(baseBlock)[VGOFF_(ldt)]; >+ if (the_ldt == NULL) { >+ base = 0; >+ limit = 0; >+ VG_(message)( >+ Vg_UserMsg, >+ "Warning: segment-override prefix encountered, but thread has no LDT" >+ ); >+ } else { >+ base = (Addr)wine_ldt_get_base ( &the_ldt[seg_selector] ); >+ limit = (UInt)wine_ldt_get_limit ( &the_ldt[seg_selector] ); >+ } > } > > /* Note, this check is just slightly too slack. Really it should >@@ -199,6 +234,10 @@ > ); > } > >+ if (0) >+ VG_(printf)("do_useseg: base = %p, addr = %p\n", >+ base, base + virtual_addr); >+ > return base + virtual_addr; > } > >@@ -367,6 +406,63 @@ > } > > >+Int VG_(sys_set_thread_area) ( ThreadId tid, >+ struct vki_modify_ldt_ldt_s* info ) >+{ >+ Int idx = info->entry_number; >+ >+ if (idx == -1) { >+ for (idx = 0; idx < VKI_GDT_TLS_ENTRIES; idx++) { >+ VgLdtEntry* tls = VG_(threads)[tid].tls + idx; >+ >+ if (tls->LdtEnt.Words.word1 == 0 && tls->LdtEnt.Words.word2 == 0) >+ break; >+ } >+ >+ if (idx == VKI_GDT_TLS_ENTRIES) >+ return -VKI_ESRCH; >+ } else if (idx < VKI_GDT_TLS_MIN || idx > VKI_GDT_TLS_MAX) { >+ return -VKI_EINVAL; >+ } else { >+ idx = info->entry_number - VKI_GDT_TLS_MIN; >+ } >+ >+ translate_to_hw_format(info, VG_(threads)[tid].tls + idx, 0); >+ >+ info->entry_number = idx + VKI_GDT_TLS_MIN; >+ >+ return 0; >+} >+ >+ >+Int VG_(sys_get_thread_area) ( ThreadId tid, >+ struct vki_modify_ldt_ldt_s* info ) >+{ >+ Int idx = info->entry_number; >+ VgLdtEntry* tls; >+ >+ if (idx < VKI_GDT_TLS_MIN || idx > VKI_GDT_TLS_MAX) >+ return -VKI_EINVAL; >+ >+ tls = VG_(threads)[tid].tls + idx - VKI_GDT_TLS_MIN; >+ >+ info->base_addr = ( tls->LdtEnt.Bits.BaseHi << 24 ) | >+ ( tls->LdtEnt.Bits.BaseMid << 16 ) | >+ tls->LdtEnt.Bits.BaseLow; >+ info->limit = ( tls->LdtEnt.Bits.LimitHi << 16 ) | >+ tls->LdtEnt.Bits.LimitLow; >+ info->seg_32bit = tls->LdtEnt.Bits.Default_Big; >+ info->contents = ( tls->LdtEnt.Bits.Type >> 2 ) & 0x3; >+ info->read_exec_only = ( tls->LdtEnt.Bits.Type & 0x1 ) ^ 0x1; >+ info->limit_in_pages = tls->LdtEnt.Bits.Granularity; >+ info->seg_not_present = tls->LdtEnt.Bits.Pres ^ 0x1; >+ info->useable = tls->LdtEnt.Bits.Sys; >+ info->reserved = 0; >+ >+ return 0; >+} >+ >+ > /*--------------------------------------------------------------------*/ > /*--- end vg_ldt.c ---*/ > /*--------------------------------------------------------------------*/ >diff -ruN valgrind-2.1.0/coregrind/vg_libpthread.c valgrind/coregrind/vg_libpthread.c >--- valgrind-2.1.0/coregrind/vg_libpthread.c 2003-11-20 10:20:54.000000000 -0600 >+++ valgrind/coregrind/vg_libpthread.c 2004-01-20 19:27:26.000000000 -0600 >@@ -8,7 +8,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -60,6 +60,10 @@ > #include <pthread.h> > #undef __USE_UNIX98 > >+#define __USE_GNU >+#include <dlfcn.h> >+#undef __USE_GNU >+ > #include <unistd.h> > #include <string.h> > #include <sys/time.h> >@@ -68,6 +72,7 @@ > #include <stdio.h> > #include <errno.h> > >+#include <stdlib.h> > > # define strong_alias(name, aliasname) \ > extern __typeof (name) aliasname __attribute__ ((alias (#name))); >@@ -106,6 +111,9 @@ > #endif > > static >+void init_thread_specific_state ( void ); >+ >+static > void init_libc_tsd_keys ( void ); > > >@@ -128,40 +136,19 @@ > return res; > } > >-static >-void my_exit ( int arg ) >-{ >- VG_(do_syscall)(__NR_exit, arg); >- /*NOTREACHED*/ >-} >- >-/* Apparently unused. >-static >-void my_write ( int fd, const void *buf, int count ) >-{ >- VG_(do_syscall)(__NR_write, fd, (int)buf, count ); >-} >-*/ >- >-/* We need this guy -- it's in valgrind.so. */ >-extern void VG_(startup) ( void ); >- >- >-/* Just start up Valgrind if it's not already going. VG_(startup)() >- detects and ignores second and subsequent calls. */ >+/* Don't do anything if we're not under Valgrind */ > static __inline__ > void ensure_valgrind ( char* caller ) > { >- VG_(startup)(); >+ if (!RUNNING_ON_VALGRIND) { >+ const char msg[] = "Warning: this libpthread.so should only be run with Valgrind\n"; >+ VG_(do_syscall)(__NR_write, 2, msg, sizeof(msg)-1); >+ VG_(do_syscall)(__NR_exit, 1); >+ } > } > > /* While we're at it ... hook our own startup function into this > game. */ >-__asm__ ( >- ".section .init\n" >- "\tcall vgPlain_startup" >-); >- > > static > __attribute__((noreturn)) >@@ -173,8 +160,8 @@ > strcat(buf, "\nPlease report this bug at: "); > strcat(buf, VG_BUGS_TO); > strcat(buf, "\n\n"); >- VALGRIND_NON_SIMD_CALL2(VG_(message), Vg_UserMsg, buf); >- my_exit(1); >+ VALGRIND_INTERNAL_PRINTF(buf); >+ _exit(1); > /* We have to persuade gcc into believing this doesn't return. */ > while (1) { }; > } >@@ -186,7 +173,7 @@ > if (get_pt_trace_level() >= 0) { > snprintf(buf, sizeof(buf), "%s%s%s", s1, s2, s3); > buf[sizeof(buf)-1] = '\0'; >- VALGRIND_NON_SIMD_CALL2(VG_(message), Vg_UserMsg, buf); >+ VALGRIND_INTERNAL_PRINTF(buf); > } > } > >@@ -223,13 +210,14 @@ > char buf[1000]; > static Bool entered = False; > if (entered) >- my_exit(2); >+ _exit(2); > entered = True; > sprintf(buf, "\n%s: %s:%d (%s): Assertion `%s' failed.\n", > "valgrind", file, line, fn, expr ); > cat_n_send ( "", buf, "" ); > sprintf(buf, "Please report this bug at: %s\n\n", VG_BUGS_TO); >- my_exit(1); >+ cat_n_send ( "", buf, "" ); >+ _exit(1); > } > > #define MY__STRING(__str) #__str >@@ -243,10 +231,14 @@ > static > void my_free ( void* ptr ) > { >+#if 0 > int res; > VALGRIND_MAGIC_SEQUENCE(res, (-1) /* default */, > VG_USERREQ__FREE, ptr, 0, 0, 0); > my_assert(res == 0); >+#else >+ free(ptr); >+#endif > } > > >@@ -254,8 +246,12 @@ > void* my_malloc ( int nbytes ) > { > void* res; >+#if 0 > VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */, > VG_USERREQ__MALLOC, nbytes, 0, 0, 0); >+#else >+ res = malloc(nbytes); >+#endif > my_assert(res != (void*)0); > return res; > } >@@ -534,6 +530,38 @@ > and for clearing up afterwards. > ------------------------------------------------ */ > >+typedef void *(*__attribute__ ((regparm (3), stdcall)) allocate_tls_t) (void *result); >+typedef void (*__attribute__ ((regparm (3), stdcall)) deallocate_tls_t) (void *tcb, int dealloc_tcb); >+ >+static allocate_tls_t allocate_tls = NULL; >+static deallocate_tls_t deallocate_tls = NULL; >+ >+static >+int get_gs() >+{ >+ int gs; >+ >+ asm volatile ("movw %%gs, %w0" : "=q" (gs)); >+ >+ return gs & 0xffff; >+} >+ >+static >+void set_gs( int gs ) >+{ >+ asm volatile ("movw %w0, %%gs" :: "q" (gs)); >+} >+ >+static >+void *get_tcb() >+{ >+ void *tcb; >+ >+ asm volatile ("movl %%gs:0, %0" : "=r" (tcb)); >+ >+ return tcb; >+} >+ > /* All exiting threads eventually pass through here, bearing the > return value, or PTHREAD_CANCELED, in ret_val. */ > static >@@ -580,7 +608,13 @@ > my_assert(specifics_ptr != (void**)1); /* 1 means invalid thread */ > if (specifics_ptr != NULL) > my_free(specifics_ptr); >- >+ >+ /* Free up any TLS data */ >+ if ((get_gs() & 7) == 3 && pthread_self() > 1) { >+ my_assert(deallocate_tls != NULL); >+ deallocate_tls(get_tcb(), 1); >+ } >+ > /* Decide on my final disposition. */ > VALGRIND_MAGIC_SEQUENCE(detached, (-1) /* default */, > VG_USERREQ__SET_OR_GET_DETACH, >@@ -611,12 +645,25 @@ > objects which might be on the parent's stack. */ > typedef > struct { >- int attr__detachstate; >- void* (*root_fn) ( void* ); >- void* arg; >+ int attr__detachstate; >+ void* tls_data; >+ int tls_segment; >+ unsigned long sysinfo; >+ void* (*root_fn) ( void* ); >+ void* arg; > } > NewThreadInfo; > >+/* Struct used to describe a TDB header, copied from glibc. */ >+typedef >+ struct { >+ void *tcb; >+ void *dtv; >+ void *self; >+ int multiple_threads; >+ unsigned long sysinfo; >+ } >+ tcbhead_t; > > /* This is passed to the VG_USERREQ__APPLY_IN_NEW_THREAD and so must > not return. Note that this runs in the new thread, not the >@@ -625,15 +672,50 @@ > __attribute__((noreturn)) > void thread_wrapper ( NewThreadInfo* info ) > { >- int attr__detachstate; >- void* (*root_fn) ( void* ); >- void* arg; >- void* ret_val; >+ int attr__detachstate; >+ void* tls_data; >+ int tls_segment; >+ unsigned long sysinfo; >+ void* (*root_fn) ( void* ); >+ void* arg; >+ void* ret_val; > > attr__detachstate = info->attr__detachstate; >+ tls_data = info->tls_data; >+ tls_segment = info->tls_segment; >+ sysinfo = info->sysinfo; > root_fn = info->root_fn; > arg = info->arg; > >+ if (tls_data) { >+ tcbhead_t *tcb = tls_data; >+ struct vki_modify_ldt_ldt_s ldt_info; >+ >+ /* Fill in the TCB header */ >+ tcb->tcb = tcb; >+ tcb->self = tcb; >+ tcb->multiple_threads = 1; >+ tcb->sysinfo = sysinfo; >+ >+ /* Fill in an LDT descriptor */ >+ ldt_info.entry_number = tls_segment; >+ ldt_info.base_addr = (unsigned long)tls_data; >+ ldt_info.limit = 0xfffff; >+ ldt_info.seg_32bit = 1; >+ ldt_info.contents = 0; >+ ldt_info.read_exec_only = 0; >+ ldt_info.limit_in_pages = 1; >+ ldt_info.seg_not_present = 0; >+ ldt_info.useable = 1; >+ ldt_info.reserved = 0; >+ >+ /* Install the thread area */ >+ VG_(do_syscall)(__NR_set_thread_area, &ldt_info); >+ >+ /* Setup the GS segment register */ >+ set_gs(ldt_info.entry_number * 8 + 3); >+ } >+ > /* Free up the arg block that pthread_create malloced. */ > my_free(info); > >@@ -644,6 +726,9 @@ > if (attr__detachstate == PTHREAD_CREATE_DETACHED) > pthread_detach(pthread_self()); > >+ /* Initialise thread specific state */ >+ init_thread_specific_state(); >+ > # ifdef GLIBC_2_3 > /* Set this thread's locale to the global (default) locale. A hack > in support of glibc-2.3. This does the biz for the all new >@@ -699,6 +784,7 @@ > { > int tid_child; > NewThreadInfo* info; >+ int gs; > > ensure_valgrind("pthread_create"); > >@@ -716,6 +802,29 @@ > else > info->attr__detachstate = PTHREAD_CREATE_JOINABLE; > >+ gs = get_gs(); >+ >+ if ((gs & 7) == 3) { >+ tcbhead_t *tcb = get_tcb(); >+ >+ if (allocate_tls == NULL || deallocate_tls == NULL) { >+ allocate_tls = (allocate_tls_t)dlsym(RTLD_DEFAULT, "_dl_allocate_tls"); >+ deallocate_tls = (deallocate_tls_t)dlsym(RTLD_DEFAULT, "_dl_deallocate_tls"); >+ } >+ >+ my_assert(allocate_tls != NULL); >+ >+ info->tls_data = allocate_tls(NULL); >+ info->tls_segment = gs >> 3; >+ info->sysinfo = tcb->sysinfo; >+ >+ tcb->multiple_threads = 1; >+ } else { >+ info->tls_data = NULL; >+ info->tls_segment = -1; >+ info->sysinfo = 0; >+ } >+ > info->root_fn = __start_routine; > info->arg = __arg; > VALGRIND_MAGIC_SEQUENCE(tid_child, VG_INVALID_THREADID /* default */, >@@ -1033,7 +1142,7 @@ > } > > int pthread_cond_init( pthread_cond_t *cond, >- const pthread_condattr_t *cond_attr) >+ const pthread_condattr_t *cond_attr) > { > cond->__c_waiting = (_pthread_descr)VG_INVALID_THREADID; > return 0; >@@ -1278,14 +1387,12 @@ > int sigwait ( const sigset_t* set, int* sig ) > { > int res; >- vki_ksiginfo_t si; >+ siginfo_t si; > > __my_pthread_testcancel(); > >- /* As with pthread_sigmask we deliberately confuse sigset_t with >- vki_ksigset_t. */ > si.si_signo = 0; >- res = VG_(ksigtimedwait)((const vki_ksigset_t *)set, &si, NULL); >+ res = sigtimedwait(set, &si, NULL); > *sig = si.si_signo; > > return 0; /* always returns 0 */ >@@ -1632,30 +1739,52 @@ > ------------------------------------------------ */ > > #include <resolv.h> >-static int thread_specific_errno[VG_N_THREADS]; >-static int thread_specific_h_errno[VG_N_THREADS]; >-static struct __res_state >- thread_specific_res_state[VG_N_THREADS]; > >-#undef errno >-extern int errno; >+typedef >+ struct { >+ int *errno_ptr; >+ int *h_errno_ptr; >+ struct __res_state *res_state_ptr; >+ int errno_data; >+ int h_errno_data; >+ struct __res_state res_state_data; >+ } >+ ThreadSpecificState; >+ >+static ThreadSpecificState thread_specific_state[VG_N_THREADS]; >+ >+static >+void init_thread_specific_state ( void ) >+{ >+ int tid = pthread_self(); >+ >+ thread_specific_state[tid].errno_ptr = NULL; >+ thread_specific_state[tid].h_errno_ptr = NULL; >+ thread_specific_state[tid].res_state_ptr = NULL; >+} >+ > int* __errno_location ( void ) > { > int tid; >- /* ensure_valgrind("__errno_location"); */ >+ >+ ensure_valgrind("__errno_location"); > VALGRIND_MAGIC_SEQUENCE(tid, 1 /* default */, > VG_USERREQ__PTHREAD_GET_THREADID, > 0, 0, 0, 0); > /* 'cos I'm paranoid ... */ > if (tid < 1 || tid >= VG_N_THREADS) > barf("__errno_location: invalid ThreadId"); >- if (tid == 1) >- return &errno; >- return & thread_specific_errno[tid]; >+ if (thread_specific_state[tid].errno_ptr == NULL) { >+ if ((get_gs() & 7) == 3) >+ thread_specific_state[tid].errno_ptr = dlsym(RTLD_DEFAULT, "errno"); >+ else if (tid == 1) >+ thread_specific_state[tid].errno_ptr = dlvsym(RTLD_DEFAULT, "errno", "GLIBC_2.0"); >+ else >+ thread_specific_state[tid].errno_ptr = &thread_specific_state[tid].errno_data; >+ } >+ return thread_specific_state[tid].errno_ptr; > } > >-#undef h_errno >-extern int h_errno; > int* __h_errno_location ( void ) > { > int tid; >@@ -1666,14 +1795,17 @@ > /* 'cos I'm paranoid ... */ > if (tid < 1 || tid >= VG_N_THREADS) > barf("__h_errno_location: invalid ThreadId"); >- if (tid == 1) >- return &h_errno; >- return & thread_specific_h_errno[tid]; >+ if (thread_specific_state[tid].h_errno_ptr == NULL) { >+ if ((get_gs() & 7) == 3) >+ thread_specific_state[tid].h_errno_ptr = dlsym(RTLD_DEFAULT, "h_errno"); >+ else if (tid == 1) >+ thread_specific_state[tid].h_errno_ptr = dlvsym(RTLD_DEFAULT, "h_errno", "GLIBC_2.0"); >+ else >+ thread_specific_state[tid].h_errno_ptr = &thread_specific_state[tid].h_errno_data; >+ } >+ return thread_specific_state[tid].h_errno_ptr; > } > >- >-#undef _res >-extern struct __res_state _res; > struct __res_state* __res_state ( void ) > { > int tid; >@@ -1684,9 +1816,18 @@ > /* 'cos I'm paranoid ... */ > if (tid < 1 || tid >= VG_N_THREADS) > barf("__res_state: invalid ThreadId"); >- if (tid == 1) >- return & _res; >- return & thread_specific_res_state[tid]; >+ if (thread_specific_state[tid].res_state_ptr == NULL) { >+ if ((get_gs() & 7) == 3) { >+ struct __res_state **resp = dlsym(RTLD_DEFAULT, "__resp"); >+ >+ thread_specific_state[tid].res_state_ptr = *resp; >+ } else if (tid == 1) { >+ thread_specific_state[tid].res_state_ptr = dlvsym(RTLD_DEFAULT, "_res", "GLIBC_2.0"); >+ } else { >+ thread_specific_state[tid].res_state_ptr = &thread_specific_state[tid].res_state_data; >+ } >+ } >+ return thread_specific_state[tid].res_state_ptr; > } > > >@@ -2261,6 +2402,7 @@ > pthread_mutex_t se_mx; > pthread_cond_t se_cv; > int count; >+ int waiters; > } > vg_sem_t; > >@@ -2295,6 +2437,29 @@ > return &se_remap_new[i]; > } > >+static void se_unmap( sem_t* orig ) >+{ >+ int res, i; >+ res = __pthread_mutex_lock(&se_remap_mx); >+ my_assert(res == 0); >+ >+ for (i = 0; i < se_remap_used; i++) { >+ if (se_remap_orig[i] == orig) >+ break; >+ } >+ if (i == se_remap_used) { >+ res = pthread_mutex_unlock(&se_remap_mx); >+ my_assert(res == 0); >+ barf("se_unmap: unmapping invalid semaphore"); >+ } else { >+ se_remap_orig[i] = se_remap_orig[--se_remap_used]; >+ se_remap_orig[se_remap_used] = 0; >+ memset(&se_remap_new[se_remap_used], 0, >+ sizeof(se_remap_new[se_remap_used])); >+ } >+ res = pthread_mutex_unlock(&se_remap_mx); >+ my_assert(res == 0); >+} > > int sem_init(sem_t *sem, int pshared, unsigned int value) > { >@@ -2315,7 +2480,6 @@ > return 0; > } > >- > int sem_wait ( sem_t* sem ) > { > int res; >@@ -2325,7 +2489,9 @@ > res = __pthread_mutex_lock(&vg_sem->se_mx); > my_assert(res == 0); > while (vg_sem->count == 0) { >+ ++vg_sem->waiters; > res = pthread_cond_wait(&vg_sem->se_cv, &vg_sem->se_mx); >+ --vg_sem->waiters; > my_assert(res == 0); > } > vg_sem->count--; >@@ -2378,18 +2544,42 @@ > > int sem_getvalue(sem_t* sem, int * sval) > { >+ int res; > vg_sem_t* vg_sem; >- ensure_valgrind("sem_trywait"); >+ ensure_valgrind("sem_getvalue"); > vg_sem = se_remap(sem); >+ res = __pthread_mutex_lock(&vg_sem->se_mx); >+ my_assert(res == 0); > *sval = vg_sem->count; >+ res = __pthread_mutex_unlock(&vg_sem->se_mx); >+ my_assert(res == 0); > return 0; > } > > > int sem_destroy(sem_t * sem) > { >- kludged("sem_destroy", "(it always succeeds, even if semaphore waited on)"); > /* if someone waiting on this semaphore, errno = EBUSY, return -1 */ >+ vg_sem_t* vg_sem; >+ int res; >+ ensure_valgrind("sem_destroy"); >+ vg_sem = se_remap(sem); >+ res = __pthread_mutex_lock(&vg_sem->se_mx); >+ my_assert(res == 0); >+ if (vg_sem->waiters > 0) >+ { >+ *(__errno_location()) = EBUSY; >+ res = __pthread_mutex_unlock(&vg_sem->se_mx); >+ my_assert(res == 0); >+ return -1; >+ } >+ res = pthread_cond_destroy(&vg_sem->se_cv); >+ my_assert(res == 0); >+ res = __pthread_mutex_unlock(&vg_sem->se_mx); >+ my_assert(res == 0); >+ res = pthread_mutex_destroy(&vg_sem->se_mx); >+ my_assert(res == 0); >+ se_unmap(sem); > return 0; > } > >@@ -2403,7 +2593,9 @@ > res = __pthread_mutex_lock(&vg_sem->se_mx); > my_assert(res == 0); > while ( vg_sem->count == 0 && res != ETIMEDOUT ) { >+ ++vg_sem->waiters; > res = pthread_cond_timedwait(&vg_sem->se_cv, &vg_sem->se_mx, abstime); >+ --vg_sem->waiters; > } > if ( vg_sem->count > 0 ) { > vg_sem->count--; >@@ -2805,17 +2997,35 @@ > ------------------------------------------------------------------ */ > int __libc_current_sigrtmin (void) > { >- return VG_(sig_rtmin); >+ int res; >+ >+ VALGRIND_MAGIC_SEQUENCE(res, 0, >+ VG_USERREQ__GET_SIGRT_MIN, >+ 0, 0, 0, 0); >+ >+ return res; > } > > int __libc_current_sigrtmax (void) > { >- return VG_(sig_rtmax); >+ int res; >+ >+ VALGRIND_MAGIC_SEQUENCE(res, 0, >+ VG_USERREQ__GET_SIGRT_MAX, >+ 0, 0, 0, 0); >+ >+ return res; > } > > int __libc_allocate_rtsig (int high) > { >- return VG_(sig_alloc_rtsig)(high); >+ int res; >+ >+ VALGRIND_MAGIC_SEQUENCE(res, 0, >+ VG_USERREQ__ALLOC_RTSIG, >+ high, 0, 0, 0); >+ >+ return res; > } > > /* --------------------------------------------------------------------- >@@ -2856,15 +3066,20 @@ > weak_alias(pthread_rwlock_trywrlock, __pthread_rwlock_trywrlock) > > >-/* I've no idea what these are, but they get called quite a lot. >- Anybody know? */ >- > #ifndef __UCLIBC__ >+/* These are called as part of stdio to lock the FILE structure for MT >+ programs. Unfortunately, the lock is not always a pthreads lock - >+ the NPTL version uses a lighter-weight lock which uses futex >+ directly (and uses a structure which is smaller than >+ pthread_mutex). So basically, this is completely broken on recent >+ glibcs. */ >+ > #undef _IO_flockfile > void _IO_flockfile ( _IO_FILE * file ) > { > pthread_mutex_lock(file->_lock); > } >+strong_alias(_IO_flockfile, __flockfile); > weak_alias(_IO_flockfile, flockfile); > > #undef _IO_funlockfile >@@ -2872,6 +3087,7 @@ > { > pthread_mutex_unlock(file->_lock); > } >+strong_alias(_IO_funlockfile, __funlockfile); > weak_alias(_IO_funlockfile, funlockfile); > #endif > >diff -ruN valgrind-2.1.0/coregrind/vg_libpthread.vs valgrind/coregrind/vg_libpthread.vs >--- valgrind-2.1.0/coregrind/vg_libpthread.vs 2003-02-24 15:24:41.000000000 -0600 >+++ valgrind/coregrind/vg_libpthread.vs 2003-12-15 20:05:11.000000000 -0600 >@@ -1,22 +1,198 @@ >+ GLIBC_2.0 { >+ pthread_join; pthread_self; pthread_equal; >+ pthread_exit; pthread_detach; > >-GLIBC_2.0 { >-}; >+ pthread_getschedparam; pthread_setschedparam; > >-GLIBC_2.1 { >-} GLIBC_2.0; >+ pthread_attr_destroy; >+ pthread_attr_getdetachstate; pthread_attr_setdetachstate; >+ pthread_attr_getschedparam; pthread_attr_setschedparam; >+ pthread_attr_getschedpolicy; pthread_attr_setschedpolicy; >+ pthread_attr_getinheritsched; pthread_attr_setinheritsched; >+ pthread_attr_getscope; pthread_attr_setscope; > >-GLIBC_2.2 { >-} GLIBC_2.1; >+ pthread_mutex_init; pthread_mutex_destroy; >+ pthread_mutex_lock; pthread_mutex_trylock; pthread_mutex_unlock; > >-GLIBC_2.2.3 { >- __pthread_clock_gettime; >- __pthread_clock_settime; >-} GLIBC_2.2; >- >-GLIBC_2.3.2 { >-} GLIBC_2.2; >- >-GLIBC_PRIVATE { >- __pthread_clock_gettime; >- __pthread_clock_settime; >-}; >+ pthread_mutexattr_init; pthread_mutexattr_destroy; >+ >+ # Don't version these, because it doesn't matter for Valgrind's libpthread >+ #pthread_cond_init; pthread_cond_destroy; >+ #pthread_cond_wait; pthread_cond_timedwait; >+ #pthread_cond_signal; pthread_cond_broadcast; >+ >+ pthread_condattr_destroy; pthread_condattr_init; >+ >+ pthread_cancel; pthread_testcancel; >+ pthread_setcancelstate; pthread_setcanceltype; >+ >+ pthread_sigmask; pthread_kill; >+ >+ pthread_key_create; pthread_key_delete; >+ pthread_getspecific; pthread_setspecific; >+ >+ pthread_once; >+ >+ pthread_atfork; >+ >+ flockfile; funlockfile; ftrylockfile; >+ >+ # Non-standard POSIX1.x functions. >+ pthread_mutexattr_getkind_np; pthread_mutexattr_setkind_np; >+ >+ # Protected names for functions used in other shared objects. >+ __pthread_mutex_init; __pthread_mutex_destroy; >+ __pthread_mutex_lock; __pthread_mutex_trylock; __pthread_mutex_unlock; >+ __pthread_mutexattr_init; __pthread_mutexattr_destroy; >+ __pthread_mutexattr_settype; >+ __pthread_key_create; __pthread_getspecific; __pthread_setspecific; >+ __pthread_once; __pthread_atfork; >+ _IO_flockfile; _IO_ftrylockfile; _IO_funlockfile; >+ >+ # Hidden entry point (through macros). >+ #_pthread_cleanup_pop; _pthread_cleanup_pop_restore; _pthread_cleanup_push; >+ #_pthread_cleanup_push_defer; >+ >+ # Semaphores. >+ #sem_destroy; sem_getvalue; sem_init; sem_post; sem_trywait; sem_wait; >+ >+ # Special fork handling. >+ fork; __fork; vfork; >+ >+ # Cancellation points. >+ close; __close; fcntl; __fcntl; read; __read; write; __write; accept; >+ connect; __connect; recv; recvfrom; recvmsg; send; __send; sendmsg; sendto; >+ fsync; lseek; __lseek; msync; nanosleep; open; __open; pause; tcdrain; >+ system; wait; __wait; waitpid; >+ >+ # Hidden entry point (through macros). >+ _pthread_cleanup_push; _pthread_cleanup_pop; >+ _pthread_cleanup_push_defer; _pthread_cleanup_pop_restore; >+ >+ pthread_kill_other_threads_np; >+ >+ # The error functions. >+ __errno_location; __h_errno_location; >+ >+ # Functions which previously have been overwritten. >+ sigwait; sigaction; __sigaction; _exit; _Exit; longjmp; siglongjmp; >+ raise; >+ }; >+ >+ GLIBC_2.1 { >+ pthread_create; >+ pthread_attr_init; >+ >+ pthread_attr_getguardsize; pthread_attr_setguardsize; >+ pthread_attr_getstackaddr; pthread_attr_setstackaddr; >+ pthread_attr_getstacksize; pthread_attr_setstacksize; >+ >+ pthread_mutexattr_gettype; pthread_mutexattr_settype; >+ >+ pthread_rwlock_init; pthread_rwlock_destroy; >+ pthread_rwlock_rdlock; pthread_rwlock_wrlock; pthread_rwlock_unlock; >+ pthread_rwlock_tryrdlock; pthread_rwlock_trywrlock; >+ >+ pthread_rwlockattr_init; pthread_rwlockattr_destroy; >+ pthread_rwlockattr_getpshared; pthread_rwlockattr_setpshared; >+ pthread_rwlockattr_getkind_np; pthread_rwlockattr_setkind_np; >+ >+ pthread_getconcurrency; pthread_setconcurrency; >+ >+ # Semaphores. >+ sem_destroy; sem_getvalue; sem_init; sem_post; sem_trywait; sem_wait; >+ >+ __libc_current_sigrtmin; __libc_current_sigrtmax; >+ __libc_allocate_rtsig; >+ } GLIBC_2.0; >+ >+ GLIBC_2.1.1 { >+ sem_close; sem_open; sem_unlink; >+ } GLIBC_2.1; >+ >+ GLIBC_2.1.2 { >+ __vfork; >+ } GLIBC_2.1.1; >+ >+ GLIBC_2.2 { >+ pthread_mutexattr_getpshared; pthread_mutexattr_setpshared; >+ >+ pthread_condattr_getpshared; pthread_condattr_setpshared; >+ >+ # New functions from IEEE Std. 1003.1-2001. >+ pthread_mutex_timedlock; >+ >+ pthread_rwlock_timedrdlock; pthread_rwlock_timedwrlock; >+ >+ pthread_attr_getstack; pthread_attr_setstack; >+ >+ pthread_spin_destroy; pthread_spin_init; pthread_spin_lock; >+ pthread_spin_trylock; pthread_spin_unlock; >+ >+ pthread_barrier_init; pthread_barrier_destroy; pthread_barrier_wait; >+ pthread_barrierattr_destroy; pthread_barrierattr_init; >+ pthread_barrierattr_setpshared; >+ >+ sem_timedwait; >+ >+ pthread_yield; >+ >+ pthread_getcpuclockid; >+ >+ # Cancellation points. >+ lseek64; open64; __open64; pread; pread64; __pread64; pwrite; pwrite64; >+ __pwrite64; >+ >+ # Names used internally. >+ __pthread_rwlock_init; __pthread_rwlock_destroy; >+ __pthread_rwlock_rdlock; __pthread_rwlock_tryrdlock; >+ __pthread_rwlock_wrlock; __pthread_rwlock_trywrlock; >+ __pthread_rwlock_unlock; >+ >+ __res_state; >+ } GLIBC_2.1.2; >+ >+ GLIBC_2.2.3 { >+ # Extensions. >+ pthread_getattr_np; >+ } GLIBC_2.2; >+ >+ GLIBC_2.2.6 { >+ # Cancellation wrapper >+ __nanosleep; >+ } GLIBC_2.2.3; >+ >+ GLIBC_2.3.2 { >+ # Changed pthread_cond_t. >+ # Don't version these, because it doesn't matter for Valgrind's libpthread >+ #pthread_cond_init; pthread_cond_destroy; >+ #pthread_cond_wait; pthread_cond_timedwait; >+ #pthread_cond_signal; pthread_cond_broadcast; >+ } GLIBC_2.2.6; >+ >+ GLIBC_2.3.3 { >+ # 1003.1-2001 function accidentally left out in 2.2. >+ pthread_barrierattr_getpshared; >+ >+ # Unix CS option. >+ pthread_condattr_getclock; pthread_condattr_setclock; >+ >+ # Proposed API extensions. >+ pthread_tryjoin_np; pthread_timedjoin_np; >+ >+ # New cancellation cleanup handling. >+ __pthread_register_cancel; __pthread_unregister_cancel; >+ __pthread_register_cancel_defer; __pthread_unregister_cancel_restore; >+ __pthread_unwind_next; >+ __pthread_cleanup_routine; >+ >+ # New affinity interfaces. >+ pthread_getaffinity_np; pthread_setaffinity_np; >+ pthread_attr_getaffinity_np; pthread_attr_setaffinity_np; >+ } GLIBC_2.3.2; >+ >+ GLIBC_PRIVATE { >+ __pthread_initialize_minimal; __pthread_cleanup_upto; >+ __pthread_clock_gettime; __pthread_clock_settime; >+ __pthread_unwind; >+ }; >diff -ruN valgrind-2.1.0/coregrind/vg_libpthread_unimp.c valgrind/coregrind/vg_libpthread_unimp.c >--- valgrind-2.1.0/coregrind/vg_libpthread_unimp.c 2003-10-12 03:33:30.000000000 -0500 >+++ valgrind/coregrind/vg_libpthread_unimp.c 2004-01-04 10:43:19.000000000 -0600 >@@ -8,7 +8,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >diff -ruN valgrind-2.1.0/coregrind/vg_main.c valgrind/coregrind/vg_main.c >--- valgrind-2.1.0/coregrind/vg_main.c 2003-12-02 04:41:18.000000000 -0600 >+++ valgrind/coregrind/vg_main.c 2004-02-11 17:33:27.000000000 -0600 >@@ -1,14 +1,13 @@ > > /*--------------------------------------------------------------------*/ >-/*--- C startup stuff, reached from vg_startup.S. ---*/ >-/*--- vg_main.c ---*/ >+/*--- Startup: the real stuff vg_main.c ---*/ > /*--------------------------------------------------------------------*/ > > /* > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -29,96 +28,104 @@ > The GNU General Public License is contained in the file COPYING. > */ > >+#define _FILE_OFFSET_BITS 64 >+ > #include "vg_include.h" >+#include "ume.h" >+#include "ume_arch.h" >+#include "ume_archdefs.h" >+ >+#include <dirent.h> >+#include <dlfcn.h> >+#include <errno.h> >+#include <fcntl.h> >+#include <stdio.h> >+#include <stdlib.h> >+#include <string.h> >+#include <sys/mman.h> >+#include <sys/types.h> >+#include <sys/stat.h> >+#include <sys/ptrace.h> >+#include <sys/signal.h> >+#include <sys/user.h> >+#include <sys/wait.h> >+#include <unistd.h> >+ >+#ifndef AT_SYSINFO >+#define AT_SYSINFO 32 >+#endif /* AT_SYSINFO */ >+ >+#ifndef AT_SYSINFO_EHDR >+#define AT_SYSINFO_EHDR 33 >+#endif /* AT_SYSINFO_EHDR */ >+ >+#ifndef AT_SECURE >+#define AT_SECURE 23 /* secure mode boolean */ >+#endif /* AT_SECURE */ >+ >+/* Amount to reserve for Valgrind's internal heap */ >+#define VALGRIND_HEAPSIZE (128*1024*1024) >+ >+/* Amount to reserve for Valgrind's internal mappings */ >+#define VALGRIND_MAPSIZE (128*1024*1024) >+ >+/* redzone gap between client address space and shadow */ >+#define REDZONE_SIZE (1 * 1024*1024) >+ >+/* size multiple for client address space */ >+#define CLIENT_SIZE_MULTIPLE (64 * 1024*1024) >+ >+#define ISSPACE(cc) ((cc) == ' ' || (cc) == '\t' || (cc) == '\n') >+ >+/*====================================================================*/ >+/*=== Global entities not referenced from generated code ===*/ >+/*====================================================================*/ > > /* --------------------------------------------------------------------- >- Compute offsets into baseBlock. See comments in vg_include.h. >+ Startup stuff > ------------------------------------------------------------------ */ >+/* linker-defined base address */ >+extern char kickstart_base; > >-/* The variables storing offsets. */ >- >-#define INVALID_OFFSET (-1) >+/* Client address space, lowest to highest (see top of ume.c) */ >+Addr VG_(client_base); /* client address space limits */ >+Addr VG_(client_end); >+Addr VG_(client_mapbase); >+Addr VG_(client_trampoline_code); >+Addr VG_(clstk_base); >+Addr VG_(clstk_end); >+ >+Addr VG_(brk_base); /* start of brk */ >+Addr VG_(brk_limit); /* current brk */ >+ >+Addr VG_(shadow_base); /* skin's shadow memory */ >+Addr VG_(shadow_end); >+ >+Addr VG_(valgrind_base); /* valgrind's address range */ >+Addr VG_(valgrind_mmap_end); /* valgrind's mmaps are between valgrind_base and here */ >+Addr VG_(valgrind_end); >+ >+/* This is set early to indicate whether this CPU has the >+ SSE/fxsave/fxrestor features. */ >+Bool VG_(have_ssestate); > >-Int VGOFF_(m_eax) = INVALID_OFFSET; >-Int VGOFF_(m_ecx) = INVALID_OFFSET; >-Int VGOFF_(m_edx) = INVALID_OFFSET; >-Int VGOFF_(m_ebx) = INVALID_OFFSET; >-Int VGOFF_(m_esp) = INVALID_OFFSET; >-Int VGOFF_(m_ebp) = INVALID_OFFSET; >-Int VGOFF_(m_esi) = INVALID_OFFSET; >-Int VGOFF_(m_edi) = INVALID_OFFSET; >-Int VGOFF_(m_eflags) = INVALID_OFFSET; >-Int VGOFF_(m_dflag) = INVALID_OFFSET; >-Int VGOFF_(m_ssestate) = INVALID_OFFSET; >-Int VGOFF_(ldt) = INVALID_OFFSET; >-Int VGOFF_(m_cs) = INVALID_OFFSET; >-Int VGOFF_(m_ss) = INVALID_OFFSET; >-Int VGOFF_(m_ds) = INVALID_OFFSET; >-Int VGOFF_(m_es) = INVALID_OFFSET; >-Int VGOFF_(m_fs) = INVALID_OFFSET; >-Int VGOFF_(m_gs) = INVALID_OFFSET; >-Int VGOFF_(m_eip) = INVALID_OFFSET; >-Int VGOFF_(spillslots) = INVALID_OFFSET; >-Int VGOFF_(sh_eax) = INVALID_OFFSET; >-Int VGOFF_(sh_ecx) = INVALID_OFFSET; >-Int VGOFF_(sh_edx) = INVALID_OFFSET; >-Int VGOFF_(sh_ebx) = INVALID_OFFSET; >-Int VGOFF_(sh_esp) = INVALID_OFFSET; >-Int VGOFF_(sh_ebp) = INVALID_OFFSET; >-Int VGOFF_(sh_esi) = INVALID_OFFSET; >-Int VGOFF_(sh_edi) = INVALID_OFFSET; >-Int VGOFF_(sh_eflags) = INVALID_OFFSET; >- >-Int VGOFF_(helper_idiv_64_32) = INVALID_OFFSET; >-Int VGOFF_(helper_div_64_32) = INVALID_OFFSET; >-Int VGOFF_(helper_idiv_32_16) = INVALID_OFFSET; >-Int VGOFF_(helper_div_32_16) = INVALID_OFFSET; >-Int VGOFF_(helper_idiv_16_8) = INVALID_OFFSET; >-Int VGOFF_(helper_div_16_8) = INVALID_OFFSET; >-Int VGOFF_(helper_imul_32_64) = INVALID_OFFSET; >-Int VGOFF_(helper_mul_32_64) = INVALID_OFFSET; >-Int VGOFF_(helper_imul_16_32) = INVALID_OFFSET; >-Int VGOFF_(helper_mul_16_32) = INVALID_OFFSET; >-Int VGOFF_(helper_imul_8_16) = INVALID_OFFSET; >-Int VGOFF_(helper_mul_8_16) = INVALID_OFFSET; >-Int VGOFF_(helper_CLD) = INVALID_OFFSET; >-Int VGOFF_(helper_STD) = INVALID_OFFSET; >-Int VGOFF_(helper_get_dirflag) = INVALID_OFFSET; >-Int VGOFF_(helper_CLC) = INVALID_OFFSET; >-Int VGOFF_(helper_STC) = INVALID_OFFSET; >-Int VGOFF_(helper_shldl) = INVALID_OFFSET; >-Int VGOFF_(helper_shldw) = INVALID_OFFSET; >-Int VGOFF_(helper_shrdl) = INVALID_OFFSET; >-Int VGOFF_(helper_shrdw) = INVALID_OFFSET; >-Int VGOFF_(helper_IN) = INVALID_OFFSET; >-Int VGOFF_(helper_OUT) = INVALID_OFFSET; >-Int VGOFF_(helper_RDTSC) = INVALID_OFFSET; >-Int VGOFF_(helper_CPUID) = INVALID_OFFSET; >-Int VGOFF_(helper_BSWAP) = INVALID_OFFSET; >-Int VGOFF_(helper_bsf) = INVALID_OFFSET; >-Int VGOFF_(helper_bsr) = INVALID_OFFSET; >-Int VGOFF_(helper_fstsw_AX) = INVALID_OFFSET; >-Int VGOFF_(helper_SAHF) = INVALID_OFFSET; >-Int VGOFF_(helper_LAHF) = INVALID_OFFSET; >-Int VGOFF_(helper_DAS) = INVALID_OFFSET; >-Int VGOFF_(helper_DAA) = INVALID_OFFSET; >-Int VGOFF_(helper_undefined_instruction) = INVALID_OFFSET; >+/* Indicates presence, and holds address of client's sysinfo page, a >+ feature of some modern kernels used to provide vsyscalls, etc. */ >+Bool VG_(sysinfo_page_exists) = False; >+Addr VG_(sysinfo_page_addr) = 0; > >-/* MAX_NONCOMPACT_HELPERS can be increased easily. If MAX_COMPACT_HELPERS is >- * increased too much, they won't really be compact any more... */ >-#define MAX_COMPACT_HELPERS 8 >-#define MAX_NONCOMPACT_HELPERS 50 >+/* stage1 (main) executable */ >+Int VG_(vgexecfd) = -1; > >-UInt VG_(n_compact_helpers) = 0; >-UInt VG_(n_noncompact_helpers) = 0; >+/* client executable */ >+Int VG_(clexecfd) = -1; > >-Addr VG_(compact_helper_addrs) [MAX_COMPACT_HELPERS]; >-Int VG_(compact_helper_offsets)[MAX_COMPACT_HELPERS]; >-Addr VG_(noncompact_helper_addrs) [MAX_NONCOMPACT_HELPERS]; >-Int VG_(noncompact_helper_offsets)[MAX_NONCOMPACT_HELPERS]; >+/* Path to library directory */ >+const Char *VG_(libdir) = VG_LIBDIR; > >-/* This is the actual defn of baseblock. */ >-UInt VG_(baseBlock)[VG_BASEBLOCK_WORDS]; >+/* our argc/argv */ >+Int VG_(vg_argc); >+Char **VG_(vg_argv); > > /* PID of the main thread */ > Int VG_(main_pid); >@@ -126,409 +133,1271 @@ > /* PGRP of process */ > Int VG_(main_pgrp); > >-/* Words. */ >-static Int baB_off = 0; >+/* Maximum allowed application-visible file descriptor */ >+Int VG_(max_fd) = -1; >+ >+/* As deduced from esp_at_startup, the client's argc, argv[] and >+ envp[] as extracted from the client's stack at startup-time. */ >+Int VG_(client_argc); >+Char** VG_(client_argv); >+Char** VG_(client_envp); >+ >+/* --------------------------------------------------------------------- >+ Running stuff >+ ------------------------------------------------------------------ */ >+/* Our signal delivery stack. */ >+UInt VG_(sigstack)[VG_SIGSTACK_SIZE_W]; >+ >+/* Saving stuff across system calls. */ >+__attribute__ ((aligned (16))) >+UInt VG_(real_sse_state_saved_over_syscall)[VG_SIZE_OF_SSESTATE_W]; >+Addr VG_(esp_saved_over_syscall); > > /* jmp_buf for fatal signals */ > Int VG_(fatal_sigNo) = -1; > Bool VG_(fatal_signal_set) = False; > jmp_buf VG_(fatal_signal_jmpbuf); > >-/* Returns the offset, in words. */ >-static Int alloc_BaB ( Int words ) >+/* Counts downwards in VG_(run_innerloop). */ >+UInt VG_(dispatch_ctr); >+ >+/* 64-bit counter for the number of basic blocks done. */ >+ULong VG_(bbs_done); >+ >+/* This is the ThreadId of the last thread the scheduler ran. */ >+ThreadId VG_(last_run_tid) = 0; >+ >+/* Tell the logging mechanism whether we are logging to a file >+ descriptor or a socket descriptor. */ >+Bool VG_(logging_to_filedes) = True; >+ >+/* This Bool is needed by wrappers in vg_clientmalloc.c to decide how >+ to behave. Initially we say False. */ >+Bool VG_(running_on_simd_CPU) = False; >+ >+/* This is the argument to __NR_exit() supplied by the first thread to >+ call that syscall. We eventually pass that to __NR_exit() for >+ real. */ >+Int VG_(exitcode) = 0; >+ >+ >+/*====================================================================*/ >+/*=== Counters, for profiling purposes only ===*/ >+/*====================================================================*/ >+ >+/* Number of lookups which miss the fast tt helper. */ >+UInt VG_(tt_fast_misses) = 0; >+ >+ >+/* Counts for TT/TC informational messages. */ >+ >+/* Number and total o/t size of translations overall. */ >+UInt VG_(overall_in_count) = 0; >+UInt VG_(overall_in_osize) = 0; >+UInt VG_(overall_in_tsize) = 0; >+/* Number and total o/t size of discards overall. */ >+UInt VG_(overall_out_count) = 0; >+UInt VG_(overall_out_osize) = 0; >+UInt VG_(overall_out_tsize) = 0; >+/* The number of discards of TT/TC. */ >+UInt VG_(number_of_tc_discards) = 0; >+/* Counts of chain and unchain operations done. */ >+UInt VG_(bb_enchain_count) = 0; >+UInt VG_(bb_dechain_count) = 0; >+/* Number of unchained jumps performed. */ >+UInt VG_(unchained_jumps_done) = 0; >+ >+ >+/* Counts pertaining to the register allocator. */ >+ >+/* total number of uinstrs input to reg-alloc */ >+UInt VG_(uinstrs_prealloc) = 0; >+ >+/* total number of uinstrs added due to spill code */ >+UInt VG_(uinstrs_spill) = 0; >+ >+/* number of bbs requiring spill code */ >+UInt VG_(translations_needing_spill) = 0; >+ >+/* total of register ranks over all translations */ >+UInt VG_(total_reg_rank) = 0; >+ >+ >+/* Counts pertaining to internal sanity checking. */ >+UInt VG_(sanity_fast_count) = 0; >+UInt VG_(sanity_slow_count) = 0; >+ >+/* Counts pertaining to the scheduler. */ >+UInt VG_(num_scheduling_events_MINOR) = 0; >+UInt VG_(num_scheduling_events_MAJOR) = 0; >+ >+ >+static __inline__ Int safe_idiv(Int a, Int b) > { >- Int off = baB_off; >- baB_off += words; >- if (baB_off >= VG_BASEBLOCK_WORDS) >- VG_(core_panic)( "alloc_BaB: baseBlock is too small"); >+ return (b == 0 ? 0 : a / b); >+} > >- return off; >+static void show_counts ( void ) >+{ >+ VG_(message)(Vg_DebugMsg, >+ " TT/TC: %d tc sectors discarded.", >+ VG_(number_of_tc_discards) ); >+ VG_(message)(Vg_DebugMsg, >+ " %d chainings, %d unchainings.", >+ VG_(bb_enchain_count), VG_(bb_dechain_count) ); >+ VG_(message)(Vg_DebugMsg, >+ "translate: new %d (%d -> %d; ratio %d:10)", >+ VG_(overall_in_count), >+ VG_(overall_in_osize), >+ VG_(overall_in_tsize), >+ safe_idiv(10*VG_(overall_in_tsize), VG_(overall_in_osize))); >+ VG_(message)(Vg_DebugMsg, >+ " discard %d (%d -> %d; ratio %d:10).", >+ VG_(overall_out_count), >+ VG_(overall_out_osize), >+ VG_(overall_out_tsize), >+ safe_idiv(10*VG_(overall_out_tsize), VG_(overall_out_osize))); >+ VG_(message)(Vg_DebugMsg, >+ " dispatch: %llu jumps (bb entries), of which %u (%lu%%) were unchained.", >+ VG_(bbs_done), >+ VG_(unchained_jumps_done), >+ ((ULong)(100) * (ULong)(VG_(unchained_jumps_done))) >+ / ( VG_(bbs_done)==0 ? 1 : VG_(bbs_done) ) >+ ); >+ >+ VG_(message)(Vg_DebugMsg, >+ " %d/%d major/minor sched events. %d tt_fast misses.", >+ VG_(num_scheduling_events_MAJOR), >+ VG_(num_scheduling_events_MINOR), >+ VG_(tt_fast_misses)); >+ >+ VG_(message)(Vg_DebugMsg, >+ "reg-alloc: %d t-req-spill, " >+ "%d+%d orig+spill uis, %d total-reg-r.", >+ VG_(translations_needing_spill), >+ VG_(uinstrs_prealloc), >+ VG_(uinstrs_spill), >+ VG_(total_reg_rank) ); >+ VG_(message)(Vg_DebugMsg, >+ " sanity: %d cheap, %d expensive checks.", >+ VG_(sanity_fast_count), >+ VG_(sanity_slow_count) ); >+ VG_(print_ccall_stats)(); > } > >-/* Align offset, in *bytes* */ >-static void align_BaB ( UInt align ) >+ >+/*====================================================================*/ >+/*=== Miscellaneous global functions ===*/ >+/*====================================================================*/ >+ >+/* Start debugger and get it to attach to this process. Called if the >+ user requests this service after an error has been shown, so she can >+ poke around and look at parameters, memory, etc. You can't >+ meaningfully get the debugger to continue the program, though; to >+ continue, quit the debugger. */ >+void VG_(start_debugger) ( Int tid ) >+{ >+ Int pid; >+ >+ if ((pid = fork()) == 0) { >+ ptrace(PTRACE_TRACEME, 0, NULL, NULL); >+ VG_(kkill)(VG_(getpid)(), VKI_SIGSTOP); >+ >+ } else if (pid > 0) { >+ struct user_regs_struct regs; >+ Int status; >+ Int res; >+ >+ if (VG_(is_running_thread)( tid )) { >+ regs.xcs = VG_(baseBlock)[VGOFF_(m_cs)]; >+ regs.xss = VG_(baseBlock)[VGOFF_(m_ss)]; >+ regs.xds = VG_(baseBlock)[VGOFF_(m_ds)]; >+ regs.xes = VG_(baseBlock)[VGOFF_(m_es)]; >+ regs.xfs = VG_(baseBlock)[VGOFF_(m_fs)]; >+ regs.xgs = VG_(baseBlock)[VGOFF_(m_gs)]; >+ regs.eax = VG_(baseBlock)[VGOFF_(m_eax)]; >+ regs.ebx = VG_(baseBlock)[VGOFF_(m_ebx)]; >+ regs.ecx = VG_(baseBlock)[VGOFF_(m_ecx)]; >+ regs.edx = VG_(baseBlock)[VGOFF_(m_edx)]; >+ regs.esi = VG_(baseBlock)[VGOFF_(m_esi)]; >+ regs.edi = VG_(baseBlock)[VGOFF_(m_edi)]; >+ regs.ebp = VG_(baseBlock)[VGOFF_(m_ebp)]; >+ regs.esp = VG_(baseBlock)[VGOFF_(m_esp)]; >+ regs.eflags = VG_(baseBlock)[VGOFF_(m_eflags)]; >+ regs.eip = VG_(baseBlock)[VGOFF_(m_eip)]; >+ } else { >+ ThreadState* tst = & VG_(threads)[ tid ]; >+ >+ regs.xcs = tst->m_cs; >+ regs.xss = tst->m_ss; >+ regs.xds = tst->m_ds; >+ regs.xes = tst->m_es; >+ regs.xfs = tst->m_fs; >+ regs.xgs = tst->m_gs; >+ regs.eax = tst->m_eax; >+ regs.ebx = tst->m_ebx; >+ regs.ecx = tst->m_ecx; >+ regs.edx = tst->m_edx; >+ regs.esi = tst->m_esi; >+ regs.edi = tst->m_edi; >+ regs.ebp = tst->m_ebp; >+ regs.esp = tst->m_esp; >+ regs.eflags = tst->m_eflags; >+ regs.eip = tst->m_eip; >+ } >+ >+ if ((res = VG_(waitpid)(pid, &status, 0)) == pid && >+ WIFSTOPPED(status) && WSTOPSIG(status) == SIGSTOP && >+ ptrace(PTRACE_SETREGS, pid, NULL, ®s) == 0 && >+ ptrace(PTRACE_DETACH, pid, NULL, SIGSTOP) == 0) { >+ Char pidbuf[15]; >+ Char file[30]; >+ Char buf[100]; >+ Char *bufptr; >+ Char *cmdptr; >+ >+ VG_(sprintf)(pidbuf, "%d", pid); >+ VG_(sprintf)(file, "/proc/%d/fd/%d", pid, VG_(clexecfd)); >+ >+ bufptr = buf; >+ cmdptr = VG_(clo_db_command); >+ >+ while (*cmdptr) { >+ switch (*cmdptr) { >+ case '%': >+ switch (*++cmdptr) { >+ case 'f': >+ VG_(memcpy)(bufptr, file, VG_(strlen)(file)); >+ bufptr += VG_(strlen)(file); >+ cmdptr++; >+ break; >+ case 'p': >+ VG_(memcpy)(bufptr, pidbuf, VG_(strlen)(pidbuf)); >+ bufptr += VG_(strlen)(pidbuf); >+ cmdptr++; >+ break; >+ default: >+ *bufptr++ = *cmdptr++; >+ break; >+ } >+ break; >+ default: >+ *bufptr++ = *cmdptr++; >+ break; >+ } >+ } >+ >+ *bufptr++ = '\0'; >+ >+ VG_(message)(Vg_UserMsg, "starting debugger with cmd: %s", buf); >+ res = VG_(system)(buf); >+ if (res == 0) { >+ VG_(message)(Vg_UserMsg, ""); >+ VG_(message)(Vg_UserMsg, >+ "Debugger has detached. Valgrind regains control. We continue."); >+ } else { >+ VG_(message)(Vg_UserMsg, "Apparently failed!"); >+ VG_(message)(Vg_UserMsg, ""); >+ } >+ } >+ >+ VG_(kkill)(pid, VKI_SIGKILL); >+ VG_(waitpid)(pid, &status, 0); >+ } >+} >+ >+ >+/* Print some helpful-ish text about unimplemented things, and give >+ up. */ >+void VG_(unimplemented) ( Char* msg ) > { >- vg_assert(2 == align || 4 == align || 8 == align || 16 == align); >- baB_off += (align-1); >- baB_off &= ~(align-1); >+ VG_(message)(Vg_UserMsg, ""); >+ VG_(message)(Vg_UserMsg, >+ "Valgrind detected that your program requires"); >+ VG_(message)(Vg_UserMsg, >+ "the following unimplemented functionality:"); >+ VG_(message)(Vg_UserMsg, " %s", msg); >+ VG_(message)(Vg_UserMsg, >+ "This may be because the functionality is hard to implement,"); >+ VG_(message)(Vg_UserMsg, >+ "or because no reasonable program would behave this way,"); >+ VG_(message)(Vg_UserMsg, >+ "or because nobody has yet needed it. In any case, let us know at"); >+ VG_(message)(Vg_UserMsg, >+ "%s and/or try to work around the problem, if you can.", VG_BUGS_TO); >+ VG_(message)(Vg_UserMsg, >+ ""); >+ VG_(message)(Vg_UserMsg, >+ "Valgrind has to exit now. Sorry. Bye!"); >+ VG_(message)(Vg_UserMsg, >+ ""); >+ VG_(pp_sched_status)(); >+ VG_(exit)(1); > } > >-/* Allocate 1 word in baseBlock and set it to the given value. */ >-static Int alloc_BaB_1_set ( Addr a ) >+Addr VG_(get_stack_pointer) ( void ) > { >- Int off = alloc_BaB(1); >- VG_(baseBlock)[off] = (UInt)a; >- return off; >+ return VG_(baseBlock)[VGOFF_(m_esp)]; > } > >-/* Registers a function in compact_helper_addrs; compact_helper_offsets is >- filled in later. */ >-void VG_(register_compact_helper)(Addr a) >+/* Debugging thing .. can be called from assembly with OYNK macro. */ >+void VG_(oynk) ( Int n ) > { >- if (MAX_COMPACT_HELPERS <= VG_(n_compact_helpers)) { >- VG_(printf)("Can only register %d compact helpers\n", >- MAX_COMPACT_HELPERS); >- VG_(core_panic)("Too many compact helpers registered"); >+ OINK(n); >+} >+ >+/* Initialize the PID and PGRP of scheduler LWP; this is also called >+ in any new children after fork. */ >+static void newpid(ThreadId unused) >+{ >+ /* PID of scheduler LWP */ >+ VG_(main_pid) = VG_(getpid)(); >+ VG_(main_pgrp) = VG_(getpgrp)(); >+} >+ >+/*====================================================================*/ >+/*=== Check we were launched by stage 1 ===*/ >+/*====================================================================*/ >+ >+/* Look for our AUXV table */ >+static void scan_auxv(void) >+{ >+ const struct ume_auxv *auxv = find_auxv((int *)ume_exec_esp); >+ int found = 0; >+ >+ for (; auxv->a_type != AT_NULL; auxv++) >+ switch(auxv->a_type) { >+ case AT_UME_PADFD: >+ as_setpadfd(auxv->u.a_val); >+ found |= 1; >+ break; >+ >+ case AT_UME_EXECFD: >+ VG_(vgexecfd) = auxv->u.a_val; >+ found |= 2; >+ break; >+ } >+ >+ if ( ! (1|2) ) { >+ fprintf(stderr, "stage2 must be launched by stage1\n"); >+ exit(127); >+ } >+} >+ >+ >+/*====================================================================*/ >+/*=== Address space determination ===*/ >+/*====================================================================*/ >+ >+/* Pad client space so it doesn't get filled in before the right time */ >+static void layout_client_space(Addr argc_addr) >+{ >+ VG_(client_base) = CLIENT_BASE; >+ VG_(valgrind_mmap_end) = (addr_t)&kickstart_base; /* end of V's mmaps */ >+ VG_(valgrind_base) = VG_(valgrind_mmap_end) - VALGRIND_MAPSIZE; >+ VG_(valgrind_end) = ROUNDUP(argc_addr, 0x10000); /* stack */ >+ >+ if (0) >+ printf("client base: %x\n" >+ "valgrind base--end: %x--%x (%x)\n" >+ "valgrind mmap end: %x\n\n", >+ VG_(client_base), >+ VG_(valgrind_base), VG_(valgrind_end), >+ VG_(valgrind_end) - VG_(valgrind_base), >+ VG_(valgrind_mmap_end)); >+ >+ as_pad((void *)VG_(client_base), (void *)VG_(valgrind_base)); >+} >+ >+static void layout_remaining_space(float ratio) >+{ >+ /* This tries to give the client as large as possible address space while >+ * taking into account the tool's shadow needs. */ >+ addr_t client_size = ROUNDDN((VG_(valgrind_base) - REDZONE_SIZE) / (1. + ratio), >+ CLIENT_SIZE_MULTIPLE); >+ addr_t shadow_size = PGROUNDUP(client_size * ratio); >+ >+ VG_(client_end) = VG_(client_base) + client_size; >+ VG_(client_mapbase) = PGROUNDDN((client_size/4)*3); /* where !FIXED mmap goes */ >+ VG_(client_trampoline_code) = VG_(client_end) - VKI_BYTES_PER_PAGE; >+ >+ VG_(shadow_base) = VG_(client_end) + REDZONE_SIZE; >+ VG_(shadow_end) = VG_(shadow_base) + shadow_size; >+ >+ if (0) >+ printf("client base--end: %x--%x (%x)\n" >+ "client mapbase: %x\n" >+ "shadow base--end: %x--%x (%x)\n\n", >+ VG_(client_base), VG_(client_end), client_size, >+ VG_(client_mapbase), >+ VG_(shadow_base), VG_(shadow_end), shadow_size); >+ >+ // Ban redzone >+ mmap((void *)VG_(client_end), REDZONE_SIZE, PROT_NONE, >+ MAP_FIXED|MAP_ANON|MAP_PRIVATE, -1, 0); >+ >+ // Make client hole >+ munmap((void*)VG_(client_base), client_size); >+ >+ // Map shadow memory. >+ // Initially all inaccessible, incrementally initialized as it is used >+ if (shadow_size != 0) >+ mmap((char *)VG_(shadow_base), shadow_size, PROT_NONE, >+ MAP_PRIVATE|MAP_ANON|MAP_FIXED, -1, 0); >+} >+ >+/*====================================================================*/ >+/*=== Command line setup ===*/ >+/*====================================================================*/ >+ >+/* Nb: malloc'd memory never freed -- kept throughout like argv, envp */ >+static char* get_file_clo(char* dir) >+{ >+# define FLEN 512 >+ Int fd, n; >+ struct stat s1; >+ char* f_clo = NULL; >+ char filename[FLEN]; >+ >+ snprintf(filename, FLEN, "%s/.valgrindrc", ( NULL == dir ? "" : dir ) ); >+ fd = VG_(open)(filename, 0, VKI_S_IRUSR); >+ if ( fd > 0 ) { >+ if ( 0 == fstat(fd, &s1) ) { >+ f_clo = malloc(s1.st_size+1); >+ vg_assert(f_clo); >+ n = read(fd, f_clo, s1.st_size); >+ if (n == -1) n = 0; >+ f_clo[n] = '\0'; >+ } >+ close(fd); > } >- VG_(compact_helper_addrs)[VG_(n_compact_helpers)] = a; >- VG_(n_compact_helpers)++; >+ return f_clo; >+# undef FLEN > } > >-/* Registers a function in noncompact_helper_addrs; noncompact_helper_offsets >- * is filled in later. >- */ >-void VG_(register_noncompact_helper)(Addr a) >+static Int count_args(char* s) > { >- if (MAX_NONCOMPACT_HELPERS <= VG_(n_noncompact_helpers)) { >- VG_(printf)("Can only register %d non-compact helpers\n", >- MAX_NONCOMPACT_HELPERS); >- VG_(printf)("Try increasing MAX_NON_COMPACT_HELPERS\n"); >- VG_(core_panic)("Too many non-compact helpers registered"); >+ Int n = 0; >+ if (s) { >+ char* cp = s; >+ while (True) { >+ // We have alternating sequences: blanks, non-blanks, blanks... >+ // count the non-blanks sequences. >+ while ( ISSPACE(*cp) ) cp++; >+ if ( !*cp ) break; >+ n++; >+ while ( !ISSPACE(*cp) && *cp ) cp++; >+ } > } >- VG_(noncompact_helper_addrs)[VG_(n_noncompact_helpers)] = a; >- VG_(n_noncompact_helpers)++; >+ return n; > } > >-/* Allocate offsets in baseBlock for the skin helpers */ >-static >-void assign_helpers_in_baseBlock(UInt n, Int offsets[], Addr addrs[]) >+/* add args out of environment, skipping multiple spaces and -- args */ >+static char** copy_args( char* s, char** to ) > { >- UInt i; >- for (i = 0; i < n; i++) >- offsets[i] = alloc_BaB_1_set( addrs[i] ); >+ if (s) { >+ char* cp = s; >+ while (True) { >+ // We have alternating sequences: blanks, non-blanks, blanks... >+ // copy the non-blanks sequences, and add terminating '\0' >+ while ( ISSPACE(*cp) ) cp++; >+ if ( !*cp ) break; >+ *to++ = cp; >+ while ( !ISSPACE(*cp) && *cp ) cp++; >+ if ( *cp ) *cp++ = '\0'; // terminate if necessary >+ if (VG_STREQ(to[-1], "--")) to--; // undo any '--' arg >+ } >+ } >+ return to; > } > >-Bool VG_(need_to_handle_esp_assignment)(void) >+// Augment command line with arguments from environment and .valgrindrc >+// files. >+static void augment_command_line(Int* vg_argc_inout, char*** vg_argv_inout) >+{ >+ int vg_argc = *vg_argc_inout; >+ char** vg_argv = *vg_argv_inout; >+ >+ char* env_clo = getenv(VALGRINDOPTS); >+ char* f1_clo = get_file_clo( getenv("HOME") ); >+ char* f2_clo = get_file_clo("."); >+ >+ /* copy any extra args from file or environment, if present */ >+ if ( (env_clo && *env_clo) || (f1_clo && *f1_clo) || (f2_clo && *f2_clo) ) { >+ /* ' ' separated extra options */ >+ char **from; >+ char **to; >+ int env_arg_count, f1_arg_count, f2_arg_count; >+ >+ env_arg_count = count_args(env_clo); >+ f1_arg_count = count_args(f1_clo); >+ f2_arg_count = count_args(f2_clo); >+ >+ if (0) >+ printf("extra-argc=%d %d %d\n", >+ env_arg_count, f1_arg_count, f2_arg_count); >+ >+ /* +2: +1 for null-termination, +1 for added '--' */ >+ from = vg_argv; >+ vg_argv = malloc( (vg_argc + env_arg_count + f1_arg_count >+ + f2_arg_count + 2) * sizeof(char **)); >+ to = vg_argv; >+ >+ /* copy argv[0] */ >+ *to++ = *from++; >+ >+ /* Copy extra args from env var and file, in the order: ~/.valgrindrc, >+ * $VALGRIND_OPTS, ./.valgrindrc -- more local options are put later >+ * to override less local ones. */ >+ to = copy_args(f1_clo, to); >+ to = copy_args(env_clo, to); >+ to = copy_args(f2_clo, to); >+ >+ /* copy original arguments, stopping at command or -- */ >+ while (*from) { >+ if (**from != '-') >+ break; >+ if (VG_STREQ(*from, "--")) { >+ from++; /* skip -- */ >+ break; >+ } >+ *to++ = *from++; >+ } >+ >+ /* add -- */ >+ *to++ = "--"; >+ >+ vg_argc = to - vg_argv; >+ >+ /* copy rest of original command line, then NULL */ >+ while (*from) *to++ = *from++; >+ *to = NULL; >+ } >+ >+ *vg_argc_inout = vg_argc; >+ *vg_argv_inout = vg_argv; >+} >+ >+static void get_command_line( int argc, char** argv, >+ Int* vg_argc_out, Char*** vg_argv_out, >+ char*** cl_argv_out ) > { >- return ( VG_(track_events).new_mem_stack_4 || >- VG_(track_events).die_mem_stack_4 || >- VG_(track_events).new_mem_stack_8 || >- VG_(track_events).die_mem_stack_8 || >- VG_(track_events).new_mem_stack_12 || >- VG_(track_events).die_mem_stack_12 || >- VG_(track_events).new_mem_stack_16 || >- VG_(track_events).die_mem_stack_16 || >- VG_(track_events).new_mem_stack_32 || >- VG_(track_events).die_mem_stack_32 || >- VG_(track_events).new_mem_stack || >- VG_(track_events).die_mem_stack >- ); >+ int vg_argc; >+ char** vg_argv; >+ char** cl_argv; >+ char* env_clo = getenv(VALGRINDCLO); >+ >+ if (env_clo != NULL && *env_clo != '\0') { >+ char *cp; >+ char **cpp; >+ >+ /* OK, we're getting all our arguments from the environment - the >+ entire command line belongs to the client (including argv[0]) */ >+ vg_argc = 1; /* argv[0] */ >+ for (cp = env_clo; *cp; cp++) >+ if (*cp == '\01') >+ vg_argc++; >+ >+ vg_argv = malloc(sizeof(char **) * (vg_argc + 1)); >+ >+ cpp = vg_argv; >+ >+ *cpp++ = "valgrind"; /* nominal argv[0] */ >+ *cpp++ = env_clo; >+ >+ for (cp = env_clo; *cp; cp++) { >+ if (*cp == '\01') { >+ *cp++ = '\0'; /* chop it up in place */ >+ *cpp++ = cp; >+ } >+ } >+ *cpp = NULL; >+ cl_argv = argv; >+ >+ } else { >+ /* Count the arguments on the command line. */ >+ vg_argv = argv; >+ >+ for (vg_argc = 1; vg_argc < argc; vg_argc++) { >+ if (argv[vg_argc][0] != '-') /* exe name */ >+ break; >+ if (VG_STREQ(argv[vg_argc], "--")) { /* dummy arg */ >+ vg_argc++; >+ break; >+ } >+ } >+ cl_argv = &argv[vg_argc]; >+ >+ /* Get extra args from VALGRIND_OPTS and .valgrindrc files. >+ * Note we don't do this if getting args from VALGRINDCLO. */ >+ augment_command_line(&vg_argc, &vg_argv); >+ } >+ >+ if (0) { >+ Int i; >+ for (i = 0; i < vg_argc; i++) >+ printf("vg_argv[%d]=\"%s\"\n", i, vg_argv[i]); >+ } >+ >+ *vg_argc_out = vg_argc; >+ *vg_argv_out = (Char**)vg_argv; >+ *cl_argv_out = cl_argv; > } > >-/* Here we assign actual offsets. It's important to get the most >- popular referents within 128 bytes of the start, so we can take >- advantage of short addressing modes relative to %ebp. Popularity >- of offsets was measured on 22 Feb 02 running a KDE application, and >- the slots rearranged accordingly, with a 1.5% reduction in total >- size of translations. */ >-static void vg_init_baseBlock ( void ) >+ >+/*====================================================================*/ >+/*=== Environment and stack setup ===*/ >+/*====================================================================*/ >+ >+/* Scan a colon-separated list, and call a function on each element. >+ The string must be mutable, because we insert a temporary '\0', but >+ the string will end up unmodified. (*func) should return 1 if it >+ doesn't need to see any more. >+*/ >+static void scan_colsep(char *colsep, int (*func)(const char *)) > { >- /* Those with offsets under 128 are carefully chosen. */ >+ char *cp, *entry; >+ int end; > >- /* WORD offsets in this column */ >- /* 0 */ VGOFF_(m_eax) = alloc_BaB(1); >- /* 1 */ VGOFF_(m_ecx) = alloc_BaB(1); >- /* 2 */ VGOFF_(m_edx) = alloc_BaB(1); >- /* 3 */ VGOFF_(m_ebx) = alloc_BaB(1); >- /* 4 */ VGOFF_(m_esp) = alloc_BaB(1); >- /* 5 */ VGOFF_(m_ebp) = alloc_BaB(1); >- /* 6 */ VGOFF_(m_esi) = alloc_BaB(1); >- /* 7 */ VGOFF_(m_edi) = alloc_BaB(1); >- /* 8 */ VGOFF_(m_eflags) = alloc_BaB(1); >+ if (colsep == NULL || >+ *colsep == '\0') >+ return; > >- if (VG_(needs).shadow_regs) { >- /* 9 */ VGOFF_(sh_eax) = alloc_BaB(1); >- /* 10 */ VGOFF_(sh_ecx) = alloc_BaB(1); >- /* 11 */ VGOFF_(sh_edx) = alloc_BaB(1); >- /* 12 */ VGOFF_(sh_ebx) = alloc_BaB(1); >- /* 13 */ VGOFF_(sh_esp) = alloc_BaB(1); >- /* 14 */ VGOFF_(sh_ebp) = alloc_BaB(1); >- /* 15 */ VGOFF_(sh_esi) = alloc_BaB(1); >- /* 16 */ VGOFF_(sh_edi) = alloc_BaB(1); >- /* 17 */ VGOFF_(sh_eflags) = alloc_BaB(1); >+ entry = cp = colsep; >+ >+ do { >+ end = (*cp == '\0'); >+ >+ if (*cp == ':' || *cp == '\0') { >+ char save = *cp; >+ >+ *cp = '\0'; >+ if ((*func)(entry)) >+ end = 1; >+ *cp = save; >+ entry = cp+1; >+ } >+ cp++; >+ } while(!end); >+} >+ >+/* Prepare the client's environment. This is basically a copy of our >+ environment, except: >+ 1. LD_LIBRARY_PATH=$VALGRINDLIB:$LD_LIBRARY_PATH >+ 2. LD_PRELOAD=$VALGRINDLIB/vg_inject.so:($VALGRINDLIB/vgpreload_TOOL.so:)?$LD_PRELOAD >+ >+ If any of these is missing, then it is added. >+ >+ Yummy. String hacking in C. >+ >+ If this needs to handle any more variables it should be hacked >+ into something table driven. >+ */ >+static char **fix_environment(char **origenv, const char *preload) >+{ >+ static const char inject_so[] = "vg_inject.so"; >+ static const char ld_library_path[] = "LD_LIBRARY_PATH="; >+ static const char ld_preload[] = "LD_PRELOAD="; >+ static const char valgrind_clo[] = VALGRINDCLO "="; >+ static const int ld_library_path_len = sizeof(ld_library_path)-1; >+ static const int ld_preload_len = sizeof(ld_preload)-1; >+ static const int valgrind_clo_len = sizeof(valgrind_clo)-1; >+ int ld_preload_done = 0; >+ int ld_library_path_done = 0; >+ char *inject_path; >+ int inject_path_len; >+ int vgliblen = strlen(VG_(libdir)); >+ char **cpp; >+ char **ret; >+ int envc; >+ const int preloadlen = (preload == NULL) ? 0 : strlen(preload); >+ >+ /* Find the vg_inject.so; also make room for the tool preload >+ library */ >+ inject_path_len = sizeof(inject_so) + vgliblen + preloadlen + 16; >+ inject_path = malloc(inject_path_len); >+ >+ if (preload) >+ snprintf(inject_path, inject_path_len, "%s/%s:%s", >+ VG_(libdir), inject_so, preload); >+ else >+ snprintf(inject_path, inject_path_len, "%s/%s", >+ VG_(libdir), inject_so); >+ >+ /* Count the original size of the env */ >+ envc = 0; /* trailing NULL */ >+ for (cpp = origenv; cpp && *cpp; cpp++) >+ envc++; >+ >+ /* Allocate a new space */ >+ ret = malloc(sizeof(char *) * (envc+3+1)); /* 3 new entries + NULL */ >+ >+ /* copy it over */ >+ for (cpp = ret; *origenv; ) >+ *cpp++ = *origenv++; >+ *cpp = NULL; >+ >+ vg_assert(envc == (cpp - ret)); >+ >+ /* Walk over the new environment, mashing as we go */ >+ for (cpp = ret; cpp && *cpp; cpp++) { >+ if (memcmp(*cpp, ld_library_path, ld_library_path_len) == 0) { >+ int done = 0; >+ int contains(const char *p) { >+ if (VG_STREQ(p, VG_(libdir))) { >+ done = 1; >+ return 1; >+ } >+ return 0; >+ } >+ >+ /* If the LD_LIBRARY_PATH already contains libdir, then don't >+ bother adding it again, even if it isn't the first (it >+ seems that the Java runtime will keep reexecing itself >+ unless its paths are at the front of LD_LIBRARY_PATH) */ >+ scan_colsep(*cpp + ld_library_path_len, contains); >+ >+ if (!done) { >+ int len = strlen(*cpp) + vgliblen*2 + 16; >+ char *cp = malloc(len); >+ >+ snprintf(cp, len, "%s%s:%s", >+ ld_library_path, VG_(libdir), >+ (*cpp)+ld_library_path_len); >+ >+ *cpp = cp; >+ } >+ >+ ld_library_path_done = 1; >+ } else if (memcmp(*cpp, ld_preload, ld_preload_len) == 0) { >+ int len = strlen(*cpp) + inject_path_len; >+ char *cp = malloc(len); >+ >+ snprintf(cp, len, "%s%s:%s", >+ ld_preload, inject_path, (*cpp)+ld_preload_len); >+ >+ *cpp = cp; >+ >+ ld_preload_done = 1; >+ } else if (memcmp(*cpp, valgrind_clo, valgrind_clo_len) == 0) { >+ *cpp = ""; >+ } > } > >- /* 9,10,11 or 18,19,20... depends on number whether shadow regs are used >- * and on compact helpers registered */ >+ /* Add the missing bits */ > >- /* Make these most-frequently-called specialised ones compact, if they >- are used. */ >- if (VG_(track_events).new_mem_stack_4) >- VG_(register_compact_helper)( (Addr) VG_(track_events).new_mem_stack_4); >+ if (!ld_library_path_done) { >+ int len = ld_library_path_len + vgliblen*2 + 16; >+ char *cp = malloc(len); > >- if (VG_(track_events).die_mem_stack_4) >- VG_(register_compact_helper)( (Addr) VG_(track_events).die_mem_stack_4); >+ snprintf(cp, len, "%s%s", ld_library_path, VG_(libdir)); > >- /* (9 or 18) + n_compact_helpers */ >- /* Allocate slots for compact helpers */ >- assign_helpers_in_baseBlock(VG_(n_compact_helpers), >- VG_(compact_helper_offsets), >- VG_(compact_helper_addrs)); >+ ret[envc++] = cp; >+ } > >- /* (9/10 or 18/19) + n_compact_helpers */ >- VGOFF_(m_eip) = alloc_BaB(1); >+ if (!ld_preload_done) { >+ int len = ld_preload_len + inject_path_len; >+ char *cp = malloc(len); >+ >+ snprintf(cp, len, "%s%s", >+ ld_preload, inject_path); >+ >+ ret[envc++] = cp; >+ } > >- /* There are currently 24 spill slots */ >- /* (11+/20+ .. 32+/43+) + n_compact_helpers. This can overlap the magic >- * boundary at >= 32 words, but most spills are to low numbered spill >- * slots, so the ones above the boundary don't see much action. */ >- VGOFF_(spillslots) = alloc_BaB(VG_MAX_SPILLSLOTS); >+ ret[envc] = NULL; > >- /* I gave up counting at this point. Since they're above the >- short-amode-boundary, there's no point. */ >+ return ret; >+} > >- VGOFF_(m_dflag) = alloc_BaB(1); >+extern char **environ; /* our environment */ >+//#include <error.h> > >- /* The FPU/SSE state. This _must_ be 16-byte aligned. */ >- align_BaB(16); >- VGOFF_(m_ssestate) = alloc_BaB(VG_SIZE_OF_SSESTATE_W); >- vg_assert( >- ( ((UInt)(& VG_(baseBlock)[VGOFF_(m_ssestate)])) >- % 16 ) >- == 0 >- ); >+/* Add a string onto the string table, and return its address */ >+static char *copy_str(char **tab, const char *str) >+{ >+ char *cp = *tab; >+ char *orig = cp; >+ >+ while(*str) >+ *cp++ = *str++; >+ *cp++ = '\0'; >+ >+ if (0) >+ printf("copied %p \"%s\" len %d\n", >+ orig, orig, cp-orig); >+ >+ *tab = cp; >+ >+ return orig; >+} >+ >+/* >+ This sets up the client's initial stack, containing the args, >+ environment and aux vector. >+ >+ The format of the stack is: >+ >+ higher address +-----------------+ >+ | Trampoline code | >+ +-----------------+ >+ | | >+ : string table : >+ | | >+ +-----------------+ >+ | AT_NULL | >+ - - >+ | auxv | >+ +-----------------+ >+ | NULL | >+ - - >+ | envp | >+ +-----------------+ >+ | NULL | >+ - - >+ | argv | >+ +-----------------+ >+ | argc | >+ lower address +-----------------+ <- esp >+ | undefined | >+ : : >+ */ >+static Addr setup_client_stack(char **orig_argv, char **orig_envp, >+ const struct exeinfo *info, >+ UInt** client_auxv) >+{ >+ char **cpp; >+ char *strtab; /* string table */ >+ char *stringbase; >+ addr_t *ptr; >+ struct ume_auxv *auxv; >+ const struct ume_auxv *orig_auxv; >+ const struct ume_auxv *cauxv; >+ unsigned stringsize; /* total size of strings in bytes */ >+ unsigned auxsize; /* total size of auxv in bytes */ >+ int argc; /* total argc */ >+ int envc; /* total number of env vars */ >+ unsigned stacksize; /* total client stack size */ >+ addr_t cl_esp; /* client stack base (initial esp) */ >+ >+ /* use our own auxv as a prototype */ >+ orig_auxv = find_auxv(ume_exec_esp); >+ >+ /* ==================== compute sizes ==================== */ >+ >+ /* first of all, work out how big the client stack will be */ >+ stringsize = 0; >+ >+ /* paste on the extra args if the loader needs them (ie, the #! >+ interpreter and its argument) */ >+ argc = 0; >+ if (info->argv0 != NULL) { >+ argc++; >+ stringsize += strlen(info->argv0) + 1; >+ } >+ if (info->argv1 != NULL) { >+ argc++; >+ stringsize += strlen(info->argv1) + 1; >+ } >+ >+ /* now scan the args we're given... */ >+ for (cpp = orig_argv; *cpp; cpp++) { >+ argc++; >+ stringsize += strlen(*cpp) + 1; >+ } >+ >+ /* ...and the environment */ >+ envc = 0; >+ for (cpp = orig_envp; cpp && *cpp; cpp++) { >+ envc++; >+ stringsize += strlen(*cpp) + 1; >+ } >+ >+ /* now, how big is the auxv? */ >+ auxsize = sizeof(*auxv); /* there's always at least one entry: AT_NULL */ >+ for (cauxv = orig_auxv; cauxv->a_type != AT_NULL; cauxv++) { >+ if (cauxv->a_type == AT_PLATFORM) >+ stringsize += strlen(cauxv->u.a_ptr) + 1; >+ auxsize += sizeof(*cauxv); >+ } >+ >+ /* OK, now we know how big the client stack is */ >+ stacksize = >+ sizeof(int) + /* argc */ >+ sizeof(char **)*argc + /* argv */ >+ sizeof(char **) + /* terminal NULL */ >+ sizeof(char **)*envc + /* envp */ >+ sizeof(char **) + /* terminal NULL */ >+ auxsize + /* auxv */ >+ ROUNDUP(stringsize, sizeof(int)) +/* strings (aligned) */ >+ VKI_BYTES_PER_PAGE; /* page for trampoline code */ >+ >+ /* cl_esp is the client's stack pointer */ >+ cl_esp = VG_(client_end) - stacksize; >+ cl_esp = ROUNDDN(cl_esp, 16); /* make stack 16 byte aligned */ >+ >+ if (0) >+ printf("stringsize=%d auxsize=%d stacksize=%d\n", >+ stringsize, auxsize, stacksize); >+ >+ >+ /* base of the string table (aligned) */ >+ stringbase = strtab = (char *)(VG_(client_trampoline_code) - ROUNDUP(stringsize, sizeof(int))); >+ >+ VG_(clstk_base) = PGROUNDDN(cl_esp); >+ VG_(clstk_end) = VG_(client_end); >+ >+ /* ==================== allocate space ==================== */ >+ >+ /* allocate a stack - mmap enough space for the stack */ >+ mmap((void *)PGROUNDDN(cl_esp), >+ VG_(client_end) - PGROUNDDN(cl_esp), >+ PROT_READ | PROT_WRITE | PROT_EXEC, >+ MAP_PRIVATE | MAP_ANON | MAP_FIXED, -1, 0); >+ > >- /* This thread's LDT pointer, and segment registers. */ >- VGOFF_(ldt) = alloc_BaB(1); >- VGOFF_(m_cs) = alloc_BaB(1); >- VGOFF_(m_ss) = alloc_BaB(1); >- VGOFF_(m_ds) = alloc_BaB(1); >- VGOFF_(m_es) = alloc_BaB(1); >- VGOFF_(m_fs) = alloc_BaB(1); >- VGOFF_(m_gs) = alloc_BaB(1); >+ /* ==================== copy client stack ==================== */ > >- VG_(register_noncompact_helper)( (Addr) & VG_(do_useseg) ); >+ ptr = (addr_t *)cl_esp; > >-#define REG(kind, size) \ >- if (VG_(track_events).kind##_mem_stack##size) \ >- VG_(register_noncompact_helper)( \ >- (Addr) VG_(track_events).kind##_mem_stack##size ); >+ /* --- argc --- */ >+ *ptr++ = argc; /* client argc */ > >- REG(new, _8); >- REG(new, _12); >- REG(new, _16); >- REG(new, _32); >- REG(new, ); >- REG(die, _8); >- REG(die, _12); >- REG(die, _16); >- REG(die, _32); >- REG(die, ); >-#undef REG >+ /* --- argv --- */ >+ if (info->argv0) { >+ *ptr++ = (addr_t)copy_str(&strtab, info->argv0); >+ free(info->argv0); >+ } >+ if (info->argv1) { >+ *ptr++ = (addr_t)copy_str(&strtab, info->argv1); >+ free(info->argv1); >+ } >+ for (cpp = orig_argv; *cpp; ptr++, cpp++) { >+ *ptr = (addr_t)copy_str(&strtab, *cpp); >+ } >+ *ptr++ = 0; >+ >+ /* --- envp --- */ >+ VG_(client_envp) = (Char **)ptr; >+ for (cpp = orig_envp; cpp && *cpp; ptr++, cpp++) >+ *ptr = (addr_t)copy_str(&strtab, *cpp); >+ *ptr++ = 0; >+ >+ /* --- auxv --- */ >+ auxv = (struct ume_auxv *)ptr; >+ *client_auxv = (UInt *)auxv; >+ >+ for (; orig_auxv->a_type != AT_NULL; auxv++, orig_auxv++) { >+ /* copy the entry... */ >+ *auxv = *orig_auxv; >+ >+ /* ...and fix up the copy */ >+ switch(auxv->a_type) { >+ case AT_PHDR: >+ if (info->phdr == 0) >+ auxv->a_type = AT_IGNORE; >+ else >+ auxv->u.a_val = info->phdr; >+ break; > >- if (VG_(need_to_handle_esp_assignment)()) >- VG_(register_noncompact_helper)((Addr) VG_(unknown_esp_update)); >+ case AT_PHNUM: >+ if (info->phdr == 0) >+ auxv->a_type = AT_IGNORE; >+ else >+ auxv->u.a_val = info->phnum; >+ break; > >- /* Helper functions. */ >- VGOFF_(helper_idiv_64_32) >- = alloc_BaB_1_set( (Addr) & VG_(helper_idiv_64_32)); >- VGOFF_(helper_div_64_32) >- = alloc_BaB_1_set( (Addr) & VG_(helper_div_64_32)); >- VGOFF_(helper_idiv_32_16) >- = alloc_BaB_1_set( (Addr) & VG_(helper_idiv_32_16)); >- VGOFF_(helper_div_32_16) >- = alloc_BaB_1_set( (Addr) & VG_(helper_div_32_16)); >- VGOFF_(helper_idiv_16_8) >- = alloc_BaB_1_set( (Addr) & VG_(helper_idiv_16_8)); >- VGOFF_(helper_div_16_8) >- = alloc_BaB_1_set( (Addr) & VG_(helper_div_16_8)); >- >- VGOFF_(helper_imul_32_64) >- = alloc_BaB_1_set( (Addr) & VG_(helper_imul_32_64)); >- VGOFF_(helper_mul_32_64) >- = alloc_BaB_1_set( (Addr) & VG_(helper_mul_32_64)); >- VGOFF_(helper_imul_16_32) >- = alloc_BaB_1_set( (Addr) & VG_(helper_imul_16_32)); >- VGOFF_(helper_mul_16_32) >- = alloc_BaB_1_set( (Addr) & VG_(helper_mul_16_32)); >- VGOFF_(helper_imul_8_16) >- = alloc_BaB_1_set( (Addr) & VG_(helper_imul_8_16)); >- VGOFF_(helper_mul_8_16) >- = alloc_BaB_1_set( (Addr) & VG_(helper_mul_8_16)); >- >- VGOFF_(helper_CLD) >- = alloc_BaB_1_set( (Addr) & VG_(helper_CLD)); >- VGOFF_(helper_STD) >- = alloc_BaB_1_set( (Addr) & VG_(helper_STD)); >- VGOFF_(helper_get_dirflag) >- = alloc_BaB_1_set( (Addr) & VG_(helper_get_dirflag)); >- >- VGOFF_(helper_CLC) >- = alloc_BaB_1_set( (Addr) & VG_(helper_CLC)); >- VGOFF_(helper_STC) >- = alloc_BaB_1_set( (Addr) & VG_(helper_STC)); >- >- VGOFF_(helper_shldl) >- = alloc_BaB_1_set( (Addr) & VG_(helper_shldl)); >- VGOFF_(helper_shldw) >- = alloc_BaB_1_set( (Addr) & VG_(helper_shldw)); >- VGOFF_(helper_shrdl) >- = alloc_BaB_1_set( (Addr) & VG_(helper_shrdl)); >- VGOFF_(helper_shrdw) >- = alloc_BaB_1_set( (Addr) & VG_(helper_shrdw)); >- >- VGOFF_(helper_RDTSC) >- = alloc_BaB_1_set( (Addr) & VG_(helper_RDTSC)); >- VGOFF_(helper_CPUID) >- = alloc_BaB_1_set( (Addr) & VG_(helper_CPUID)); >- >- VGOFF_(helper_bsf) >- = alloc_BaB_1_set( (Addr) & VG_(helper_bsf)); >- VGOFF_(helper_bsr) >- = alloc_BaB_1_set( (Addr) & VG_(helper_bsr)); >- >- VGOFF_(helper_fstsw_AX) >- = alloc_BaB_1_set( (Addr) & VG_(helper_fstsw_AX)); >- VGOFF_(helper_SAHF) >- = alloc_BaB_1_set( (Addr) & VG_(helper_SAHF)); >- VGOFF_(helper_LAHF) >- = alloc_BaB_1_set( (Addr) & VG_(helper_LAHF)); >- VGOFF_(helper_DAS) >- = alloc_BaB_1_set( (Addr) & VG_(helper_DAS)); >- VGOFF_(helper_DAA) >- = alloc_BaB_1_set( (Addr) & VG_(helper_DAA)); >- VGOFF_(helper_IN) >- = alloc_BaB_1_set( (Addr) & VG_(helper_IN)); >- VGOFF_(helper_OUT) >- = alloc_BaB_1_set( (Addr) & VG_(helper_OUT)); >+ case AT_BASE: >+ if (info->interp_base == 0) >+ auxv->a_type = AT_IGNORE; >+ else >+ auxv->u.a_val = info->interp_base; >+ break; > >- VGOFF_(helper_undefined_instruction) >- = alloc_BaB_1_set( (Addr) & VG_(helper_undefined_instruction)); >+ case AT_PLATFORM: /* points to a platform description string */ >+ auxv->u.a_ptr = copy_str(&strtab, orig_auxv->u.a_ptr); >+ break; > >- /* Allocate slots for noncompact helpers */ >- assign_helpers_in_baseBlock(VG_(n_noncompact_helpers), >- VG_(noncompact_helper_offsets), >- VG_(noncompact_helper_addrs)); >+ case AT_ENTRY: >+ auxv->u.a_val = info->entry; >+ break; > >+ case AT_IGNORE: >+ case AT_EXECFD: >+ case AT_PHENT: >+ case AT_PAGESZ: >+ case AT_FLAGS: >+ case AT_NOTELF: >+ case AT_UID: >+ case AT_EUID: >+ case AT_GID: >+ case AT_EGID: >+ case AT_CLKTCK: >+ case AT_HWCAP: >+ case AT_FPUCW: >+ case AT_DCACHEBSIZE: >+ case AT_ICACHEBSIZE: >+ case AT_UCACHEBSIZE: >+ /* All these are pointerless, so we don't need to do anything >+ about them. */ >+ break; > >- /* Initialise slots that require it */ >- VG_(copy_m_state_static_to_baseBlock)(); >+ case AT_SECURE: >+ /* If this is 1, then it means that this program is running >+ suid, and therefore the dynamic linker should be careful >+ about LD_PRELOAD, etc. However, since stage1 (the thing >+ the kernel actually execve's) should never be SUID, and we >+ need LD_PRELOAD/LD_LIBRARY_PATH to work for the client, we >+ set AT_SECURE to 0. */ >+ auxv->u.a_val = 0; >+ break; > >- /* Pretend the root thread has a completely empty LDT to start with. */ >- VG_(baseBlock)[VGOFF_(ldt)] = (UInt)NULL; >+ case AT_SYSINFO: >+ /* Leave this unmolested for now, but we'll update it later >+ when we set up the client trampoline code page */ >+ break; > >- /* Initialise shadow regs */ >- if (VG_(needs).shadow_regs) { >- VG_(baseBlock)[VGOFF_(sh_esp)] = >- VG_(baseBlock)[VGOFF_(sh_ebp)] = >- VG_(baseBlock)[VGOFF_(sh_eax)] = >- VG_(baseBlock)[VGOFF_(sh_ecx)] = >- VG_(baseBlock)[VGOFF_(sh_edx)] = >- VG_(baseBlock)[VGOFF_(sh_ebx)] = >- VG_(baseBlock)[VGOFF_(sh_esi)] = >- VG_(baseBlock)[VGOFF_(sh_edi)] = 0; >- VG_(baseBlock)[VGOFF_(sh_eflags)] = 0; >- VG_TRACK( post_regs_write_init ); >+ case AT_SYSINFO_EHDR: >+ /* Trash this, because we don't reproduce it */ >+ auxv->a_type = AT_IGNORE; >+ break; >+ >+ default: >+ /* stomp out anything we don't know about */ >+ if (0) >+ printf("stomping auxv entry %d\n", auxv->a_type); >+ auxv->a_type = AT_IGNORE; >+ break; >+ >+ } > } >-} >+ *auxv = *orig_auxv; >+ vg_assert(auxv->a_type == AT_NULL); > >+ vg_assert((strtab-stringbase) == stringsize); > >-/* --------------------------------------------------------------------- >- Global entities which are not referenced from generated code. >- ------------------------------------------------------------------ */ >+ return cl_esp; >+} > >-/* The stack on which Valgrind runs. We can't use the same stack as >- the simulatee -- that's an important design decision. */ >-UInt VG_(stack)[VG_STACK_SIZE_W]; >+/*====================================================================*/ >+/*=== Find executable ===*/ >+/*====================================================================*/ > >-/* Ditto our signal delivery stack. */ >-UInt VG_(sigstack)[VG_SIGSTACK_SIZE_W]; >+static const char* find_executable(const char* exec) >+{ >+ vg_assert(NULL != exec); >+ if (strchr(exec, '/') == NULL) { >+ /* no '/' - we need to search the path */ >+ char *path = getenv("PATH"); >+ int pathlen = path ? strlen(path) : 0; > >-/* Saving stuff across system calls. */ >-__attribute__ ((aligned (16))) >-UInt VG_(real_sse_state_saved_over_syscall)[VG_SIZE_OF_SSESTATE_W]; >-Addr VG_(esp_saved_over_syscall); >+ int match_exe(const char *entry) { >+ char buf[pathlen + strlen(entry) + 3]; > >-/* Counts downwards in vg_run_innerloop. */ >-UInt VG_(dispatch_ctr); >+ /* empty PATH element means . */ >+ if (*entry == '\0') >+ entry = "."; > >+ snprintf(buf, sizeof(buf), "%s/%s", entry, exec); > >-/* 64-bit counter for the number of basic blocks done. */ >-ULong VG_(bbs_done); >-/* 64-bit counter for the number of bbs to go before a debug exit. */ >-ULong VG_(bbs_to_go); >+ if (access(buf, R_OK|X_OK) == 0) { >+ exec = strdup(buf); >+ vg_assert(NULL != exec); >+ return 1; >+ } >+ return 0; >+ } >+ scan_colsep(path, match_exe); >+ } >+ return exec; >+} > >-/* This is the ThreadId of the last thread the scheduler ran. */ >-ThreadId VG_(last_run_tid) = 0; > >-/* This is the argument to __NR_exit() supplied by the first thread to >- call that syscall. We eventually pass that to __NR_exit() for >- real. */ >-Int VG_(exitcode) = 0; >+/*====================================================================*/ >+/*=== Loading tools ===*/ >+/*====================================================================*/ > >-/* Tell the logging mechanism whether we are logging to a file >- descriptor or a socket descriptor. */ >-Bool VG_(logging_to_filedes) = True; >+static void list_tools(void) >+{ >+ DIR *dir = opendir(VG_(libdir)); >+ struct dirent *de; >+ int first = 1; > >-/* Is this a SSE/SSE2-capable CPU? If so, we had better save/restore >- the SSE state all over the place. This is set up very early, in >- vg_startup.S. We have to determine it early since we can't even >- correctly snapshot the startup machine state without it. */ >-/* Initially True. Safer to err on the side of SSEness and get SIGILL >- than to not notice for some reason that we have SSE and get weird >- errors later on. */ >-Bool VG_(have_ssestate) = True; >+ if (dir == NULL) { >+ fprintf(stderr, "Can't open %s: %s (installation problem?)\n", >+ VG_(libdir), strerror(errno)); >+ return; >+ } > >+ while((de = readdir(dir)) != NULL) { >+ int len = strlen(de->d_name); > >-/* --------------------------------------------------------------------- >- Counters, for informational purposes only. >- ------------------------------------------------------------------ */ >+ /* look for vgskin_TOOL.so names */ >+ if (len > (7+1+3) && /* "vgskin_" + at least 1-char toolname + ".so" */ >+ strncmp(de->d_name, "vgskin_", 7) == 0 && >+ VG_STREQ(de->d_name + len - 3, ".so")) { >+ if (first) { >+ printf("Available tools:\n"); >+ first = 0; >+ } >+ de->d_name[len-3] = '\0'; >+ printf("\t%s\n", de->d_name+7); >+ } >+ } > >-/* Number of lookups which miss the fast tt helper. */ >-UInt VG_(tt_fast_misses) = 0; >+ closedir(dir); > >+ if (first) >+ printf("No tools available in \"%s\" (installation problem?)\n", >+ VG_(libdir)); >+} > >-/* Counts for TT/TC informational messages. */ > >-/* Number and total o/t size of translations overall. */ >-UInt VG_(overall_in_count) = 0; >-UInt VG_(overall_in_osize) = 0; >-UInt VG_(overall_in_tsize) = 0; >-/* Number and total o/t size of discards overall. */ >-UInt VG_(overall_out_count) = 0; >-UInt VG_(overall_out_osize) = 0; >-UInt VG_(overall_out_tsize) = 0; >-/* The number of discards of TT/TC. */ >-UInt VG_(number_of_tc_discards) = 0; >-/* Counts of chain and unchain operations done. */ >-UInt VG_(bb_enchain_count) = 0; >-UInt VG_(bb_dechain_count) = 0; >-/* Number of unchained jumps performed. */ >-UInt VG_(unchained_jumps_done) = 0; >+/* Find and load a tool, and check it looks ok. Also looks to see if there's >+ * a matching vgpreload_*.so file, and returns its name in *preloadpath. */ >+static void load_tool( const char *toolname, void** handle_out, >+ ToolInfo** toolinfo_out, char **preloadpath_out ) >+{ >+ Bool ok; >+ int len = strlen(VG_(libdir)) + strlen(toolname)*2 + 16; >+ char buf[len]; >+ void* handle; >+ ToolInfo* toolinfo; >+ char* preloadpath = NULL; >+ Int* vg_malloc_redzonep; > >+ // XXX: allowing full paths for --tool option -- does it make sense? >+ // Doesn't allow for vgpreload_<tool>.so. > >-/* Counts pertaining to the register allocator. */ >+ if (strchr(toolname, '/') != 0) { >+ /* toolname contains '/', and so must be a pathname */ >+ handle = dlopen(toolname, RTLD_NOW); >+ } else { >+ /* just try in the libdir */ >+ snprintf(buf, len, "%s/vgskin_%s.so", VG_(libdir), toolname); >+ handle = dlopen(buf, RTLD_NOW); >+ >+ if (handle != NULL) { >+ snprintf(buf, len, "%s/vgpreload_%s.so", VG_(libdir), toolname); >+ if (access(buf, R_OK) == 0) { >+ preloadpath = strdup(buf); >+ vg_assert(NULL != preloadpath); >+ } >+ } >+ } > >-/* total number of uinstrs input to reg-alloc */ >-UInt VG_(uinstrs_prealloc) = 0; >+ ok = (NULL != handle); >+ if (!ok) { >+ fprintf(stderr, "Can't open tool \"%s\": %s\n", toolname, dlerror()); >+ goto bad_load; >+ } >+ >+ toolinfo = dlsym(handle, "vgSkin_tool_info"); >+ ok = (NULL != toolinfo); >+ if (!ok) { >+ fprintf(stderr, "Tool \"%s\" doesn't define SK_(tool_info) - " >+ "add VG_DETERMINE_INTERFACE_VERSION?\n", toolname); >+ goto bad_load; >+ } >+ >+ ok = (toolinfo->sizeof_ToolInfo == sizeof(*toolinfo) && >+ toolinfo->interface_major_version == VG_CORE_INTERFACE_MAJOR_VERSION && >+ toolinfo->sk_pre_clo_init != NULL); >+ if (!ok) { >+ fprintf(stderr, "Error:\n" >+ " Tool and core interface versions do not match.\n" >+ " Interface version used by core is: %d.%d (size %d)\n" >+ " Interface version used by tool is: %d.%d (size %d)\n" >+ " The major version numbers must match.\n", >+ VG_CORE_INTERFACE_MAJOR_VERSION, >+ VG_CORE_INTERFACE_MINOR_VERSION, >+ sizeof(*toolinfo), >+ toolinfo->interface_major_version, >+ toolinfo->interface_minor_version, >+ toolinfo->sizeof_ToolInfo); >+ fprintf(stderr, " You need to at least recompile, and possibly update,\n"); >+ if (VG_CORE_INTERFACE_MAJOR_VERSION > toolinfo->interface_major_version) >+ fprintf(stderr, " your skin to work with this version of Valgrind.\n"); >+ else >+ fprintf(stderr, " your version of Valgrind to work with this skin.\n"); >+ goto bad_load; >+ } > >-/* total number of uinstrs added due to spill code */ >-UInt VG_(uinstrs_spill) = 0; >+ // Set redzone size for V's allocator >+ vg_malloc_redzonep = dlsym(handle, STR(VG_(vg_malloc_redzone_szB))); >+ if ( NULL != vg_malloc_redzonep ) { >+ VG_(vg_malloc_redzone_szB) = *vg_malloc_redzonep; >+ } > >-/* number of bbs requiring spill code */ >-UInt VG_(translations_needing_spill) = 0; >+ vg_assert(NULL != handle && NULL != toolinfo); >+ *handle_out = handle; >+ *toolinfo_out = toolinfo; >+ *preloadpath_out = preloadpath; >+ return; > >-/* total of register ranks over all translations */ >-UInt VG_(total_reg_rank) = 0; > >+ bad_load: >+ if (handle != NULL) >+ dlclose(handle); >+ >+ fprintf(stderr, "Aborting: couldn't load tool\n"); >+ list_tools(); >+ exit(127); >+} >+ >+/*====================================================================*/ >+/*=== Loading the client ===*/ >+/*====================================================================*/ >+ >+static void load_client(char* cl_argv[], const char* exec, >+ /*inout*/Int* need_help, >+ /*out*/struct exeinfo* info, /*out*/Addr* client_eip) >+{ >+ // If they didn't specify an executable with --exec, and didn't specify >+ // --help, then use client argv[0] (searching $PATH if necessary). >+ if (NULL == exec && !*need_help) { >+ if (cl_argv[0] == NULL || >+ ( NULL == (exec = find_executable(cl_argv[0])) ) ) >+ { >+ *need_help = 1; >+ } >+ } > >-/* Counts pertaining to internal sanity checking. */ >-UInt VG_(sanity_fast_count) = 0; >-UInt VG_(sanity_slow_count) = 0; >+ info->map_base = VG_(client_mapbase); >+ info->setbrk = False; > >-/* Counts pertaining to the scheduler. */ >-UInt VG_(num_scheduling_events_MINOR) = 0; >-UInt VG_(num_scheduling_events_MAJOR) = 0; >+ info->exe_base = VG_(client_base); >+ info->exe_end = VG_(client_end); >+ info->argv = cl_argv; >+ >+ if (*need_help) { >+ VG_(clexecfd) = -1; >+ info->argv0 = NULL; >+ info->argv1 = NULL; >+ } else { >+ Int ret; >+ VG_(clexecfd) = VG_(open)(exec, O_RDONLY, VKI_S_IRUSR); >+ ret = do_exec(exec, info); >+ if (ret != 0) { >+ fprintf(stderr, "do_exec(%s) failed: %s\n", exec, strerror(ret)); >+ exit(127); >+ } >+ } > >+ /* Copy necessary bits of 'info' that were filled in */ >+ *client_eip = info->init_eip; >+ VG_(brk_base) = VG_(brk_limit) = info->brkbase; >+} > >-/* --------------------------------------------------------------------- >- Values derived from command-line options. >- ------------------------------------------------------------------ */ >+ >+/*====================================================================*/ >+/*=== Command-line: variables, processing ===*/ >+/*====================================================================*/ > > /* Define, and set defaults. */ > Bool VG_(clo_error_limit) = True; >-Bool VG_(clo_GDB_attach) = False; >-Char* VG_(clo_GDB_path) = GDB_PATH; >+Bool VG_(clo_db_attach) = False; >+Char* VG_(clo_db_command) = VG_CLO_DEFAULT_DBCOMMAND; > Bool VG_(clo_gen_suppressions) = False; > Int VG_(sanity_level) = 1; > Int VG_(clo_verbosity) = 1; >@@ -554,7 +1423,6 @@ > Bool VG_(clo_trace_symtab) = False; > Bool VG_(clo_trace_sched) = False; > Int VG_(clo_trace_pthread_level) = 0; >-ULong VG_(clo_stop_after) = 1000000000000000LL; > Int VG_(clo_dump_error) = 0; > Int VG_(clo_backtrace_size) = 4; > Char* VG_(clo_weird_hacks) = NULL; >@@ -562,6 +1430,8 @@ > Bool VG_(clo_track_fds) = False; > Bool VG_(clo_chain_bb) = True; > Bool VG_(clo_show_below_main) = False; >+Bool VG_(clo_pointercheck) = True; >+Bool VG_(clo_branchpred) = False; > > static Bool VG_(clo_wait_for_gdb) = False; > >@@ -574,31 +1444,6 @@ > Bool VG_(clo_lowlat_syscalls) = False; /* low-latency syscalls */ > Bool VG_(clo_lowlat_signals) = False; /* low-latency signals */ > >-/* This Bool is needed by wrappers in vg_clientmalloc.c to decide how >- to behave. Initially we say False. */ >-Bool VG_(running_on_simd_CPU) = False; >- >-/* Holds client's %esp at the point we gained control. */ >-Addr VG_(esp_at_startup); >- >-/* Indicates presence, and holds address of client's sysinfo page, a >- feature of some modern kernels used to provide vsyscalls, etc. */ >-Bool VG_(sysinfo_page_exists) = False; >-Addr VG_(sysinfo_page_addr) = 0; >- >-/* As deduced from VG_(esp_at_startup), the client's argc, argv[] and >- envp[] as extracted from the client's stack at startup-time. */ >-Int VG_(client_argc); >-Char** VG_(client_argv); >-Char** VG_(client_envp); >- >-/* A place into which to copy the value of env var VG_ARGS, so we >- don't have to modify the original. */ >-static Char vg_cmdline_copy[M_VG_CMDLINE_STRLEN]; >- >-/* --------------------------------------------------------------------- >- Processing of command-line options. >- ------------------------------------------------------------------ */ > > void VG_(bad_option) ( Char* opt ) > { >@@ -615,30 +1460,21 @@ > VG_(clo_log_to) = VgLogTo_Fd; > VG_(clo_logfile_fd) = 2; /* stderr */ > VG_(printf)( >- "valgrind.so: Startup or configuration error:\n %s\n", msg); >+ "valgrind: Startup or configuration error:\n %s\n", msg); > VG_(printf)( >- "valgrind.so: Unable to start up properly. Giving up.\n"); >+ "valgrind: Unable to start up properly. Giving up.\n"); > VG_(exit)(1); > } > >-static void args_grok_error ( Char* msg ) >-{ >- VG_(shutdown_logging)(); >- VG_(clo_log_to) = VgLogTo_Fd; >- VG_(clo_logfile_fd) = 2; /* stderr */ >- VG_(printf)("valgrind.so: When searching for " >- "client's argc/argc/envp:\n\t%s\n", msg); >- config_error("couldn't find client's argc/argc/envp"); >-} >- >-static void usage ( void ) >+void usage ( Bool debug_help ) > { > Char* usage1 = >-"usage: valgrind [options] prog-and-args\n" >+"usage: valgrind --tool=<toolname> [options] prog-and-args\n" > "\n" > " common user options for all Valgrind tools, with defaults in [ ]:\n" >-" --tool=<name> Use the Valgrind tool named <name> [memcheck]\n" >+" --tool=<name> Use the Valgrind tool named <name>\n" > " --help show this message\n" >+" --help-debug show this message, plus debugging options\n" > " --version show version\n" > " -q --quiet run silently; only print error msgs\n" > " -v --verbose be more verbose, incl counts of errors\n" >@@ -656,6 +1492,7 @@ > " a signal [no]\n" > " --lowlat-syscalls=no|yes improve wake-up latency when a thread's\n" > " syscall completes [no]\n" >+" --pointercheck=no|yes enforce client address space limits [yes]\n" > "\n" > " user options for Valgrind tools that report errors:\n" > " --logfile-fd=<number> file descriptor for messages [2=stderr]\n" >@@ -668,11 +1505,10 @@ > " --suppressions=<filename> suppress errors described in <filename>\n" > " --gen-suppressions=no|yes print suppressions for errors detected [no]\n" > >-" --gdb-attach=no|yes start GDB when errors detected? [no]\n" >-" --gdb-path=/path/to/gdb path to the GDB to use [/usr/bin/gdb]\n" >-" --input-fd=<number> file descriptor for (gdb) input [0=stdin]\n" >-"\n" >-" user options for %s:\n"; >+" --db-attach=no|yes start debugger when errors detected? [no]\n" >+" --db-command=<command> command to start debugger [gdb -nw %%f %%p]\n" >+" --input-fd=<number> file descriptor for input [0=stdin]\n" >+"\n"; > > Char* usage2 = > "\n" >@@ -682,27 +1518,25 @@ > " --optimise=no|yes improve intermediate code? [yes]\n" > " --profile=no|yes profile? (tool must be built for it) [no]\n" > " --chain-bb=no|yes do basic-block chaining? [yes]\n" >+" --branchpred=yes|no generate branch prediction hints [no]\n" > " --trace-codegen=<XXXXX> show generated code? (X = 0|1) [00000]\n" > " --trace-syscalls=no|yes show all system calls? [no]\n" > " --trace-signals=no|yes show signal handling details? [no]\n" > " --trace-symtab=no|yes show symbol table details? [no]\n" > " --trace-sched=no|yes show thread scheduler details? [no]\n" > " --trace-pthread=none|some|all show pthread event details? [none]\n" >-" --stop-after=<number> switch to real CPU after executing\n" >-" <number> basic blocks [infinity]\n" > " --wait-for-gdb=yes|no pause on startup to wait for gdb attach\n" > "\n" > " debugging options for Valgrind tools that report errors\n" > " --dump-error=<number> show translation for basic block associated\n" > " with <number>'th error context [0=show none]\n" >-"\n" >-" debugging options for %s:\n"; >+"\n"; > > Char* usage3 = > "\n" >-" Extra options are read from env variable $VALGRIND_OPTS\n" >+" Extra options read from ~/.valgrindrc, $VALGRIND_OPTS, ./.valgrindrc\n" > "\n" >-" Valgrind is Copyright (C) 2000-2003 Julian Seward\n" >+" Valgrind is Copyright (C) 2000-2004 Julian Seward\n" > " and licensed under the GNU General Public License, version 2.\n" > " Bug reports, feedback, admiration, abuse, etc, to: %s.\n" > "\n" >@@ -710,17 +1544,27 @@ > " tool's start-up message for more information.\n" > "\n"; > >- VG_(printf)(usage1, VG_(details).name); >- /* Don't print skin string directly for security, ha! */ >- if (VG_(needs).command_line_options) >- SK_(print_usage)(); >- else >- VG_(printf)(" (none)\n"); >- VG_(printf)(usage2, VG_(details).name); >- if (VG_(needs).command_line_options) >- SK_(print_debug_usage)(); >- else >- VG_(printf)(" (none)\n"); >+ VG_(printf)(usage1); >+ if (VG_(details).name) { >+ VG_(printf)(" user options for %s:\n", VG_(details).name); >+ /* Don't print skin string directly for security, ha! */ >+ if (VG_(needs).command_line_options) >+ SK_(print_usage)(); >+ else >+ VG_(printf)(" (none)\n"); >+ } >+ if (debug_help) { >+ VG_(printf)(usage2); >+ >+ if (VG_(details).name) { >+ VG_(printf)(" debugging options for %s:\n", VG_(details).name); >+ >+ if (VG_(needs).command_line_options) >+ SK_(print_debug_usage)(); >+ else >+ VG_(printf)(" (none)\n"); >+ } >+ } > VG_(printf)(usage3, VG_BUGS_TO); > > VG_(shutdown_logging)(); >@@ -729,40 +1573,48 @@ > VG_(exit)(1); > } > >+static void pre_process_cmd_line_options >+ ( Int* need_help, const char** tool, const char** exec ) >+{ >+ UInt i; >+ >+ /* parse the options we have (only the options we care about now) */ >+ for (i = 1; i < VG_(vg_argc); i++) { > >-/* Callback for looking for the stack segment. */ >-Addr VG_(foundstack_start) = (Addr)NULL; >-UInt VG_(foundstack_size) = 0; >+ if (strcmp(VG_(vg_argv)[i], "--version") == 0) { >+ printf("valgrind-" VERSION "\n"); >+ exit(1); >+ >+ } else if (strcmp(VG_(vg_argv)[i], "--help") == 0) { >+ *need_help = 1; >+ >+ } else if (strcmp(VG_(vg_argv)[i], "--help-debug") == 0) { >+ *need_help = 2; >+ >+ } else if (strncmp(VG_(vg_argv)[i], "--tool=", 7) == 0 || >+ strncmp(VG_(vg_argv)[i], "--skin=", 7) == 0) { >+ *tool = &VG_(vg_argv)[i][7]; >+ >+ } else if (strncmp(VG_(vg_argv)[i], "--exec=", 7) == 0) { >+ *exec = &VG_(vg_argv)[i][7]; >+ } >+ } > >-static void vg_findstack_callback ( Addr start, UInt size, >- Char r, Char w, Char x, >- UInt foffset, UChar* filename ) >-{ >- Addr lastword; >- if (size == 0) return; >- if (r != 'r' || w != 'w' >- /* || x != 'x' --not necessarily so on x86-64*/ >- ) return; >- lastword = start + size - 4; >- if (start <= VG_(esp_at_startup) >- && VG_(esp_at_startup) <= lastword) { >- VG_(foundstack_start) = start; >- VG_(foundstack_size) = size; >- vg_assert(VG_(foundstack_size) > 0); >+ /* If no tool specified, can give usage message without loading tool */ >+ if (*tool == NULL) { >+ if (!need_help) >+ list_tools(); >+ usage(/*help-debug?*/False); > } > } > >- >- >-static void process_cmd_line_options ( void ) >+static void process_cmd_line_options >+ ( UInt* client_auxv, Addr esp_at_startup, >+ const char* toolname, Int need_help ) > { >- Char* argv[M_VG_CMDLINE_OPTS]; >- Int argc; >- Char* p; >- Char* str; >- Int i, eventually_logfile_fd, ctr; >- >-# define ISSPACE(cc) ((cc) == ' ' || (cc) == '\t' || (cc) == '\n') >+ Int i, eventually_logfile_fd; >+ Int *auxp; >+ Int toolname_len = VG_(strlen)(toolname); > > /* log to stderr by default, but usage message goes to stdout */ > eventually_logfile_fd = 2; >@@ -772,298 +1624,182 @@ > VG_(startup_logging)(); > > /* Check for sane path in ./configure --prefix=... */ >- if (VG_(strlen)(VG_LIBDIR) < 1 >- || VG_LIBDIR[0] != '/') >+ if (VG_LIBDIR[0] != '/') > config_error("Please use absolute paths in " > "./configure --prefix=... or --libdir=..."); > >- /* (Suggested by Fabrice Bellard ... ) >- We look for the Linux ELF table and go down until we find the >- envc & envp. It is not fool-proof, but these structures should >- change less often than the libc ones. */ >- { >- Int* sp; >- >- /* Look for the stack segment by parsing /proc/self/maps and >- looking for a section bracketing VG_(esp_at_startup) which >- has rwx permissions and no associated file. Note that this uses >- the /proc/self/maps contents read at the start of VG_(main)(), >- and doesn't re-read /proc/self/maps. */ >- >- VG_(parse_procselfmaps)( vg_findstack_callback ); >- >- /* Now foundstack_start and foundstack_size should delimit the stack. */ >- if (VG_(foundstack_size) == 0) { >- args_grok_error("Cannot determine stack segment " >- "from /proc/self/maps"); >- } >- >- if (0) >- VG_(printf)("stack segment is %p .. %p\n", >- VG_(foundstack_start), >- VG_(foundstack_start) + VG_(foundstack_size) - 4 ); >- >- sp = (UInt*)(VG_(foundstack_start) + VG_(foundstack_size) ); >- if ((((UInt)(sp)) % VKI_BYTES_PER_PAGE) != 0) { >- args_grok_error("Stack segment is not page aligned?!"); >- } >- >- /* we locate: NEW_AUX_ENT(1, AT_PAGESZ, ELF_EXEC_PAGESIZE) in >- the elf interpreter table */ >- >- sp -= 2; >- while (sp[0] != VKI_AT_PAGESZ || sp[1] != 4096) { >- /* VG_(printf)("trying %p\n", sp); */ >- sp--; >- } >- >- if (sp[2] == VKI_AT_BASE >- && sp[0] == VKI_AT_PAGESZ >- && sp[-2] == VKI_AT_PHNUM >- && sp[-4] == VKI_AT_PHENT >- && sp[-6] == VKI_AT_PHDR >- && sp[-6-1] == 0) { >- if (0) >- VG_(printf)("Looks like you've got a 2.2.X kernel here.\n"); >- sp -= 6; >- } else >- if (sp[2] == VKI_AT_CLKTCK >- && sp[0] == VKI_AT_PAGESZ >- && sp[-2] == VKI_AT_HWCAP >- && sp[-2-1] == 0) { >- if (0) >- VG_(printf)("Looks like you've got a 2.4.X kernel here.\n"); >- sp -= 2; >- } else >- if (sp[2] == VKI_AT_CLKTCK >- && sp[0] == VKI_AT_PAGESZ >- && sp[-2] == VKI_AT_HWCAP >- && sp[-4] == VKI_AT_SYSINFO >- && sp[-4-1] == 0) { >- if (0) >- VG_(printf)("Looks like you've got a 2.4.X kernel with " >- "a sysinfo page at %x here.\n", sp[-3]); >- VG_(sysinfo_page_exists) = True; >- VG_(sysinfo_page_addr) = sp[-3]; >- sp -= 4; >- } else >- if (sp[2] == VKI_AT_CLKTCK >- && sp[0] == VKI_AT_PAGESZ >- && sp[-2] == VKI_AT_HWCAP >- && sp[-4] == VKI_AT_USER_AUX_SEGMENT >- && sp[-4-1] == 0) { >- if (0) >- VG_(printf)("Looks like you've got a R-H Limbo 2.4.X " >- "kernel here.\n"); >- sp -= 4; >- } else >- if (sp[2] == VKI_AT_CLKTCK >- && sp[0] == VKI_AT_PAGESZ >- && sp[-2] == VKI_AT_HWCAP >- && sp[-2-20-1] == 0) { >- if (0) >- VG_(printf)("Looks like you've got a early 2.4.X kernel here.\n"); >- sp -= 22; >- } else >- if (sp[2] == VKI_AT_CLKTCK >- && sp[0] == VKI_AT_PAGESZ >- && sp[-2] == VKI_AT_HWCAP >- && sp[-4-1] == 0) { >- if (0) >- VG_(printf)("Looks like a 2.5.43-2.5.67 kernel here.\n"); >- sp -= 4; >- } else >- if (sp[2] == VKI_AT_CLKTCK >- && sp[0] == VKI_AT_PAGESZ >- && sp[-2] == VKI_AT_HWCAP >- && sp[-6] == VKI_AT_SYSINFO >- && sp[-6-1] == 0) { >- if (0) >- VG_(printf)("Looks like a >= 2.5.68 kernel with " >- "a sysinfo page at %x here.\n", sp[-5]); >- VG_(sysinfo_page_exists) = True; >- VG_(sysinfo_page_addr) = sp[-5]; >- sp -= 6; >- } else >- args_grok_error( >- "ELF frame does not look like 2.2.X or 2.4.X.\n " >- "See kernel sources linux/fs/binfmt_elf.c to make sense of this." >- ); >- >- sp--; >- if (*sp != 0) >- args_grok_error("can't find NULL at end of env[]"); >- >- /* sp now points to NULL at the end of env[] */ >- ctr = 0; >- while (True) { >- sp --; >- if (*sp == 0) break; >- if (++ctr >= 2000) >- args_grok_error( >- "suspiciously many (2000) env[] entries; giving up"); >- >- } >- /* sp now points to NULL at the end of argv[] */ >- VG_(client_envp) = (Char**)(sp+1); >- >- ctr = 0; >- VG_(client_argc) = 0; >- while (True) { >- sp--; >- if (*sp == VG_(client_argc)) >- break; >- VG_(client_argc)++; >- if (++ctr >= 1000) >- args_grok_error( >- "suspiciously many (1000) argv[] entries; giving up"); >- } >- >- VG_(client_argv) = (Char**)(sp+1); >- } >- >- /* Now that VG_(client_envp) has been set, we can extract the args >- for Valgrind itself. Copy into global var so that we don't have to >- write zeroes to the getenv'd value itself. */ >- str = VG_(getenv)("VG_ARGS"); >- argc = 0; >- >- if (!str) { >- config_error("Can't read options from env var VG_ARGS."); >- } >- >- if (VG_(strlen)(str) >= M_VG_CMDLINE_STRLEN-1) { >- config_error("Command line length exceeds M_CMDLINE_STRLEN."); >- } >- VG_(strcpy)(vg_cmdline_copy, str); >- str = NULL; >- >- p = &vg_cmdline_copy[0]; >- while (True) { >- while (ISSPACE(*p)) { *p = 0; p++; } >- if (*p == 0) break; >- if (argc < M_VG_CMDLINE_OPTS-1) { >- argv[argc] = p; argc++; >- } else { >- config_error( >- "Found more than M_CMDLINE_OPTS command-line opts."); >+ for (auxp = client_auxv; auxp[0] != VKI_AT_NULL; auxp += 2) { >+ switch(auxp[0]) { >+ case VKI_AT_SYSINFO: >+ VG_(sysinfo_page_exists) = True; >+ auxp[1] = (Int)(VG_(client_trampoline_code) + VG_(tramp_syscall_offset)); >+ VG_(sysinfo_page_addr) = auxp[1]; >+ break; > } >- while (*p != 0 && !ISSPACE(*p)) p++; >- } >+ } > >- for (i = 0; i < argc; i++) { >+ if (need_help) >+ usage(/*--help-debug?*/need_help == 2); > >- if (VG_CLO_STREQ(argv[i], "-v") || >- VG_CLO_STREQ(argv[i], "--verbose")) >+ /* We know the initial ESP is pointing at argc/argv */ >+ VG_(client_argc) = *(Int *)esp_at_startup; >+ VG_(client_argv) = (Char **)(esp_at_startup + sizeof(Int)); >+ >+ for (i = 1; i < VG_(vg_argc); i++) { >+ >+ Char* arg = VG_(vg_argv)[i]; >+ >+ // XXX: allow colons in options, for Josef >+ >+ /* Look for matching "--toolname:foo" */ >+ if (VG_(strstr)(arg, ":")) { >+ if (VG_CLO_STREQN(2, arg, "--") && >+ VG_CLO_STREQN(toolname_len, arg+2, toolname) && >+ VG_CLO_STREQN(1, arg+2+toolname_len, ":")) >+ { >+ // prefix matches, convert "--toolname:foo" to "--foo" >+ if (0) >+ VG_(printf)("tool-specific arg: %s\n", arg); >+ arg += toolname_len + 1; >+ arg[0] = '-'; >+ arg[1] = '-'; >+ >+ } else { >+ // prefix doesn't match, skip to next arg >+ continue; >+ } >+ } >+ >+ /* Ignore these options - they've already been handled */ >+ if (VG_CLO_STREQN(7, arg, "--tool=") || >+ VG_CLO_STREQN(7, arg, "--skin=")) >+ continue; >+ if (VG_CLO_STREQN(7, arg, "--exec=")) >+ continue; >+ >+ if ( VG_CLO_STREQ(arg, "--")) >+ continue; >+ else if (VG_CLO_STREQ(arg, "-v") || >+ VG_CLO_STREQ(arg, "--verbose")) > VG_(clo_verbosity)++; >- else if (VG_CLO_STREQ(argv[i], "-q") || >- VG_CLO_STREQ(argv[i], "--quiet")) >+ else if (VG_CLO_STREQ(arg, "-q") || >+ VG_CLO_STREQ(arg, "--quiet")) > VG_(clo_verbosity)--; > >- else if (VG_CLO_STREQ(argv[i], "--error-limit=yes")) >+ else if (VG_CLO_STREQ(arg, "--error-limit=yes")) > VG_(clo_error_limit) = True; >- else if (VG_CLO_STREQ(argv[i], "--error-limit=no")) >+ else if (VG_CLO_STREQ(arg, "--error-limit=no")) > VG_(clo_error_limit) = False; > >- else if (VG_CLO_STREQ(argv[i], "--gdb-attach=yes")) >- VG_(clo_GDB_attach) = True; >- else if (VG_CLO_STREQ(argv[i], "--gdb-attach=no")) >- VG_(clo_GDB_attach) = False; >+ else if (VG_CLO_STREQ(arg, "--db-attach=yes")) >+ VG_(clo_db_attach) = True; >+ else if (VG_CLO_STREQ(arg, "--db-attach=no")) >+ VG_(clo_db_attach) = False; > >- else if (VG_CLO_STREQN(11,argv[i], "--gdb-path=")) >- VG_(clo_GDB_path) = &argv[i][11]; >+ else if (VG_CLO_STREQN(13,arg, "--db-command=")) >+ VG_(clo_db_command) = &arg[13]; > >- else if (VG_CLO_STREQ(argv[i], "--gen-suppressions=yes")) >+ else if (VG_CLO_STREQ(arg, "--gen-suppressions=yes")) > VG_(clo_gen_suppressions) = True; >- else if (VG_CLO_STREQ(argv[i], "--gen-suppressions=no")) >+ else if (VG_CLO_STREQ(arg, "--gen-suppressions=no")) > VG_(clo_gen_suppressions) = False; > >- else if (VG_CLO_STREQ(argv[i], "--show-below-main=yes")) >+ else if (VG_CLO_STREQ(arg, "--show-below-main=yes")) > VG_(clo_show_below_main) = True; >- else if (VG_CLO_STREQ(argv[i], "--show-below-main=no")) >+ else if (VG_CLO_STREQ(arg, "--show-below-main=no")) > VG_(clo_show_below_main) = False; > >- else if (VG_CLO_STREQ(argv[i], "--demangle=yes")) >+ else if (VG_CLO_STREQ(arg, "--pointercheck=yes")) >+ VG_(clo_pointercheck) = True; >+ else if (VG_CLO_STREQ(arg, "--pointercheck=no")) >+ VG_(clo_pointercheck) = False; >+ >+ else if (VG_CLO_STREQ(arg, "--demangle=yes")) > VG_(clo_demangle) = True; >- else if (VG_CLO_STREQ(argv[i], "--demangle=no")) >+ else if (VG_CLO_STREQ(arg, "--demangle=no")) > VG_(clo_demangle) = False; > >- else if (VG_CLO_STREQ(argv[i], "--trace-children=yes")) >+ else if (VG_CLO_STREQ(arg, "--trace-children=yes")) > VG_(clo_trace_children) = True; >- else if (VG_CLO_STREQ(argv[i], "--trace-children=no")) >+ else if (VG_CLO_STREQ(arg, "--trace-children=no")) > VG_(clo_trace_children) = False; > >- else if (VG_CLO_STREQ(argv[i], "--run-libc-freeres=yes")) >+ else if (VG_CLO_STREQ(arg, "--run-libc-freeres=yes")) > VG_(clo_run_libc_freeres) = True; >- else if (VG_CLO_STREQ(argv[i], "--run-libc-freeres=no")) >+ else if (VG_CLO_STREQ(arg, "--run-libc-freeres=no")) > VG_(clo_run_libc_freeres) = False; > >- else if (VG_CLO_STREQ(argv[i], "--track-fds=yes")) >+ else if (VG_CLO_STREQ(arg, "--track-fds=yes")) > VG_(clo_track_fds) = True; >- else if (VG_CLO_STREQ(argv[i], "--track-fds=no")) >+ else if (VG_CLO_STREQ(arg, "--track-fds=no")) > VG_(clo_track_fds) = False; > >- else if (VG_CLO_STREQN(15, argv[i], "--sanity-level=")) >- VG_(sanity_level) = (Int)VG_(atoll)(&argv[i][15]); >+ else if (VG_CLO_STREQN(15, arg, "--sanity-level=")) >+ VG_(sanity_level) = (Int)VG_(atoll)(&arg[15]); > >- else if (VG_CLO_STREQN(13, argv[i], "--logfile-fd=")) { >+ else if (VG_CLO_STREQN(13, arg, "--logfile-fd=")) { > VG_(clo_log_to) = VgLogTo_Fd; > VG_(clo_logfile_name) = NULL; >- eventually_logfile_fd = (Int)VG_(atoll)(&argv[i][13]); >+ eventually_logfile_fd = (Int)VG_(atoll)(&arg[13]); > } > >- else if (VG_CLO_STREQN(10, argv[i], "--logfile=")) { >+ else if (VG_CLO_STREQN(10, arg, "--logfile=")) { > VG_(clo_log_to) = VgLogTo_File; >- VG_(clo_logfile_name) = &argv[i][10]; >+ VG_(clo_logfile_name) = &arg[10]; > } > >- else if (VG_CLO_STREQN(12, argv[i], "--logsocket=")) { >+ else if (VG_CLO_STREQN(12, arg, "--logsocket=")) { > VG_(clo_log_to) = VgLogTo_Socket; >- VG_(clo_logfile_name) = &argv[i][12]; >+ VG_(clo_logfile_name) = &arg[12]; > } > >- else if (VG_CLO_STREQN(11, argv[i], "--input-fd=")) >- VG_(clo_input_fd) = (Int)VG_(atoll)(&argv[i][11]); >+ else if (VG_CLO_STREQN(11, arg, "--input-fd=")) >+ VG_(clo_input_fd) = (Int)VG_(atoll)(&arg[11]); > >- else if (VG_CLO_STREQN(15, argv[i], "--suppressions=")) { >+ else if (VG_CLO_STREQN(15, arg, "--suppressions=")) { > if (VG_(clo_n_suppressions) >= VG_CLO_MAX_SFILES) { > VG_(message)(Vg_UserMsg, "Too many suppression files specified."); > VG_(message)(Vg_UserMsg, > "Increase VG_CLO_MAX_SFILES and recompile."); >- VG_(bad_option)(argv[i]); >+ VG_(bad_option)(arg); > } >- VG_(clo_suppressions)[VG_(clo_n_suppressions)] = &argv[i][15]; >+ VG_(clo_suppressions)[VG_(clo_n_suppressions)] = &arg[15]; > VG_(clo_n_suppressions)++; > } >- else if (VG_CLO_STREQ(argv[i], "--profile=yes")) >+ else if (VG_CLO_STREQ(arg, "--profile=yes")) > VG_(clo_profile) = True; >- else if (VG_CLO_STREQ(argv[i], "--profile=no")) >+ else if (VG_CLO_STREQ(arg, "--profile=no")) > VG_(clo_profile) = False; > >- else if (VG_CLO_STREQ(argv[i], "--chain-bb=yes")) >+ else if (VG_CLO_STREQ(arg, "--chain-bb=yes")) > VG_(clo_chain_bb) = True; >- else if (VG_CLO_STREQ(argv[i], "--chain-bb=no")) >+ else if (VG_CLO_STREQ(arg, "--chain-bb=no")) > VG_(clo_chain_bb) = False; > >- else if (VG_CLO_STREQ(argv[i], "--single-step=yes")) >+ else if (VG_CLO_STREQ(arg, "--branchpred=yes")) >+ VG_(clo_branchpred) = True; >+ else if (VG_CLO_STREQ(arg, "--branchpred=no")) >+ VG_(clo_branchpred) = False; >+ >+ else if (VG_CLO_STREQ(arg, "--single-step=yes")) > VG_(clo_single_step) = True; >- else if (VG_CLO_STREQ(argv[i], "--single-step=no")) >+ else if (VG_CLO_STREQ(arg, "--single-step=no")) > VG_(clo_single_step) = False; > >- else if (VG_CLO_STREQ(argv[i], "--optimise=yes")) >+ else if (VG_CLO_STREQ(arg, "--optimise=yes")) > VG_(clo_optimise) = True; >- else if (VG_CLO_STREQ(argv[i], "--optimise=no")) >+ else if (VG_CLO_STREQ(arg, "--optimise=no")) > VG_(clo_optimise) = False; > > /* "vwxyz" --> 000zyxwv (binary) */ >- else if (VG_CLO_STREQN(16, argv[i], "--trace-codegen=")) { >+ else if (VG_CLO_STREQN(16, arg, "--trace-codegen=")) { > Int j; >- char* opt = & argv[i][16]; >+ char* opt = & arg[16]; > > if (5 != VG_(strlen)(opt)) { > VG_(message)(Vg_UserMsg, > "--trace-codegen argument must have 5 digits"); >- VG_(bad_option)(argv[i]); >+ VG_(bad_option)(arg); > } > for (j = 0; j < 5; j++) { > if ('0' == opt[j]) { /* do nothing */ } >@@ -1071,95 +1807,87 @@ > else { > VG_(message)(Vg_UserMsg, "--trace-codegen argument can only " > "contain 0s and 1s"); >- VG_(bad_option)(argv[i]); >+ VG_(bad_option)(arg); > } > } > } > >- else if (VG_CLO_STREQ(argv[i], "--trace-syscalls=yes")) >+ else if (VG_CLO_STREQ(arg, "--trace-syscalls=yes")) > VG_(clo_trace_syscalls) = True; >- else if (VG_CLO_STREQ(argv[i], "--trace-syscalls=no")) >+ else if (VG_CLO_STREQ(arg, "--trace-syscalls=no")) > VG_(clo_trace_syscalls) = False; > >- else if (VG_CLO_STREQ(argv[i], "--trace-signals=yes")) >+ else if (VG_CLO_STREQ(arg, "--trace-signals=yes")) > VG_(clo_trace_signals) = True; >- else if (VG_CLO_STREQ(argv[i], "--trace-signals=no")) >+ else if (VG_CLO_STREQ(arg, "--trace-signals=no")) > VG_(clo_trace_signals) = False; > >- else if (VG_CLO_STREQ(argv[i], "--trace-symtab=yes")) >+ else if (VG_CLO_STREQ(arg, "--trace-symtab=yes")) > VG_(clo_trace_symtab) = True; >- else if (VG_CLO_STREQ(argv[i], "--trace-symtab=no")) >+ else if (VG_CLO_STREQ(arg, "--trace-symtab=no")) > VG_(clo_trace_symtab) = False; > >- else if (VG_CLO_STREQ(argv[i], "--trace-sched=yes")) >+ else if (VG_CLO_STREQ(arg, "--trace-sched=yes")) > VG_(clo_trace_sched) = True; >- else if (VG_CLO_STREQ(argv[i], "--trace-sched=no")) >+ else if (VG_CLO_STREQ(arg, "--trace-sched=no")) > VG_(clo_trace_sched) = False; > >- else if (VG_CLO_STREQ(argv[i], "--trace-pthread=none")) >+ else if (VG_CLO_STREQ(arg, "--trace-pthread=none")) > VG_(clo_trace_pthread_level) = 0; >- else if (VG_CLO_STREQ(argv[i], "--trace-pthread=some")) >+ else if (VG_CLO_STREQ(arg, "--trace-pthread=some")) > VG_(clo_trace_pthread_level) = 1; >- else if (VG_CLO_STREQ(argv[i], "--trace-pthread=all")) >+ else if (VG_CLO_STREQ(arg, "--trace-pthread=all")) > VG_(clo_trace_pthread_level) = 2; > >- else if (VG_CLO_STREQN(14, argv[i], "--weird-hacks=")) >- VG_(clo_weird_hacks) = &argv[i][14]; >+ else if (VG_CLO_STREQN(14, arg, "--weird-hacks=")) >+ VG_(clo_weird_hacks) = &arg[14]; > >- else if (VG_CLO_STREQN(17, argv[i], "--signal-polltime=")) >- VG_(clo_signal_polltime) = VG_(atoll)(&argv[i][17]); >+ else if (VG_CLO_STREQN(17, arg, "--signal-polltime=")) >+ VG_(clo_signal_polltime) = VG_(atoll)(&arg[17]); > >- else if (VG_CLO_STREQ(argv[i], "--lowlat-signals=yes")) >+ else if (VG_CLO_STREQ(arg, "--lowlat-signals=yes")) > VG_(clo_lowlat_signals) = True; >- else if (VG_CLO_STREQ(argv[i], "--lowlat-signals=no")) >+ else if (VG_CLO_STREQ(arg, "--lowlat-signals=no")) > VG_(clo_lowlat_signals) = False; > >- else if (VG_CLO_STREQ(argv[i], "--lowlat-syscalls=yes")) >+ else if (VG_CLO_STREQ(arg, "--lowlat-syscalls=yes")) > VG_(clo_lowlat_syscalls) = True; >- else if (VG_CLO_STREQ(argv[i], "--lowlat-syscalls=no")) >+ else if (VG_CLO_STREQ(arg, "--lowlat-syscalls=no")) > VG_(clo_lowlat_syscalls) = False; > >- else if (VG_CLO_STREQN(13, argv[i], "--stop-after=")) >- VG_(clo_stop_after) = VG_(atoll)(&argv[i][13]); >- >- else if (VG_CLO_STREQN(13, argv[i], "--dump-error=")) >- VG_(clo_dump_error) = (Int)VG_(atoll)(&argv[i][13]); >+ else if (VG_CLO_STREQN(13, arg, "--dump-error=")) >+ VG_(clo_dump_error) = (Int)VG_(atoll)(&arg[13]); > >- else if (VG_CLO_STREQ(argv[i], "--wait-for-gdb=yes")) >+ else if (VG_CLO_STREQ(arg, "--wait-for-gdb=yes")) > VG_(clo_wait_for_gdb) = True; >- else if (VG_CLO_STREQ(argv[i], "--wait-for-gdb=no")) >+ else if (VG_CLO_STREQ(arg, "--wait-for-gdb=no")) > VG_(clo_wait_for_gdb) = False; > >- else if (VG_CLO_STREQN(14, argv[i], "--num-callers=")) { >+ else if (VG_CLO_STREQN(14, arg, "--num-callers=")) { > /* Make sure it's sane. */ >- VG_(clo_backtrace_size) = (Int)VG_(atoll)(&argv[i][14]); >+ VG_(clo_backtrace_size) = (Int)VG_(atoll)(&arg[14]); > if (VG_(clo_backtrace_size) < 1) > VG_(clo_backtrace_size) = 1; > if (VG_(clo_backtrace_size) >= VG_DEEPEST_BACKTRACE) > VG_(clo_backtrace_size) = VG_DEEPEST_BACKTRACE; > } > >- else if (VG_(needs).command_line_options) { >- Bool ok = SK_(process_cmd_line_option)(argv[i]); >- if (!ok) >- usage(); >+ else if ( ! VG_(needs).command_line_options >+ || ! SK_(process_cmd_line_option)(arg) ) { >+ usage(/*--help-debug?*/need_help == 2); > } >- else >- usage(); > } > >-# undef ISSPACE >- > if (VG_(clo_verbosity) < 0) > VG_(clo_verbosity) = 0; > >- if (VG_(clo_GDB_attach) && VG_(clo_trace_children)) { >+ if (VG_(clo_db_attach) && VG_(clo_trace_children)) { > VG_(message)(Vg_UserMsg, ""); > VG_(message)(Vg_UserMsg, >- "--gdb-attach=yes conflicts with --trace-children=yes"); >+ "--db-attach=yes conflicts with --trace-children=yes"); > VG_(message)(Vg_UserMsg, > "Please choose one or the other, but not both."); >- VG_(bad_option)("--gdb-attach=yes and --trace-children=yes"); >+ VG_(bad_option)("--db-attach=yes and --trace-children=yes"); > } > > /* Set up logging now. After this is done, VG_(clo_logfile_fd) >@@ -1188,7 +1916,7 @@ > vg_assert(VG_(clo_logfile_name) != NULL); > vg_assert(VG_(strlen)(VG_(clo_logfile_name)) <= 900); /* paranoia */ > >- for(;;) { >+ for (;;) { > if (seq == 0) > VG_(sprintf)(logfilename, "%s.pid%d", > VG_(clo_logfile_name), pid ); >@@ -1202,7 +1930,7 @@ > VKI_O_CREAT|VKI_O_WRONLY|VKI_O_EXCL|VKI_O_TRUNC, > VKI_S_IRUSR|VKI_S_IWUSR); > if (eventually_logfile_fd >= 0) { >- VG_(clo_logfile_fd) = eventually_logfile_fd; >+ VG_(clo_logfile_fd) = VG_(safe_fd)(eventually_logfile_fd); > break; > } else { > if (eventually_logfile_fd != -VKI_EEXIST) { >@@ -1251,7 +1979,7 @@ > } > > /* Move logfile_fd into the safe range, so it doesn't conflict with any app fds */ >- eventually_logfile_fd = VG_(fcntl)(VG_(clo_logfile_fd), VKI_F_DUPFD, VG_MAX_FD+1); >+ eventually_logfile_fd = VG_(fcntl)(VG_(clo_logfile_fd), VKI_F_DUPFD, VG_(max_fd)+1); > if (eventually_logfile_fd < 0) > VG_(message)(Vg_UserMsg, "valgrind: failed to move logfile fd into safe range"); > else { >@@ -1279,7 +2007,7 @@ > "Using valgrind-%s, a program supervision framework for x86-linux.", > VERSION); > VG_(message)(Vg_UserMsg, >- "Copyright (C) 2000-2003, and GNU GPL'd, by Julian Seward."); >+ "Copyright (C) 2000-2004, and GNU GPL'd, by Julian Seward."); > } > > if (VG_(clo_verbosity) > 0 && VG_(clo_log_to) != VgLogTo_Fd) { >@@ -1294,43 +2022,172 @@ > if (VG_(clo_verbosity) > 1) { > if (VG_(clo_log_to) != VgLogTo_Fd) > VG_(message)(Vg_UserMsg, ""); >+ VG_(message)(Vg_UserMsg, "Valgrind library directory: %s", VG_(libdir)); > VG_(message)(Vg_UserMsg, "Command line"); > for (i = 0; i < VG_(client_argc); i++) > VG_(message)(Vg_UserMsg, " %s", VG_(client_argv)[i]); > >- VG_(message)(Vg_UserMsg, "Startup, with flags:"); >- for (i = 0; i < argc; i++) { >- VG_(message)(Vg_UserMsg, " %s", argv[i]); >- } >- } >+ VG_(message)(Vg_UserMsg, "Startup, with flags:"); >+ for (i = 1; i < VG_(vg_argc); i++) { >+ VG_(message)(Vg_UserMsg, " %s", VG_(vg_argv)[i]); >+ } >+ } >+ >+ if (VG_(clo_n_suppressions) < VG_CLO_MAX_SFILES-1 && >+ (VG_(needs).core_errors || VG_(needs).skin_errors)) { >+ /* If there are no suppression files specified and the skin >+ needs one, load the default */ >+ static const Char default_supp[] = "default.supp"; >+ Int len = VG_(strlen)(VG_(libdir)) + 1 + sizeof(default_supp); >+ Char *buf = VG_(arena_malloc)(VG_AR_CORE, len); >+ VG_(sprintf)(buf, "%s/%s", VG_(libdir), default_supp); >+ VG_(clo_suppressions)[VG_(clo_n_suppressions)] = buf; >+ VG_(clo_n_suppressions)++; >+ } >+ >+ if (VG_(clo_gen_suppressions) && >+ !VG_(needs).core_errors && !VG_(needs).skin_errors) { >+ config_error("Can't use --gen-suppressions=yes with this skin,\n" >+ " as it doesn't generate errors."); >+ } >+} >+ >+ >+/*====================================================================*/ >+/*=== File descriptor setup ===*/ >+/*====================================================================*/ >+ >+static void setup_file_descriptors(void) >+{ >+ struct vki_rlimit rl; >+ >+ /* Get the current file descriptor limits. */ >+ if (VG_(getrlimit)(VKI_RLIMIT_NOFILE, &rl) < 0) { >+ rl.rlim_cur = 1024; >+ rl.rlim_max = 1024; >+ } >+ >+ /* Work out where to move the soft limit to. */ >+ if (rl.rlim_cur + VG_N_RESERVED_FDS <= rl.rlim_max) { >+ rl.rlim_cur = rl.rlim_cur + VG_N_RESERVED_FDS; >+ } else { >+ rl.rlim_cur = rl.rlim_max; >+ } >+ >+ /* Reserve some file descriptors for our use. */ >+ VG_(max_fd) = rl.rlim_cur - VG_N_RESERVED_FDS; >+ >+ /* Update the soft limit. */ >+ VG_(setrlimit)(VKI_RLIMIT_NOFILE, &rl); >+ >+ if (VG_(vgexecfd) != -1) >+ VG_(vgexecfd) = VG_(safe_fd)( VG_(vgexecfd) ); >+ if (VG_(clexecfd) != -1) >+ VG_(clexecfd) = VG_(safe_fd)( VG_(clexecfd) ); >+} >+ >+ >+/*====================================================================*/ >+/*=== baseBlock: definition + setup ===*/ >+/*====================================================================*/ >+ >+/* The variables storing offsets. */ >+ >+#define INVALID_OFFSET (-1) >+ >+Int VGOFF_(m_eax) = INVALID_OFFSET; >+Int VGOFF_(m_ecx) = INVALID_OFFSET; >+Int VGOFF_(m_edx) = INVALID_OFFSET; >+Int VGOFF_(m_ebx) = INVALID_OFFSET; >+Int VGOFF_(m_esp) = INVALID_OFFSET; >+Int VGOFF_(m_ebp) = INVALID_OFFSET; >+Int VGOFF_(m_esi) = INVALID_OFFSET; >+Int VGOFF_(m_edi) = INVALID_OFFSET; >+Int VGOFF_(m_eflags) = INVALID_OFFSET; >+Int VGOFF_(m_dflag) = INVALID_OFFSET; >+Int VGOFF_(m_ssestate) = INVALID_OFFSET; >+Int VGOFF_(ldt) = INVALID_OFFSET; >+Int VGOFF_(tls) = INVALID_OFFSET; >+Int VGOFF_(m_cs) = INVALID_OFFSET; >+Int VGOFF_(m_ss) = INVALID_OFFSET; >+Int VGOFF_(m_ds) = INVALID_OFFSET; >+Int VGOFF_(m_es) = INVALID_OFFSET; >+Int VGOFF_(m_fs) = INVALID_OFFSET; >+Int VGOFF_(m_gs) = INVALID_OFFSET; >+Int VGOFF_(m_eip) = INVALID_OFFSET; >+Int VGOFF_(spillslots) = INVALID_OFFSET; >+Int VGOFF_(sh_eax) = INVALID_OFFSET; >+Int VGOFF_(sh_ecx) = INVALID_OFFSET; >+Int VGOFF_(sh_edx) = INVALID_OFFSET; >+Int VGOFF_(sh_ebx) = INVALID_OFFSET; >+Int VGOFF_(sh_esp) = INVALID_OFFSET; >+Int VGOFF_(sh_ebp) = INVALID_OFFSET; >+Int VGOFF_(sh_esi) = INVALID_OFFSET; >+Int VGOFF_(sh_edi) = INVALID_OFFSET; >+Int VGOFF_(sh_eflags) = INVALID_OFFSET; >+ >+Int VGOFF_(helper_idiv_64_32) = INVALID_OFFSET; >+Int VGOFF_(helper_div_64_32) = INVALID_OFFSET; >+Int VGOFF_(helper_idiv_32_16) = INVALID_OFFSET; >+Int VGOFF_(helper_div_32_16) = INVALID_OFFSET; >+Int VGOFF_(helper_idiv_16_8) = INVALID_OFFSET; >+Int VGOFF_(helper_div_16_8) = INVALID_OFFSET; >+Int VGOFF_(helper_imul_32_64) = INVALID_OFFSET; >+Int VGOFF_(helper_mul_32_64) = INVALID_OFFSET; >+Int VGOFF_(helper_imul_16_32) = INVALID_OFFSET; >+Int VGOFF_(helper_mul_16_32) = INVALID_OFFSET; >+Int VGOFF_(helper_imul_8_16) = INVALID_OFFSET; >+Int VGOFF_(helper_mul_8_16) = INVALID_OFFSET; >+Int VGOFF_(helper_CLD) = INVALID_OFFSET; >+Int VGOFF_(helper_STD) = INVALID_OFFSET; >+Int VGOFF_(helper_get_dirflag) = INVALID_OFFSET; >+Int VGOFF_(helper_CLC) = INVALID_OFFSET; >+Int VGOFF_(helper_STC) = INVALID_OFFSET; >+Int VGOFF_(helper_CMC) = INVALID_OFFSET; >+Int VGOFF_(helper_shldl) = INVALID_OFFSET; >+Int VGOFF_(helper_shldw) = INVALID_OFFSET; >+Int VGOFF_(helper_shrdl) = INVALID_OFFSET; >+Int VGOFF_(helper_shrdw) = INVALID_OFFSET; >+Int VGOFF_(helper_IN) = INVALID_OFFSET; >+Int VGOFF_(helper_OUT) = INVALID_OFFSET; >+Int VGOFF_(helper_RDTSC) = INVALID_OFFSET; >+Int VGOFF_(helper_CPUID) = INVALID_OFFSET; >+Int VGOFF_(helper_BSWAP) = INVALID_OFFSET; >+Int VGOFF_(helper_bsfw) = INVALID_OFFSET; >+Int VGOFF_(helper_bsfl) = INVALID_OFFSET; >+Int VGOFF_(helper_bsrw) = INVALID_OFFSET; >+Int VGOFF_(helper_bsrl) = INVALID_OFFSET; >+Int VGOFF_(helper_fstsw_AX) = INVALID_OFFSET; >+Int VGOFF_(helper_SAHF) = INVALID_OFFSET; >+Int VGOFF_(helper_LAHF) = INVALID_OFFSET; >+Int VGOFF_(helper_DAS) = INVALID_OFFSET; >+Int VGOFF_(helper_DAA) = INVALID_OFFSET; >+Int VGOFF_(helper_AAS) = INVALID_OFFSET; >+Int VGOFF_(helper_AAA) = INVALID_OFFSET; >+Int VGOFF_(helper_AAD) = INVALID_OFFSET; >+Int VGOFF_(helper_AAM) = INVALID_OFFSET; >+Int VGOFF_(helper_cmpxchg8b) = INVALID_OFFSET; >+Int VGOFF_(helper_undefined_instruction) = INVALID_OFFSET; >+ >+/* MAX_NONCOMPACT_HELPERS can be increased easily. If MAX_COMPACT_HELPERS is >+ * increased too much, they won't really be compact any more... */ >+#define MAX_COMPACT_HELPERS 8 >+#define MAX_NONCOMPACT_HELPERS 50 > >- if (VG_(clo_n_suppressions) == 0 && >- (VG_(needs).core_errors || VG_(needs).skin_errors)) { >- config_error("No error-suppression files were specified."); >- } >+UInt VG_(n_compact_helpers) = 0; >+UInt VG_(n_noncompact_helpers) = 0; > >- if (VG_(clo_gen_suppressions) && >- !VG_(needs).core_errors && !VG_(needs).skin_errors) { >- config_error("Can't use --gen-suppressions=yes with this skin,\n" >- " as it doesn't generate errors."); >- } >+Addr VG_(compact_helper_addrs) [MAX_COMPACT_HELPERS]; >+Int VG_(compact_helper_offsets)[MAX_COMPACT_HELPERS]; >+Addr VG_(noncompact_helper_addrs) [MAX_NONCOMPACT_HELPERS]; >+Int VG_(noncompact_helper_offsets)[MAX_NONCOMPACT_HELPERS]; > >-} >+/* This is the actual defn of baseblock. */ >+UInt VG_(baseBlock)[VG_BASEBLOCK_WORDS]; > >-/* --------------------------------------------------------------------- >- Copying to/from m_state_static. >- ------------------------------------------------------------------ */ >+/* Words. */ >+static Int baB_off = 0; > >-/* See comment about this in vg_include.h. Change only with >- great care. >-*/ >-__attribute__ ((aligned (16))) >-UInt VG_(m_state_static) [6 /* segment regs, Intel order */ >- + 8 /* int regs, in Intel order */ >- + 1 /* %eflags */ >- + 1 /* %eip */ >- + VG_SIZE_OF_SSESTATE_W /* FPU state */ >- ]; > > UInt VG_(insertDflag)(UInt eflags, Int d) > { >@@ -1355,235 +2212,613 @@ > return ret; > } > >-void VG_(copy_baseBlock_to_m_state_static) ( void ) >+/* Returns the offset, in words. */ >+static Int alloc_BaB ( Int words ) >+{ >+ Int off = baB_off; >+ baB_off += words; >+ if (baB_off >= VG_BASEBLOCK_WORDS) >+ VG_(core_panic)( "alloc_BaB: baseBlock is too small"); >+ >+ return off; >+} >+ >+/* Align offset, in *bytes* */ >+static void align_BaB ( UInt align ) > { >- Int i; >- VG_(m_state_static)[ 0/4] = VG_(baseBlock)[VGOFF_(m_cs)]; >- VG_(m_state_static)[ 4/4] = VG_(baseBlock)[VGOFF_(m_ss)]; >- VG_(m_state_static)[ 8/4] = VG_(baseBlock)[VGOFF_(m_ds)]; >- VG_(m_state_static)[12/4] = VG_(baseBlock)[VGOFF_(m_es)]; >- VG_(m_state_static)[16/4] = VG_(baseBlock)[VGOFF_(m_fs)]; >- VG_(m_state_static)[20/4] = VG_(baseBlock)[VGOFF_(m_gs)]; >- >- VG_(m_state_static)[24/4] = VG_(baseBlock)[VGOFF_(m_eax)]; >- VG_(m_state_static)[28/4] = VG_(baseBlock)[VGOFF_(m_ecx)]; >- VG_(m_state_static)[32/4] = VG_(baseBlock)[VGOFF_(m_edx)]; >- VG_(m_state_static)[36/4] = VG_(baseBlock)[VGOFF_(m_ebx)]; >- VG_(m_state_static)[40/4] = VG_(baseBlock)[VGOFF_(m_esp)]; >- VG_(m_state_static)[44/4] = VG_(baseBlock)[VGOFF_(m_ebp)]; >- VG_(m_state_static)[48/4] = VG_(baseBlock)[VGOFF_(m_esi)]; >- VG_(m_state_static)[52/4] = VG_(baseBlock)[VGOFF_(m_edi)]; >- >- VG_(m_state_static)[56/4] >- = VG_(insertDflag)(VG_(baseBlock)[VGOFF_(m_eflags)], >- VG_(baseBlock)[VGOFF_(m_dflag)]); >- VG_(m_state_static)[60/4] = VG_(baseBlock)[VGOFF_(m_eip)]; >- >- for (i = 0; i < VG_SIZE_OF_SSESTATE_W; i++) >- VG_(m_state_static)[64/4 + i] >- = VG_(baseBlock)[VGOFF_(m_ssestate) + i]; >+ vg_assert(2 == align || 4 == align || 8 == align || 16 == align); >+ baB_off += (align-1); >+ baB_off &= ~(align-1); > } > >+/* Allocate 1 word in baseBlock and set it to the given value. */ >+static Int alloc_BaB_1_set ( Addr a ) >+{ >+ Int off = alloc_BaB(1); >+ VG_(baseBlock)[off] = (UInt)a; >+ return off; >+} > >-void VG_(copy_m_state_static_to_baseBlock) ( void ) >-{ >- Int i; >- VG_(baseBlock)[VGOFF_(m_cs)] = VG_(m_state_static)[ 0/4]; >- VG_(baseBlock)[VGOFF_(m_ss)] = VG_(m_state_static)[ 4/4]; >- VG_(baseBlock)[VGOFF_(m_ds)] = VG_(m_state_static)[ 8/4]; >- VG_(baseBlock)[VGOFF_(m_es)] = VG_(m_state_static)[12/4]; >- VG_(baseBlock)[VGOFF_(m_fs)] = VG_(m_state_static)[16/4]; >- VG_(baseBlock)[VGOFF_(m_gs)] = VG_(m_state_static)[20/4]; >- >- VG_(baseBlock)[VGOFF_(m_eax)] = VG_(m_state_static)[24/4]; >- VG_(baseBlock)[VGOFF_(m_ecx)] = VG_(m_state_static)[28/4]; >- VG_(baseBlock)[VGOFF_(m_edx)] = VG_(m_state_static)[32/4]; >- VG_(baseBlock)[VGOFF_(m_ebx)] = VG_(m_state_static)[36/4]; >- VG_(baseBlock)[VGOFF_(m_esp)] = VG_(m_state_static)[40/4]; >- VG_(baseBlock)[VGOFF_(m_ebp)] = VG_(m_state_static)[44/4]; >- VG_(baseBlock)[VGOFF_(m_esi)] = VG_(m_state_static)[48/4]; >- VG_(baseBlock)[VGOFF_(m_edi)] = VG_(m_state_static)[52/4]; >- >- VG_(baseBlock)[VGOFF_(m_eflags)] >- = VG_(m_state_static)[56/4] & ~EFlagD; >- VG_(baseBlock)[VGOFF_(m_dflag)] >- = VG_(extractDflag)(VG_(m_state_static)[56/4]); >- >- VG_(baseBlock)[VGOFF_(m_eip)] = VG_(m_state_static)[60/4]; >- >- for (i = 0; i < VG_SIZE_OF_SSESTATE_W; i++) >- VG_(baseBlock)[VGOFF_(m_ssestate) + i] >- = VG_(m_state_static)[64/4 + i]; >+/* Registers a function in compact_helper_addrs; compact_helper_offsets is >+ filled in later. */ >+void VG_(register_compact_helper)(Addr a) >+{ >+ if (MAX_COMPACT_HELPERS <= VG_(n_compact_helpers)) { >+ VG_(printf)("Can only register %d compact helpers\n", >+ MAX_COMPACT_HELPERS); >+ VG_(core_panic)("Too many compact helpers registered"); >+ } >+ VG_(compact_helper_addrs)[VG_(n_compact_helpers)] = a; >+ VG_(n_compact_helpers)++; > } > >-Addr VG_(get_stack_pointer) ( void ) >+/* Registers a function in noncompact_helper_addrs; noncompact_helper_offsets >+ * is filled in later. >+ */ >+void VG_(register_noncompact_helper)(Addr a) > { >- return VG_(baseBlock)[VGOFF_(m_esp)]; >+ if (MAX_NONCOMPACT_HELPERS <= VG_(n_noncompact_helpers)) { >+ VG_(printf)("Can only register %d non-compact helpers\n", >+ MAX_NONCOMPACT_HELPERS); >+ VG_(printf)("Try increasing MAX_NON_COMPACT_HELPERS\n"); >+ VG_(core_panic)("Too many non-compact helpers registered"); >+ } >+ VG_(noncompact_helper_addrs)[VG_(n_noncompact_helpers)] = a; >+ VG_(n_noncompact_helpers)++; > } > >-/* Some random tests needed for leak checking */ >+/* Allocate offsets in baseBlock for the skin helpers */ >+static >+void assign_helpers_in_baseBlock(UInt n, Int offsets[], Addr addrs[]) >+{ >+ UInt i; >+ for (i = 0; i < n; i++) >+ offsets[i] = alloc_BaB_1_set( addrs[i] ); >+} > >-Bool VG_(within_stack)(Addr a) >+Bool VG_(need_to_handle_esp_assignment)(void) > { >- if (a >= ((Addr)(&VG_(stack))) >- && a <= ((Addr)(&VG_(stack))) + sizeof(VG_(stack))) >- return True; >- else >- return False; >+ return ( VG_(defined_new_mem_stack_4)() || >+ VG_(defined_die_mem_stack_4)() || >+ VG_(defined_new_mem_stack_8)() || >+ VG_(defined_die_mem_stack_8)() || >+ VG_(defined_new_mem_stack_12)() || >+ VG_(defined_die_mem_stack_12)() || >+ VG_(defined_new_mem_stack_16)() || >+ VG_(defined_die_mem_stack_16)() || >+ VG_(defined_new_mem_stack_32)() || >+ VG_(defined_die_mem_stack_32)() || >+ VG_(defined_new_mem_stack)() || >+ VG_(defined_die_mem_stack)() >+ ); > } > >-Bool VG_(within_m_state_static_OR_threads)(Addr a) >+/* Here we assign actual offsets. It's important to get the most >+ popular referents within 128 bytes of the start, so we can take >+ advantage of short addressing modes relative to %ebp. Popularity >+ of offsets was measured on 22 Feb 02 running a KDE application, and >+ the slots rearranged accordingly, with a 1.5% reduction in total >+ size of translations. */ >+static void init_baseBlock ( Addr client_eip, Addr esp_at_startup ) > { >- if (a >= ((Addr)(&VG_(m_state_static))) >- && a < ((Addr)(&VG_(m_state_static))) + sizeof(VG_(m_state_static))) >- return True; >+ /* Those with offsets under 128 are carefully chosen. */ >+ >+ /* WORD offsets in this column */ >+ /* 0 */ VGOFF_(m_eax) = alloc_BaB_1_set(0); >+ /* 1 */ VGOFF_(m_ecx) = alloc_BaB_1_set(0); >+ /* 2 */ VGOFF_(m_edx) = alloc_BaB_1_set(0); >+ /* 3 */ VGOFF_(m_ebx) = alloc_BaB_1_set(0); >+ /* 4 */ VGOFF_(m_esp) = alloc_BaB_1_set(esp_at_startup); >+ /* 5 */ VGOFF_(m_ebp) = alloc_BaB_1_set(0); >+ /* 6 */ VGOFF_(m_esi) = alloc_BaB_1_set(0); >+ /* 7 */ VGOFF_(m_edi) = alloc_BaB_1_set(0); >+ /* 8 */ VGOFF_(m_eflags) = alloc_BaB_1_set(0); >+ >+ if (VG_(needs).shadow_regs) { >+ /* 9 */ VGOFF_(sh_eax) = alloc_BaB_1_set(0); >+ /* 10 */ VGOFF_(sh_ecx) = alloc_BaB_1_set(0); >+ /* 11 */ VGOFF_(sh_edx) = alloc_BaB_1_set(0); >+ /* 12 */ VGOFF_(sh_ebx) = alloc_BaB_1_set(0); >+ /* 13 */ VGOFF_(sh_esp) = alloc_BaB_1_set(0); >+ /* 14 */ VGOFF_(sh_ebp) = alloc_BaB_1_set(0); >+ /* 15 */ VGOFF_(sh_esi) = alloc_BaB_1_set(0); >+ /* 16 */ VGOFF_(sh_edi) = alloc_BaB_1_set(0); >+ /* 17 */ VGOFF_(sh_eflags) = alloc_BaB_1_set(0); >+ VG_TRACK( post_regs_write_init ); >+ } >+ >+ /* 9,10,11 or 18,19,20... depends on number whether shadow regs are used >+ * and on compact helpers registered */ >+ >+ /* Make these most-frequently-called specialised ones compact, if they >+ are used. */ >+ if (VG_(defined_new_mem_stack_4)()) >+ VG_(register_compact_helper)( (Addr) VG_(tool_interface).track_new_mem_stack_4); >+ >+ if (VG_(defined_die_mem_stack_4)()) >+ VG_(register_compact_helper)( (Addr) VG_(tool_interface).track_die_mem_stack_4); >+ >+ /* (9 or 18) + n_compact_helpers */ >+ /* Allocate slots for compact helpers */ >+ assign_helpers_in_baseBlock(VG_(n_compact_helpers), >+ VG_(compact_helper_offsets), >+ VG_(compact_helper_addrs)); >+ >+ /* (9/10 or 18/19) + n_compact_helpers */ >+ VGOFF_(m_eip) = alloc_BaB_1_set(client_eip); >+ >+ /* There are currently 24 spill slots */ >+ /* (11+/20+ .. 32+/43+) + n_compact_helpers. This can overlap the magic >+ * boundary at >= 32 words, but most spills are to low numbered spill >+ * slots, so the ones above the boundary don't see much action. */ >+ VGOFF_(spillslots) = alloc_BaB(VG_MAX_SPILLSLOTS); >+ >+ /* I gave up counting at this point. Since they're above the >+ short-amode-boundary, there's no point. */ >+ >+ VGOFF_(m_dflag) = alloc_BaB_1_set(1); // 1 == forward D-flag >+ >+ /* The FPU/SSE state. This _must_ be 16-byte aligned. Initial >+ state doesn't matter much, as long as it's not totally borked. */ >+ align_BaB(16); >+ VGOFF_(m_ssestate) = alloc_BaB(VG_SIZE_OF_SSESTATE_W); >+ vg_assert( >+ 0 == ( ((UInt)(& VG_(baseBlock)[VGOFF_(m_ssestate)])) % 16 ) >+ ); >+ >+ /* I assume that if we have SSE2 we also have SSE */ >+ VG_(have_ssestate) = >+ VG_(cpu_has_feature)(VG_X86_FEAT_FXSR) && >+ VG_(cpu_has_feature)(VG_X86_FEAT_SSE); >+ >+ /* set up an initial FPU state (doesn't really matter what it is, >+ so long as it's somewhat valid) */ >+ if (!VG_(have_ssestate)) >+ asm volatile("fwait; fnsave %0; fwait; frstor %0; fwait" >+ : >+ : "m" (VG_(baseBlock)[VGOFF_(m_ssestate)]) >+ : "cc", "memory"); >+ else >+ asm volatile("fwait; fxsave %0; fwait; andl $0xffbf, %1;" >+ "fxrstor %0; fwait" >+ : >+ : "m" (VG_(baseBlock)[VGOFF_(m_ssestate)]), >+ "m" (VG_(baseBlock)[VGOFF_(m_ssestate)+(24/4)]) >+ : "cc", "memory"); >+ >+ if (0) { >+ if (VG_(have_ssestate)) >+ VG_(printf)("Looks like a SSE-capable CPU\n"); >+ else >+ VG_(printf)("Looks like a MMX-only CPU\n"); >+ } >+ >+ /* LDT pointer: pretend the root thread has an empty LDT to start with. */ >+ VGOFF_(ldt) = alloc_BaB_1_set((UInt)NULL); >+ >+ /* TLS pointer: pretend the root thread has no TLS array for now. */ >+ VGOFF_(tls) = alloc_BaB_1_set((UInt)NULL); >+ >+ /* segment registers */ >+ VGOFF_(m_cs) = alloc_BaB_1_set(0); >+ VGOFF_(m_ss) = alloc_BaB_1_set(0); >+ VGOFF_(m_ds) = alloc_BaB_1_set(0); >+ VGOFF_(m_es) = alloc_BaB_1_set(0); >+ VGOFF_(m_fs) = alloc_BaB_1_set(0); >+ VGOFF_(m_gs) = alloc_BaB_1_set(0); >+ >+ VG_(register_noncompact_helper)( (Addr) & VG_(do_useseg) ); >+ >+#define REG(kind, size) \ >+ if (VG_(defined_##kind##_mem_stack##size)()) \ >+ VG_(register_noncompact_helper)( \ >+ (Addr) VG_(tool_interface).track_##kind##_mem_stack##size ); >+ REG(new, _8); >+ REG(new, _12); >+ REG(new, _16); >+ REG(new, _32); >+ REG(new, ); >+ REG(die, _8); >+ REG(die, _12); >+ REG(die, _16); >+ REG(die, _32); >+ REG(die, ); >+#undef REG >+ >+ if (VG_(need_to_handle_esp_assignment)()) >+ VG_(register_noncompact_helper)((Addr) VG_(unknown_esp_update)); >+ >+# define HELPER(name) \ >+ VGOFF_(helper_##name) = alloc_BaB_1_set( (Addr) & VG_(helper_##name)) >+ >+ /* Helper functions. */ >+ HELPER(idiv_64_32); HELPER(div_64_32); >+ HELPER(idiv_32_16); HELPER(div_32_16); >+ HELPER(idiv_16_8); HELPER(div_16_8); >+ >+ HELPER(imul_32_64); HELPER(mul_32_64); >+ HELPER(imul_16_32); HELPER(mul_16_32); >+ HELPER(imul_8_16); HELPER(mul_8_16); >+ >+ HELPER(CLD); HELPER(STD); >+ HELPER(get_dirflag); >+ >+ HELPER(CLC); HELPER(STC); >+ HELPER(CMC); >+ >+ HELPER(shldl); HELPER(shldw); >+ HELPER(shrdl); HELPER(shrdw); >+ >+ HELPER(RDTSC); HELPER(CPUID); > >- if (a >= ((Addr)(&VG_(threads)[0])) >- && a < ((Addr)(&VG_(threads)[VG_N_THREADS]))) >- return True; >+ HELPER(bsfw); HELPER(bsfl); >+ HELPER(bsrw); HELPER(bsrl); > >- return False; >+ HELPER(fstsw_AX); >+ HELPER(SAHF); HELPER(LAHF); >+ HELPER(DAS); HELPER(DAA); >+ HELPER(AAS); HELPER(AAA); >+ HELPER(AAD); HELPER(AAM); >+ HELPER(IN); HELPER(OUT); >+ HELPER(cmpxchg8b); >+ >+ HELPER(undefined_instruction); >+ >+# undef HELPER >+ >+ /* Allocate slots for noncompact helpers */ >+ assign_helpers_in_baseBlock(VG_(n_noncompact_helpers), >+ VG_(noncompact_helper_offsets), >+ VG_(noncompact_helper_addrs)); > } > >-/* --------------------------------------------------------------------- >- Show accumulated counts. >- ------------------------------------------------------------------ */ > >-static __inline__ Int safe_idiv(Int a, Int b) >+/*====================================================================*/ >+/*=== Setup pointercheck ===*/ >+/*====================================================================*/ >+ >+static void setup_pointercheck(void) >+{ >+ int ret; >+ >+ if (VG_(clo_pointercheck)) { >+ vki_modify_ldt_t ldt = { >+ VG_POINTERCHECK_SEGIDX, // entry_number >+ VG_(client_base), // base_addr >+ (VG_(client_end)-VG_(client_base)) / VKI_BYTES_PER_PAGE, // limit >+ 1, // seg_32bit >+ 0, // contents: data, RW, non-expanding >+ 0, // ! read_exec_only >+ 1, // limit_in_pages >+ 0, // ! seg not present >+ 1, // useable >+ }; >+ ret = VG_(do_syscall)(__NR_modify_ldt, 1, &ldt, sizeof(ldt)); >+ if (ret < 0) { >+ VG_(message)(Vg_UserMsg, >+ "Warning: ignoring --pointercheck=yes, " >+ "because modify_ldt failed (errno=%d)", -ret); >+ VG_(clo_pointercheck) = False; >+ } >+ } >+} >+ >+/*====================================================================*/ >+/*=== Initialise program data/text, etc. ===*/ >+/*====================================================================*/ >+ >+static void build_valgrind_map_callback >+ ( Addr start, UInt size, Char rr, Char ww, Char xx, >+ UInt dev, UInt ino, ULong foffset, const UChar* filename ) > { >- return (b == 0 ? 0 : a / b); >+ UInt prot = 0; >+ UInt flags = SF_MMAP|SF_NOSYMS; >+ Bool is_stack_segment; >+ >+ is_stack_segment = >+ (start == VG_(clstk_base) && (start+size) == VG_(clstk_end)); >+ >+ /* Only record valgrind mappings for now, without loading any >+ symbols. This is so we know where the free space is before we >+ start allocating more memory (note: heap is OK, it's just mmap >+ which is the problem here). */ >+ if (start >= VG_(valgrind_base) && (start+size) <= VG_(valgrind_end)) { >+ flags |= SF_VALGRIND; >+ VG_(map_file_segment)(start, size, prot, flags, dev, ino, foffset, filename); >+ } > } > >-static void vg_show_counts ( void ) >+// Global var used to pass local data to callback >+Addr esp_at_startup___global_arg = 0; >+ >+static void build_segment_map_callback >+ ( Addr start, UInt size, Char rr, Char ww, Char xx, >+ UInt dev, UInt ino, ULong foffset, const UChar* filename ) > { >- VG_(message)(Vg_DebugMsg, >- " TT/TC: %d tc sectors discarded.", >- VG_(number_of_tc_discards) ); >- VG_(message)(Vg_DebugMsg, >- " %d chainings, %d unchainings.", >- VG_(bb_enchain_count), VG_(bb_dechain_count) ); >- VG_(message)(Vg_DebugMsg, >- "translate: new %d (%d -> %d; ratio %d:10)", >- VG_(overall_in_count), >- VG_(overall_in_osize), >- VG_(overall_in_tsize), >- safe_idiv(10*VG_(overall_in_tsize), VG_(overall_in_osize))); >- VG_(message)(Vg_DebugMsg, >- " discard %d (%d -> %d; ratio %d:10).", >- VG_(overall_out_count), >- VG_(overall_out_osize), >- VG_(overall_out_tsize), >- safe_idiv(10*VG_(overall_out_tsize), VG_(overall_out_osize))); >- VG_(message)(Vg_DebugMsg, >- " dispatch: %llu jumps (bb entries), of which %u (%lu%%) were unchained.", >- VG_(bbs_done), >- VG_(unchained_jumps_done), >- ((ULong)(100) * (ULong)(VG_(unchained_jumps_done))) >- / ( VG_(bbs_done)==0 ? 1 : VG_(bbs_done) ) >- ); >+ UInt prot = 0; >+ UInt flags; >+ Bool is_stack_segment; >+ Addr r_esp; > >- VG_(message)(Vg_DebugMsg, >- " %d/%d major/minor sched events. %d tt_fast misses.", >- VG_(num_scheduling_events_MAJOR), >- VG_(num_scheduling_events_MINOR), >- VG_(tt_fast_misses)); >+ is_stack_segment >+ = (start == VG_(clstk_base) && (start+size) == VG_(clstk_end)); > >- VG_(message)(Vg_DebugMsg, >- "reg-alloc: %d t-req-spill, " >- "%d+%d orig+spill uis, %d total-reg-r.", >- VG_(translations_needing_spill), >- VG_(uinstrs_prealloc), >- VG_(uinstrs_spill), >- VG_(total_reg_rank) ); >- VG_(message)(Vg_DebugMsg, >- " sanity: %d cheap, %d expensive checks.", >- VG_(sanity_fast_count), >- VG_(sanity_slow_count) ); >- VG_(print_ccall_stats)(); >+ if (rr == 'r') prot |= VKI_PROT_READ; >+ if (ww == 'w') prot |= VKI_PROT_WRITE; >+ if (xx == 'x') prot |= VKI_PROT_EXEC; >+ >+ if (is_stack_segment) >+ flags = SF_STACK | SF_GROWDOWN; >+ else >+ flags = SF_EXEC|SF_MMAP; >+ >+ if (filename != NULL) >+ flags |= SF_FILE; >+ >+ if (start >= VG_(valgrind_base) && (start+size) <= VG_(valgrind_end)) >+ flags |= SF_VALGRIND; >+ >+ VG_(map_file_segment)(start, size, prot, flags, dev, ino, foffset, filename); >+ >+ if (VG_(is_client_addr)(start) && VG_(is_client_addr)(start+size-1)) >+ VG_TRACK( new_mem_startup, start, size, rr=='r', ww=='w', xx=='x' ); >+ >+ /* If this is the stack segment mark all below %esp as noaccess. */ >+ r_esp = esp_at_startup___global_arg; >+ vg_assert(0 != r_esp); >+ if (is_stack_segment) { >+ if (0) >+ VG_(message)(Vg_DebugMsg, "invalidating stack area: %x .. %x", >+ start,r_esp); >+ VG_TRACK( die_mem_stack, start, r_esp-start ); >+ } > } > > >-/* --------------------------------------------------------------------- >- Main! >- ------------------------------------------------------------------ */ >+/*====================================================================*/ >+/*=== Sanity check machinery (permanently engaged) ===*/ >+/*====================================================================*/ > >-/* Initialize the PID and PGRP of scheduler LWP; this is also called >- in any new children after fork. */ >-static void newpid(ThreadId unused) >+/* A fast sanity check -- suitable for calling circa once per >+ millisecond. */ >+ >+void VG_(do_sanity_checks) ( Bool force_expensive ) > { >- /* PID of scheduler LWP */ >- VG_(main_pid) = VG_(getpid)(); >- VG_(main_pgrp) = VG_(getpgrp)(); >+ VGP_PUSHCC(VgpCoreCheapSanity); >+ >+ if (VG_(sanity_level) < 1) return; >+ >+ /* --- First do all the tests that we can do quickly. ---*/ >+ >+ VG_(sanity_fast_count)++; >+ >+ /* Check stuff pertaining to the memory check system. */ >+ >+ /* Check that nobody has spuriously claimed that the first or >+ last 16 pages of memory have become accessible [...] */ >+ if (VG_(needs).sanity_checks) { >+ VGP_PUSHCC(VgpSkinCheapSanity); >+ vg_assert(SK_(cheap_sanity_check)()); >+ VGP_POPCC(VgpSkinCheapSanity); >+ } >+ >+ /* --- Now some more expensive checks. ---*/ >+ >+ /* Once every 25 times, check some more expensive stuff. */ >+ if ( force_expensive >+ || VG_(sanity_level) > 1 >+ || (VG_(sanity_level) == 1 && (VG_(sanity_fast_count) % 25) == 0)) { >+ >+ VGP_PUSHCC(VgpCoreExpensiveSanity); >+ VG_(sanity_slow_count)++; >+ >+ VG_(proxy_sanity)(); >+ >+# if 0 >+ { void zzzmemscan(void); zzzmemscan(); } >+# endif >+ >+ if ((VG_(sanity_fast_count) % 250) == 0) >+ VG_(sanity_check_tc_tt)(); >+ >+ if (VG_(needs).sanity_checks) { >+ VGP_PUSHCC(VgpSkinExpensiveSanity); >+ vg_assert(SK_(expensive_sanity_check)()); >+ VGP_POPCC(VgpSkinExpensiveSanity); >+ } >+ /* >+ if ((VG_(sanity_fast_count) % 500) == 0) VG_(mallocSanityCheckAll)(); >+ */ >+ VGP_POPCC(VgpCoreExpensiveSanity); >+ } >+ >+ if (VG_(sanity_level) > 1) { >+ VGP_PUSHCC(VgpCoreExpensiveSanity); >+ /* Check sanity of the low-level memory manager. Note that bugs >+ in the client's code can cause this to fail, so we don't do >+ this check unless specially asked for. And because it's >+ potentially very expensive. */ >+ VG_(mallocSanityCheckAll)(); >+ VGP_POPCC(VgpCoreExpensiveSanity); >+ } >+ VGP_POPCC(VgpCoreCheapSanity); > } > >-/* Where we jump to once Valgrind has got control, and the real >- machine's state has been copied to the m_state_static. */ > >-void VG_(main) ( void ) >-{ >- Int i; >+/*====================================================================*/ >+/*=== main() ===*/ >+/*====================================================================*/ >+ >+int main(int argc, char **argv) >+{ >+ char **cl_argv; >+ const char *tool = NULL; >+ const char *exec = NULL; >+ char *preload; /* tool-specific LD_PRELOAD .so */ >+ char **env; >+ Int need_help = 0; // 0 = no, 1 = --help, 2 = --help-debug >+ struct exeinfo info; >+ ToolInfo *toolinfo = NULL; >+ void *tool_dlhandle; >+ Addr client_eip; >+ Addr esp_at_startup; /* client's %esp at the point we gained control. */ >+ UInt * client_auxv; > VgSchedReturnCode src; > >+ //============================================================ >+ // Nb: startup is complex. Prerequisites are shown at every step. >+ // >+ // *** Be very careful when messing with the order *** >+ //============================================================ >+ >+ //-------------------------------------------------------------- >+ // Check we were launched by stage1 >+ // p: n/a [must be first step] >+ //-------------------------------------------------------------- >+ scan_auxv(); >+ > if (0) { >- if (VG_(have_ssestate)) >- VG_(printf)("Looks like a SSE-capable CPU\n"); >- else >- VG_(printf)("Looks like a MMX-only CPU\n"); >+ int prmap(void *start, void *end, const char *perm, off_t off, >+ int maj, int min, int ino) { >+ printf("mapping %10p-%10p %s %02x:%02x %d\n", >+ start, end, perm, maj, min, ino); >+ return True; >+ } >+ printf("========== main() ==========\n"); >+ foreach_map(prmap); > } > >- /* Check skin and core versions are compatible */ >- if (VG_CORE_INTERFACE_MAJOR_VERSION != VG_(skin_interface_major_version)) { >- VG_(printf)("Error:\n" >- " Tool and core interface versions do not match.\n" >- " Interface version used by core is: %d.%d\n" >- " Interface version used by tool is: %d.%d\n" >- " The major version numbers must match.\n", >- VG_CORE_INTERFACE_MAJOR_VERSION, >- VG_CORE_INTERFACE_MINOR_VERSION, >- VG_(skin_interface_major_version), >- VG_(skin_interface_minor_version)); >- VG_(printf)(" You need to at least recompile, and possibly update,\n"); >- if (VG_CORE_INTERFACE_MAJOR_VERSION > VG_(skin_interface_major_version)) >- VG_(printf)(" your skin to work with this version of Valgrind.\n"); >- else >- VG_(printf)(" your version of Valgrind to work with this skin.\n"); >- VG_(printf)(" Aborting, sorry.\n"); >- VG_(exit)(1); >- } >+ //-------------------------------------------------------------- >+ // Look for alternative libdir >+ // p: n/a >+ //-------------------------------------------------------------- >+ { char *cp = getenv(VALGRINDLIB); >+ if (cp != NULL) >+ VG_(libdir) = cp; >+ } >+ >+ //-------------------------------------------------------------- >+ // Begin working out address space layout >+ // p: n/a >+ //-------------------------------------------------------------- >+ layout_client_space( (Addr) & argc ); >+ >+ //-------------------------------------------------------------- >+ // Get valgrind args + client args (inc. from VALGRIND_OPTS/.valgrindrc). >+ // Pre-process the command line. >+ // p: n/a >+ //-------------------------------------------------------------- >+ get_command_line(argc, argv, &VG_(vg_argc), &VG_(vg_argv), &cl_argv); >+ pre_process_cmd_line_options(&need_help, &tool, &exec); >+ >+ //============================================================== >+ // Nb: once a tool is specified, the tool.so must be loaded even if >+ // they specified --help or didn't specify a client program. >+ //============================================================== >+ >+ //-------------------------------------------------------------- >+ // With client padded out, map in tool >+ // p: layout_client_space() [for padding] >+ // p: set-libdir [for VG_(libdir)] >+ // p: pre_process_cmd_line_options() [for 'tool'] >+ //-------------------------------------------------------------- >+ load_tool(tool, &tool_dlhandle, &toolinfo, &preload); >+ >+ //============================================================== >+ // Can use VG_(malloc)() and VG_(arena_malloc)() only after load_tool() >+ // -- redzone size is now set. >+ //============================================================== >+ >+ //-------------------------------------------------------------- >+ // Finalise address space layout >+ // p: layout_client_space(), load_tool() [for 'toolinfo'] >+ //-------------------------------------------------------------- >+ layout_remaining_space( toolinfo->shadow_ratio ); >+ >+ //-------------------------------------------------------------- >+ // Load client executable, finding in $PATH if necessary >+ // p: layout_client_space() [so there's space] >+ // p: pre_process_cmd_line_options() [for 'exec', 'need_help'] >+ // p: layout_remaining_space [so there's space] >+ //-------------------------------------------------------------- >+ load_client(cl_argv, exec, /*inout*/&need_help, &info, &client_eip); >+ >+ //-------------------------------------------------------------- >+ // Everything in place, unpad us >+ // p: layout_remaining_space() [everything must be mapped in before now] >+ // p: load_client() [ditto] >+ //-------------------------------------------------------------- >+ as_unpad((void *)VG_(shadow_end), (void *)~0); >+ as_closepadfile(); /* no more padding */ >+ >+ //-------------------------------------------------------------- >+ // Set up client's environment >+ // p: set-libdir [for VG_(libdir)] >+ // p: load_tool() [for 'preload'] >+ //-------------------------------------------------------------- >+ env = fix_environment(environ, preload); >+ >+ //-------------------------------------------------------------- >+ // Setup client stack and eip >+ // p: load_client() [for 'info'] >+ // p: fix_environment() [for 'env'] >+ //-------------------------------------------------------------- >+ esp_at_startup = setup_client_stack(cl_argv, env, &info, &client_auxv); >+ >+ if (0) >+ printf("entry=%x client esp=%x vg_argc=%d brkbase=%x\n", >+ client_eip, esp_at_startup, VG_(vg_argc), VG_(brk_base)); >+ >+ //============================================================== >+ // Finished setting up operating environment. Now initialise >+ // Valgrind. (This is where the old VG_(main)() started.) >+ //============================================================== >+ >+ //-------------------------------------------------------------- >+ // Read /proc/self/maps into a buffer >+ // p: all memory layout, environment setup [so memory maps are right] >+ //-------------------------------------------------------------- >+ VG_(read_procselfmaps)(); > >+ //-------------------------------------------------------------- >+ // atfork >+ // p: n/a >+ //-------------------------------------------------------------- > VG_(atfork)(NULL, NULL, newpid); > newpid(VG_INVALID_THREADID); > >- /* Set up our stack sanity-check words. */ >- for (i = 0; i < 10; i++) { >- VG_(stack)[i] = (UInt)(&VG_(stack)[i]) ^ 0xA4B3C2D1; >- VG_(stack)[VG_STACK_SIZE_W-1-i] >- = (UInt)(&VG_(stack)[VG_STACK_SIZE_W-i-1]) ^ 0xABCD4321; >- } >- >- /* Read /proc/self/maps into a buffer. Must be before: >- - SK_(pre_clo_init)(): so that if it calls VG_(malloc)(), any mmap'd >- superblocks are not erroneously identified as being owned by the >- client, which would be bad. >- - init_memory(): that's where the buffer is parsed >- - init_tt_tc(): so the anonymous mmaps for the translation table and >- translation cache aren't identified as part of the client, which would >- waste > 20M of virtual address space, and be bad. >- */ >- VG_(read_procselfmaps)(); >- >- /* Setup stuff that depends on the skin. Must be before: >- - vg_init_baseBlock(): to register helpers >- - process_cmd_line_options(): to register skin name and description, >- and turn on/off 'command_line_options' need >- - init_memory() (to setup memory event trackers). >- */ >- SK_(pre_clo_init)(); >+ //-------------------------------------------------------------- >+ // setup file descriptors >+ // p: n/a >+ //-------------------------------------------------------------- >+ setup_file_descriptors(); >+ >+ //-------------------------------------------------------------- >+ // Setup tool >+ // p: VG_(read_procselfmaps)() [so if sk_pre_clo_init calls >+ // VG_(malloc), any mmap'd superblocks aren't erroneously >+ // identified later as being owned by the client] >+ // XXX: is that necessary, now that we look for V's segments separately? >+ // XXX: alternatively, if sk_pre_clo_init does use VG_(malloc)(), is it >+ // wrong to ignore any segments that might add in parse_procselfmaps? >+ //-------------------------------------------------------------- >+ (*toolinfo->sk_pre_clo_init)(); >+ VG_(tool_init_dlsym)(tool_dlhandle); > VG_(sanity_check_needs)(); > >- /* Process Valgrind's command-line opts (from env var VG_ARGS). */ >- process_cmd_line_options(); >- >+ //-------------------------------------------------------------- >+ // Process Valgrind's + tool's command-line options >+ // p: load_tool() [for 'tool'] >+ // p: load_client() [for 'need_help'] >+ // p: setup_file_descriptors() [for 'VG_(max_fd)'] >+ // p: sk_pre_clo_init [to set 'command_line_options' need] >+ //-------------------------------------------------------------- >+ process_cmd_line_options(client_auxv, esp_at_startup, tool, need_help); >+ >+ //-------------------------------------------------------------- >+ // Allow GDB attach >+ // p: process_cmd_line_options() [for VG_(clo_wait_for_gdb)] >+ //-------------------------------------------------------------- > /* Hook to delay things long enough so we can get the pid and > attach GDB in another shell. */ > if (VG_(clo_wait_for_gdb)) { >@@ -1592,73 +2827,156 @@ > VG_(do_syscall)(__NR_pause); > } > >- /* Do post command-line processing initialisation. Must be before: >- - vg_init_baseBlock(): to register any more helpers >- */ >+ //-------------------------------------------------------------- >+ // Setup tool, post command-line processing >+ // p: process_cmd_line_options [tool assumes it] >+ //-------------------------------------------------------------- > SK_(post_clo_init)(); > >- /* Set up baseBlock offsets and copy the saved machine's state into it. */ >- vg_init_baseBlock(); >- >- /* Search for file descriptors that are inherited from our parent. */ >+ //-------------------------------------------------------------- >+ // Set up baseBlock >+ // p: {pre,post}_clo_init() [for tool helper registration] >+ // load_client() [for 'client_eip'] >+ // setup_client_stack() [for 'esp_at_startup'] >+ //-------------------------------------------------------------- >+ init_baseBlock(client_eip, esp_at_startup); >+ >+ //-------------------------------------------------------------- >+ // Search for file descriptors that are inherited from our parent >+ // p: process_cmd_line_options [for VG_(clo_track_fds)] >+ //-------------------------------------------------------------- > if (VG_(clo_track_fds)) > VG_(init_preopened_fds)(); > >- /* Initialise the scheduler, and copy the client's state from >- baseBlock into VG_(threads)[1]. Must be before: >- - VG_(sigstartup_actions)() >- */ >+ //-------------------------------------------------------------- >+ // Initialise the scheduler >+ // p: init_baseBlock() [baseBlock regs copied into VG_(threads)[1]] >+ // p: setup_file_descriptors() [else VG_(safe_fd)() breaks] >+ //-------------------------------------------------------------- > VG_(scheduler_init)(); > >- /* Set up the ProxyLWP machinery */ >+ //-------------------------------------------------------------- >+ // Set up the ProxyLWP machinery >+ // p: VG_(scheduler_init)()? [XXX: subtle dependency?] >+ // - subs: VG_(sigstartup_actions)()? >+ //-------------------------------------------------------------- > VG_(proxy_init)(); > >- /* Initialise the signal handling subsystem, temporarily parking >- the saved blocking-mask in saved_sigmask. */ >+ //-------------------------------------------------------------- >+ // Initialise the signal handling subsystem >+ // p: VG_(atfork)(NULL, NULL, newpid) [else problems with sigmasks] >+ // p: VG_(proxy_init)() [else breaks...] >+ //-------------------------------------------------------------- >+ // Nb: temporarily parks the saved blocking-mask in saved_sigmask. > VG_(sigstartup_actions)(); > >- /* Perhaps we're profiling Valgrind? */ >+ //-------------------------------------------------------------- >+ // Perhaps we're profiling Valgrind? >+ // p: process_cmd_line_options() [for VG_(clo_profile)] >+ // p: others? >+ // >+ // XXX: this seems to be broken? It always says the tool wasn't built >+ // for profiling; vg_profile.c's functions don't seem to be overriding >+ // vg_dummy_profile.c's? >+ // >+ // XXX: want this as early as possible. Looking for --profile >+ // in pre_process_cmd_line_options() could get it earlier. >+ //-------------------------------------------------------------- > if (VG_(clo_profile)) > VGP_(init_profiling)(); > >- /* Start calibration of our RDTSC-based clock. */ >- VG_(start_rdtsc_calibration)(); >+ VGP_PUSHCC(VgpStartup); > >- /* Parse /proc/self/maps to learn about startup segments. */ >- VGP_PUSHCC(VgpInitMem); >- VG_(init_memory)(); >- VGP_POPCC(VgpInitMem); >- >- /* Read the list of errors to suppress. This should be found in >- the file specified by vg_clo_suppressions. */ >+ //-------------------------------------------------------------- >+ // Reserve Valgrind's kickstart, heap and stack >+ // p: XXX ??? >+ //-------------------------------------------------------------- >+ VG_(map_segment)(VG_(valgrind_mmap_end), >+ VG_(valgrind_end)-VG_(valgrind_mmap_end), >+ VKI_PROT_NONE, SF_VALGRIND|SF_FIXED); >+ >+ //-------------------------------------------------------------- >+ // Identify Valgrind's segments >+ // p: read proc/self/maps >+ // p: VG_(map_segment) [XXX ???] >+ // p: sk_pre_clo_init() [to setup new_mem_startup tracker] >+ //-------------------------------------------------------------- >+ VG_(parse_procselfmaps) ( build_valgrind_map_callback ); >+ >+ // XXX: I can't see why these two need to be separate; could they be >+ // folded together? If not, need a comment explaining why. >+ // >+ // XXX: can we merge reading and parsing of /proc/self/maps? >+ // >+ // XXX: can we dynamically allocate the /proc/self/maps buffer? (or mmap >+ // it?) Or does that disturb its contents... >+ >+ //-------------------------------------------------------------- >+ // Build segment map (all segments) >+ // p: setup_client_stack() [for 'esp_at_startup'] >+ //-------------------------------------------------------------- >+ esp_at_startup___global_arg = esp_at_startup; >+ VG_(parse_procselfmaps) ( build_segment_map_callback ); /* everything */ >+ esp_at_startup___global_arg = 0; >+ >+ //============================================================== >+ // Can only use VG_(map)() after VG_(map_segment)() [XXX ???] >+ //============================================================== >+ >+ //-------------------------------------------------------------- >+ // Build segment map (all segments) >+ // p: setup_client_stack() [for 'esp_at_startup'] >+ //-------------------------------------------------------------- >+ /* Initialize our trampoline page (which is also sysinfo stuff) */ >+ VG_(memcpy)( (void *)VG_(client_trampoline_code), >+ &VG_(trampoline_code_start), VG_(trampoline_code_length) ); >+ VG_(mprotect)( (void *)VG_(client_trampoline_code), >+ VG_(trampoline_code_length), VKI_PROT_READ|VKI_PROT_EXEC ); >+ >+ //-------------------------------------------------------------- >+ // Read suppression file >+ // p: process_cmd_line_options() [for VG_(clo_suppressions)] >+ //-------------------------------------------------------------- > if (VG_(needs).core_errors || VG_(needs).skin_errors) > VG_(load_suppressions)(); > >- /* End calibration of our RDTSC-based clock, leaving it as long as >- we can. */ >- VG_(end_rdtsc_calibration)(); >- >- /* Initialise translation table and translation cache. */ >+ //-------------------------------------------------------------- >+ // Initialise translation table and translation cache >+ // p: read_procselfmaps [so the anonymous mmaps for the TT/TC >+ // aren't identified as part of the client, which would waste >+ // > 20M of virtual address space.] >+ //-------------------------------------------------------------- > VG_(init_tt_tc)(); > >- if (VG_(clo_verbosity) == 1) { >- VG_(message)(Vg_UserMsg, >- "For more details, rerun with: -v"); >- } >- >- /* Force a read of the debug info so that we can look for >- glibc entry points to intercept. */ >+ //-------------------------------------------------------------- >+ // Read debug info to find glibc entry points to intercept >+ // p: parse_procselfmaps? [XXX for debug info?] >+ // p: init_tt_tc? [XXX ???] >+ //-------------------------------------------------------------- > VG_(setup_code_redirect_table)(); > >- /* Now it is safe for malloc et al in vg_clientmalloc.c to act >- instrumented-ly. */ >+ //-------------------------------------------------------------- >+ // Verbosity message >+ // p: end_rdtsc_calibration [so startup message is printed first] >+ //-------------------------------------------------------------- >+ if (VG_(clo_verbosity) == 1) >+ VG_(message)(Vg_UserMsg, "For more details, rerun with: -v"); > if (VG_(clo_verbosity) > 0) > VG_(message)(Vg_UserMsg, ""); > >- VG_(bbs_to_go) = VG_(clo_stop_after); >+ //-------------------------------------------------------------- >+ // Setup pointercheck >+ // p: process_cmd_line_options() [for VG_(clo_pointercheck)] >+ //-------------------------------------------------------------- >+ setup_pointercheck(); > >- /* Run! */ >+ >+ >+ //-------------------------------------------------------------- >+ // Run! >+ //-------------------------------------------------------------- > VG_(running_on_simd_CPU) = True; >+ VGP_POPCC(VgpStartup); > VGP_PUSHCC(VgpSched); > > if (__builtin_setjmp(&VG_(fatal_signal_jmpbuf)) == 0) { >@@ -1670,6 +2988,12 @@ > VGP_POPCC(VgpSched); > VG_(running_on_simd_CPU) = False; > >+ >+ >+ //-------------------------------------------------------------- >+ // Finalisation: cleanup, messages, etc. Order no so important, only >+ // affects what order the messages come. >+ //-------------------------------------------------------------- > if (VG_(clo_verbosity) > 0) > VG_(message)(Vg_UserMsg, ""); > >@@ -1679,7 +3003,7 @@ > } > > /* Print out file descriptor summary and stats. */ >- if(VG_(clo_track_fds)) >+ if (VG_(clo_track_fds)) > VG_(fd_stats)(); > > if (VG_(needs).core_errors || VG_(needs).skin_errors) >@@ -1690,7 +3014,7 @@ > VG_(do_sanity_checks)( True /*include expensive checks*/ ); > > if (VG_(clo_verbosity) > 1) >- vg_show_counts(); >+ show_counts(); > > if (VG_(clo_verbosity) > 3) > VG_(print_UInstr_histogram)(); >@@ -1709,31 +3033,18 @@ > if (VG_(clo_profile)) > VGP_(done_profiling)(); > >+ /* Must be after all messages are done */ > VG_(shutdown_logging)(); > >- /* Remove valgrind.so from a LD_PRELOAD=... string so child >- processes don't get traced into. Also mess up $libdir/valgrind >- so that our libpthread.so disappears from view. */ >- /* 26 Apr 03: doing this often causes trouble for no reason, and is >- pointless when we are just about to VgSrc_ExitSyscall. So don't >- bother in that case. */ >- if ((!VG_(clo_trace_children)) >- && src != VgSrc_ExitSyscall) { >- VG_(mash_LD_PRELOAD_and_LD_LIBRARY_PATH)( >- VG_(getenv)("LD_PRELOAD"), >- VG_(getenv)("LD_LIBRARY_PATH") >- ); >- } >- > /* We're exiting, so nuke all the threads and clean up the proxy LWPs */ > vg_assert(src == VgSrc_FatalSig || > VG_(threads)[VG_(last_run_tid)].status == VgTs_Runnable || > VG_(threads)[VG_(last_run_tid)].status == VgTs_WaitJoiner); > VG_(nuke_all_threads_except)(VG_INVALID_THREADID); > >- /* Decide how to exit. This depends on what the scheduler >- returned. */ >- >+ //-------------------------------------------------------------- >+ // Exit, according to the scheduler's return code >+ //-------------------------------------------------------------- > switch (src) { > case VgSrc_ExitSyscall: /* the normal way out */ > vg_assert(VG_(last_run_tid) > 0 >@@ -1745,331 +3056,31 @@ > that arg. */ > VG_(exit)( VG_(exitcode) ); > /* NOT ALIVE HERE! */ >- VG_(core_panic)("entered the afterlife in vg_main() -- ExitSyscall"); >+ VG_(core_panic)("entered the afterlife in main() -- ExitSyscall"); > break; /* what the hell :) */ > > case VgSrc_Deadlock: > /* Just exit now. No point in continuing. */ > VG_(proxy_shutdown)(); > VG_(exit)(0); >- VG_(core_panic)("entered the afterlife in vg_main() -- Deadlock"); >+ VG_(core_panic)("entered the afterlife in main() -- Deadlock"); > break; > >- case VgSrc_BbsDone: >- /* Tricky; we have to try and switch back to the real CPU. >- This is all very dodgy and won't work at all in the >- presence of threads, or if the client happened to be >- running a signal handler. */ >- /* Prepare to restore state to the real CPU. */ >- VG_(sigshutdown_actions)(); >- VG_(load_thread_state)(1 /* root thread */ ); >- VG_(copy_baseBlock_to_m_state_static)(); >- >- VG_(proxy_shutdown)(); >- >- /* This pushes a return address on the simulator's stack, >- which is abandoned. We call vg_sigshutdown_actions() at >- the end of vg_switch_to_real_CPU(), so as to ensure that >- the original stack and machine state is restored before >- the real signal mechanism is restored. */ >- VG_(switch_to_real_CPU)(); >- > case VgSrc_FatalSig: > /* We were killed by a fatal signal, so replicate the effect */ > vg_assert(VG_(fatal_sigNo) != -1); > VG_(kill_self)(VG_(fatal_sigNo)); >- VG_(core_panic)("vg_main(): signal was supposed to be fatal"); >+ VG_(core_panic)("main(): signal was supposed to be fatal"); > break; > > default: >- VG_(core_panic)("vg_main(): unexpected scheduler return code"); >- } >-} >- >- >-/* Debugging thing .. can be called from assembly with OYNK macro. */ >-void VG_(oynk) ( Int n ) >-{ >- OINK(n); >-} >- >- >-/* Find "valgrind.so" in a LD_PRELOAD=... string, and convert it to >- "valgrinq.so", which doesn't do anything. This is used to avoid >- tracing into child processes. To make this work the build system >- also supplies a dummy file, "valgrinq.so". >- >- Also replace "vgskin_<foo>.so" with whitespace, for the same reason; >- without it, child processes try to find valgrind.so symbols in the >- skin .so. >- >- Also look for $(libdir)/lib/valgrind in LD_LIBRARY_PATH and change >- it to $(libdir)/lib/valgrinq, so as to make our libpthread.so >- disappear. >-*/ >-static void slideleft ( Char* s ) >-{ >- vg_assert(s && (*s == ' ' || *s == ':')); >- while (True) { >- s[0] = s[1]; >- if (s[0] == '\0') break; >- s++; >- } >-} >- >- >-void VG_(mash_LD_PRELOAD_and_LD_LIBRARY_PATH) ( Char* ld_preload_str, >- Char* ld_library_path_str ) >-{ >- Char* vg_prel = NULL; >- Char* sk_prel = NULL; >- Char* coredir2 = NULL; >- Char* p; >- Char* coredir_first; >- Char* coredir_last; >- Int coredir_len; >- Int i; >- Int what; >- >-#define MUTANCY(n) { what = n; goto mutancy; } >- >- if (ld_preload_str == NULL || ld_library_path_str == NULL) MUTANCY(0); >- >- /* VG_(printf)("pre:\n%s\n%s\n", ld_preload_str, ld_library_path_str); */ >- >- /* LD_PRELOAD = "<skindir>/vgskin_foo.so:<coredir>/valgrind.so:X" >- LD_LIBRARY_PATH = "<coredir>:Y" */ >- >- /* Setting up, finding things */ >- >- /* LD_PRELOAD: Search for "valgrind.so" */ >- vg_prel = VG_(strstr)(ld_preload_str, "valgrind.so"); >- >- /* LD_PRELOAD: if "valgrind.so" not found, has been done before; >- "valgrinq.so" should be there instead. Then stop. */ >- if (NULL == vg_prel) { >- if (VG_(strstr)(ld_preload_str, "valgrinq.so") == NULL) MUTANCY(1); >- return; >- } >- >- /* LD_PRELOAD: find start of <coredir> */ >- p = vg_prel; >- >- for (p = vg_prel; *p != ':' && p > ld_preload_str; p--) { } >- if (*p != ':') MUTANCY(2); /* skin.so entry must precede it */ >- coredir_first = p+1; >- coredir_last = vg_prel - 1; >- coredir_len = coredir_last - coredir_first; >- >- /* LD_PRELOAD: find "vgskin_foo.so" */ >- sk_prel = VG_(strstr)(ld_preload_str, "vgskin_"); >- if (sk_prel == NULL) MUTANCY(4); >- >- /* LD_LIBRARY_PATH: find <coredir> */ >- *coredir_last = '\0'; /* Temporarily zero-terminate coredir */ >- coredir2 = VG_(strstr)(ld_library_path_str, coredir_first); >- if (coredir2 == NULL) MUTANCY(5); >- *coredir_last = '/'; /* Undo zero-termination */ >- >- /* Changing things */ >- >- /* LD_PRELOAD: "valgrind.so" --> "valgrinq.so" */ >- if (vg_prel[7] != 'd') MUTANCY(6); >- vg_prel[7] = 'q'; >- >- /* LD_PRELOAD: "<skindir>/vgskin_foo.so:<coredir>/valgrinq.so:X" --> >- " vgskin_foo.so:<coredir>/valgrinq.so:X" */ >- p = sk_prel-1; >- while (*p != ':' && p >= ld_preload_str) { >- *p = ' '; >- p--; >- } >- /* LD_PRELOAD: " vgskin_foo.so:<coredir>/valgrinq.so:X" --> >- " :<coredir>/valgrinq.so:X" */ >- p = sk_prel; >- while (*p != ':' && *p != '\0') { >- *p = ' '; >- p++; >- } >- if (*p == '\0') MUTANCY(7); /* valgrind.so has disappeared?! */ >- >- /* LD_LIBRARY_PATH: "<coredir>:Y" --> " :Y" */ >- for (i = 0; i < coredir_len; i++) >- coredir2[i] = ' '; >- >- /* Zap the leading spaces and : in both strings. */ >- while (ld_preload_str[0] == ' ') slideleft(ld_preload_str); >- if (ld_preload_str[0] == ':') slideleft(ld_preload_str); >- >- while (ld_library_path_str[0] == ' ') slideleft(ld_library_path_str); >- if (ld_library_path_str[0] == ':') slideleft(ld_library_path_str); >- >- /* VG_(printf)("post:\n%s\n%s\n", ld_preload_str, ld_library_path_str); */ >- >- return; >- >- >-mutancy: >- VG_(printf)( >- "\nVG_(mash_LD_PRELOAD_and_LD_LIBRARY_PATH): internal error:\n" >- " what = %d\n" >- " ld_preload_str = `%s'\n" >- " ld_library_path_str = `%s'\n" >- " vg_prel = `%s'\n" >- " sk_prel = `%s'\n" >- " coredir2 = `%s'\n" >- " VG_LIBDIR = `%s'\n", >- what, ld_preload_str, ld_library_path_str, >- vg_prel, sk_prel, coredir2, VG_LIBDIR >- ); >- VG_(printf)( >- "\n" >- "Note that this is often caused by mis-installation of valgrind.\n" >- "Correct installation procedure is:\n" >- " ./configure --prefix=/install/dir\n" >- " make install\n" >- "And then use /install/dir/bin/valgrind\n" >- "Moving the installation directory elsewhere after 'make install'\n" >- "will cause the above error. Hand-editing the paths in the shell\n" >- "scripts is also likely to cause problems.\n" >- "\n" >- ); >- VG_(core_panic)("VG_(mash_LD_PRELOAD_and_LD_LIBRARY_PATH) failed\n"); >-} >- >- >-/* RUNS ON THE CLIENT'S STACK, but on the real CPU. Start GDB and get >- it to attach to this process. Called if the user requests this >- service after an error has been shown, so she can poke around and >- look at parameters, memory, etc. You can't meaningfully get GDB to >- continue the program, though; to continue, quit GDB. */ >-extern void VG_(start_GDB_whilst_on_client_stack) ( void ) >-{ >- Int res; >- UChar buf[100]; >- >- VG_(sprintf)(buf, "%s -nw /proc/%d/exe %d", >- VG_(clo_GDB_path), VG_(getpid)(), VG_(getpid)()); >- VG_(message)(Vg_UserMsg, "starting GDB with cmd: %s", buf); >- res = VG_(system)(buf); >- if (res == 0) { >- VG_(message)(Vg_UserMsg, ""); >- VG_(message)(Vg_UserMsg, >- "GDB has detached. Valgrind regains control. We continue."); >- } else { >- VG_(message)(Vg_UserMsg, "Apparently failed!"); >- VG_(message)(Vg_UserMsg, ""); >+ VG_(core_panic)("main(): unexpected scheduler return code"); > } >-} >- > >-/* Print some helpful-ish text about unimplemented things, and give >- up. */ >-void VG_(unimplemented) ( Char* msg ) >-{ >- VG_(message)(Vg_UserMsg, ""); >- VG_(message)(Vg_UserMsg, >- "Valgrind detected that your program requires"); >- VG_(message)(Vg_UserMsg, >- "the following unimplemented functionality:"); >- VG_(message)(Vg_UserMsg, " %s", msg); >- VG_(message)(Vg_UserMsg, >- "This may be because the functionality is hard to implement,"); >- VG_(message)(Vg_UserMsg, >- "or because no reasonable program would behave this way,"); >- VG_(message)(Vg_UserMsg, >- "or because nobody has yet needed it. In any case, let us know at"); >- VG_(message)(Vg_UserMsg, >- "%s and/or try to work around the problem, if you can.", VG_BUGS_TO); >- VG_(message)(Vg_UserMsg, >- ""); >- VG_(message)(Vg_UserMsg, >- "Valgrind has to exit now. Sorry. Bye!"); >- VG_(message)(Vg_UserMsg, >- ""); >- VG_(pp_sched_status)(); >- VG_(exit)(1); >+ abort(); > } > > >-/* --------------------------------------------------------------------- >- Sanity check machinery (permanently engaged). >- ------------------------------------------------------------------ */ >- >-/* A fast sanity check -- suitable for calling circa once per >- millisecond. */ >- >-void VG_(do_sanity_checks) ( Bool force_expensive ) >-{ >- Int i; >- >- VGP_PUSHCC(VgpCoreCheapSanity); >- >- if (VG_(sanity_level) < 1) return; >- >- /* --- First do all the tests that we can do quickly. ---*/ >- >- VG_(sanity_fast_count)++; >- >- /* Check that we haven't overrun our private stack. */ >- for (i = 0; i < 10; i++) { >- vg_assert(VG_(stack)[i] >- == ((UInt)(&VG_(stack)[i]) ^ 0xA4B3C2D1)); >- vg_assert(VG_(stack)[VG_STACK_SIZE_W-1-i] >- == ((UInt)(&VG_(stack)[VG_STACK_SIZE_W-i-1]) ^ 0xABCD4321)); >- } >- >- /* Check stuff pertaining to the memory check system. */ >- >- /* Check that nobody has spuriously claimed that the first or >- last 16 pages of memory have become accessible [...] */ >- if (VG_(needs).sanity_checks) { >- VGP_PUSHCC(VgpSkinCheapSanity); >- vg_assert(SK_(cheap_sanity_check)()); >- VGP_POPCC(VgpSkinCheapSanity); >- } >- >- /* --- Now some more expensive checks. ---*/ >- >- /* Once every 25 times, check some more expensive stuff. */ >- if ( force_expensive >- || VG_(sanity_level) > 1 >- || (VG_(sanity_level) == 1 && (VG_(sanity_fast_count) % 25) == 0)) { >- >- VGP_PUSHCC(VgpCoreExpensiveSanity); >- VG_(sanity_slow_count)++; >- >- VG_(proxy_sanity)(); >- >-# if 0 >- { void zzzmemscan(void); zzzmemscan(); } >-# endif >- >- if ((VG_(sanity_fast_count) % 250) == 0) >- VG_(sanity_check_tc_tt)(); >- >- if (VG_(needs).sanity_checks) { >- VGP_PUSHCC(VgpSkinExpensiveSanity); >- vg_assert(SK_(expensive_sanity_check)()); >- VGP_POPCC(VgpSkinExpensiveSanity); >- } >- /* >- if ((VG_(sanity_fast_count) % 500) == 0) VG_(mallocSanityCheckAll)(); >- */ >- VGP_POPCC(VgpCoreExpensiveSanity); >- } >- >- if (VG_(sanity_level) > 1) { >- VGP_PUSHCC(VgpCoreExpensiveSanity); >- /* Check sanity of the low-level memory manager. Note that bugs >- in the client's code can cause this to fail, so we don't do >- this check unless specially asked for. And because it's >- potentially very expensive. */ >- VG_(mallocSanityCheckAll)(); >- VGP_POPCC(VgpCoreExpensiveSanity); >- } >- VGP_POPCC(VgpCoreCheapSanity); >-} > /*--------------------------------------------------------------------*/ > /*--- end vg_main.c ---*/ > /*--------------------------------------------------------------------*/ >diff -ruN valgrind-2.1.0/coregrind/vg_malloc2.c valgrind/coregrind/vg_malloc2.c >--- valgrind-2.1.0/coregrind/vg_malloc2.c 2003-07-12 07:11:39.000000000 -0500 >+++ valgrind/coregrind/vg_malloc2.c 2004-01-26 11:24:41.000000000 -0600 >@@ -8,7 +8,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -35,6 +35,68 @@ > /* Define to turn on (heavyweight) debugging machinery. */ > /* #define DEBUG_MALLOC */ > >+/*------------------------------------------------------------*/ >+/*--- Command line options ---*/ >+/*------------------------------------------------------------*/ >+ >+/* Round malloc sizes upwards to integral number of words? default: NO */ >+Bool VG_(clo_sloppy_malloc) = False; >+ >+/* DEBUG: print malloc details? default: NO */ >+Bool VG_(clo_trace_malloc) = False; >+ >+/* Minimum alignment in functions that don't specify alignment explicitly. >+ default: 0, i.e. use default of the machine (== 4) */ >+Int VG_(clo_alignment) = 4; >+ >+ >+Bool VG_(replacement_malloc_process_cmd_line_option)(Char* arg) >+{ >+ if (VG_CLO_STREQN(12, arg, "--alignment=")) { >+ VG_(clo_alignment) = (Int)VG_(atoll)(&arg[12]); >+ >+ if (VG_(clo_alignment) < 4 >+ || VG_(clo_alignment) > 4096 >+ || VG_(log2)( VG_(clo_alignment) ) == -1 /* not a power of 2 */) { >+ VG_(message)(Vg_UserMsg, ""); >+ VG_(message)(Vg_UserMsg, >+ "Invalid --alignment= setting. " >+ "Should be a power of 2, >= 4, <= 4096."); >+ VG_(bad_option)("--alignment"); >+ } >+ } >+ >+ else if (VG_CLO_STREQ(arg, "--sloppy-malloc=yes")) >+ VG_(clo_sloppy_malloc) = True; >+ else if (VG_CLO_STREQ(arg, "--sloppy-malloc=no")) >+ VG_(clo_sloppy_malloc) = False; >+ >+ else if (VG_CLO_STREQ(arg, "--trace-malloc=yes")) >+ VG_(clo_trace_malloc) = True; >+ else if (VG_CLO_STREQ(arg, "--trace-malloc=no")) >+ VG_(clo_trace_malloc) = False; >+ >+ else >+ return False; >+ >+ return True; >+} >+ >+void VG_(replacement_malloc_print_usage)(void) >+{ >+ VG_(printf)( >+" --sloppy-malloc=no|yes round malloc sizes to next word? [no]\n" >+" --alignment=<number> set minimum alignment of allocations [4]\n" >+ ); >+} >+ >+void VG_(replacement_malloc_print_debug_usage)(void) >+{ >+ VG_(printf)( >+" --trace-malloc=no|yes show client malloc details? [no]\n" >+ ); >+} >+ > > /*------------------------------------------------------------*/ > /*--- Structs n stuff ---*/ >@@ -66,9 +128,10 @@ > typedef > struct { > Char* name; >- Int rz_szW; /* Red zone size in words */ >- Bool rz_check; /* Check red-zone on free? */ >- Int min_sblockW; /* Minimum superblock size */ >+ Bool clientmem; /* allocates in the client address space */ >+ Int rz_szW; /* Red zone size in words */ >+ Bool rz_check; /* Check red-zone on free? */ >+ Int min_sblockW; /* Minimum superblock size */ > WordF* freelist[VG_N_MALLOC_LISTS]; > Superblock* sblocks; > /* Stats only. */ >@@ -143,11 +206,12 @@ > /* Initialise an arena. */ > static > void arena_init ( Arena* a, Char* name, >- Int rz_szW, Bool rz_check, Int min_sblockW ) >+ Int rz_szW, Bool rz_check, Int min_sblockW, Bool client ) > { > Int i; > vg_assert((min_sblockW % VKI_WORDS_PER_PAGE) == 0); > a->name = name; >+ a->clientmem = client; > a->rz_szW = rz_szW; > a->rz_check = rz_check; > a->min_sblockW = min_sblockW; >@@ -190,32 +254,32 @@ > > /* Use a checked red zone size of 1 word for our internal stuff, > and an unchecked zone of arbitrary size for the client. Of >- course the client's red zone can be checked by the skin, eg. >+ course the client's red zone can be checked by the tool, eg. > by using addressibility maps, but not by the mechanism implemented > here, which merely checks at the time of freeing that the red > zone words are unchanged. */ > >- arena_init ( &vg_arena[VG_AR_CORE], "core", 1, True, 262144 ); >+ arena_init ( &vg_arena[VG_AR_CORE], "core", 1, True, 262144, False ); > >- arena_init ( &vg_arena[VG_AR_SKIN], "skin", 1, True, 262144 ); >+ arena_init ( &vg_arena[VG_AR_TOOL], "tool", 1, True, 262144, False ); > >- arena_init ( &vg_arena[VG_AR_SYMTAB], "symtab", 1, True, 262144 ); >+ arena_init ( &vg_arena[VG_AR_SYMTAB], "symtab", 1, True, 262144, False ); > >- arena_init ( &vg_arena[VG_AR_JITTER], "JITter", 1, True, 8192 ); >+ arena_init ( &vg_arena[VG_AR_JITTER], "JITter", 1, True, 8192, False ); > > /* No particular reason for this figure, it's just smallish */ > sk_assert(VG_(vg_malloc_redzone_szB) < 128); > arena_init ( &vg_arena[VG_AR_CLIENT], "client", >- VG_(vg_malloc_redzone_szB)/4, False, 262144 ); >+ VG_(vg_malloc_redzone_szB)/4, False, 262144, True ); > > arena_init ( &vg_arena[VG_AR_DEMANGLE], "demangle", 4 /*paranoid*/, >- True, 16384 ); >+ True, 16384, False ); > >- arena_init ( &vg_arena[VG_AR_EXECTXT], "exectxt", 1, True, 16384 ); >+ arena_init ( &vg_arena[VG_AR_EXECTXT], "exectxt", 1, True, 16384, False ); > >- arena_init ( &vg_arena[VG_AR_ERRORS], "errors", 1, True, 16384 ); >+ arena_init ( &vg_arena[VG_AR_ERRORS], "errors", 1, True, 16384, False ); > >- arena_init ( &vg_arena[VG_AR_TRANSIENT], "transien", 2, True, 16384 ); >+ arena_init ( &vg_arena[VG_AR_TRANSIENT], "transien", 2, True, 16384, False ); > > init_done = True; > # ifdef DEBUG_MALLOC >@@ -257,8 +321,13 @@ > cszW += 2; /* Take into account sb->next and sb->n_words fields */ > if (cszW < a->min_sblockW) cszW = a->min_sblockW; > while ((cszW % VKI_WORDS_PER_PAGE) > 0) cszW++; >- sb = VG_(get_memory_from_mmap) ( cszW * sizeof(Word), >- "newSuperblock" ); >+ >+ if (a->clientmem) { >+ sb = (Superblock *)VG_(client_alloc)(0, cszW * sizeof(Word), >+ VKI_PROT_READ|VKI_PROT_WRITE|VKI_PROT_EXEC, 0); >+ } else >+ sb = VG_(get_memory_from_mmap) ( cszW * sizeof(Word), >+ "newSuperblock" ); > sb->n_payload_words = cszW - 2; > a->bytes_mmaped += cszW * sizeof(Word); > if (0) >@@ -1289,31 +1358,31 @@ > /*--- Skin-visible functions. ---*/ > /*------------------------------------------------------------*/ > >-/* All just wrappers to avoid exposing arenas to skins */ >+/* All just wrappers to avoid exposing arenas to tools */ > > void* VG_(malloc) ( Int nbytes ) > { >- return VG_(arena_malloc) ( VG_AR_SKIN, nbytes ); >+ return VG_(arena_malloc) ( VG_AR_TOOL, nbytes ); > } > > void VG_(free) ( void* ptr ) > { >- VG_(arena_free) ( VG_AR_SKIN, ptr ); >+ VG_(arena_free) ( VG_AR_TOOL, ptr ); > } > > void* VG_(calloc) ( Int nmemb, Int nbytes ) > { >- return VG_(arena_calloc) ( VG_AR_SKIN, /*alignment*/4, nmemb, nbytes ); >+ return VG_(arena_calloc) ( VG_AR_TOOL, /*alignment*/4, nmemb, nbytes ); > } > > void* VG_(realloc) ( void* ptr, Int size ) > { >- return VG_(arena_realloc) ( VG_AR_SKIN, ptr, /*alignment*/4, size ); >+ return VG_(arena_realloc) ( VG_AR_TOOL, ptr, /*alignment*/4, size ); > } > > void* VG_(malloc_aligned) ( Int req_alignB, Int req_pszB ) > { >- return VG_(arena_malloc_aligned) ( VG_AR_SKIN, req_alignB, req_pszB ); >+ return VG_(arena_malloc_aligned) ( VG_AR_TOOL, req_alignB, req_pszB ); > } > > >diff -ruN valgrind-2.1.0/coregrind/vg_memory.c valgrind/coregrind/vg_memory.c >--- valgrind-2.1.0/coregrind/vg_memory.c 2003-10-13 17:26:54.000000000 -0500 >+++ valgrind/coregrind/vg_memory.c 2004-01-24 12:18:52.000000000 -0600 >@@ -9,7 +9,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -32,219 +32,528 @@ > > #include "vg_include.h" > >+#include <stddef.h> >+ > /* Define to debug the memory-leak-detector. */ > /* #define VG_DEBUG_LEAKCHECK */ > >+static const Bool mem_debug = False; >+ >+static Int addrcmp(const void *ap, const void *bp) >+{ >+ Addr a = *(Addr *)ap; >+ Addr b = *(Addr *)bp; >+ Int ret; >+ >+ if (a == b) >+ ret = 0; >+ else >+ ret = (a < b) ? -1 : 1; >+ >+ return ret; >+} >+ >+static Char *straddr(void *p) >+{ >+ static Char buf[16]; >+ >+ VG_(sprintf)(buf, "%p", *(Addr *)p); >+ >+ return buf; >+} >+ >+static SkipList sk_segments = SKIPLIST_INIT(Segment, addr, addrcmp, straddr, VG_AR_CORE); > > /*--------------------------------------------------------------*/ >-/*--- Initialise program data/text etc on program startup. ---*/ >+/*--- Maintain an ordered list of all the client's mappings ---*/ > /*--------------------------------------------------------------*/ > >-typedef >- struct _ExeSeg { >- Addr start; >- UInt size; >- struct _ExeSeg* next; >- } >- ExeSeg; >- >-/* The list of current executable segments loaded. Required so that when a >- segment is munmap'd, if it's executable we can recognise it as such and >- invalidate translations for it, and drop any basic-block specific >- information being stored. If symbols are being used, this list will have >- the same segments recorded in it as the SegInfo symbols list (but much >- less information about each segment). >-*/ >-static ExeSeg* exeSegsHead = NULL; >+Bool VG_(seg_contains)(const Segment *s, Addr p, UInt len) >+{ >+ Addr se = s->addr+s->len; >+ Addr pe = p+len; > >-/* Prepend it -- mmaps/munmaps likely to follow a stack pattern(?) so this >- is good. >- Also check no segments overlap, which would be very bad. Check is linear >- for each seg added (quadratic overall) but the total number should be >- small (konqueror has around 50 --njn). */ >-static void add_exe_segment_to_list( Addr a, UInt len ) >-{ >- Addr lo = a; >- Addr hi = a + len - 1; >- ExeSeg* es; >- ExeSeg* es2; >- >- /* Prepend it */ >- es = (ExeSeg*)VG_(arena_malloc)(VG_AR_CORE, sizeof(ExeSeg)); >- es->start = a; >- es->size = len; >- es->next = exeSegsHead; >- exeSegsHead = es; >- >- /* Check there's no overlap with the rest of the list */ >- for (es2 = es->next; es2 != NULL; es2 = es2->next) { >- Addr lo2 = es2->start; >- Addr hi2 = es2->start + es2->size - 1; >- Bool overlap; >- vg_assert(lo < hi); >- vg_assert(lo2 < hi2); >- /* the main assertion */ >- overlap = (lo <= lo2 && lo2 <= hi) >- || (lo <= hi2 && hi2 <= hi); >- if (overlap) { >- VG_(printf)("\n\nOVERLAPPING EXE SEGMENTS\n" >- " new: start %p, size %d\n" >- " old: start %p, size %d\n\n", >- es->start, es->size, es2->start, es2->size ); >- vg_assert(! overlap); >- } >+ vg_assert(pe >= p); >+ >+ return (p >= s->addr && pe <= se); >+} >+ >+Bool VG_(seg_overlaps)(const Segment *s, Addr p, UInt len) >+{ >+ Addr se = s->addr+s->len; >+ Addr pe = p+len; >+ >+ vg_assert(pe >= p); >+ >+ return (p < se && pe > s->addr); >+} >+ >+/* Prepare a Segment structure for recycling by freeing everything >+ hanging off it. */ >+static void recycleseg(Segment *s) >+{ >+ if (s->flags & SF_CODE) >+ VG_(invalidate_translations)(s->addr, s->len, False); >+ >+ if (s->filename != NULL) >+ VG_(arena_free)(VG_AR_CORE, (Char *)s->filename); >+ >+ /* keep the SegInfo, if any - it probably still applies */ >+} >+ >+/* When freeing a Segment, also clean up every one else's ideas of >+ what was going on in that range of memory */ >+static void freeseg(Segment *s) >+{ >+ recycleseg(s); >+ if (s->symtab != NULL) { >+ VG_(symtab_decref)(s->symtab, s->addr, s->len); >+ s->symtab = NULL; > } >+ >+ VG_(SkipNode_Free)(&sk_segments, s); > } > >-static Bool remove_if_exeseg_from_list( Addr a ) >+/* Split a segment at address a, returning the new segment */ >+Segment *VG_(split_segment)(Addr a) > { >- ExeSeg **prev_next_ptr = & exeSegsHead, >- *curr = exeSegsHead; >+ Segment *s = VG_(SkipList_Find)(&sk_segments, &a); >+ Segment *ns; >+ Int delta; >+ >+ vg_assert((a & (VKI_BYTES_PER_PAGE-1)) == 0); >+ >+ /* missed */ >+ if (s == NULL) >+ return NULL; > >- while (True) { >- if (curr == NULL) break; >- if (a == curr->start) break; >- prev_next_ptr = &curr->next; >- curr = curr->next; >+ /* a at or beyond endpoint */ >+ if (s->addr == a || a >= (s->addr+s->len)) >+ return NULL; >+ >+ vg_assert(a > s->addr && a < (s->addr+s->len)); >+ >+ ns = VG_(SkipNode_Alloc)(&sk_segments); >+ >+ *ns = *s; >+ >+ delta = a - s->addr; >+ ns->addr += delta; >+ ns->offset += delta; >+ ns->len -= delta; >+ s->len = delta; >+ >+ if (s->filename != NULL) >+ ns->filename = VG_(arena_strdup)(VG_AR_CORE, s->filename); >+ >+ if (ns->symtab != NULL) >+ VG_(symtab_incref)(ns->symtab); >+ >+ VG_(SkipList_Insert)(&sk_segments, ns); >+ >+ return ns; >+} >+ >+/* This unmaps all the segments in the range [addr, addr+len); any >+ partial mappings at the ends are truncated. */ >+void VG_(unmap_range)(Addr addr, UInt len) >+{ >+ Segment *s; >+ Segment *next; >+ static const Bool debug = False || mem_debug; >+ Addr end; >+ >+ if (len == 0) >+ return; >+ >+ len = PGROUNDUP(len); >+ vg_assert(addr == PGROUNDDN(addr)); >+ >+ if (debug) >+ VG_(printf)("unmap_range(%p, %d)\n", addr, len); >+ >+ end = addr+len; >+ >+ /* Everything must be page-aligned */ >+ vg_assert((addr & (VKI_BYTES_PER_PAGE-1)) == 0); >+ vg_assert((len & (VKI_BYTES_PER_PAGE-1)) == 0); >+ >+ for(s = VG_(SkipList_Find)(&sk_segments, &addr); >+ s != NULL && s->addr < (addr+len); >+ s = next) { >+ Addr seg_end = s->addr + s->len; >+ >+ /* fetch next now in case we end up deleting this segment */ >+ next = VG_(SkipNode_Next)(&sk_segments, s); >+ >+ if (debug) >+ VG_(printf)("unmap: addr=%p-%p s=%p ->addr=%p-%p len=%d\n", >+ addr, end, s, s->addr, seg_end, s->len); >+ >+ if (!VG_(seg_overlaps)(s, addr, len)) { >+ if (debug) >+ VG_(printf)(" (no overlap)\n"); >+ continue; >+ } >+ >+ /* 4 cases: */ >+ if (addr > s->addr && >+ addr < seg_end && >+ end >= seg_end) { >+ /* this segment's tail is truncated by [addr, addr+len) >+ -> truncate tail >+ */ >+ s->len = addr - s->addr; >+ >+ if (debug) >+ VG_(printf)(" case 1: s->len=%d\n", s->len); >+ } else if (addr <= s->addr && end > s->addr && end < seg_end) { >+ /* this segment's head is truncated by [addr, addr+len) >+ -> truncate head >+ */ >+ Int delta = end - s->addr; >+ >+ if (debug) >+ VG_(printf)(" case 2: s->addr=%p s->len=%d delta=%d\n", s->addr, s->len, delta); >+ >+ s->addr += delta; >+ s->offset += delta; >+ s->len -= delta; >+ >+ vg_assert(s->len != 0); >+ } else if (addr <= s->addr && end >= seg_end) { >+ /* this segment is completely contained within [addr, addr+len) >+ -> delete segment >+ */ >+ Segment *rs = VG_(SkipList_Remove)(&sk_segments, &s->addr); >+ vg_assert(rs == s); >+ freeseg(s); >+ >+ if (debug) >+ VG_(printf)(" case 3: s==%p deleted\n", s); >+ } else if (addr > s->addr && end < seg_end) { >+ /* [addr, addr+len) is contained within a single segment >+ -> split segment into 3, delete middle portion >+ */ >+ Segment *middle, *rs; >+ >+ middle = VG_(split_segment)(addr); >+ VG_(split_segment)(addr+len); >+ >+ vg_assert(middle->addr == addr); >+ rs = VG_(SkipList_Remove)(&sk_segments, &addr); >+ vg_assert(rs == middle); >+ >+ freeseg(rs); >+ >+ if (debug) >+ VG_(printf)(" case 4: subrange %p-%p deleted\n", >+ addr, addr+len); >+ } > } >- if (curr == NULL) >+} >+ >+/* Return true if two segments are adjacent and mergable (s1 is >+ assumed to have a lower ->addr than s2) */ >+static inline Bool neighbours(Segment *s1, Segment *s2) >+{ >+ if (s1->addr+s1->len != s2->addr) > return False; > >- vg_assert(*prev_next_ptr == curr); >+ if (s1->flags != s2->flags) >+ return False; > >- *prev_next_ptr = curr->next; >+ if (s1->prot != s2->prot) >+ return False; > >- VG_(arena_free)(VG_AR_CORE, curr); >- return True; >-} >+ if (s1->symtab != s2->symtab) >+ return False; > >-/* Records the exe segment in the ExeSeg list (checking for overlaps), and >- reads debug info if required. Note the entire /proc/pid/maps file is >- read for the debug info, but it just reads symbols for newly added exe >- segments. This is required to find out their names if they have one, >- because with mmap() we only have the file descriptor, not the name. We >- don't use this at startup because we do have the names then. */ >-void VG_(new_exeseg_mmap) ( Addr a, UInt len ) >-{ >- add_exe_segment_to_list( a, len ); >- VG_(read_all_symbols)(); >-} >- >-/* Like VG_(new_exeseg_mmap)(), but here we do have the name, so we don't >- need to grovel through /proc/self/maps to find it. */ >-void VG_(new_exeseg_startup) ( Addr a, UInt len, Char rr, Char ww, Char xx, >- UInt foffset, UChar* filename ) >-{ >- add_exe_segment_to_list( a, len ); >- VG_(read_seg_symbols)( a, len, rr, ww, xx, foffset, filename); >-} >- >-/* Invalidate translations as necessary (also discarding any basic >- block-specific info retained by the skin) and unload any debug >- symbols. */ >-// Nb: remove_if_exeseg_from_list() and VG_(maybe_unload_symbols)() >-// both ignore 'len', but that seems that's ok for most programs... see >-// comment above vg_syscalls.c:mmap_segment() et al for more details. >-void VG_(remove_if_exeseg) ( Addr a, UInt len ) >-{ >- if (remove_if_exeseg_from_list( a )) { >- VG_(invalidate_translations) ( a, len, False ); >- VG_(unload_symbols) ( a, len ); >+ if (s1->flags & SF_FILE){ >+ if ((s1->offset + s1->len) != s2->offset) >+ return False; >+ if (s1->dev != s2->dev) >+ return False; >+ if (s1->ino != s2->ino) >+ return False; > } >+ >+ return True; > } > >+/* If possible, merge segment with its neighbours - some segments, >+ including s, may be destroyed in the process */ >+static void merge_segments(Addr a, UInt len) >+{ >+ Segment *s; >+ Segment *next; > >-static >-void startup_segment_callback ( Addr start, UInt size, >- Char rr, Char ww, Char xx, >- UInt foffset, UChar* filename ) >-{ >- UInt r_esp; >- Bool is_stack_segment; >- Bool verbose = False; /* set to True for debugging */ >- >- if (verbose) >- VG_(message)(Vg_DebugMsg, >- "initial map %8x-%8x %c%c%c? %8x (%d) (%s)", >- start,start+size,rr,ww,xx,foffset, >- size, filename?filename:(UChar*)"NULL"); >- >- if (rr != 'r' && xx != 'x' && ww != 'w') { >- /* Implausible as it seems, R H 6.2 generates such segments: >- 40067000-400ac000 r-xp 00000000 08:05 320686 /usr/X11R6/lib/libXt.so.6.0 >- 400ac000-400ad000 ---p 00045000 08:05 320686 /usr/X11R6/lib/libXt.so.6.0 >- 400ad000-400b0000 rw-p 00045000 08:05 320686 /usr/X11R6/lib/libXt.so.6.0 >- when running xedit. So just ignore them. */ >- if (0) >- VG_(printf)("No permissions on a segment mapped from %s\n", >- filename?filename:(UChar*)"NULL"); >- return; >+ vg_assert((a & (VKI_BYTES_PER_PAGE-1)) == 0); >+ vg_assert((len & (VKI_BYTES_PER_PAGE-1)) == 0); >+ >+ a -= VKI_BYTES_PER_PAGE; >+ len += VKI_BYTES_PER_PAGE; >+ >+ for(s = VG_(SkipList_Find)(&sk_segments, &a); >+ s != NULL && s->addr < (a+len);) { >+ next = VG_(SkipNode_Next)(&sk_segments, s); >+ >+ if (next && neighbours(s, next)) { >+ Segment *rs; >+ >+ if (0) >+ VG_(printf)("merge %p-%p with %p-%p\n", >+ s->addr, s->addr+s->len, >+ next->addr, next->addr+next->len); >+ s->len += next->len; >+ s = VG_(SkipNode_Next)(&sk_segments, next); >+ >+ rs = VG_(SkipList_Remove)(&sk_segments, &next->addr); >+ vg_assert(next == rs); >+ freeseg(next); >+ } else >+ s = next; > } >+} > >- /* If this segment corresponds to something mmap'd /dev/zero by the >- low-level memory manager (vg_malloc2.c), skip it. Clients >- should never have access to the segments which hold valgrind >- internal data. And access to client data in the VG_AR_CLIENT >- arena is mediated by the skin, so we don't want make it >- accessible at this stage. */ >- if (VG_(is_inside_segment_mmapd_by_low_level_MM)( start )) { >- if (verbose) >- VG_(message)(Vg_DebugMsg, >- " skipping %8x-%8x (owned by our MM)", >- start, start+size ); >- /* Don't announce it to the skin. */ >- return; >+void VG_(map_file_segment)(Addr addr, UInt len, UInt prot, UInt flags, >+ UInt dev, UInt ino, ULong off, const Char *filename) >+{ >+ Segment *s; >+ static const Bool debug = False || mem_debug; >+ Bool recycled; >+ >+ if (debug) >+ VG_(printf)("map_file_segment(%p, %d, %x, %x, %4x, %d, %ld, %s)\n", >+ addr, len, prot, flags, dev, ino, off, filename); >+ >+ /* Everything must be page-aligned */ >+ vg_assert((addr & (VKI_BYTES_PER_PAGE-1)) == 0); >+ len = PGROUNDUP(len); >+ >+ /* First look to see what already exists around here */ >+ s = VG_(SkipList_Find)(&sk_segments, &addr); >+ >+ if (s != NULL && s->addr == addr && s->len == len) { >+ /* This probably means we're just updating the flags */ >+ recycled = True; >+ recycleseg(s); >+ >+ /* If we had a symtab, but the new mapping is incompatible, then >+ free up the old symtab in preparation for a new one. */ >+ if (s->symtab != NULL && >+ (!(s->flags & SF_FILE) || >+ !(flags & SF_FILE) || >+ s->dev != dev || >+ s->ino != ino || >+ s->offset != off)) { >+ VG_(symtab_decref)(s->symtab, s->addr, s->len); >+ s->symtab = NULL; >+ } >+ } else { >+ recycled = False; >+ VG_(unmap_range)(addr, len); >+ >+ s = VG_(SkipNode_Alloc)(&sk_segments); >+ >+ s->addr = addr; >+ s->len = len; >+ s->symtab = NULL; > } >+ >+ s->flags = flags; >+ s->prot = prot; >+ s->dev = dev; >+ s->ino = ino; >+ s->offset = off; > >- /* This is similar to what happens when we mmap some new memory */ >- if (filename != NULL && xx == 'x') { >- VG_(new_exeseg_startup)( start, size, rr, ww, xx, foffset, filename ); >+ if (filename != NULL) >+ s->filename = VG_(arena_strdup)(VG_AR_CORE, filename); >+ else >+ s->filename = NULL; >+ >+ if (debug) { >+ Segment *ts; >+ for(ts = VG_(SkipNode_First)(&sk_segments); >+ ts != NULL; >+ ts = VG_(SkipNode_Next)(&sk_segments, ts)) >+ VG_(printf)("list: %8p->%8p ->%d (0x%x) prot=%x flags=%x\n", >+ ts, ts->addr, ts->len, ts->len, ts->prot, ts->flags); >+ >+ VG_(printf)("inserting s=%p addr=%p len=%d\n", >+ s, s->addr, s->len); > } > >- VG_TRACK( new_mem_startup, start, size, rr=='r', ww=='w', xx=='x' ); >+ if (!recycled) >+ VG_(SkipList_Insert)(&sk_segments, s); > >- /* If this is the stack segment mark all below %esp as noaccess. */ >- r_esp = VG_(baseBlock)[VGOFF_(m_esp)]; >- is_stack_segment = start <= r_esp && r_esp < start+size; >- if (is_stack_segment) { >- if (0) >- VG_(message)(Vg_DebugMsg, "invalidating stack area: %x .. %x", >- start,r_esp); >- VG_TRACK( die_mem_stack, start, r_esp-start ); >+ /* If this mapping is of the beginning of a file, isn't part of >+ Valgrind, is at least readable and seems to contain an object >+ file, then try reading symbols from it. */ >+ if ((flags & (SF_MMAP|SF_NOSYMS)) == SF_MMAP && >+ s->symtab == NULL) { >+ if (off == 0 && >+ filename != NULL && >+ (prot & (VKI_PROT_READ|VKI_PROT_EXEC)) == (VKI_PROT_READ|VKI_PROT_EXEC) && >+ len >= VKI_BYTES_PER_PAGE && >+ s->symtab == NULL && >+ VG_(is_object_file)((void *)addr)) >+ { >+ s->symtab = VG_(read_seg_symbols)(s); >+ >+ if (s->symtab != NULL) { >+ s->flags |= SF_DYNLIB; >+ } >+ } else if (flags & SF_MMAP) { >+ const SegInfo *info; >+ >+ /* Otherwise see if an existing symtab applies to this Segment */ >+ for(info = VG_(next_seginfo)(NULL); >+ info != NULL; >+ info = VG_(next_seginfo)(info)) { >+ if (VG_(seg_overlaps)(s, VG_(seg_start)(info), VG_(seg_size)(info))) >+ { >+ s->symtab = (SegInfo *)info; >+ VG_(symtab_incref)((SegInfo *)info); >+ } >+ } >+ } > } >+ >+ /* clean up */ >+ merge_segments(addr, len); > } > >+void VG_(map_fd_segment)(Addr addr, UInt len, UInt prot, UInt flags, >+ Int fd, ULong off, const Char *filename) >+{ >+ struct vki_stat st; >+ Char *name = NULL; > >-/* 1. Records startup segments from /proc/pid/maps. Takes special note >- of the executable ones, because if they're munmap()ed we need to >- discard translations. Also checks there's no exe segment overlaps. >+ st.st_dev = 0; >+ st.st_ino = 0; > >- Note that `read_from_file' is false; we read /proc/self/maps into a >- buffer at the start of VG_(main) so that any superblocks mmap'd by >- calls to VG_(malloc)() by SK_({pre,post}_clo_init) aren't erroneously >- thought of as being owned by the client. >+ if (fd != -1 && (flags & SF_FILE)) { >+ vg_assert((off & (VKI_BYTES_PER_PAGE-1)) == 0); > >- 2. Sets up the end of the data segment so that vg_syscalls.c can make >- sense of calls to brk(). >- */ >-void VG_(init_memory) ( void ) >+ if (VG_(fstat)(fd, &st) < 0) >+ flags &= ~SF_FILE; >+ } >+ >+ if ((flags & SF_FILE) && filename == NULL && fd != -1) >+ name = VG_(resolve_filename)(fd); >+ >+ if (filename == NULL) >+ filename = name; >+ >+ VG_(map_file_segment)(addr, len, prot, flags, st.st_dev, st.st_ino, off, filename); >+ >+ if (name) >+ VG_(arena_free)(VG_AR_CORE, name); >+} >+ >+void VG_(map_segment)(Addr addr, UInt len, UInt prot, UInt flags) >+{ >+ flags &= ~SF_FILE; >+ >+ VG_(map_file_segment)(addr, len, prot, flags, 0, 0, 0, 0); >+} >+ >+/* set new protection flags on an address range */ >+void VG_(mprotect_range)(Addr a, UInt len, UInt prot) > { >- /* 1 */ >- VG_(parse_procselfmaps) ( startup_segment_callback ); >+ Segment *s, *next; >+ static const Bool debug = False || mem_debug; >+ >+ if (debug) >+ VG_(printf)("mprotect_range(%p, %d, %x)\n", a, len, prot); >+ >+ /* Everything must be page-aligned */ >+ vg_assert((a & (VKI_BYTES_PER_PAGE-1)) == 0); >+ len = PGROUNDUP(len); >+ >+ VG_(split_segment)(a); >+ VG_(split_segment)(a+len); >+ >+ for(s = VG_(SkipList_Find)(&sk_segments, &a); >+ s != NULL && s->addr < a+len; >+ s = next) >+ { >+ next = VG_(SkipNode_Next)(&sk_segments, s); >+ if (s->addr < a) >+ continue; >+ >+ s->prot = prot; >+ } >+ >+ merge_segments(a, len); >+} >+ >+Addr VG_(find_map_space)(Addr addr, UInt len, Bool for_client) >+{ >+ static const Bool debug = False || mem_debug; >+ Segment *s; >+ Addr ret; >+ Addr limit = (for_client ? VG_(client_end) : VG_(valgrind_mmap_end)); >+ >+ if (addr == 0) >+ addr = for_client ? VG_(client_mapbase) : VG_(valgrind_base); >+ else { >+ /* leave space for redzone and still try to get the exact >+ address asked for */ >+ addr -= VKI_BYTES_PER_PAGE; >+ } >+ ret = addr; >+ >+ /* Everything must be page-aligned */ >+ vg_assert((addr & (VKI_BYTES_PER_PAGE-1)) == 0); >+ len = PGROUNDUP(len); >+ >+ len += VKI_BYTES_PER_PAGE * 2; /* leave redzone gaps before and after mapping */ >+ >+ if (debug) >+ VG_(printf)("find_map_space: ret starts as %p-%p client=%d\n", >+ ret, ret+len, for_client); >+ >+ for(s = VG_(SkipList_Find)(&sk_segments, &ret); >+ s != NULL && s->addr < (ret+len); >+ s = VG_(SkipNode_Next)(&sk_segments, s)) >+ { >+ if (debug) >+ VG_(printf)("s->addr=%p len=%d (%p) ret=%p\n", >+ s->addr, s->len, s->addr+s->len, ret); > >- /* 2 */ >- VG_(init_dataseg_end_for_brk)(); >+ if (s->addr < (ret + len) && (s->addr + s->len) > ret) >+ ret = s->addr+s->len; >+ } >+ >+ if (debug) { >+ if (s) >+ VG_(printf)(" s->addr=%p ->len=%d\n", s->addr, s->len); >+ else >+ VG_(printf)(" s == NULL\n"); >+ } > >- /* kludge: some newer kernels place a "sysinfo" page up high, with >- vsyscalls in it, and possibly some other stuff in the future. */ >- if (VG_(sysinfo_page_exists)) { >- // 2003-Sep-25, njn: Jeremy thinks the sysinfo page probably doesn't >- // have any symbols that need to be loaded. So just treat it like >- // a non-executable page. >- //VG_(new_exeseg_mmap)( VG_(sysinfo_page_addr), 4096 ); >- VG_TRACK( new_mem_startup, VG_(sysinfo_page_addr), 4096, >- True, True, True ); >- } >+ if ((limit - len) < ret) >+ ret = 0; /* no space */ >+ else >+ ret += VKI_BYTES_PER_PAGE; /* skip leading redzone */ >+ >+ if (debug) >+ VG_(printf)("find_map_space(%p, %d, %d) -> %p\n", >+ addr, len, for_client, ret); >+ >+ return ret; >+} >+ >+Segment *VG_(find_segment)(Addr a) >+{ >+ return VG_(SkipList_Find)(&sk_segments, &a); >+} >+ >+Segment *VG_(next_segment)(Segment *s) >+{ >+ return VG_(SkipNode_Next)(&sk_segments, s); > } > > /*------------------------------------------------------------*/ >@@ -359,6 +668,134 @@ > } > > /*--------------------------------------------------------------------*/ >+/*--- manage allocation of memory on behalf of the client ---*/ >+/*--------------------------------------------------------------------*/ >+ >+Addr VG_(client_alloc)(Addr addr, UInt len, UInt prot, UInt flags) >+{ >+ len = PGROUNDUP(len); >+ >+ if (!(flags & SF_FIXED)) >+ addr = VG_(find_map_space)(addr, len, True); >+ >+ flags |= SF_CORE; >+ >+ if (VG_(mmap)((void *)addr, len, prot, >+ VKI_MAP_FIXED | VKI_MAP_PRIVATE | VKI_MAP_ANONYMOUS | VKI_MAP_CLIENT, >+ -1, 0) == (void *)addr) { >+ VG_(map_segment)(addr, len, prot, flags); >+ return addr; >+ } >+ >+ return 0; >+} >+ >+void VG_(client_free)(Addr addr) >+{ >+ Segment *s = VG_(find_segment)(addr); >+ >+ if (s == NULL || s->addr != addr || !(s->flags & SF_CORE)) { >+ VG_(message)(Vg_DebugMsg, "VG_(client_free)(%p) - no CORE memory found there", addr); >+ return; >+ } >+ >+ VG_(munmap)((void *)s->addr, s->len); >+} >+ >+Bool VG_(is_client_addr)(Addr a) >+{ >+ return a >= VG_(client_base) && a < VG_(client_end); >+} >+ >+Bool VG_(is_shadow_addr)(Addr a) >+{ >+ return a >= VG_(shadow_base) && a < VG_(shadow_end); >+} >+ >+Bool VG_(is_valgrind_addr)(Addr a) >+{ >+ return a >= VG_(valgrind_base) && a < VG_(valgrind_end); >+} >+ >+Addr VG_(get_client_base)(void) >+{ >+ return VG_(client_base); >+} >+ >+Addr VG_(get_client_end)(void) >+{ >+ return VG_(client_end); >+} >+ >+Addr VG_(get_client_size)(void) >+{ >+ return VG_(client_end)-VG_(client_base); >+} >+ >+Addr VG_(get_shadow_base)(void) >+{ >+ return VG_(shadow_base); >+} >+ >+Addr VG_(get_shadow_end)(void) >+{ >+ return VG_(shadow_end); >+} >+ >+Addr VG_(get_shadow_size)(void) >+{ >+ return VG_(shadow_end)-VG_(shadow_base); >+} >+ >+ >+void VG_(init_shadow_range)(Addr p, UInt sz, Bool call_init) >+{ >+ if (0) >+ VG_(printf)("init_shadow_range(%p, %d)\n", p, sz); >+ >+ vg_assert(VG_(needs).shadow_memory); >+ vg_assert(VG_(defined_init_shadow_page)()); >+ >+ sz = PGROUNDUP(p+sz) - PGROUNDDN(p); >+ p = PGROUNDDN(p); >+ >+ VG_(mprotect)((void *)p, sz, VKI_PROT_READ|VKI_PROT_WRITE); >+ >+ if (call_init) >+ while(sz) { >+ /* ask the skin to initialize each page */ >+ VG_TRACK( init_shadow_page, PGROUNDDN(p) ); >+ >+ p += VKI_BYTES_PER_PAGE; >+ sz -= VKI_BYTES_PER_PAGE; >+ } >+} >+ >+void *VG_(shadow_alloc)(UInt size) >+{ >+ static Addr shadow_alloc = 0; >+ void *ret; >+ >+ vg_assert(VG_(needs).shadow_memory); >+ vg_assert(!VG_(defined_init_shadow_page)()); >+ >+ size = PGROUNDUP(size); >+ >+ if (shadow_alloc == 0) >+ shadow_alloc = VG_(shadow_base); >+ >+ if (shadow_alloc >= VG_(shadow_end)) >+ return 0; >+ >+ ret = (void *)shadow_alloc; >+ VG_(mprotect)(ret, size, VKI_PROT_READ|VKI_PROT_WRITE); >+ >+ shadow_alloc += size; >+ >+ return ret; >+} >+ >+/*--------------------------------------------------------------------*/ > /*--- end vg_memory.c ---*/ > /*--------------------------------------------------------------------*/ > >diff -ruN valgrind-2.1.0/coregrind/vg_messages.c valgrind/coregrind/vg_messages.c >--- valgrind-2.1.0/coregrind/vg_messages.c 2003-10-31 01:12:21.000000000 -0600 >+++ valgrind/coregrind/vg_messages.c 2004-01-04 10:43:19.000000000 -0600 >@@ -8,7 +8,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >diff -ruN valgrind-2.1.0/coregrind/vg_mylibc.c valgrind/coregrind/vg_mylibc.c >--- valgrind-2.1.0/coregrind/vg_mylibc.c 2003-11-20 10:20:54.000000000 -0600 >+++ valgrind/coregrind/vg_mylibc.c 2004-01-26 11:24:42.000000000 -0600 >@@ -9,7 +9,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -248,15 +248,57 @@ > void* VG_(mmap)( void* start, UInt length, > UInt prot, UInt flags, UInt fd, UInt offset) > { >- Int res; >+ Addr res; > UInt args[6]; >+ >+ if (!(flags & VKI_MAP_FIXED)) { >+ start = (void *)VG_(find_map_space)((Addr)start, length, !!(flags & VKI_MAP_CLIENT)); >+ if (start == 0) >+ return (void *)-1; >+ >+ flags |= VKI_MAP_FIXED; >+ } >+ > args[0] = (UInt)start; > args[1] = length; > args[2] = prot; >- args[3] = flags; >+ args[3] = flags & ~(VKI_MAP_NOSYMS|VKI_MAP_CLIENT); > args[4] = fd; > args[5] = offset; > res = VG_(do_syscall)(__NR_mmap, (UInt)(&(args[0])) ); >+ >+ if (!VG_(is_kerror)(res)) { >+ UInt sf_flags = SF_MMAP; >+ >+ if (flags & VKI_MAP_FIXED) >+ sf_flags |= SF_FIXED; >+ if (flags & VKI_MAP_SHARED) >+ sf_flags |= SF_SHARED; >+ if (!(flags & VKI_MAP_ANONYMOUS)) >+ sf_flags |= SF_FILE; >+ if (!(flags & VKI_MAP_CLIENT)) >+ sf_flags |= SF_VALGRIND; >+ if (flags & VKI_MAP_NOSYMS) >+ sf_flags |= SF_NOSYMS; >+ >+ /* placeholder - caller will update flags etc if they want */ >+ VG_(map_fd_segment)(res, length, prot, sf_flags, fd, offset, NULL); >+ >+ if (flags & VKI_MAP_CLIENT) { >+ if (res < VG_(client_base) || res >= VG_(client_end)) { >+ VG_(munmap)((void *)res, length); >+ res = -1; >+ } >+ } else { >+ if (res < VG_(valgrind_base) || res >= VG_(valgrind_end)) { >+ VG_(munmap)((void *)res, length); >+ res = -1; >+ } >+ } >+ } >+ >+ >+ > return VG_(is_kerror)(res) ? ((void*)(-1)) : (void*)res; > } > >@@ -264,6 +306,16 @@ > Int VG_(munmap)( void* start, Int length ) > { > Int res = VG_(do_syscall)(__NR_munmap, (UInt)start, (UInt)length ); >+ if (!VG_(is_kerror)(res)) >+ VG_(unmap_range)((Addr)start, length); >+ return VG_(is_kerror)(res) ? -1 : 0; >+} >+ >+Int VG_(mprotect)( void *start, Int length, UInt prot ) >+{ >+ Int res = VG_(do_syscall)(__NR_mprotect, (UInt)start, (UInt)length, prot ); >+ if (!VG_(is_kerror)(res)) >+ VG_(mprotect_range)((Addr)start, length, prot); > return VG_(is_kerror)(res) ? -1 : 0; > } > >@@ -968,17 +1020,24 @@ > __inline__ Char* VG_(arena_strdup) ( ArenaId aid, const Char* s ) > { > Int i; >- Int len = VG_(strlen)(s) + 1; >- Char* res = VG_(arena_malloc) (aid, len); >+ Int len; >+ Char* res; >+ >+ if (s == NULL) >+ return NULL; >+ >+ len = VG_(strlen)(s) + 1; >+ res = VG_(arena_malloc) (aid, len); >+ > for (i = 0; i < len; i++) > res[i] = s[i]; > return res; > } > >-/* Wrapper to avoid exposing skins to ArenaId's */ >+/* Wrapper to avoid exposing tools to ArenaId's */ > Char* VG_(strdup) ( const Char* s ) > { >- return VG_(arena_strdup) ( VG_AR_SKIN, s ); >+ return VG_(arena_strdup) ( VG_AR_TOOL, s ); > } > > /* --------------------------------------------------------------------- >@@ -992,7 +1051,7 @@ > /* Keep track of recursion depth. */ > static Int recDepth; > >-static Bool string_match_wrk ( Char* pat, Char* str ) >+static Bool string_match_wrk ( const Char* pat, const Char* str ) > { > vg_assert(recDepth >= 0 && recDepth < 500); > recDepth++; >@@ -1027,7 +1086,7 @@ > } > } > >-Bool VG_(string_match) ( Char* pat, Char* str ) >+Bool VG_(string_match) ( const Char* pat, const Char* str ) > { > Bool b; > recDepth = 0; >@@ -1057,7 +1116,7 @@ > Addr stacktop; > > asm("movl %%ebp, %0; movl %%esp, %1" : "=r" (ebp), "=r" (esp)); >- stacktop = (Addr)&VG_(stack)[VG_STACK_SIZE_W]; >+ stacktop = VG_(valgrind_end); > if (esp >= (Addr)&VG_(sigstack)[0] && esp < (Addr)&VG_(sigstack)[VG_STACK_SIZE_W]) > stacktop = (Addr)&VG_(sigstack)[VG_STACK_SIZE_W]; > >@@ -1144,13 +1203,15 @@ > { > Int newfd; > >- newfd = VG_(fcntl)(oldfd, VKI_F_DUPFD, VG_MAX_FD+1); >+ vg_assert(VG_(max_fd) != -1); >+ >+ newfd = VG_(fcntl)(oldfd, VKI_F_DUPFD, VG_(max_fd)+1); > if (newfd != -1) > VG_(close)(oldfd); > > VG_(fcntl)(newfd, VKI_F_SETFD, VKI_FD_CLOEXEC); > >- vg_assert(newfd > VG_MAX_FD); >+ vg_assert(newfd > VG_(max_fd)); > return newfd; > } > >@@ -1282,14 +1343,95 @@ > Misc functions looking for a proper home. > ------------------------------------------------------------------ */ > >-/* We do getenv without libc's help by snooping around in >- VG_(client_envp) as determined at startup time. */ >-Char* VG_(getenv) ( Char* varname ) >+/* clone the environment */ >+Char **VG_(env_clone) ( Char **oldenv ) >+{ >+ Char **oldenvp; >+ Char **newenvp; >+ Char **newenv; >+ Int envlen; >+ >+ for (oldenvp = oldenv; oldenvp && *oldenvp; oldenvp++); >+ >+ envlen = oldenvp - oldenv + 1; >+ >+ newenv = VG_(arena_malloc)(VG_AR_CORE, envlen * sizeof(Char **)); >+ >+ oldenvp = oldenv; >+ newenvp = newenv; >+ >+ while (oldenvp && *oldenvp) { >+ *newenvp++ = *oldenvp++; >+ } >+ >+ *newenvp = *oldenvp; >+ >+ return newenv; >+} >+ >+void VG_(env_unsetenv) ( Char **env, const Char *varname ) >+{ >+ Char **from; >+ Char **to = NULL; >+ Int len = VG_(strlen)(varname); >+ >+ for(from = to = env; from && *from; from++) { >+ if (!(VG_(strncmp)(varname, *from, len) == 0 && (*from)[len] == '=')) { >+ *to = *from; >+ to++; >+ } >+ } >+ *to = *from; >+} >+ >+/* set the environment; returns the old env if a new one was allocated */ >+Char **VG_(env_setenv) ( Char ***envp, const Char* varname, const Char *val ) >+{ >+ Char **env = (*envp); >+ Char **cpp; >+ Int len = VG_(strlen)(varname); >+ Char *valstr = VG_(arena_malloc)(VG_AR_CORE, len + VG_(strlen)(val) + 2); >+ Char **oldenv = NULL; >+ >+ VG_(sprintf)(valstr, "%s=%s", varname, val); >+ >+ for(cpp = env; cpp && *cpp; cpp++) { >+ if (VG_(strncmp)(varname, *cpp, len) == 0 && (*cpp)[len] == '=') { >+ *cpp = valstr; >+ return oldenv; >+ } >+ } >+ >+ if (env == NULL) { >+ env = VG_(arena_malloc)(VG_AR_CORE, sizeof(Char **) * 2); >+ env[0] = valstr; >+ env[1] = NULL; >+ >+ *envp = env; >+ >+ } else { >+ Int envlen = (cpp-env) + 2; >+ Char **newenv = VG_(arena_malloc)(VG_AR_CORE, envlen * sizeof(Char **)); >+ >+ for(cpp = newenv; *env; ) >+ *cpp++ = *env++; >+ *cpp++ = valstr; >+ *cpp++ = NULL; >+ >+ oldenv = *envp; >+ >+ *envp = newenv; >+ } >+ >+ return oldenv; >+} >+ >+Char* VG_(env_getenv) ( Char **env, Char* varname ) > { > Int i, n; > n = VG_(strlen)(varname); >- for (i = 0; VG_(client_envp)[i] != NULL; i++) { >- Char* s = VG_(client_envp)[i]; >+ for (i = 0; env[i] != NULL; i++) { >+ Char* s = env[i]; > if (VG_(strncmp)(varname, s, n) == 0 && s[n] == '=') { > return & s[n+1]; > } >@@ -1297,6 +1439,12 @@ > return NULL; > } > >+/* We do getenv without libc's help by snooping around in >+ VG_(client_envp) as determined at startup time. */ >+Char *VG_(getenv)(Char *varname) >+{ >+ return VG_(env_getenv)(VG_(client_envp), varname); >+} > > /* Support for getrlimit. */ > Int VG_(getrlimit) (Int resource, struct vki_rlimit *rlim) >@@ -1309,6 +1457,17 @@ > } > > >+/* Support for setrlimit. */ >+Int VG_(setrlimit) (Int resource, struct vki_rlimit *rlim) >+{ >+ Int res; >+ /* res = setrlimit( resource, rlim ); */ >+ res = VG_(do_syscall)(__NR_setrlimit, (UInt)resource, (UInt)rlim); >+ if(VG_(is_kerror)(res)) res = -1; >+ return res; >+} >+ >+ > /* Support for getdents. */ > Int VG_(getdents) (UInt fd, struct vki_dirent *dirp, UInt count) > { >@@ -1363,7 +1522,6 @@ > Int VG_(system) ( Char* cmd ) > { > Int pid, res; >- void* environ[1] = { NULL }; > if (cmd == NULL) > return 1; > pid = VG_(do_syscall)(__NR_fork); >@@ -1371,13 +1529,48 @@ > return -1; > if (pid == 0) { > /* child */ >+ static Char** envp = NULL; > Char* argv[4]; >+ >+ if (envp == NULL) { >+ Int i; >+ Char* ld_preload_str = NULL; >+ Char* ld_library_path_str = NULL; >+ Char* buf; >+ >+ envp = VG_(env_clone)(VG_(client_envp)); >+ >+ for (i = 0; envp[i] != NULL; i++) { >+ if (VG_(strncmp)(envp[i], "LD_PRELOAD=", 11) == 0) >+ ld_preload_str = &envp[i][11]; >+ if (VG_(strncmp)(envp[i], "LD_LIBRARY_PATH=", 16) == 0) >+ ld_library_path_str = &envp[i][16]; >+ } >+ >+ buf = VG_(arena_malloc)(VG_AR_CORE, VG_(strlen)(VG_(libdir)) + 20); >+ >+ VG_(sprintf)(buf, "%s*/vg_inject.so", VG_(libdir)); >+ VG_(mash_colon_env)(ld_preload_str, buf); >+ >+ VG_(sprintf)(buf, "%s*/vgpreload_*.so", VG_(libdir)); >+ VG_(mash_colon_env)(ld_preload_str, buf); >+ >+ VG_(sprintf)(buf, "%s*", VG_(libdir)); >+ VG_(mash_colon_env)(ld_library_path_str, buf); >+ >+ VG_(env_unsetenv)(envp, VALGRINDCLO); >+ >+ VG_(arena_free)(VG_AR_CORE, buf); >+ } >+ > argv[0] = "/bin/sh"; > argv[1] = "-c"; > argv[2] = cmd; > argv[3] = 0; >+ > (void)VG_(do_syscall)(__NR_execve, >- (UInt)"/bin/sh", (UInt)argv, (UInt)&environ); >+ (UInt)"/bin/sh", (UInt)argv, (UInt)envp); >+ > /* If we're still alive here, execve failed. */ > return -1; > } else { >@@ -1393,130 +1586,28 @@ > > > /* --------------------------------------------------------------------- >- Support for a millisecond-granularity counter using RDTSC. >+ Support for a millisecond-granularity timer. > ------------------------------------------------------------------ */ > >-static __inline__ ULong do_rdtsc_insn ( void ) >-{ >- ULong x; >- __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x)); >- return x; >-} >- >-/* 0 = pre-calibration, 1 = calibration, 2 = running */ >-static Int rdtsc_calibration_state = 0; >-static ULong rdtsc_ticks_per_millisecond = 0; /* invalid value */ >- >-static struct vki_timeval rdtsc_cal_start_timeval; >-static struct vki_timeval rdtsc_cal_end_timeval; >- >-static ULong rdtsc_cal_start_raw; >-static ULong rdtsc_cal_end_raw; >- > UInt VG_(read_millisecond_timer) ( void ) > { >- ULong rdtsc_now; >- // If called before rdtsc setup completed (eg. from SK_(pre_clo_init)()) >- // just return 0. >- if (rdtsc_calibration_state < 2) return 0; >- rdtsc_now = do_rdtsc_insn(); >- vg_assert(rdtsc_now > rdtsc_cal_end_raw); >- rdtsc_now -= rdtsc_cal_end_raw; >- rdtsc_now /= rdtsc_ticks_per_millisecond; >- return (UInt)rdtsc_now; >-} >- >- >-void VG_(start_rdtsc_calibration) ( void ) >-{ >+ static ULong base = 0; >+ struct vki_timeval tv_now; >+ ULong now; > Int res; >- vg_assert(rdtsc_calibration_state == 0); >- rdtsc_calibration_state = 1; >- rdtsc_cal_start_raw = do_rdtsc_insn(); >- res = VG_(do_syscall)(__NR_gettimeofday, (UInt)&rdtsc_cal_start_timeval, >- (UInt)NULL); >- vg_assert(!VG_(is_kerror)(res)); >-} >- >-void VG_(end_rdtsc_calibration) ( void ) >-{ >- Int res, loops; >- ULong cpu_clock_MHZ; >- ULong cal_clock_ticks; >- ULong cal_wallclock_microseconds; >- ULong wallclock_start_microseconds; >- ULong wallclock_end_microseconds; >- struct vki_timespec req; >- struct vki_timespec rem; >- >- vg_assert(rdtsc_calibration_state == 1); >- rdtsc_calibration_state = 2; >- >- /* Try and delay for 20 milliseconds, so that we can at least have >- some minimum level of accuracy. */ >- req.tv_sec = 0; >- req.tv_nsec = 20 * 1000 * 1000; >- loops = 0; >- while (True) { >- res = VG_(nanosleep)(&req, &rem); >- vg_assert(res == 0 /*ok*/ || res == 1 /*interrupted*/); >- if (res == 0) >- break; >- if (rem.tv_sec == 0 && rem.tv_nsec == 0) >- break; >- req = rem; >- loops++; >- if (loops > 100) >- VG_(core_panic)("calibration nanosleep loop failed?!"); >- } > >- /* Now read both timers, and do the Math. */ >- rdtsc_cal_end_raw = do_rdtsc_insn(); >- res = VG_(do_syscall)(__NR_gettimeofday, (UInt)&rdtsc_cal_end_timeval, >+ res = VG_(do_syscall)(__NR_gettimeofday, (UInt)&tv_now, > (UInt)NULL); >+ >+ now = tv_now.tv_sec * 1000000ULL + tv_now.tv_usec; >+ >+ if (base == 0) >+ base = now; > >- vg_assert(rdtsc_cal_end_raw > rdtsc_cal_start_raw); >- cal_clock_ticks = rdtsc_cal_end_raw - rdtsc_cal_start_raw; >- >- wallclock_start_microseconds >- = (1000000ULL * (ULong)(rdtsc_cal_start_timeval.tv_sec)) >- + (ULong)(rdtsc_cal_start_timeval.tv_usec); >- wallclock_end_microseconds >- = (1000000ULL * (ULong)(rdtsc_cal_end_timeval.tv_sec)) >- + (ULong)(rdtsc_cal_end_timeval.tv_usec); >- vg_assert(wallclock_end_microseconds > wallclock_start_microseconds); >- cal_wallclock_microseconds >- = wallclock_end_microseconds - wallclock_start_microseconds; >- >- /* Since we just nanoslept for 20 ms ... */ >- vg_assert(cal_wallclock_microseconds >= 20000); >- >- /* Now we know (roughly) that cal_clock_ticks on RDTSC take >- cal_wallclock_microseconds elapsed time. Calculate the RDTSC >- ticks-per-millisecond value. */ >- if (0) >- VG_(printf)("%lld ticks in %lld microseconds\n", >- cal_clock_ticks, cal_wallclock_microseconds ); >- >- rdtsc_ticks_per_millisecond >- = cal_clock_ticks / (cal_wallclock_microseconds / 1000ULL); >- cpu_clock_MHZ >- = (1000ULL * rdtsc_ticks_per_millisecond) / 1000000ULL; >- if (VG_(clo_verbosity) >= 1) >- VG_(message)(Vg_UserMsg, "Estimated CPU clock rate is %d MHz", >- (UInt)cpu_clock_MHZ); >- if (cpu_clock_MHZ < 50 || cpu_clock_MHZ > 10000) >- VG_(core_panic)("end_rdtsc_calibration: " >- "estimated CPU MHz outside range 50 .. 10000"); >- /* Paranoia about division by zero later. */ >- vg_assert(rdtsc_ticks_per_millisecond != 0); >- if (0) >- VG_(printf)("ticks per millisecond %llu\n", >- rdtsc_ticks_per_millisecond); >+ return (now - base) / 1000; > } > > >- > /* --------------------------------------------------------------------- > Primitive support for bagging memory via mmap. > ------------------------------------------------------------------ */ >@@ -1525,10 +1616,27 @@ > { > static UInt tot_alloc = 0; > void* p; >- p = VG_(mmap)( 0, nBytes, >- VKI_PROT_READ|VKI_PROT_WRITE|VKI_PROT_EXEC, >- VKI_MAP_PRIVATE|VKI_MAP_ANONYMOUS, -1, 0 ); >+ >+#if 0 >+ p = VG_(mmap)( (void *)VG_(valgrind_base), nBytes, >+ VKI_PROT_READ | VKI_PROT_WRITE | VKI_PROT_EXEC, >+ VKI_MAP_PRIVATE | VKI_MAP_ANONYMOUS, -1, 0 ); >+#else >+ /* use brk, because it will definitely be in the valgrind address space */ >+ { >+ Char *b = VG_(brk)(0); >+ >+ p = (void *)PGROUNDUP(b); >+ >+ b = VG_(brk)(p + PGROUNDUP(nBytes)); >+ >+ if (b != (p + PGROUNDUP(nBytes))) >+ p = (void *)-1; >+ } >+#endif >+ > if (p != ((void*)(-1))) { >+ vg_assert(p >= (void *)VG_(valgrind_mmap_end) && p < (void *)VG_(valgrind_end)); > tot_alloc += (UInt)nBytes; > if (0) > VG_(printf)( >diff -ruN valgrind-2.1.0/coregrind/vg_needs.c valgrind/coregrind/vg_needs.c >--- valgrind-2.1.0/coregrind/vg_needs.c 2003-11-14 11:47:52.000000000 -0600 >+++ valgrind/coregrind/vg_needs.c 2004-01-21 09:08:03.000000000 -0600 >@@ -1,6 +1,6 @@ > > /*--------------------------------------------------------------------*/ >-/*--- Stuff relating to skin data structures. ---*/ >+/*--- Stuff relating to tool data structures. ---*/ > /*--- vg_needs.c ---*/ > /*--------------------------------------------------------------------*/ > >@@ -8,7 +8,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Nicholas Nethercote >+ Copyright (C) 2000-2004 Nicholas Nethercote > njn25@cam.ac.uk > > This program is free software; you can redistribute it and/or >@@ -33,7 +33,7 @@ > > > /* --------------------------------------------------------------------- >- Skin data structure initialisation >+ Tool data structure initialisation > ------------------------------------------------------------------ */ > > /* Init with default values. */ >@@ -58,61 +58,7 @@ > .syscall_wrapper = False, > .sanity_checks = False, > .data_syms = False, >-}; >- >-VgTrackEvents VG_(track_events) = { >- /* Memory events */ >- .new_mem_startup = NULL, >- .new_mem_stack_signal = NULL, >- .new_mem_brk = NULL, >- .new_mem_mmap = NULL, >- >- .copy_mem_remap = NULL, >- .change_mem_mprotect = NULL, >- >- .die_mem_stack_signal = NULL, >- .die_mem_brk = NULL, >- .die_mem_munmap = NULL, >- >- .new_mem_stack_4 = NULL, >- .new_mem_stack_8 = NULL, >- .new_mem_stack_12 = NULL, >- .new_mem_stack_16 = NULL, >- .new_mem_stack_32 = NULL, >- .new_mem_stack = NULL, >- >- .die_mem_stack_4 = NULL, >- .die_mem_stack_8 = NULL, >- .die_mem_stack_12 = NULL, >- .die_mem_stack_16 = NULL, >- .die_mem_stack_32 = NULL, >- .die_mem_stack = NULL, >- >- .ban_mem_stack = NULL, >- >- .pre_mem_read = NULL, >- .pre_mem_read_asciiz = NULL, >- .pre_mem_write = NULL, >- .post_mem_write = NULL, >- >- /* Register events */ >- .post_regs_write_init = NULL, >- .post_reg_write_syscall_return = NULL, >- .post_reg_write_deliver_signal = NULL, >- .post_reg_write_pthread_return = NULL, >- .post_reg_write_clientreq_return = NULL, >- .post_reg_write_clientcall_return = NULL, >- >- /* Scheduler events */ >- .thread_run = NULL, >- >- /* Mutex events */ >- .post_mutex_lock = NULL, >- .post_mutex_unlock = NULL, >- >- /* Signal events */ >- .pre_deliver_signal = NULL, >- .post_deliver_signal = NULL, >+ .shadow_memory = False, > }; > > /* static */ >@@ -132,35 +78,35 @@ > CHECK_NOT(VG_(details).copyright_author, NULL); > CHECK_NOT(VG_(details).bug_reports_to, NULL); > >- if ( (VG_(track_events).new_mem_stack_4 || >- VG_(track_events).new_mem_stack_8 || >- VG_(track_events).new_mem_stack_12 || >- VG_(track_events).new_mem_stack_16 || >- VG_(track_events).new_mem_stack_32) && >- ! VG_(track_events).new_mem_stack) >+ if ( (VG_(defined_new_mem_stack_4)() || >+ VG_(defined_new_mem_stack_8)() || >+ VG_(defined_new_mem_stack_12)() || >+ VG_(defined_new_mem_stack_16)() || >+ VG_(defined_new_mem_stack_32)()) && >+ ! VG_(defined_new_mem_stack)()) > { > VG_(printf)("\nTool error: one of the specialised `new_mem_stack_n'\n" > "events tracked, but not the generic `new_mem_stack' one.\n"); > VG_(skin_panic)("`new_mem_stack' should be defined\n"); > } > >- if ( (VG_(track_events).die_mem_stack_4 || >- VG_(track_events).die_mem_stack_8 || >- VG_(track_events).die_mem_stack_12 || >- VG_(track_events).die_mem_stack_16 || >- VG_(track_events).die_mem_stack_32) && >- ! VG_(track_events).die_mem_stack) >+ if ( (VG_(defined_die_mem_stack_4)() || >+ VG_(defined_die_mem_stack_8)() || >+ VG_(defined_die_mem_stack_12)() || >+ VG_(defined_die_mem_stack_16)() || >+ VG_(defined_die_mem_stack_32)()) && >+ ! VG_(defined_die_mem_stack)()) > { > VG_(printf)("\nTool error: one of the specialised `die_mem_stack_n'\n" > "events tracked, but not the generic `die_mem_stack' one.\n"); > VG_(skin_panic)("`die_mem_stack' should be defined\n"); > } > >- if ( (VG_(track_events).post_reg_write_syscall_return || >- VG_(track_events).post_reg_write_deliver_signal || >- VG_(track_events).post_reg_write_pthread_return || >- VG_(track_events).post_reg_write_clientreq_return || >- VG_(track_events).post_reg_write_clientcall_return) && >+ if ( (VG_(defined_post_reg_write_syscall_return)() || >+ VG_(defined_post_reg_write_deliver_signal)() || >+ VG_(defined_post_reg_write_pthread_return)() || >+ VG_(defined_post_reg_write_clientreq_return)() || >+ VG_(defined_post_reg_write_clientcall_return)()) && > ! VG_(needs).shadow_regs) > { > VG_(printf)("\nTool error: one of the `post_reg_write'\n" >@@ -168,6 +114,16 @@ > VG_(skin_panic)("`shadow_regs' should be set\n"); > } > >+ if (VG_(needs).shadow_memory != (VG_(get_shadow_size)() != 0)) { >+ if (VG_(get_shadow_size)() != 0) >+ VG_(printf)("\nTool error: tool allocated shadow memory, but apparently doesn't " >+ "need it.\n"); >+ else >+ VG_(printf)("\nTool error: tool didn't allocated shadow memory, but apparently " >+ "needs it.\n"); >+ VG_(skin_panic)("VG_(needs).shadow_memory need should be set to match SK_(shadow_ratio)\n"); >+ } >+ > #undef CHECK_NOT > #undef INVALID_Bool > } >@@ -210,68 +166,7 @@ > NEEDS(syscall_wrapper) > NEEDS(sanity_checks) > NEEDS(data_syms) >- >-/*--------------------------------------------------------------------*/ >-#define TRACK(event, args...) \ >- void VG_(track_##event)(void (*f)(args)) \ >- { \ >- VG_(track_events).event = f; \ >- } >- >-/* Memory events */ >-TRACK(new_mem_startup, Addr a, UInt len, Bool rr, Bool ww, Bool xx) >-TRACK(new_mem_stack_signal, Addr a, UInt len) >-TRACK(new_mem_brk, Addr a, UInt len) >-TRACK(new_mem_mmap, Addr a, UInt len, Bool rr, Bool ww, Bool xx) >- >-TRACK(copy_mem_remap, Addr from, Addr to, UInt len) >-TRACK(change_mem_mprotect, Addr a, UInt len, Bool rr, Bool ww, Bool xx) >- >-TRACK(die_mem_stack_signal, Addr a, UInt len) >-TRACK(die_mem_brk, Addr a, UInt len) >-TRACK(die_mem_munmap, Addr a, UInt len) >- >-TRACK(new_mem_stack_4, Addr new_ESP) >-TRACK(new_mem_stack_8, Addr new_ESP) >-TRACK(new_mem_stack_12, Addr new_ESP) >-TRACK(new_mem_stack_16, Addr new_ESP) >-TRACK(new_mem_stack_32, Addr new_ESP) >-TRACK(new_mem_stack, Addr a, UInt len) >- >-TRACK(die_mem_stack_4, Addr new_ESP) >-TRACK(die_mem_stack_8, Addr new_ESP) >-TRACK(die_mem_stack_12, Addr new_ESP) >-TRACK(die_mem_stack_16, Addr new_ESP) >-TRACK(die_mem_stack_32, Addr new_ESP) >-TRACK(die_mem_stack, Addr a, UInt len) >- >-TRACK(ban_mem_stack, Addr a, UInt len) >- >-TRACK(pre_mem_read, CorePart part, ThreadId tid, Char* s, Addr a, >- UInt size) >-TRACK(pre_mem_read_asciiz, CorePart part, ThreadId tid, Char* s, Addr a) >-TRACK(pre_mem_write, CorePart part, ThreadId tid, Char* s, Addr a, >- UInt size) >-TRACK(post_mem_write, Addr a, UInt size) >- >-TRACK(post_regs_write_init, void ); >-TRACK(post_reg_write_syscall_return, ThreadId tid, UInt reg ); >-TRACK(post_reg_write_deliver_signal, ThreadId tid, UInt reg ); >-TRACK(post_reg_write_pthread_return, ThreadId tid, UInt reg ); >-TRACK(post_reg_write_clientreq_return, ThreadId tid, UInt reg ); >-TRACK(post_reg_write_clientcall_return, ThreadId tid, UInt reg, Addr f ); >- >-TRACK(thread_run, ThreadId tid) >- >-TRACK(post_thread_create, ThreadId tid, ThreadId child) >-TRACK(post_thread_join, ThreadId joiner, ThreadId joinee) >- >-TRACK( pre_mutex_lock, ThreadId tid, void* /*pthread_mutex_t* */ mutex) >-TRACK(post_mutex_lock, ThreadId tid, void* /*pthread_mutex_t* */ mutex) >-TRACK(post_mutex_unlock, ThreadId tid, void* /*pthread_mutex_t* */ mutex) >- >-TRACK( pre_deliver_signal, ThreadId tid, Int sigNum, Bool alt_stack) >-TRACK(post_deliver_signal, ThreadId tid, Int sigNum) >+NEEDS(shadow_memory) > > /*--------------------------------------------------------------------*/ > /* UCodeBlocks */ >diff -ruN valgrind-2.1.0/coregrind/vg_procselfmaps.c valgrind/coregrind/vg_procselfmaps.c >--- valgrind-2.1.0/coregrind/vg_procselfmaps.c 2003-10-14 17:13:28.000000000 -0500 >+++ valgrind/coregrind/vg_procselfmaps.c 2004-01-04 10:43:20.000000000 -0600 >@@ -8,7 +8,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -50,6 +50,12 @@ > return -1; > } > >+static Int decdigit ( Char c ) >+{ >+ if (c >= '0' && c <= '9') return (Int)(c - '0'); >+ return -1; >+} >+ > static Int readchar ( Char* buf, Char* ch ) > { > if (*buf == 0) return 0; >@@ -68,6 +74,17 @@ > return n; > } > >+static Int readdec ( Char* buf, UInt* val ) >+{ >+ Int n = 0; >+ *val = 0; >+ while (hexdigit(*buf) >= 0) { >+ *val = (*val * 10) + decdigit(*buf); >+ n++; buf++; >+ } >+ return n; >+} >+ > > /* Read /proc/self/maps, store the contents in a static buffer. If there's > a syntax error or other failure, just abort. */ >@@ -124,13 +141,16 @@ > procmap_buf! > */ > void VG_(parse_procselfmaps) ( >- void (*record_mapping)( Addr, UInt, Char, Char, Char, UInt, UChar* ) ) >+ void (*record_mapping)( Addr addr, UInt len, Char rr, Char ww, Char xx, >+ UInt dev, UInt ino, ULong foff, const UChar* filename ) >+ ) > { > Int i, j, i_eol; > Addr start, endPlusOne; > UChar* filename; > UInt foffset; > UChar rr, ww, xx, pp, ch, tmp; >+ UInt maj, min, ino; > > sk_assert( '\0' != procmap_buf[0] && 0 != buf_n_tot); > >@@ -142,7 +162,7 @@ > while (True) { > if (i >= buf_n_tot) break; > >- /* Read (without fscanf :) the pattern %8x-%8x %c%c%c%c %8x */ >+ /* Read (without fscanf :) the pattern %8x-%8x %c%c%c%c %8x %2x:%2x %d */ > j = readhex(&procmap_buf[i], &start); > if (j > 0) i += j; else goto syntaxerror; > j = readchar(&procmap_buf[i], &ch); >@@ -159,7 +179,7 @@ > if (j == 1 && (ww == 'w' || ww == '-')) i += j; else goto syntaxerror; > j = readchar(&procmap_buf[i], &xx); > if (j == 1 && (xx == 'x' || xx == '-')) i += j; else goto syntaxerror; >- /* I haven't a clue what this last field means. */ >+ /* This field is the shared/private flag */ > j = readchar(&procmap_buf[i], &pp); > if (j == 1 && (pp == 'p' || pp == '-' || pp == 's')) > i += j; else goto syntaxerror; >@@ -169,7 +189,23 @@ > > j = readhex(&procmap_buf[i], &foffset); > if (j > 0) i += j; else goto syntaxerror; >- >+ >+ j = readchar(&procmap_buf[i], &ch); >+ if (j == 1 && ch == ' ') i += j; else goto syntaxerror; >+ >+ j = readhex(&procmap_buf[i], &maj); >+ if (j > 0) i += j; else goto syntaxerror; >+ j = readchar(&procmap_buf[i], &ch); >+ if (j == 1 && ch == ':') i += j; else goto syntaxerror; >+ j = readhex(&procmap_buf[i], &min); >+ if (j > 0) i += j; else goto syntaxerror; >+ >+ j = readchar(&procmap_buf[i], &ch); >+ if (j == 1 && ch == ' ') i += j; else goto syntaxerror; >+ >+ j = readdec(&procmap_buf[i], &ino); >+ if (j > 0) i += j; else goto syntaxerror; >+ > goto read_line_ok; > > syntaxerror: >@@ -203,7 +239,7 @@ > } > > (*record_mapping) ( start, endPlusOne-start, >- rr, ww, xx, >+ rr, ww, xx, maj * 256 + min, ino, > foffset, filename ); > > if ('\0' != tmp) { >diff -ruN valgrind-2.1.0/coregrind/vg_proxylwp.c valgrind/coregrind/vg_proxylwp.c >--- valgrind-2.1.0/coregrind/vg_proxylwp.c 2003-11-27 03:07:47.000000000 -0600 >+++ valgrind/coregrind/vg_proxylwp.c 2004-01-20 19:27:26.000000000 -0600 >@@ -7,7 +7,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -180,7 +180,7 @@ > jmp_buf jumpbuf; > }; > >-static void sys_wait_results(Bool block, ThreadId tid, enum RequestType reqtype); >+static void sys_wait_results(Bool block, ThreadId tid, enum RequestType reqtype, Bool restart); > > struct PX_Request { > enum RequestType request; >@@ -196,7 +196,7 @@ > union { > Int syscallno; /* system call completed */ > vki_ksiginfo_t siginfo; /* signal */ >- }; >+ } u; > }; > > /* results pipe */ >@@ -257,7 +257,6 @@ > } > > #define PROXYLWP_OFFSET (VKI_BYTES_PER_PAGE - sizeof(ProxyLWP)) >-#define ROUNDDN(p) ((UChar *)((Addr)(p) & ~(VKI_BYTES_PER_PAGE-1))) > > /* > Allocate a page for the ProxyLWP and its stack. >@@ -271,7 +270,7 @@ > { > UChar *p = VG_(get_memory_from_mmap)(VKI_BYTES_PER_PAGE, "alloc_LWP"); > ProxyLWP *ret; >- vg_assert(p == ROUNDDN(p)); /* px must be page aligned */ >+ vg_assert(p == (UChar *)PGROUNDDN(p)); /* px must be page aligned */ > > ret = (ProxyLWP *)(p + PROXYLWP_OFFSET); > >@@ -283,7 +282,7 @@ > /* Free a thread structure */ > static void LWP_free(ProxyLWP *px) > { >- UChar *p = ROUNDDN(px); >+ UChar *p = (UChar *)PGROUNDDN(px); > > vg_assert(px->magic == VG_PROXY_MAGIC); > px->magic = 0; >@@ -297,7 +296,7 @@ > end). */ > static inline ProxyLWP *LWP_TSD(void *esp) > { >- UChar *p = ROUNDDN(esp); >+ UChar *p = (UChar *)PGROUNDDN(esp); > ProxyLWP *ret; > > ret = (ProxyLWP *)(p + PROXYLWP_OFFSET); >@@ -512,7 +511,7 @@ > /* First, send the signal info */ > sigreply.tid = px->tid; > sigreply.req = PX_Signal; >- sigreply.siginfo = px->siginfo; >+ sigreply.u.siginfo = px->siginfo; > > if (!send_reply(&sigreply)) { > ret = 44; /* incomplete or failed write */ >@@ -554,7 +553,7 @@ > XXX how to distunguish between restartable and > non-restartable syscalls? Does it matter? > */ >- reply.syscallno = tst->syscallno; >+ reply.u.syscallno = tst->syscallno; > > tst->m_eax = -VKI_ERESTARTSYS; > px->state = PXS_IntReply; >@@ -599,7 +598,7 @@ > /* We were actually running the syscall when interrupted. > reply should already be set up, including return in eax. */ > vg_assert(reply.req == PX_RunSyscall); >- vg_assert(reply.syscallno == tst->syscallno); >+ vg_assert(reply.u.syscallno == tst->syscallno); > vg_assert(tst->status == VgTs_WaitSys); > px->state = PXS_IntReply; > break; >@@ -608,7 +607,7 @@ > /* The syscall is done; we just need to send the results > back. */ > vg_assert(reply.req == PX_RunSyscall); >- vg_assert(reply.syscallno == tst->syscallno); >+ vg_assert(reply.u.syscallno == tst->syscallno); > px->state = PXS_IntReply; > break; > >@@ -712,7 +711,7 @@ > case PX_RunSyscall: > /* Run a syscall for our thread; results will be poked > back into tst */ >- reply.syscallno = tst->syscallno; >+ reply.u.syscallno = tst->syscallno; > > vg_assert(px->state == PXS_WaitReq || > px->state == PXS_SigACK); >@@ -723,7 +722,7 @@ > on the way to us as we got the signal. > */ > px_printf("RunSyscall in SigACK: rejecting syscall %d with ERESTARTSYS\n", >- reply.syscallno); >+ reply.u.syscallno); > tst->m_eax = -VKI_ERESTARTSYS; > } else { > Int syscallno = tst->syscallno; >@@ -842,9 +841,9 @@ > it by the normal mechanism. In this case, just wait for the > syscall to dinish. */ > if (tst->status == VgTs_WaitSys && tst->syscallno == __NR_rt_sigtimedwait) >- sys_wait_results(True, tid, PX_RunSyscall); >+ sys_wait_results(True, tid, PX_RunSyscall, True); > else >- sys_wait_results(True, tid, PX_Signal); >+ sys_wait_results(True, tid, PX_Signal, True); > } > } > >@@ -867,7 +866,7 @@ > if (lwp != 0) > VG_(ktkill)(lwp, VKI_SIGVGINT); > >- sys_wait_results(True, tid, PX_RunSyscall); >+ sys_wait_results(True, tid, PX_RunSyscall, False); > > vg_assert(tst->status == VgTs_Runnable); > } >@@ -1064,7 +1063,7 @@ > proxy_wait, because if we don't read the results pipe, the proxy > may be blocked writing to it, causing a deadlock with us as we > wait for it to exit. */ >- sys_wait_results(True, tid, PX_Exiting); >+ sys_wait_results(True, tid, PX_Exiting, True); > res = proxy_wait(proxy, True, &status); > > if ((!res || status != 0) && VG_(clo_verbosity) > 1) >@@ -1092,7 +1091,7 @@ > reply, otherwise it will block forever). If tid != 0, then it will > wait for a reply for that particular tid. > */ >-static void sys_wait_results(Bool block, ThreadId tid, enum RequestType reqtype) >+static void sys_wait_results(Bool block, ThreadId tid, enum RequestType reqtype, Bool restart) > { > Bool found_reply = (reqtype == PX_BAD); > struct PX_Reply res; >@@ -1151,21 +1150,21 @@ > VG_(printf)("tid %d in status %d\n", > tst->tid, tst->status); > >- vg_assert(res.syscallno == tst->syscallno); >+ vg_assert(res.u.syscallno == tst->syscallno); > vg_assert(tst->status == VgTs_WaitSys); > >- VG_(post_syscall)(res.tid); >+ VG_(post_syscall)(res.tid, restart); > break; > > case PX_Signal: > if (VG_(clo_trace_signals) || VG_(clo_trace_syscalls)) > VG_(message)(Vg_DebugMsg, "sys_wait_results: got PX_Signal for TID %d, signal %d", >- res.tid, res.siginfo.si_signo); >+ res.tid, res.u.siginfo.si_signo); > >- vg_assert(res.siginfo.si_signo != 0); >+ vg_assert(res.u.siginfo.si_signo != 0); > if (VG_(threads)[res.tid].proxy && > !VG_(threads)[res.tid].proxy->terminating) >- VG_(deliver_signal)(res.tid, &res.siginfo, True); >+ VG_(deliver_signal)(res.tid, &res.u.siginfo, True); > break; > > case PX_Ping: >@@ -1188,16 +1187,16 @@ > /* External version */ > void VG_(proxy_results)(void) > { >- sys_wait_results(False, 0, PX_BAD); >+ sys_wait_results(False, 0, PX_BAD, True); > } > >-void VG_(proxy_wait_sys)(ThreadId tid) >+void VG_(proxy_wait_sys)(ThreadId tid, Bool restart) > { > ThreadState *tst = VG_(get_ThreadState)(tid); > > vg_assert(tst->status == VgTs_WaitSys); > >- sys_wait_results(True, tid, PX_RunSyscall); >+ sys_wait_results(True, tid, PX_RunSyscall, restart); > } > > /* Tell proxy about it's thread's updated signal mask */ >@@ -1227,7 +1226,7 @@ > with respect to each other (ie, if thread A then thread B > updates their signal masks, A's update must be done before B's > is). */ >- sys_wait_results(True, tid, PX_SetSigmask); >+ sys_wait_results(True, tid, PX_SetSigmask, True); > } > > void VG_(proxy_sigack)(ThreadId tid, const vki_ksigset_t *mask) >@@ -1272,7 +1271,7 @@ > if (VG_(do_signal_routing)) > VG_(route_signals)(); > else >- sys_wait_results(True, VG_INVALID_THREADID /* any */, PX_Signal); >+ sys_wait_results(True, VG_INVALID_THREADID /* any */, PX_Signal, True); > } > > /* Issue a syscall to the thread's ProxyLWP */ >@@ -1365,7 +1364,7 @@ > tid, px->lwp, ret); > sane = False; > } >- sys_wait_results(True, tid, PX_Ping); >+ sys_wait_results(True, tid, PX_Ping, True); > /* Can't make an assertion here, fortunately; this will > either come back or it won't. */ > } >@@ -1374,6 +1373,15 @@ > vg_assert(sane); > } > >+/* Get the PID/TID of the ProxyLWP. */ >+Int VG_(proxy_id)(ThreadId tid) >+{ >+ ThreadState *tst = VG_(get_ThreadState)(tid); >+ ProxyLWP *proxy = tst->proxy; >+ >+ return proxy->lwp; >+} >+ > /*--------------------------------------------------------------------*/ > /*--- Proxy LWP machinery. vg_proxylwp.c ---*/ > /*--------------------------------------------------------------------*/ >diff -ruN valgrind-2.1.0/coregrind/vg_replace_malloc.c valgrind/coregrind/vg_replace_malloc.c >--- valgrind-2.1.0/coregrind/vg_replace_malloc.c 2003-11-27 18:15:57.000000000 -0600 >+++ valgrind/coregrind/vg_replace_malloc.c 2004-01-21 09:08:03.000000000 -0600 >@@ -8,7 +8,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -36,242 +36,172 @@ > have no prototypes in vg_include.h, since they are not intended to > be called from within Valgrind. > >- This file can be #included into a skin that wishes to know about >+ This file can be #included into a tool that wishes to know about > calls to malloc(). It should define functions SK_(malloc) et al > that will be called. > ------------------------------------------------------------------ */ > > #include "valgrind.h" /* for VALGRIND_NON_SIMD_CALL[12] */ > #include "vg_include.h" >+#include "vg_skin.h" > >-/*------------------------------------------------------------*/ >-/*--- Command line options ---*/ >-/*------------------------------------------------------------*/ >- >-/* Round malloc sizes upwards to integral number of words? default: NO */ >-Bool VG_(clo_sloppy_malloc) = False; >- >-/* DEBUG: print malloc details? default: NO */ >-Bool VG_(clo_trace_malloc) = False; >- >-/* Minimum alignment in functions that don't specify alignment explicitly. >- default: 0, i.e. use default of the machine (== 4) */ >-Int VG_(clo_alignment) = 4; >- >- >-Bool VG_(replacement_malloc_process_cmd_line_option)(Char* arg) >-{ >- if (VG_CLO_STREQN(12, arg, "--alignment=")) { >- VG_(clo_alignment) = (Int)VG_(atoll)(&arg[12]); >- >- if (VG_(clo_alignment) < 4 >- || VG_(clo_alignment) > 4096 >- || VG_(log2)( VG_(clo_alignment) ) == -1 /* not a power of 2 */) { >- VG_(message)(Vg_UserMsg, ""); >- VG_(message)(Vg_UserMsg, >- "Invalid --alignment= setting. " >- "Should be a power of 2, >= 4, <= 4096."); >- VG_(bad_option)("--alignment"); >- } >- } >- >- else if (VG_CLO_STREQ(arg, "--sloppy-malloc=yes")) >- VG_(clo_sloppy_malloc) = True; >- else if (VG_CLO_STREQ(arg, "--sloppy-malloc=no")) >- VG_(clo_sloppy_malloc) = False; >- >- else if (VG_CLO_STREQ(arg, "--trace-malloc=yes")) >- VG_(clo_trace_malloc) = True; >- else if (VG_CLO_STREQ(arg, "--trace-malloc=no")) >- VG_(clo_trace_malloc) = False; >- >- else >- return False; >- >- return True; >-} >- >-void VG_(replacement_malloc_print_usage)(void) >-{ >- VG_(printf)( >-" --sloppy-malloc=no|yes round malloc sizes to next word? [no]\n" >-" --alignment=<number> set minimum alignment of allocations [4]\n" >- ); >-} >- >-void VG_(replacement_malloc_print_debug_usage)(void) >-{ >- VG_(printf)( >-" --trace-malloc=no|yes show client malloc details? [no]\n" >- ); >-} >- >+/* Create an alias */ >+#define ALIAS(ret, name, args, toname) \ >+ ret name args __attribute__((alias(#toname), visibility("protected"))) >+ >+/* Declare a function, along with libc's various aliases */ >+#define LIBALIAS(ret, name, args) \ >+ ALIAS(ret, __##name, args, name); \ >+ ALIAS(ret, __libc_##name, args, name); \ >+ ret name args > > /*------------------------------------------------------------*/ > /*--- Replacing malloc() et al ---*/ > /*------------------------------------------------------------*/ > >+static struct vg_mallocfunc_info info; >+static int init_done; >+ >+/* Startup hook - called as init section */ >+static void init(void) __attribute__((constructor)); >+ > /* Below are new versions of malloc, __builtin_new, free, > __builtin_delete, calloc, realloc, memalign, and friends. > >- malloc, __builtin_new, free, __builtin_delete, calloc and realloc >- can be entered either on the real CPU or the simulated one. If on >- the real one, this is because the dynamic linker is running the >- static initialisers for C++, before starting up Valgrind itself. >- In this case it is safe to route calls through to >- VG_(arena_malloc)/VG_(arena_free), since they are self-initialising. >- >- Once Valgrind is initialised, vg_running_on_simd_CPU becomes True. >- The call needs to be transferred from the simulated CPU back to the >- real one and routed to the VG_(cli_malloc)() or VG_(cli_free)(). To do >- that, the client-request mechanism (in valgrind.h) is used to convey >- requests to the scheduler. >+ None of these functions are called directly - they are not meant to >+ be found by the dynamic linker. They get called because >+ vg_replace_malloc installs a bunch of code redirects which causes >+ Valgrind to use these functions rather than the ones they're >+ replacing. That said, we certainly don't mind if the linker finds >+ them, because it makes our life easier with respect to startup >+ initialization order (we can't guarantee that our init routine will >+ necessarily be called early enough to do the redirects before >+ someone wants to allocate). > */ > > #define MALLOC_TRACE(format, args...) \ >- if (VG_(clo_trace_malloc)) \ >+ if (info.clo_trace_malloc) \ > VALGRIND_INTERNAL_PRINTF(format, ## args ) > > #define MAYBE_SLOPPIFY(n) \ >- if (VG_(clo_sloppy_malloc)) { \ >- while ((n % 4) > 0) n++; \ >+ if (info.clo_sloppy_malloc) { \ >+ n = (n+3) & ~3; \ > } > > /* ALL calls to malloc() and friends wind up here. */ > #define ALLOC(fff, vgfff) \ >-void* fff ( Int n ) \ >+LIBALIAS(void *, fff, (Int n)) \ > { \ > void* v; \ > \ >- MALLOC_TRACE(#fff "[simd=%d](%d)", \ >- (UInt)VG_(is_running_on_simd_CPU)(), n ); \ >+ MALLOC_TRACE(#fff "(%d)", n ); \ > MAYBE_SLOPPIFY(n); \ >+ if (!init_done) init(); \ > \ >- if (VG_(is_running_on_simd_CPU)()) { \ >- v = (void*)VALGRIND_NON_SIMD_CALL1( vgfff, n ); \ >- } else if (VG_(clo_alignment) != 4) { \ >- v = VG_(arena_malloc_aligned)(VG_AR_CLIENT, VG_(clo_alignment), n); \ >- } else { \ >- v = VG_(arena_malloc)(VG_AR_CLIENT, n); \ >- } \ >+ v = (void*)VALGRIND_NON_SIMD_CALL1( info.sk_##vgfff, n ); \ > MALLOC_TRACE(" = %p", v ); \ > return v; \ > } >-ALLOC( malloc, SK_(malloc) ); >-ALLOC( __builtin_new, SK_(__builtin_new) ); >-ALLOC( _Znwj, SK_(__builtin_new) ); >+ALLOC( malloc, malloc ); >+ALLOC( __builtin_new, __builtin_new ); >+ALLOC( _Znwj, __builtin_new ); > > // operator new(unsigned, std::nothrow_t const&) >-ALLOC( _ZnwjRKSt9nothrow_t, SK_(__builtin_new) ); >+ALLOC( _ZnwjRKSt9nothrow_t, __builtin_new ); > >-ALLOC( __builtin_vec_new, SK_(__builtin_vec_new) ); >-ALLOC( _Znaj, SK_(__builtin_vec_new) ); >+ALLOC( __builtin_vec_new, __builtin_vec_new ); >+ALLOC( _Znaj, __builtin_vec_new ); > > // operator new[](unsigned, std::nothrow_t const& >-ALLOC( _ZnajRKSt9nothrow_t, SK_(__builtin_vec_new) ); >+ALLOC( _ZnajRKSt9nothrow_t, __builtin_vec_new ); > > #define FREE(fff, vgfff) \ >-void fff ( void* p ) \ >+LIBALIAS(void, fff, (void *p)) \ > { \ >- MALLOC_TRACE(#fff "[simd=%d](%p)", \ >- (UInt)VG_(is_running_on_simd_CPU)(), p ); \ >+ MALLOC_TRACE(#fff "(%p)", p ); \ > if (p == NULL) \ > return; \ >- if (VG_(is_running_on_simd_CPU)()) { \ >- (void)VALGRIND_NON_SIMD_CALL1( vgfff, p ); \ >- } else { \ >- VG_(arena_free)(VG_AR_CLIENT, p); \ >- } \ >-} >-FREE( free, SK_(free) ); >-FREE( __builtin_delete, SK_(__builtin_delete) ); >-FREE( _ZdlPv, SK_(__builtin_delete) ); >-FREE( __builtin_vec_delete, SK_(__builtin_vec_delete) ); >-FREE( _ZdaPv, SK_(__builtin_vec_delete) ); >+ if (!init_done) init(); \ >+ (void)VALGRIND_NON_SIMD_CALL1( info.sk_##vgfff, p ); \ >+} >+FREE( free, free ); >+FREE( __builtin_delete, __builtin_delete ); >+FREE( _ZdlPv, __builtin_delete ); >+FREE( __builtin_vec_delete, __builtin_vec_delete ); >+FREE( _ZdaPv, __builtin_vec_delete ); > >-void* calloc ( UInt nmemb, UInt size ) >+LIBALIAS(void*, calloc, ( Int nmemb, Int size )) > { > void* v; > >- MALLOC_TRACE("calloc[simd=%d](%d,%d)", >- (UInt)VG_(is_running_on_simd_CPU)(), nmemb, size ); >+ MALLOC_TRACE("calloc(%d,%d)", nmemb, size ); > MAYBE_SLOPPIFY(size); > >- if (VG_(is_running_on_simd_CPU)()) { >- v = (void*)VALGRIND_NON_SIMD_CALL2( SK_(calloc), nmemb, size ); >- } else { >- v = VG_(arena_calloc)(VG_AR_CLIENT, VG_(clo_alignment), nmemb, size); >- } >+ if (!init_done) init(); >+ v = (void*)VALGRIND_NON_SIMD_CALL2( info.sk_calloc, nmemb, size ); > MALLOC_TRACE(" = %p", v ); > return v; > } > >- >-void* realloc ( void* ptrV, Int new_size ) >+LIBALIAS(void*, realloc, ( void* ptrV, Int new_size )) > { > void* v; > >- MALLOC_TRACE("realloc[simd=%d](%p,%d)", >- (UInt)VG_(is_running_on_simd_CPU)(), ptrV, new_size ); >+ MALLOC_TRACE("realloc(%p,%d)", ptrV, new_size ); > MAYBE_SLOPPIFY(new_size); > > if (ptrV == NULL) > return malloc(new_size); > if (new_size <= 0) { > free(ptrV); >- if (VG_(clo_trace_malloc)) >- VG_(printf)(" = 0" ); >+ if (info.clo_trace_malloc) >+ VALGRIND_INTERNAL_PRINTF(" = 0" ); > return NULL; > } >- if (VG_(is_running_on_simd_CPU)()) { >- v = (void*)VALGRIND_NON_SIMD_CALL2( SK_(realloc), ptrV, new_size ); >- } else { >- v = VG_(arena_realloc)(VG_AR_CLIENT, ptrV, VG_(clo_alignment), new_size); >- } >+ if (!init_done) init(); >+ v = (void*)VALGRIND_NON_SIMD_CALL2( info.sk_realloc, ptrV, new_size ); > MALLOC_TRACE(" = %p", v ); > return v; > } > > >-void* memalign ( Int alignment, Int n ) >+LIBALIAS(void*, memalign, ( Int alignment, Int n )) > { > void* v; > >- MALLOC_TRACE("memalign[simd=%d](al %d, size %d)", >- (UInt)VG_(is_running_on_simd_CPU)(), alignment, n ); >+ MALLOC_TRACE("memalign(al %d, size %d)", alignment, n ); > MAYBE_SLOPPIFY(n); > >- if (VG_(is_running_on_simd_CPU)()) { >- v = (void*)VALGRIND_NON_SIMD_CALL2( SK_(memalign), alignment, n ); >- } else { >- v = VG_(arena_malloc_aligned)(VG_AR_CLIENT, alignment, n); >- } >+ if (!init_done) init(); >+ v = (void*)VALGRIND_NON_SIMD_CALL2( info.sk_memalign, alignment, n ); > MALLOC_TRACE(" = %p", v ); > return v; > } > > >-void* valloc ( Int size ) >+LIBALIAS(void*, valloc, ( Int size )) > { > return memalign(VKI_BYTES_PER_PAGE, size); > } > > > /* Various compatibility wrapper functions, for glibc and libstdc++. */ >-void cfree ( void* p ) >+ >+/* Don't just alias free, otherwise people could get confused seeing >+ cfree rather than free in error output */ >+LIBALIAS(void, cfree, ( void* p ) ) > { >- free ( p ); >+ free(p); > } > >- >-int mallopt ( int cmd, int value ) >+LIBALIAS(int, mallopt, ( int cmd, int value )) > { > /* In glibc-2.2.4, 1 denotes a successful return value for mallopt */ > return 1; > } > > >-int __posix_memalign ( void **memptr, UInt alignment, UInt size ) >+LIBALIAS(int, posix_memalign, ( void **memptr, UInt alignment, UInt size )) > { > void *mem; > >@@ -290,25 +220,17 @@ > return VKI_ENOMEM /*12*/ /*ENOMEM*/; > } > >-# define weak_alias(name, aliasname) \ >- extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))); >-weak_alias(__posix_memalign, posix_memalign); >- >-Int malloc_usable_size ( void* p ) >+LIBALIAS(int, malloc_usable_size, ( void* p )) > { > Int pszB; > >- MALLOC_TRACE("malloc_usable_size[simd=%d](%p)", >- (UInt)VG_(is_running_on_simd_CPU)(), p ); >+ MALLOC_TRACE("malloc_usable_size(%p)", p ); > if (NULL == p) > return 0; > >- if (VG_(is_running_on_simd_CPU)()) { >- pszB = (Int)VALGRIND_NON_SIMD_CALL2( VG_(arena_payload_szB), >- VG_AR_CLIENT, p ); >- } else { >- pszB = VG_(arena_payload_szB)(VG_AR_CLIENT, p); >- } >+ if (!init_done) init(); >+ pszB = (Int)VALGRIND_NON_SIMD_CALL2( info.arena_payload_szB, >+ VG_AR_CLIENT, p ); > MALLOC_TRACE(" = %d", pszB ); > > return pszB; >@@ -316,21 +238,28 @@ > > > /* Bomb out if we get any of these. */ >-/* HACK: We shouldn't call VG_(core_panic) or VG_(message) on the simulated >- CPU. Really we should pass the request in the usual way, and >- Valgrind itself can do the panic. Too tedious, however. >-*/ >-void pvalloc ( void ) >-{ VG_(core_panic)("call to pvalloc\n"); } >-void malloc_stats ( void ) >-{ VG_(core_panic)("call to malloc_stats\n"); } >- >-void malloc_trim ( void ) >-{ VG_(core_panic)("call to malloc_trim\n"); } >-void malloc_get_state ( void ) >-{ VG_(core_panic)("call to malloc_get_state\n"); } >-void malloc_set_state ( void ) >-{ VG_(core_panic)("call to malloc_set_state\n"); } >+ >+extern void _exit(int); >+ >+static void panic(const char *str) >+{ >+ VALGRIND_PRINTF_BACKTRACE("Program aborting because of call to %s", str); >+ >+ _exit(99); >+ *(int *)0 = 'x'; >+} >+ >+#define PANIC(x) \ >+ void x(void) \ >+ { \ >+ panic(#x); \ >+ } >+ >+PANIC(pvalloc); >+PANIC(malloc_stats); >+PANIC(malloc_trim); >+PANIC(malloc_get_state); >+PANIC(malloc_set_state); > > > /* Yet another ugly hack. Cannot include <malloc.h> because we >@@ -351,7 +280,7 @@ > int keepcost; /* top-most, releasable (via malloc_trim) space */ > }; > >-struct mallinfo mallinfo ( void ) >+LIBALIAS(struct mallinfo, mallinfo, ( void )) > { > /* Should really try to return something a bit more meaningful */ > UInt i; >@@ -362,6 +291,83 @@ > return mi; > } > >+static const struct { >+ const Char *libname; >+ Addr func; >+} replacements[] = >+{ >+#define E(pfx, x) { pfx #x, (Addr)x } >+#define R(x) E("", x), E("__libc_", x), E("__", x) >+ >+ /* alloc */ >+ R(malloc), >+ R(__builtin_new), >+ R(_Znwj), >+ R(_ZnwjRKSt9nothrow_t), /* operator new(unsigned, std::nothrow_t const&) */ >+ R(__builtin_vec_new), >+ R(_Znaj), >+ R(_ZnajRKSt9nothrow_t), /* operator new[](unsigned, std::nothrow_t const& */ >+ R(calloc), >+ R(realloc), >+ R(memalign), >+ R(valloc), >+ R(cfree), >+ R(posix_memalign), >+ >+ /* free */ >+ R(free), >+ R(__builtin_delete), >+ R(_ZdlPv), >+ R(__builtin_vec_delete), >+ R(_ZdaPv), >+ >+ /* misc */ >+ R(mallopt), >+ R(malloc_usable_size), >+ R(mallinfo), >+ >+ /* bad */ >+ R(pvalloc), >+ R(malloc_stats), >+ R(malloc_trim), >+ R(malloc_get_state), >+ R(malloc_set_state), >+#undef R >+#undef S >+#undef E >+}; >+ >+/* All the code in here is unused until this function is called */ >+ >+static void init(void) >+{ >+ int i; >+ int res; >+ >+ if (init_done) >+ return; >+ >+ init_done = 1; >+ >+ VALGRIND_MAGIC_SEQUENCE(res, -1, VG_USERREQ__GET_MALLOCFUNCS, &info, 0, 0, 0); >+ >+ for(i = 0; i < sizeof(replacements)/sizeof(*replacements); i++) { >+#if 0 >+ /* doesn't seem much point - ld-linux.so will have already used >+ malloc/free before we run */ >+ VALGRIND_MAGIC_SEQUENCE(res, 0, VG_USERREQ__REGISTER_REDIRECT_ADDR, >+ "soname:ld-linux.so.2", replacements[i].libname, >+ replacements[i].func, 0); >+#endif >+ VALGRIND_MAGIC_SEQUENCE(res, 0, VG_USERREQ__REGISTER_REDIRECT_ADDR, >+ "soname:libc.so.6", replacements[i].libname, >+ replacements[i].func, 0); >+ VALGRIND_MAGIC_SEQUENCE(res, 0, VG_USERREQ__REGISTER_REDIRECT_ADDR, >+ "soname:libstdc++*", replacements[i].libname, >+ replacements[i].func, 0); >+ } >+} >+ > /*--------------------------------------------------------------------*/ > /*--- end vg_replace_malloc.c ---*/ > /*--------------------------------------------------------------------*/ >diff -ruN valgrind-2.1.0/coregrind/vg_scheduler.c valgrind/coregrind/vg_scheduler.c >--- valgrind-2.1.0/coregrind/vg_scheduler.c 2003-11-13 17:02:16.000000000 -0600 >+++ valgrind/coregrind/vg_scheduler.c 2004-02-01 11:29:58.000000000 -0600 >@@ -7,7 +7,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -119,6 +119,10 @@ > > typedef UInt ThreadKey; > >+/* The scheduler does need to know the address of it so it can be >+ called at program exit. */ >+static Addr VG_(__libc_freeres_wrapper); >+ > > UInt VG_(syscall_altered_shadow_reg); > UInt VG_(signal_delivery_altered_shadow_reg); >@@ -243,6 +247,7 @@ > switch (event) { > case VG_TRC_EBP_JMP_SYSCALL: return "SYSCALL"; > case VG_TRC_EBP_JMP_CLIENTREQ: return "CLIENTREQ"; >+ case VG_TRC_EBP_JMP_YIELD: return "YIELD"; > case VG_TRC_INNER_COUNTERZERO: return "COUNTERZERO"; > case VG_TRC_INNER_FASTMISS: return "FASTMISS"; > case VG_TRC_UNRESUMABLE_SIGNAL: return "FATALSIGNAL"; >@@ -334,6 +339,7 @@ > vg_assert(vg_tid_currently_in_baseBlock == VG_INVALID_THREADID); > > VG_(baseBlock)[VGOFF_(ldt)] = (UInt)VG_(threads)[tid].ldt; >+ VG_(baseBlock)[VGOFF_(tls)] = (UInt)VG_(threads)[tid].tls; > VG_(baseBlock)[VGOFF_(m_cs)] = VG_(threads)[tid].m_cs; > VG_(baseBlock)[VGOFF_(m_ss)] = VG_(threads)[tid].m_ss; > VG_(baseBlock)[VGOFF_(m_ds)] = VG_(threads)[tid].m_ds; >@@ -415,6 +421,19 @@ > vg_assert((void*)VG_(threads)[tid].ldt > == (void*)VG_(baseBlock)[VGOFF_(ldt)]); > >+ /* We don't copy out the TLS entry, because it can never be changed >+ by the normal actions of the thread, only by the set_thread_area >+ syscall, in which case we will correctly be updating >+ VG_(threads)[tid].tls. This printf happens iff the following >+ assertion fails. */ >+ if ((void*)VG_(threads)[tid].tls != (void*)VG_(baseBlock)[VGOFF_(tls)]) >+ VG_(printf)("VG_(threads)[%d].tls=%p VG_(baseBlock)[VGOFF_(tls)]=%p\n", >+ tid, (void*)VG_(threads)[tid].tls, >+ (void*)VG_(baseBlock)[VGOFF_(tls)]); >+ >+ vg_assert((void*)VG_(threads)[tid].tls >+ == (void*)VG_(baseBlock)[VGOFF_(tls)]); >+ > VG_(threads)[tid].m_cs = VG_(baseBlock)[VGOFF_(m_cs)]; > VG_(threads)[tid].m_ss = VG_(baseBlock)[VGOFF_(m_ss)]; > VG_(threads)[tid].m_ds = VG_(baseBlock)[VGOFF_(m_ds)]; >@@ -464,6 +483,7 @@ > > /* Fill it up with junk. */ > VG_(baseBlock)[VGOFF_(ldt)] = junk; >+ VG_(baseBlock)[VGOFF_(tls)] = junk; > VG_(baseBlock)[VGOFF_(m_cs)] = junk; > VG_(baseBlock)[VGOFF_(m_ss)] = junk; > VG_(baseBlock)[VGOFF_(m_ds)] = junk; >@@ -497,7 +517,6 @@ > volatile UInt trc = 0; > vg_assert(VG_(is_valid_tid)(tid)); > vg_assert(VG_(threads)[tid].status == VgTs_Runnable); >- vg_assert(VG_(bbs_to_go) > 0); > vg_assert(!VG_(scheduler_jmpbuf_valid)); > > VGP_PUSHCC(VgpRun); >@@ -533,6 +552,7 @@ > { > vg_assert(tid >= 0 && tid < VG_N_THREADS); > VG_(threads)[tid].ldt = NULL; >+ VG_(clear_TLS_for_thread)(VG_(threads)[tid].tls); > VG_(threads)[tid].tid = tid; > VG_(threads)[tid].status = VgTs_Empty; > VG_(threads)[tid].associated_mx = NULL; >@@ -560,8 +580,7 @@ > > /* Initialise the scheduler. Create a single "main" thread ready to > run, with special ThreadId of one. This is called at startup; the >- caller takes care to park the client's state is parked in >- VG_(baseBlock). >+ caller takes care to park the client's state in VG_(baseBlock). > */ > void VG_(scheduler_init) ( void ) > { >@@ -591,12 +610,13 @@ > /* Copy VG_(baseBlock) state to tid_main's slot. */ > vg_tid_currently_in_baseBlock = tid_main; > vg_tid_last_in_baseBlock = tid_main; >+ VG_(baseBlock)[VGOFF_(tls)] = (UInt)VG_(threads)[tid_main].tls; > VG_(save_thread_state) ( tid_main ); > > VG_(threads)[tid_main].stack_highest_word >- = VG_(foundstack_start) + VG_(foundstack_size) - 4; >- VG_(threads)[tid_main].stack_base = VG_(foundstack_start); >- VG_(threads)[tid_main].stack_size = VG_(foundstack_size); >+ = VG_(clstk_end) - 4; >+ VG_(threads)[tid_main].stack_base = VG_(clstk_base); >+ VG_(threads)[tid_main].stack_size = VG_(clstk_end) - VG_(clstk_base); > > /* So now ... */ > vg_assert(vg_tid_currently_in_baseBlock == VG_INVALID_THREADID); >@@ -694,7 +714,7 @@ > > /* If pre_syscall returns true, then we're done immediately */ > if (VG_(pre_syscall)(tid)) { >- VG_(post_syscall(tid)); >+ VG_(post_syscall(tid, True)); > vg_assert(VG_(threads)[tid].status == VgTs_Runnable); > } else { > vg_assert(VG_(threads)[tid].status == VgTs_WaitSys); >@@ -880,10 +900,6 @@ > or declare deadlock, or sleep if there are no runnable > threads but some are blocked on I/O. */ > >- /* Was a debug-stop requested? */ >- if (VG_(bbs_to_go) == 0) >- goto debug_stop; >- > /* Do the following loop until a runnable thread is found, or > deadlock is detected. */ > while (True) { >@@ -975,10 +991,7 @@ > decrement is done before the bb is actually run, so you > always get at least one decrement even if nothing happens. > */ >- if (VG_(bbs_to_go) >= VG_SCHEDULING_QUANTUM) >- VG_(dispatch_ctr) = VG_SCHEDULING_QUANTUM + 1; >- else >- VG_(dispatch_ctr) = (UInt)VG_(bbs_to_go) + 1; >+ VG_(dispatch_ctr) = VG_SCHEDULING_QUANTUM + 1; > > /* ... and remember what we asked for. */ > dispatch_ctr_SAVED = VG_(dispatch_ctr); >@@ -1092,19 +1105,20 @@ > /* If __NR_exit, remember the supplied argument. */ > VG_(exitcode) = VG_(threads)[tid].m_ebx; /* syscall arg1 */ > >- /* Only run __libc_freeres if the skin says it's ok and >+ /* Only run __libc_freeres if the tool says it's ok and > it hasn't been overridden with --run-libc-freeres=no > on the command line. */ > >- if (VG_(needs).libc_freeres && VG_(clo_run_libc_freeres)) { >- >+ if (VG_(needs).libc_freeres && >+ VG_(clo_run_libc_freeres) && >+ VG_(__libc_freeres_wrapper) != 0) { > if (VG_(clo_verbosity) > 2 > || VG_(clo_trace_syscalls) || VG_(clo_trace_sched)) { > VG_(message)(Vg_DebugMsg, > "Caught __NR_exit; running __libc_freeres()"); > } > VG_(nuke_all_threads_except) ( tid ); >- VG_(threads)[tid].m_eip = (UInt)(&VG_(__libc_freeres_wrapper)); >+ VG_(threads)[tid].m_eip = (UInt)VG_(__libc_freeres_wrapper); > vg_assert(VG_(threads)[tid].status == VgTs_Runnable); > goto stage1; /* party on, dudes (but not for much longer :) */ > >@@ -1164,7 +1178,6 @@ > > done_this_time = (Int)dispatch_ctr_SAVED - (Int)VG_(dispatch_ctr) - 1; > vg_assert(done_this_time >= 0); >- VG_(bbs_to_go) -= (ULong)done_this_time; > VG_(bbs_done) += (ULong)done_this_time; > > if (0 && trc != VG_TRC_INNER_FASTMISS) >@@ -1181,13 +1194,16 @@ > > switch (trc) { > >+ case VG_TRC_EBP_JMP_YIELD: >+ /* Explicit yield. Let a new thread be scheduled, >+ simply by doing nothing, causing us to arrive back at >+ Phase 1. */ >+ break; >+ > case VG_TRC_INNER_COUNTERZERO: > /* Timeslice is out. Let a new thread be scheduled, > simply by doing nothing, causing us to arrive back at > Phase 1. */ >- if (VG_(bbs_to_go) == 0) { >- goto debug_stop; >- } > vg_assert(VG_(dispatch_ctr) == 0); > break; > >@@ -1225,20 +1241,6 @@ > /* NOTREACHED */ > VG_(core_panic)("scheduler: post-main-loop ?!"); > /* NOTREACHED */ >- >- debug_stop: >- /* If we exited because of a debug stop, print the translation >- of the last block executed -- by translating it again, and >- throwing away the result. */ >- VG_(printf)( >- "======vvvvvvvv====== LAST TRANSLATION ======vvvvvvvv======\n"); >- VG_(translate)( tid, >- VG_(threads)[tid].m_eip, NULL, NULL, NULL, NULL ); >- VG_(printf)("\n"); >- VG_(printf)( >- "======^^^^^^^^====== LAST TRANSLATION ======^^^^^^^^======\n"); >- >- return VgSrc_BbsDone; > } > > void VG_(need_resched) ( ThreadId prefer ) >@@ -1357,6 +1359,9 @@ > VG_(deallocate_LDT_for_thread)( VG_(threads)[tid].ldt ); > VG_(threads)[tid].ldt = NULL; > >+ /* Clear its TLS array. */ >+ VG_(clear_TLS_for_thread)( VG_(threads)[tid].tls ); >+ > /* Not interested in the timeout anymore */ > VG_(threads)[tid].awaken_at = 0xFFFFFFFF; > >@@ -1843,6 +1848,10 @@ > VG_(baseBlock)[VGOFF_(ldt)] = (UInt)VG_(threads)[tid].ldt; > } > >+ /* Initialise the thread's TLS array */ >+ VG_(clear_TLS_for_thread)( VG_(threads)[tid].tls ); >+ VG_(baseBlock)[VGOFF_(tls)] = (UInt)VG_(threads)[tid].tls; >+ > VG_(save_thread_state)(tid); > vg_tid_last_in_baseBlock = tid; > >@@ -1858,8 +1867,9 @@ > assigning it for the first time. */ > vg_assert(VG_(threads)[tid].stack_size == 0); > vg_assert(VG_(threads)[tid].stack_base == (Addr)NULL); >- new_stack = (Addr)VG_(get_memory_from_mmap)( new_stk_szb, >- "new thread stack" ); >+ new_stack = VG_(client_alloc)(0, new_stk_szb, >+ VKI_PROT_READ | VKI_PROT_WRITE | VKI_PROT_EXEC, >+ SF_STACK); > VG_(threads)[tid].stack_base = new_stack; > VG_(threads)[tid].stack_size = new_stk_szb; > VG_(threads)[tid].stack_highest_word >@@ -2059,8 +2069,12 @@ > } > > if (mutex->__m_count > 0) { >- >- vg_assert(VG_(is_valid_tid)((ThreadId)mutex->__m_owner)); >+ if (!VG_(is_valid_tid)((ThreadId)mutex->__m_owner)) { >+ VG_(record_pthread_error)( tid, >+ "pthread_mutex_lock/trylock: mutex has invalid owner"); >+ SET_PTHREQ_RETVAL(tid, VKI_EINVAL); >+ return; >+ } > > /* Someone has it already. */ > if ((ThreadId)mutex->__m_owner == tid) { >@@ -2880,35 +2894,48 @@ > UInt* arg = (UInt*)(VG_(threads)[tid].m_eax); > UInt req_no = arg[0]; > >- /* VG_(printf)("req no = 0x%x\n", req_no); */ >+ if (0) >+ VG_(printf)("req no = 0x%x\n", req_no); > switch (req_no) { > > case VG_USERREQ__CLIENT_CALL0: { > UInt (*f)(void) = (void*)arg[1]; >- SET_CLCALL_RETVAL(tid, f ( ), (Addr)f); >+ if (f == NULL) >+ VG_(message)(Vg_DebugMsg, "VG_USERREQ__CLIENT_CALL: func=%p\n", f); >+ else >+ SET_CLCALL_RETVAL(tid, f ( ), (Addr)f); > break; > } > case VG_USERREQ__CLIENT_CALL1: { > UInt (*f)(UInt) = (void*)arg[1]; >- SET_CLCALL_RETVAL(tid, f ( arg[2] ), (Addr)f ); >+ if (f == NULL) >+ VG_(message)(Vg_DebugMsg, "VG_USERREQ__CLIENT_CALL: func=%p\n", f); >+ else >+ SET_CLCALL_RETVAL(tid, f ( arg[2] ), (Addr)f ); > break; > } > case VG_USERREQ__CLIENT_CALL2: { > UInt (*f)(UInt, UInt) = (void*)arg[1]; >- SET_CLCALL_RETVAL(tid, f ( arg[2], arg[3] ), (Addr)f ); >+ if (f == NULL) >+ VG_(message)(Vg_DebugMsg, "VG_USERREQ__CLIENT_CALL: func=%p\n", f); >+ else >+ SET_CLCALL_RETVAL(tid, f ( arg[2], arg[3] ), (Addr)f ); > break; > } > case VG_USERREQ__CLIENT_CALL3: { > UInt (*f)(UInt, UInt, UInt) = (void*)arg[1]; >- SET_CLCALL_RETVAL(tid, f ( arg[2], arg[3], arg[4] ), (Addr)f ); >+ if (f == NULL) >+ VG_(message)(Vg_DebugMsg, "VG_USERREQ__CLIENT_CALL: func=%p\n", f); >+ else >+ SET_CLCALL_RETVAL(tid, f ( arg[2], arg[3], arg[4] ), (Addr)f ); > break; > } > >- /* Note: for skins that replace malloc() et al, we want to call >+ /* Note: for tools that replace malloc() et al, we want to call > the replacement versions. For those that don't, we want to call > VG_(cli_malloc)() et al. We do this by calling SK_(malloc)(), which >- malloc-replacing skins must replace, but have its default definition >- call */ >+ malloc-replacing tools must replace, but have the default definition >+ of SK_(malloc)() call VG_(cli_malloc)(). */ > > /* Note: for MALLOC and FREE, must set the appropriate "lock"... see > the comment in vg_defaults.c/SK_(malloc)() for why. */ >@@ -3109,13 +3136,27 @@ > case VG_USERREQ__SIGNAL_RETURNS: > handle_signal_return(tid); > break; >- >+ >+ >+ case VG_USERREQ__GET_SIGRT_MIN: >+ SET_PTHREQ_RETVAL(tid, VG_(sig_rtmin)); >+ break; >+ >+ case VG_USERREQ__GET_SIGRT_MAX: >+ SET_PTHREQ_RETVAL(tid, VG_(sig_rtmax)); >+ break; >+ >+ case VG_USERREQ__ALLOC_RTSIG: >+ SET_PTHREQ_RETVAL(tid, VG_(sig_alloc_rtsig)((Int)arg[1])); >+ break; >+ > case VG_USERREQ__PRINTF: { > int count = > VG_(vmessage)( Vg_ClientMsg, (char *)arg[1], (va_list)arg[2] ); > SET_CLREQ_RETVAL( tid, count ); > break; } > >+ > case VG_USERREQ__INTERNAL_PRINTF: { > int count = > VG_(vmessage)( Vg_UserMsg, (char *)arg[1], (va_list)arg[2] ); >@@ -3138,6 +3179,46 @@ > SET_CLREQ_RETVAL( tid, count ); > break; } > >+ case VG_USERREQ__REGISTER_LIBC_FREERES: >+ VG_(__libc_freeres_wrapper) = arg[1]; >+ SET_CLREQ_RETVAL( tid, 0 ); /* return value is meaningless */ >+ break; >+ >+ case VG_USERREQ__GET_MALLOCFUNCS: { >+ struct vg_mallocfunc_info *info = (struct vg_mallocfunc_info *)arg[1]; >+ >+ info->sk_malloc = (Addr)SK_(malloc); >+ info->sk_calloc = (Addr)SK_(calloc); >+ info->sk_realloc = (Addr)SK_(realloc); >+ info->sk_memalign = (Addr)SK_(memalign); >+ info->sk___builtin_new = (Addr)SK_(__builtin_new); >+ info->sk___builtin_vec_new = (Addr)SK_(__builtin_vec_new); >+ info->sk_free = (Addr)SK_(free); >+ info->sk___builtin_delete = (Addr)SK_(__builtin_delete); >+ info->sk___builtin_vec_delete = (Addr)SK_(__builtin_vec_delete); >+ >+ info->arena_payload_szB = (Addr)VG_(arena_payload_szB); >+ >+ info->clo_sloppy_malloc = VG_(clo_sloppy_malloc); >+ info->clo_trace_malloc = VG_(clo_trace_malloc); >+ >+ SET_CLREQ_RETVAL( tid, 0 ); /* return value is meaningless */ >+ >+ break; >+ } >+ >+ case VG_USERREQ__REGISTER_REDIRECT_SYM: { >+ VG_(add_redirect_sym)((const Char *)arg[1], (const Char *)arg[2], >+ (const Char *)arg[3], (const Char *)arg[4]); >+ break; >+ } >+ >+ case VG_USERREQ__REGISTER_REDIRECT_ADDR: { >+ VG_(add_redirect_addr)((const Char *)arg[1], (const Char *)arg[2], >+ (Addr)arg[3]); >+ break; >+ } >+ > /* Requests from the client program */ > > case VG_USERREQ__DISCARD_TRANSLATIONS: >@@ -3160,7 +3241,7 @@ > UInt ret; > > if (VG_(clo_verbosity) > 2) >- VG_(printf)("client request: code %d, addr %p, len %d\n", >+ VG_(printf)("client request: code %x, addr %p, len %d\n", > arg[0], (void*)arg[1], arg[2] ); > > if (SK_(handle_client_request) ( tid, arg, &ret )) >@@ -3169,7 +3250,7 @@ > static Bool whined = False; > > if (!whined) { >- // Allow for requests in core, but defined by skins, which >+ // Allow for requests in core, but defined by tools, which > // have 0 and 0 in their two high bytes. > Char c1 = (arg[0] >> 24) & 0xff; > Char c2 = (arg[0] >> 16) & 0xff; >diff -ruN valgrind-2.1.0/coregrind/vg_signals.c valgrind/coregrind/vg_signals.c >--- valgrind-2.1.0/coregrind/vg_signals.c 2003-12-08 15:58:37.000000000 -0600 >+++ valgrind/coregrind/vg_signals.c 2004-01-26 10:48:06.000000000 -0600 >@@ -8,7 +8,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -984,13 +984,13 @@ > "delivering signal %d (%s) to thread %d: on ALT STACK", > sigNo, signame(sigNo), tid ); > >- /* Signal delivery to skins */ >+ /* Signal delivery to tools */ > VG_TRACK( pre_deliver_signal, tid, sigNo, /*alt_stack*/False ); > > } else { > esp_top_of_frame = tst->m_esp; > >- /* Signal delivery to skins */ >+ /* Signal delivery to tools */ > VG_TRACK( pre_deliver_signal, tid, sigNo, /*alt_stack*/True ); > } > >@@ -1010,7 +1010,7 @@ > /* retaddr, sigNo, psigInfo, puContext fields are to be written */ > VG_TRACK( pre_mem_write, Vg_CoreSignal, tid, "signal handler frame", > (Addr)frame, offsetof(VgSigFrame, handlerArgs) ); >- frame->retaddr = (UInt)(&VG_(signalreturn_bogusRA)); >+ frame->retaddr = (UInt)VG_(client_trampoline_code)+VG_(tramp_sigreturn_offset); > frame->sigNo = sigNo; > frame->sigNo_private = sigNo; > VG_TRACK( post_mem_write, (Addr)frame, offsetof(VgSigFrame, handlerArgs) ); >@@ -1170,7 +1170,7 @@ > tst->sig_mask = frame->mask; > VG_(proxy_setsigmask)(tid); > >- /* Notify skins */ >+ /* Notify tools */ > VG_TRACK( post_deliver_signal, tid, sigNo ); > > return sigNo; >@@ -1323,6 +1323,10 @@ > > vg_assert(!core || (core && terminate)); > >+ if (VG_(clo_trace_signals)) >+ VG_(message)(Vg_DebugMsg, "delivering %d to default handler %s%s", >+ sigNo, terminate ? "terminate" : "", core ? "+core" : ""); >+ > if (terminate) { > if (VG_(clo_verbosity) != 0 && (core || VG_(clo_verbosity) > 1)) { > VG_(message)(Vg_UserMsg, ""); >@@ -1336,8 +1340,8 @@ > switch(sigNo) { > case VKI_SIGSEGV: > switch(info->si_code) { >- case 1: event = "Address not mapped to object"; break; >- case 2: event = "Invalid permissions for mapped object"; break; >+ case 1: event = "Access not within mapped region"; break; >+ case 2: event = "Bad permissions for mapped region"; break; > } > break; > >@@ -1387,9 +1391,8 @@ > } > } > >- if (VG_(is_action_requested)( "Attach to GDB", & VG_(clo_GDB_attach) )) { >- ThreadState* tst = & VG_(threads)[ tid ]; >- VG_(swizzle_esp_then_start_GDB)( tst->m_eip, tst->m_esp, tst->m_ebp ); >+ if (VG_(is_action_requested)( "Attach to debugger", & VG_(clo_db_attach) )) { >+ VG_(start_debugger)( tid ); > } > > if (VG_(fatal_signal_set)) { >@@ -1409,6 +1412,7 @@ > Int sigNo = info->si_signo; > vki_ksigset_t handlermask; > SCSS_Per_Signal *handler = &vg_scss.scss_per_sig[sigNo]; >+ void *handler_fn; > ThreadState *tst = VG_(get_ThreadState)(tid); > > if (VG_(clo_trace_signals)) >@@ -1443,32 +1447,27 @@ > came. Either way, it is going to give us some syscall > results right now, so wait for them to appear. This makes > the thread runnable again, so we're in the right state to run >- the handler, and resume the syscall when we're done. */ >- VG_(proxy_wait_sys)(tid); >- >+ the handler. We ask post_syscall to restart based on the >+ client's sigaction flags. */ > if (0) >- VG_(printf)("signal %d interrupting syscall %d\n", >- sigNo, tst->syscallno); >- >- if (tst->m_eax == -VKI_ERESTARTSYS) { >- if (handler->scss_flags & VKI_SA_RESTART) { >- VG_(restart_syscall)(tid); >- } else >- tst->m_eax = -VKI_EINTR; >- } else { >- /* return value is already in eax - either EINTR or the >- normal return value */ >- } >+ VG_(printf)("signal %d interrupted syscall %d; restart=%d\n", >+ sigNo, tst->syscallno, !!(handler->scss_flags & VKI_SA_RESTART)); >+ VG_(proxy_wait_sys)(tid, !!(handler->scss_flags & VKI_SA_RESTART)); > } > >- vg_assert(handler->scss_handler != VKI_SIG_IGN); >+ /* If the client specifies SIG_IGN, treat it as SIG_DFL */ >+ handler_fn = handler->scss_handler; >+ if (handler_fn == VKI_SIG_IGN) >+ handler_fn = VKI_SIG_DFL; >+ >+ vg_assert(handler_fn != VKI_SIG_IGN); > > if (sigNo == VKI_SIGCHLD && (handler->scss_flags & VKI_SA_NOCLDWAIT)) { > //VG_(printf)("sigNo==SIGCHLD and app asked for NOCLDWAIT\n"); > vg_babyeater(sigNo, NULL, NULL); > } > >- if (handler->scss_handler == VKI_SIG_DFL) { >+ if (handler_fn == VKI_SIG_DFL) { > handlermask = tst->sig_mask; /* no change to signal mask */ > vg_default_action(info, tid); > } else { >@@ -1604,8 +1603,7 @@ > */ > > if (VG_(clo_trace_signals)) { >- VG_(start_msg)(Vg_DebugMsg); >- VG_(add_to_msg)("signal %d arrived ... ", sigNo ); >+ VG_(message)(Vg_DebugMsg, "signal %d arrived ... si_code=%d", sigNo, info->si_code ); > } > vg_assert(sigNo >= 1 && sigNo <= VKI_KNSIG); > >@@ -1631,6 +1629,77 @@ > vg_assert((Char*)(&(VG_(sigstack)[0])) <= (Char*)(&dummy_local)); > vg_assert((Char*)(&dummy_local) < (Char*)(&(VG_(sigstack)[VG_SIGSTACK_SIZE_W]))); > >+ /* Special fault-handling case. We can now get signals which can >+ act upon and immediately restart the faulting instruction. >+ */ >+ if (info->si_signo == VKI_SIGSEGV) { >+ ThreadId tid = VG_(get_current_or_recent_tid)(); >+ Addr fault = (Addr)info->_sifields._sigfault._addr; >+ Addr esp = VG_(is_running_thread)(tid) ? >+ VG_(baseBlock)[VGOFF_(m_esp)] : VG_(threads)[tid].m_esp; >+ Segment *seg; >+ >+ seg = VG_(find_segment)(fault); >+ if (seg != NULL) >+ seg = VG_(next_segment)(seg); >+ >+ if (VG_(clo_trace_signals)) { >+ if (seg == NULL) >+ VG_(message)(Vg_DebugMsg, >+ "SIGSEGV: si_code=%d faultaddr=%p tid=%d esp=%p seg=NULL shad=%p-%p", >+ info->si_code, fault, tid, esp, >+ VG_(shadow_base), VG_(shadow_end)); >+ else >+ VG_(message)(Vg_DebugMsg, >+ "SIGSEGV: si_code=%d faultaddr=%p tid=%d esp=%p seg=%p-%p fl=%x shad=%p-%p", >+ info->si_code, fault, tid, esp, seg->addr, seg->addr+seg->len, seg->flags, >+ VG_(shadow_base), VG_(shadow_end)); >+ } >+ >+ if (info->si_code == 1 && /* SEGV_MAPERR */ >+ seg != NULL && >+ fault >= esp && >+ fault < seg->addr && >+ (seg->flags & SF_GROWDOWN)) { >+ /* If the fault address is above esp but below the current known >+ stack segment base, and it was a fault because there was >+ nothing mapped there (as opposed to a permissions fault), >+ then extend the stack segment. >+ */ >+ Addr base = PGROUNDDN(esp); >+ Char *ret = VG_(mmap)((Char *)base, seg->addr - base, >+ VKI_PROT_READ | VKI_PROT_WRITE | VKI_PROT_EXEC, >+ VKI_MAP_PRIVATE | VKI_MAP_FIXED | VKI_MAP_ANONYMOUS | VKI_MAP_CLIENT, >+ -1, 0); >+ if ((Addr)ret == base) { >+ VG_(map_segment)(base, seg->addr - base, >+ VKI_PROT_READ|VKI_PROT_WRITE|VKI_PROT_EXEC, >+ SF_STACK|SF_GROWDOWN); >+ return; /* restart instruction */ >+ } >+ /* Otherwise fall into normal signal handling */ >+ } else if (info->si_code == 2 && /* SEGV_ACCERR */ >+ VG_(needs).shadow_memory && >+ VG_(is_shadow_addr)(fault)) { >+ /* If there's a fault within the shadow memory range, and it >+ is a permissions fault, then it means that the client is >+ using some memory which had not previously been used. >+ This catches those faults, makes the memory accessible, >+ and calls the tool to initialize that page. >+ */ >+ static Int recursion = 0; >+ >+ if (recursion++ == 0) { >+ VG_(init_shadow_range)(PGROUNDDN(fault), VKI_BYTES_PER_PAGE, True); >+ recursion--; >+ return; >+ } else { >+ /* otherwise fall into normal SEGV handling */ >+ recursion--; >+ } >+ } >+ } >+ > if (VG_(scheduler_jmpbuf_valid)) { > /* Can't continue; must longjmp back to the scheduler and thus > enter the sighandler immediately. */ >@@ -1661,13 +1730,26 @@ > it was actually generated by Valgrind internally. > */ > struct vki_sigcontext *sc = &uc->uc_mcontext; >+ Char buf[1024]; > > VG_(message)(Vg_DebugMsg, > "INTERNAL ERROR: Valgrind received a signal %d (%s) - exiting", > sigNo, signame(sigNo)); >+ >+ buf[0] = 0; >+ if (1 && !VG_(get_fnname)(sc->eip, buf+2, sizeof(buf)-5)) { >+ Int len; >+ >+ buf[0] = ' '; >+ buf[1] = '('; >+ len = VG_(strlen)(buf); >+ buf[len] = ')'; >+ buf[len+1] = '\0'; >+ } >+ > VG_(message)(Vg_DebugMsg, >- "si_code=%x Fault EIP: %p; Faulting address: %p", >- info->si_code, sc->eip, info->_sifields._sigfault._addr); >+ "si_code=%x Fault EIP: %p%s; Faulting address: %p", >+ info->si_code, sc->eip, buf, info->_sifields._sigfault._addr); > > if (0) > VG_(kill_self)(sigNo); /* generate a core dump */ >diff -ruN valgrind-2.1.0/coregrind/vg_skiplist.c valgrind/coregrind/vg_skiplist.c >--- valgrind-2.1.0/coregrind/vg_skiplist.c 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/vg_skiplist.c 2004-01-26 11:24:42.000000000 -0600 >@@ -0,0 +1,343 @@ >+ >+/* >+ This file is part of Valgrind, an extensible x86 protected-mode >+ emulator for monitoring program execution on x86-Unixes. >+ >+ Copyright (C) 2002-2004 Nicholas Nethercote >+ njn25@cam.ac.uk >+ >+ 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. >+*/ >+ >+#include "vg_include.h" >+ >+#include <stdlib.h> >+ >+#define SKIPLIST_DEBUG 0 >+ >+#define SK_MAXHEIGHT 20 /* 2^20 elements */ >+#define SKIPLIST_MAGIC 0x5b1ff872 >+#define SKIPLIST_HEAD_MAGIC (~SKIPLIST_MAGIC) >+ >+ >+#if SKIPLIST_DEBUG >+#define inline >+#endif /* SKIPLIST_DEBUG */ >+ >+struct _SkipNode { >+ UInt magic; >+ UShort level; /* level is the max level (level == 0 means 1 next pointer) */ >+ SkipNode *next[0]; >+}; >+ >+ >+ >+static inline Int get_height(void) >+{ >+ UInt ret = 0; >+ >+ while((ret < SK_MAXHEIGHT) && (random() & 1)) >+ ret++; >+ >+ return ret; >+} >+ >+static inline void *key_of_data(const SkipList *l, void *d) >+{ >+ return (void *)((Char *)d + l->keyoff); >+} >+ >+static inline SkipNode *node_of_data(const SkipList *l, const void *d) >+{ >+ SkipNode *n = (SkipNode *)((Char *)d + l->size); >+ >+ if (SKIPLIST_DEBUG && n->magic != SKIPLIST_MAGIC) >+ VG_(printf)("bad magic on node %p = %x (not %x)\n", >+ n, n->magic, SKIPLIST_MAGIC); >+ >+ vg_assert(n->magic == SKIPLIST_MAGIC); >+ >+ return n; >+} >+ >+static inline void *data_of_node(const SkipList *l, const SkipNode *n) >+{ >+ if (SKIPLIST_DEBUG && n->magic != SKIPLIST_MAGIC) >+ VG_(printf)("bad magic on node %p = %x (not %x)\n", >+ n, n->magic, SKIPLIST_MAGIC); >+ >+ vg_assert(n->magic == SKIPLIST_MAGIC); >+ return (void *)((Char *)n - l->size); >+} >+ >+static inline void *key_of_node(const SkipList *l, const SkipNode *n) >+{ >+ return key_of_data(l, data_of_node(l, n)); >+} >+ >+static inline void validate_skiplist(const SkipList *l, const Char *where) >+{ >+#if SKIPLIST_DEBUG >+ const SkipNode *prev[SK_MAXHEIGHT]; >+ Int i; >+ const SkipNode *n, *next; >+ >+ VG_(printf)("---------------- %s ----------------\n", where); >+ >+ if (l->head == NULL) >+ return; >+ >+ for(i = 0; i <= l->head->level; i++) { >+ VG_(printf)("l->head->next[%d]=%p\n", >+ i, l->head->next[i]); >+ prev[i] = l->head->next[i]; >+ } >+ >+ for(n = l->head->next[0]; n != NULL; n = next) { >+ next = n->next[0]; >+ >+ VG_(printf)("n=%p next=%p, n->level=%d k=%s\n", >+ n, next, n->level, (*l->strkey)(key_of_node(l, n))); >+ for(i = 0; i <= n->level; i++) { >+ VG_(printf)(" n->next[%d] = %p\n", >+ i, n->next[i]); >+ VG_(printf)(" prev[%d] = %p\n", >+ i, prev[i]); >+ } >+ >+ vg_assert(l->head->level >= n->level); >+ >+ for(i = 0; i <= n->level; i++) >+ vg_assert(prev[i] == n); >+ >+ for(i = 0; i <= n->level; i++) >+ prev[i] = n->next[i]; >+ >+ vg_assert(next == NULL || (l->cmp)(key_of_node(l, n), key_of_node(l, next)) < 0); >+ } >+#endif /* SKIPLIST_DEBUG */ >+} >+ >+void *VG_(SkipNode_Alloc)(const SkipList *l) >+{ >+ UInt size = l->size; >+ Int h = get_height(); >+ SkipNode *n; >+ Char *ret; >+ >+ size += sizeof(SkipNode) + (h+1)*sizeof(SkipNode *); >+ >+ if (l->arena == -1) >+ *(Short *)&l->arena = VG_AR_TOOL; >+ >+ ret = VG_(arena_malloc)(l->arena, size); >+ >+ if (ret == NULL) >+ return NULL; >+ >+ n = (SkipNode *)(ret + l->size); >+ n->level = h; >+ n->magic = SKIPLIST_MAGIC; >+ >+ while(h-- >= 0) >+ n->next[h] = NULL; >+ >+ return ret; >+} >+ >+void VG_(SkipNode_Free)(const SkipList *l, void *p) >+{ >+ if (SKIPLIST_DEBUG) { >+ SkipNode *n = node_of_data(l, p); >+ >+ VG_(printf)("SkipNode_Free: freeing %p (node %p)\n", >+ p, n); >+ n->magic = 0x55ffaabb; >+ } >+ VG_(arena_free)(l->arena, p); >+} >+ >+void *VG_(SkipNode_First)(const SkipList *l) >+{ >+ SkipNode *n = l->head ? l->head->next[0] : NULL; >+ >+ if (n == NULL) >+ return NULL; >+ else >+ return data_of_node(l, n); >+} >+ >+void *VG_(SkipNode_Next)(const SkipList *l, void *data) >+{ >+ SkipNode *n = node_of_data(l, data); >+ >+ n = n->next[0]; >+ >+ if (n == NULL) >+ return NULL; >+ >+ return data_of_node(l, n); >+} >+ >+ >+ >+static Int cmp(const SkipList *l, SkipNode *n, void *k2) >+{ >+ void *k1 = key_of_node(l, n); >+ >+ if (k1 == k2) >+ return 0; >+ >+ if (l->head == n) >+ return -1; >+ >+ return (l->cmp)(k1, k2); >+} >+ >+/* Search the list for k; it either returns the k if it exists, or the >+ one before if not. */ >+static SkipNode *SkipList__Find(const SkipList *l, void *k, SkipNode **prevs) >+{ >+ SkipNode *n; >+ Int lvl; >+ >+ if (SKIPLIST_DEBUG) >+ VG_(printf)("SkipList__Find: finding %s\n", (*l->strkey)(k)); >+ >+ validate_skiplist(l, "SkipList__Find"); >+ >+ if (l->head == NULL) >+ return NULL; >+ >+ for(lvl = l->head->level, n = l->head; lvl >= 0; lvl--) { >+ while(n->next[lvl] != NULL && cmp(l, n->next[lvl], k) < 0) { >+ if (SKIPLIST_DEBUG) >+ VG_(printf)("SkipList__Find: n=%p n->next[%d]=%p\n", >+ n, lvl, n->next[lvl]); >+ n = n->next[lvl]; >+ } >+ if (prevs) >+ prevs[lvl] = n; >+ } >+ >+ /* XXX Is there a cleaner way of getting this? >+ >+ If we get an exact match, return it. >+ If we get the head, return NULL. >+ Otherwise return the one before where the hit would be. >+ */ >+ if (n->next[0] != NULL && cmp(l, n->next[0], k) == 0) >+ n = n->next[0]; >+ if (n == l->head) >+ n = NULL; >+ >+ if (SKIPLIST_DEBUG) { >+ >+ VG_(printf)("SkipList__Find returning node %p\n", n); >+ >+ if (n == NULL) { >+ SkipNode *nn; >+ >+ for(nn = l->head->next[0]; nn != NULL; nn = nn->next[0]) >+ vg_assert(cmp(l, nn, k) != 0); >+ } else >+ vg_assert(cmp(l, n, k) <= 0); >+ } >+ >+ return n; >+} >+ >+void *VG_(SkipList_Find)(const SkipList *l, void *k) >+{ >+ SkipNode *n = SkipList__Find(l, k, NULL); >+ >+ if (n != NULL) >+ return data_of_node(l, n); >+ return NULL; >+} >+ >+void VG_(SkipList_Insert)(SkipList *l, void *data) >+{ >+ SkipNode *update[SK_MAXHEIGHT]; >+ SkipNode *n; >+ void *k = key_of_data(l, data); >+ Int i; >+ >+ if (SKIPLIST_DEBUG) >+ VG_(printf)("inserting node %p, key %s, height %d\n", >+ data, (*l->strkey)(key_of_data(l, data)), node_of_data(l, data)->level); >+ >+ validate_skiplist(l, "SkipList_Insert before"); >+ >+ if (l->head == NULL) { >+ Int size = sizeof(SkipNode) * sizeof(SkipNode *) * SK_MAXHEIGHT; >+ >+ if (l->arena == -1) >+ *(Short *)&l->arena = VG_AR_TOOL; >+ >+ l->head = VG_(arena_malloc)(l->arena, size); >+ VG_(memset)(l->head, 0, size); >+ >+ l->head->magic = SKIPLIST_HEAD_MAGIC; >+ l->head->level = 0; >+ } >+ >+ n = SkipList__Find(l, k, update); >+ >+ vg_assert(n == NULL || (l->cmp)(key_of_node(l, n), k) != 0); >+ >+ n = node_of_data(l, data); >+ >+ vg_assert(l->head != NULL); >+ if (l->head->level < n->level) { >+ for(i = l->head->level+1; i <= n->level; i++) >+ l->head->next[i] = n; >+ l->head->level = n->level; >+ } >+ >+ for(i = 0; i <= n->level; i++) { >+ n->next[i] = update[i]->next[i]; >+ update[i]->next[i] = n; >+ } >+ >+ validate_skiplist(l, "SkipList_Insert after"); >+} >+ >+void *VG_(SkipList_Remove)(SkipList *l, void *k) >+{ >+ SkipNode *update[SK_MAXHEIGHT]; >+ SkipNode *n; >+ Int i; >+ >+ validate_skiplist(l, "SkipList_Remove before"); >+ >+ n = SkipList__Find(l, k, update); >+ if (n == NULL) >+ return NULL; >+ >+ vg_assert((l->cmp)(k, key_of_node(l, n)) == 0); >+ >+ for(i = 0; i <= n->level; i++) { >+ update[i]->next[i] = n->next[i]; >+ n->next[i] = NULL; >+ } >+ >+ validate_skiplist(l, "SkipList_Remove after"); >+ >+ return data_of_node(l, n); >+} >diff -ruN valgrind-2.1.0/coregrind/vg_stabs.c valgrind/coregrind/vg_stabs.c >--- valgrind-2.1.0/coregrind/vg_stabs.c 2003-10-18 08:58:44.000000000 -0500 >+++ valgrind/coregrind/vg_stabs.c 2004-01-06 10:02:29.000000000 -0600 >@@ -6,7 +6,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -300,7 +300,7 @@ > return &sf->types[sym]; > } > >-static inline Bool isdigit(Char c, Int base, Int *v) >+static Bool isdigit(Char c, Int base, Int *v) > { > switch(base) { > case 10: >@@ -650,6 +650,13 @@ > break; > } > >+ case 'k': /* const */ >+ case 'B': { /* volatile */ >+ /* 'k' TYPE */ >+ type = stabtype_parser(si, NULL, &p); >+ break; >+ } >+ > case 'x': { /* reference to undefined type */ > /* 'x' ('s' | 'u' | 'e') NAME ':' */ > Int brac = 0; /* < > brackets in type */ >@@ -1005,12 +1012,12 @@ > case N_STSYM: > case N_LCSYM: > sym->kind = SyStatic; >- sym->addr = si->offset + (Addr)val; >+ sym->u.addr = si->offset + (Addr)val; > break; > > case N_PSYM: > sym->kind = SyEBPrel; /* +ve offset off EBP (erk, or ESP if no frame pointer) */ >- sym->offset = val; >+ sym->u.offset = val; > break; > > case N_LSYM: >@@ -1018,17 +1025,17 @@ > sym->kind = SyEBPrel; /* -ve off EBP when there's a frame pointer */ > else > sym->kind = SyESPrel; /* +ve off ESP when there's no frame pointer */ >- sym->offset = val; >+ sym->u.offset = val; > break; > > case N_RSYM: > sym->kind = SyReg; >- sym->regno = val; >+ sym->u.regno = val; > break; > > case N_GSYM: > sym->kind = SyGlobal; >- sym->addr = 0; /* XXX should really look up global address */ >+ sym->u.addr = 0; /* XXX should really look up global address */ > break; > > default: >diff -ruN valgrind-2.1.0/coregrind/vg_startup.S valgrind/coregrind/vg_startup.S >--- valgrind-2.1.0/coregrind/vg_startup.S 2003-12-12 21:07:40.000000000 -0600 >+++ valgrind/coregrind/vg_startup.S 1969-12-31 18:00:00.000000000 -0600 >@@ -1,297 +0,0 @@ >- >-##--------------------------------------------------------------------## >-##--- Startup and shutdown code for Valgrind. ---## >-##--- vg_startup.S ---## >-##--------------------------------------------------------------------## >- >-/* >- This file is part of Valgrind, an extensible x86 protected-mode >- emulator for monitoring program execution on x86-Unixes. >- >- Copyright (C) 2000-2003 Julian Seward >- jseward@acm.org >- >- 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. >-*/ >- >-#include "vg_constants.h" >-#include "config.h" >- >- >-#--------------------------------------------------------------------- >-# >-# Startup and shutdown code for Valgrind. Particularly hairy. >-# >-# The dynamic linker, ld.so, will run the contents of the .init >-# section, once it has located, mmap-d and and linked the shared >-# libraries needed by the program. Valgrind is itself a shared >-# library. ld.so then runs code in the .init sections of each >-# library in turn, in order to give them a chance to initialise >-# themselves. We hijack this mechanism. Our startup routine >-# does return -- and execution continues -- except on the >-# synthetic CPU, not the real one. But ld.so, and the program >-# it is starting, cant tell the difference. >-# >-# The management apologise for the lack of apostrophes in these >-# comments. GNU as seems to object to them, for some reason. >- >- >-.section .init >- call VG_(startup) >-.section .fini >- call VG_(shutdown) >- >-.section .data >-valgrind_already_initted: >- .word 0 >- >-.section .text >- >- >-.global VG_(startup) >-VG_(startup): >- pushfl >- cmpl $0, valgrind_already_initted >- je really_start_up >- popfl >- ret >- >-really_start_up: >- popfl >- movl $1, valgrind_already_initted >- >- # Record %esp as it was when we got here. This is because argv/c >- # and envp[] are passed as args to this function, and we need to see >- # envp so we can get at the env var VG_ARGS without help from libc. >- # The stack layout at this point depends on the version of glibc in >- # use. See process_cmd_line_options() in vg_main.c for details. >- movl %esp, VG_(esp_at_startup) >- >- # We have control! Save the state of the machine in >- # the simulators state, and switch stacks. >- # Except ... we cant copy the machines registers into their >- # final places in vg_baseBlock, because the offsets to them >- # have not yet been set up. Instead, they are copied to a >- # temporary place (m_state_static). In vg_main.c, once the >- # baseBlock offsets are set up, values are copied into baseBlock. >- movw %cs, VG_(m_state_static)+0 >- movw %ss, VG_(m_state_static)+4 >- movw %ds, VG_(m_state_static)+8 >- movw %es, VG_(m_state_static)+12 >- movw %fs, VG_(m_state_static)+16 >- movw %gs, VG_(m_state_static)+20 >- movl %eax, VG_(m_state_static)+24 >- movl %ecx, VG_(m_state_static)+28 >- movl %edx, VG_(m_state_static)+32 >- movl %ebx, VG_(m_state_static)+36 >- movl %esp, VG_(m_state_static)+40 >- movl %ebp, VG_(m_state_static)+44 >- movl %esi, VG_(m_state_static)+48 >- movl %edi, VG_(m_state_static)+52 >- pushfl >- popl %eax >- movl %eax, VG_(m_state_static)+56 >- >- # now weve captured all the integer registers and >- # flags, figure out whether this is an sse-enabled >- # cpu or not. >- movb $0, VG_(have_ssestate) # assume sse-disabled >- movl $0, %eax >- cpuid >- cmpl $1, %eax >- jl get_fpu # we cant do cpuid(1) ?! >- movl $1, %eax >- cpuid >- testl $(1<<25), %edx >- jz get_fpu # edx bit 25 is set iff sse >- # well, it looks like were sse-enabled >- movb $1, VG_(have_ssestate) >- >- # next, capture the FPU/SSE state >-get_fpu: >- fwait >- >- pushfl >- cmpb $0, VG_(have_ssestate) >- jz qq3nosse >- fxsave VG_(m_state_static)+64 >- andl $0x0000FFBF, VG_(m_state_static)+64+24 >- fxrstor VG_(m_state_static)+64 >- jmp qq3merge >-qq3nosse: >- fnsave VG_(m_state_static)+64 >- frstor VG_(m_state_static)+64 >-qq3merge: >- popfl >- >- # keep the first and last 10 words free to check for overruns >- movl $VG_(stack)+39996 -40, %esp >- >- # Now some real magic. We need this procedure to return, >- # since thats what ld.so expects, but running on the >- # simulator. So vg_main starts the simulator running at >- # the insn labelled first_insn_to_simulate. >- >- movl $first_insn_to_simulate, VG_(m_state_static)+60 >- jmp VG_(main) >-first_insn_to_simulate: >- # Nothing else to do -- just return in the "normal" way. >- ret >- >- >- >-VG_(shutdown): >- # Just return, and ignore any attempt by ld.so to call >- # valgrind.sos exit function. We just run the client all >- # the way to the final exit() syscall. This sidesteps >- # problems caused by ld.so calling the finalisation code >- # of other .sos *after* it shuts down valgrind, which >- # was causing big problems with threads. >- ret >- >- >- >-.global VG_(switch_to_real_CPU) >-VG_(switch_to_real_CPU): >- # Once Valgrind has decided it needs to exit, >- # because the specified number of insns have been completed >- # during a debugging run, it jumps here, which copies the >- # simulators state into the real machine state. Execution >- # of the rest of the program continues on the real CPU, >- # and there is no way for the simulator to regain control >- # after this point. >- >- pushfl >- cmpb $0, VG_(have_ssestate) >- jz qq4nosse >- andl $0x0000FFBF, VG_(m_state_static)+64+24 >- fxrstor VG_(m_state_static)+64 >- jmp qq4merge >-qq4nosse: >- frstor VG_(m_state_static)+64 >-qq4merge: >- popfl >- >- movl VG_(m_state_static)+56, %eax >- pushl %eax >- popfl >- /* some of these are apparently illegal */ >- /* movw VG_(m_state_static)+0, %cs */ >- movw VG_(m_state_static)+4, %ss >- movw VG_(m_state_static)+8, %ds >- movw VG_(m_state_static)+12, %es >- movw VG_(m_state_static)+16, %fs >- movw VG_(m_state_static)+20, %gs >- movl VG_(m_state_static)+24, %eax >- movl VG_(m_state_static)+28, %ecx >- movl VG_(m_state_static)+32, %edx >- movl VG_(m_state_static)+36, %ebx >- movl VG_(m_state_static)+40, %esp >- movl VG_(m_state_static)+44, %ebp >- movl VG_(m_state_static)+48, %esi >- movl VG_(m_state_static)+52, %edi >- >- jmp *VG_(m_state_static)+60 >- >- >- >-/*------------------------------------------------------------*/ >-/*--- A function to temporarily copy %ESP/%EBP into ---*/ >-/*--- %esp/%ebp and then start up GDB. ---*/ >-/*------------------------------------------------------------*/ >- >-/* >-extern void VG_(swizzle_esp_then_start_GDB) ( Addr m_eip_at_error, >- Addr m_esp_at_error, >- Addr m_ebp_at_error ); >-*/ >- >-/*--- This is clearly not re-entrant! ---*/ >-.data >-vg_ebp_saved_over_GDB_start: >- .long 0 >-vg_esp_saved_over_GDB_start: >- .long 0 >-.text >- >-.type VG_(swizzle_esp_then_start_GDB),@function >-.global VG_(swizzle_esp_then_start_GDB) >-VG_(swizzle_esp_then_start_GDB): >-#ifdef HAVE_GAS_CFI >- .cfi_startproc >-#endif >- pushal >- >- # remember the simulators current stack/frame pointers >- movl %ebp, vg_ebp_saved_over_GDB_start >- movl %esp, vg_esp_saved_over_GDB_start >- >- # get args into regs >- movl 44(%esp), %eax # client %EBP >- movl 40(%esp), %ebx # client %ESP >- movl 36(%esp), %ecx # client %EIP >- >- # Now that we dont need to refer to simulators stack any more, >- # put %ESP into %esp >- movl %ebx, %esp >- >- ### %esp now refers to clients stack >- ### mess with the clients stack to make it look as if it >- ### called this procedure, since otherwise it will look to gdb >- ### as if the top (currently executing) stack frame of the >- ### client is missing. >- >- # push %EIP. This is a faked-up return address. >- pushl %ecx >- >- # push %EBP. This is a faked %ebp-chain pointer. >- pushl %eax >-#ifdef HAVE_GAS_CFI >- .cfi_adjust_cfa_offset 0x4 >-#endif >- >- movl %esp, %ebp >-#ifdef HAVE_GAS_CFI >- .cfi_def_cfa_register ebp >-#endif >- >- call VG_(start_GDB_whilst_on_client_stack) >- >- # restore the simulators stack/frame pointer >- movl vg_ebp_saved_over_GDB_start, %ebp >- movl vg_esp_saved_over_GDB_start, %esp >-#ifdef HAVE_GAS_CFI >- .cfi_adjust_cfa_offset -0x4 >-#endif >- >- popal >- ret >-#ifdef HAVE_GAS_CFI >- .cfi_endproc >-#endif >- >-# gcc puts this construction at the end of every function. I think it >-# allows the linker to figure out the size of the function. So we do >-# the same, in the vague hope that it might help GDBs navigation. >-.Lend_of_swizzle: >- .size VG_(swizzle_esp_then_start_GDB), .Lend_of_swizzle-VG_(swizzle_esp_then_start_GDB) >- >- >-##--------------------------------------------------------------------## >-##--- end vg_startup.S ---## >-##--------------------------------------------------------------------## >diff -ruN valgrind-2.1.0/coregrind/vg_symtab2.c valgrind/coregrind/vg_symtab2.c >--- valgrind-2.1.0/coregrind/vg_symtab2.c 2003-12-13 18:27:02.000000000 -0600 >+++ valgrind/coregrind/vg_symtab2.c 2004-02-05 16:58:37.000000000 -0600 >@@ -7,7 +7,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -301,8 +301,8 @@ > Int size = next - this; > ScopeRange range; > >- /* Ignore zero-sized scopes */ >- if (this == next) { >+ /* Ignore zero-sized or negative scopes */ >+ if (size <= 0) { > if (debug) > VG_(printf)("ignoring zero-sized range, scope %p at %p\n", scope, this); > return; >@@ -398,6 +398,65 @@ > return a->addr - b->addr; > } > >+/* Two symbols have the same address. Which name do we prefer? >+ >+ In general we prefer the longer name, but if the choice is between >+ __libc_X and X, then choose X (similarly with __GI__ and __ >+ prefixes). >+ */ >+static RiSym *prefersym(RiSym *a, RiSym *b) >+{ >+ Int pfx; >+ Int lena, lenb; >+ Int i; >+ static const struct { >+ const Char *prefix; >+ Int len; >+ } prefixes[] = { >+#define PFX(x) { x, sizeof(x)-1 } >+ /* order from longest to shortest */ >+ PFX("__GI___libc_"), >+ PFX("__GI___"), >+ PFX("__libc_"), >+ PFX("__GI__"), >+ PFX("__GI_"), >+ PFX("__"), >+#undef PFX >+ }; >+ >+ lena = VG_(strlen)(a->name); >+ lenb = VG_(strlen)(b->name); >+ >+ /* rearrange so that a is the long one */ >+ if (lena < lenb) { >+ RiSym *t; >+ Int lt; >+ >+ t = a; >+ a = b; >+ b = t; >+ >+ lt = lena; >+ lena = lenb; >+ lenb = lt; >+ } >+ >+ for(i = pfx = 0; i < sizeof(prefixes)/sizeof(*prefixes); i++) { >+ Int pfxlen = prefixes[i].len; >+ >+ if (pfxlen < lena && >+ VG_(memcmp)(a->name, prefixes[i].prefix, pfxlen) == 0) { >+ pfx = pfxlen; >+ break; >+ } >+ } >+ >+ if (pfx != 0 && VG_(strcmp)(a->name + pfx, b->name) == 0) >+ return b; >+ >+ return a; >+} >+ > static > void canonicaliseSymtab ( SegInfo* si ) > { >@@ -415,7 +474,7 @@ > cleanup_more: > > /* If two symbols have identical address ranges, favour the >- one with the longer name. >+ one with the longer name (unless the extra length is junk) > */ > do { > n_merged = 0; >@@ -427,12 +486,7 @@ > && si->symtab[i].size == si->symtab[i+1].size) { > n_merged++; > /* merge the two into one */ >- if (VG_(strlen)(si->symtab[i].name) >- > VG_(strlen)(si->symtab[i+1].name)) { >- si->symtab[si->symtab_used++] = si->symtab[i]; >- } else { >- si->symtab[si->symtab_used++] = si->symtab[i+1]; >- } >+ si->symtab[si->symtab_used++] = *prefersym(&si->symtab[i], &si->symtab[i+1]); > i++; > } else { > si->symtab[si->symtab_used++] = si->symtab[i]; >@@ -663,6 +717,35 @@ > /*--- Read info from a .so/exe file. ---*/ > /*------------------------------------------------------------*/ > >+Bool VG_(is_object_file)(const void *buf) >+{ >+ { >+ Elf32_Ehdr *ehdr = (Elf32_Ehdr *)buf; >+ Int ok = 1; >+ >+ ok &= (ehdr->e_ident[EI_MAG0] == 0x7F >+ && ehdr->e_ident[EI_MAG1] == 'E' >+ && ehdr->e_ident[EI_MAG2] == 'L' >+ && ehdr->e_ident[EI_MAG3] == 'F'); >+ ok &= (ehdr->e_ident[EI_CLASS] == ELFCLASS32 >+ && ehdr->e_ident[EI_DATA] == ELFDATA2LSB >+ && ehdr->e_ident[EI_VERSION] == EV_CURRENT); >+ ok &= (ehdr->e_type == ET_EXEC || ehdr->e_type == ET_DYN); >+ ok &= (ehdr->e_machine == EM_386); >+ ok &= (ehdr->e_version == EV_CURRENT); >+ ok &= (ehdr->e_shstrndx != SHN_UNDEF); >+ ok &= (ehdr->e_shoff != 0 && ehdr->e_shnum != 0); >+ ok &= (ehdr->e_phoff != 0 && ehdr->e_phnum != 0); >+ >+ if (ok) >+ return True; >+ } >+ >+ /* other file formats here? */ >+ >+ return False; >+} >+ > /* Read a symbol table (normal or dynamic) */ > static > void read_symtab( SegInfo* si, Char* tab_name, >@@ -794,7 +877,6 @@ > name = VG_(addStr) ( si, t0, -1 ); > vg_assert(name != NULL > /* && 0==VG_(strcmp)(t0,&vg_strtab[nmoff]) */ ); >- vg_assert( (Int)sym->st_value >= 0); > /* VG_(printf)("%p + %d: %p %s\n", si->start, > (Int)sym->st_value, sym_addr, t0 ); */ > risym.addr = sym_addr; >@@ -823,7 +905,7 @@ > > oimage = (Addr)NULL; > if (VG_(clo_verbosity) > 1) >- VG_(message)(Vg_UserMsg, "Reading syms from %s", si->filename ); >+ VG_(message)(Vg_UserMsg, "Reading syms from %s (%p)", si->filename, si->start ); > > /* mmap the object image aboard, so that we can read symbols and > line number info out of it. It will be munmapped immediately >@@ -843,7 +925,8 @@ > } > > oimage = (Addr)VG_(mmap)( NULL, n_oimage, >- VKI_PROT_READ, VKI_MAP_PRIVATE, fd, 0 ); >+ VKI_PROT_READ, VKI_MAP_PRIVATE|VKI_MAP_NOSYMS, fd, 0 ); >+ > VG_(close)(fd); > > if (oimage == ((Addr)(-1))) { >@@ -859,21 +942,8 @@ > ok = (n_oimage >= sizeof(Elf32_Ehdr)); > ehdr = (Elf32_Ehdr*)oimage; > >- if (ok) { >- ok &= (ehdr->e_ident[EI_MAG0] == 0x7F >- && ehdr->e_ident[EI_MAG1] == 'E' >- && ehdr->e_ident[EI_MAG2] == 'L' >- && ehdr->e_ident[EI_MAG3] == 'F'); >- ok &= (ehdr->e_ident[EI_CLASS] == ELFCLASS32 >- && ehdr->e_ident[EI_DATA] == ELFDATA2LSB >- && ehdr->e_ident[EI_VERSION] == EV_CURRENT); >- ok &= (ehdr->e_type == ET_EXEC || ehdr->e_type == ET_DYN); >- ok &= (ehdr->e_machine == EM_386); >- ok &= (ehdr->e_version == EV_CURRENT); >- ok &= (ehdr->e_shstrndx != SHN_UNDEF); >- ok &= (ehdr->e_shoff != 0 && ehdr->e_shnum != 0); >- ok &= (ehdr->e_phoff != 0 && ehdr->e_phnum != 0); >- } >+ if (ok) >+ ok &= VG_(is_object_file)(ehdr); > > if (!ok) { > VG_(symerr)("Invalid ELF header, or missing stringtab/sectiontab."); >@@ -891,6 +961,7 @@ > { > Bool offset_set = False; > Elf32_Addr prev_addr = 0; >+ Addr baseaddr = 0; > > si->offset = 0; > >@@ -900,12 +971,37 @@ > > o_phdr = &((Elf32_Phdr *)(oimage + ehdr->e_phoff))[i]; > >+ if (o_phdr->p_type == PT_DYNAMIC && si->soname == NULL) { >+ const Elf32_Dyn *dyn = (const Elf32_Dyn *)(oimage + o_phdr->p_offset); >+ Int stroff = -1; >+ Char *strtab = NULL; >+ Int j; >+ >+ for(j = 0; dyn[j].d_tag != DT_NULL; j++) { >+ switch(dyn[j].d_tag) { >+ case DT_SONAME: >+ stroff = dyn[j].d_un.d_val; >+ break; >+ >+ case DT_STRTAB: >+ strtab = (Char *)oimage + dyn[j].d_un.d_ptr - baseaddr; >+ break; >+ } >+ } >+ >+ if (stroff != -1 && strtab != 0) { >+ TRACE_SYMTAB("soname=%s\n", strtab+stroff); >+ si->soname = VG_(arena_strdup)(VG_AR_SYMTAB, strtab+stroff); >+ } >+ } >+ > if (o_phdr->p_type != PT_LOAD) > continue; > > if (!offset_set) { > offset_set = True; > si->offset = si->start - o_phdr->p_vaddr; >+ baseaddr = o_phdr->p_vaddr; > } > > if (o_phdr->p_vaddr < prev_addr) { >@@ -936,10 +1032,31 @@ > (mapped_end > (si->start+si->size))) { > UInt newsz = mapped_end - si->start; > if (newsz > si->size) { >+ Segment *seg; >+ > if (0) > VG_(printf)("extending mapping %p..%p %d -> ..%p %d\n", > si->start, si->start+si->size, si->size, > si->start+newsz, newsz); >+ >+ for(seg = VG_(find_segment)(si->start); >+ seg != NULL && VG_(seg_overlaps)(seg, si->start, si->size); >+ seg = VG_(next_segment)(seg)) { >+ if (seg->symtab == si) >+ continue; >+ >+ if (seg->symtab != NULL) >+ VG_(symtab_decref)(seg->symtab, seg->addr, seg->len); >+ >+ VG_(symtab_incref)(si); >+ seg->symtab = si; >+ >+ if (0) >+ VG_(printf)("adding symtab %p (%p-%p) to segment %p (%p-%p)\n", >+ si, si->start, si->start+newsz, >+ seg, seg->addr, seg->addr+seg->len); >+ } >+ > si->size = newsz; > } > } >@@ -1074,54 +1191,26 @@ > */ > static SegInfo* segInfo = NULL; > >-void VG_(read_seg_symbols) ( Addr start, UInt size, >- Char rr, Char ww, Char xx, >- UInt foffset, UChar* filename ) >+static void resolve_seg_redirs(SegInfo *si); >+ >+SegInfo *VG_(read_seg_symbols) ( Segment *seg ) > { > SegInfo* si; > >- /* Stay sane ... */ >- if (size == 0) >- return; >- >- /* We're only interested in collecting symbols in executable >- segments which are associated with a real file. Hence: */ >- if (filename == NULL || xx != 'x') >- return; >- if (0 == VG_(strcmp)(filename, "/dev/zero")) >- return; >- if (foffset != 0) >- return; >+ vg_assert(seg->symtab == NULL); > > VGP_PUSHCC(VgpReadSyms); > >- /* Perhaps we already have this one? If so, skip. */ >- for (si = segInfo; si != NULL; si = si->next) { >- /* >- if (0==VG_(strcmp)(si->filename, filename)) >- VG_(printf)("same fnames: %c%c%c (%p, %d) (%p, %d) %s\n", >- rr,ww,xx,si->start,si->size,start,size,filename); >- */ >- /* For some reason the observed size of a mapping can change, so >- we don't use that to determine uniqueness. */ >- if (si->start == start >- /* && si->size == size */ >- && 0==VG_(strcmp)(si->filename, filename)) >- { >- VGP_POPCC(VgpReadSyms); >- return; >- } >- } >- > /* Get the record initialised right. */ > si = VG_(arena_malloc)(VG_AR_SYMTAB, sizeof(SegInfo)); > > VG_(memset)(si, 0, sizeof(*si)); >- si->start = start; >- si->size = size; >- si->foffset = foffset; >- si->filename = VG_(arena_malloc)(VG_AR_SYMTAB, 1 + VG_(strlen)(filename)); >- VG_(strcpy)(si->filename, filename); >+ si->start = seg->addr; >+ si->size = seg->len; >+ si->foffset = seg->offset; >+ si->filename = VG_(arena_strdup)(VG_AR_SYMTAB, seg->filename); >+ >+ si->ref = 1; > > si->symtab = NULL; > si->symtab_size = si->symtab_used = 0; >@@ -1131,6 +1220,8 @@ > si->scopetab = NULL; > si->scopetab_size = si->scopetab_used = 0; > >+ si->seg = seg; >+ > si->stab_typetab = NULL; > > si->plt_start = si->plt_size = 0; >@@ -1155,28 +1246,16 @@ > canonicaliseSymtab ( si ); > canonicaliseLoctab ( si ); > canonicaliseScopetab ( si ); >+ >+ /* do redirects */ >+ resolve_seg_redirs( si ); > } > VGP_POPCC(VgpReadSyms); >-} > >- >-/* This one really is the Head Honcho. Update the symbol tables to >- reflect the current state of /proc/self/maps. Rather than re-read >- everything, just read the entries which are not already in segInfo. >- So we can call here repeatedly, after every mmap of a non-anonymous >- segment with execute permissions, for example, to pick up new >- libraries as they are dlopen'd. Conversely, when the client does >- munmap(), vg_symtab_notify_munmap() throws away any symbol tables >- which happen to correspond to the munmap()d area. */ >-void VG_(read_all_symbols) ( void ) >-{ >- /* 9 July 2003: In order to work around PLT bypassing in >- glibc-2.3.2 (see below VG_(setup_code_redirect_table)), we need >- to load debug info regardless of the skin, unfortunately. */ >- VG_(read_procselfmaps) ( ); >- VG_(parse_procselfmaps) ( VG_(read_seg_symbols) ); >+ return si; > } > >+ > /* When an munmap() call happens, check to see whether it corresponds > to a segment for a .so, and if so discard the relevant SegInfo. > This might not be a very clever idea from the point of view of >@@ -1202,8 +1281,8 @@ > > if (VG_(clo_verbosity) > 1) > VG_(message)(Vg_UserMsg, >- "discard syms in %s due to munmap()", >- curr->filename ? curr->filename : (Char *)"???"); >+ "discard syms at %p-%p in %s due to munmap()", >+ start, start+length, curr->filename ? curr->filename : (Char *)"???"); > > vg_assert(prev == NULL || prev->next == curr); > >@@ -1217,6 +1296,18 @@ > return; > } > >+void VG_(symtab_decref)(SegInfo *si, Addr start, UInt len) >+{ >+ vg_assert(si->ref >= 1); >+ if (--si->ref == 0) >+ VG_(unload_symbols)(si->start, si->size); >+} >+ >+void VG_(symtab_incref)(SegInfo *si) >+{ >+ vg_assert(si->ref > 0); >+ si->ref++; >+} > > /*------------------------------------------------------------*/ > /*--- Use of symbol table & location info to create ---*/ >@@ -1256,8 +1347,8 @@ > table is designed we have no option but to do a complete linear > scan of the table. Returns NULL if not found. */ > >-static Addr reverse_search_one_symtab ( SegInfo* si, >- Char* name ) >+static Addr reverse_search_one_symtab ( const SegInfo* si, >+ const Char* name ) > { > UInt i; > for (i = 0; i < si->symtab_used; i++) { >@@ -1280,19 +1371,25 @@ > { > Int sno; > SegInfo* si; >+ Segment *s; > > VGP_PUSHCC(VgpSearchSyms); >+ >+ s = VG_(find_segment)(ptr); >+ >+ if (s == NULL || !VG_(seg_overlaps)(s, ptr, 0) || s->symtab == NULL) >+ goto not_found; > >- for (si = segInfo; si != NULL; si = si->next) { >- if (si->start <= ptr && ptr < si->start+si->size) { >- sno = search_one_symtab ( si, ptr, match_anywhere_in_fun ); >- if (sno == -1) goto not_found; >- *symno = sno; >- *psi = si; >- VGP_POPCC(VgpSearchSyms); >- return; >- } >- } >+ si = s->symtab; >+ >+ sno = search_one_symtab ( si, ptr, match_anywhere_in_fun ); >+ if (sno == -1) goto not_found; >+ >+ *symno = sno; >+ *psi = si; >+ VGP_POPCC(VgpSearchSyms); >+ return; >+ > not_found: > *psi = NULL; > VGP_POPCC(VgpSearchSyms); >@@ -1447,7 +1544,7 @@ > return True; > } > >-/* This is available to skins... always demangle C++ names, >+/* This is available to tools... always demangle C++ names, > match anywhere in function, but don't show offsets. */ > Bool VG_(get_fnname) ( Addr a, Char* buf, Int nbuf ) > { >@@ -1456,7 +1553,7 @@ > /*show offset?*/False ); > } > >-/* This is available to skins... always demangle C++ names, >+/* This is available to tools... always demangle C++ names, > match anywhere in function, and show offset if nonzero. */ > Bool VG_(get_fnname_w_offset) ( Addr a, Char* buf, Int nbuf ) > { >@@ -1465,7 +1562,7 @@ > /*show offset?*/True ); > } > >-/* This is available to skins... always demangle C++ names, >+/* This is available to tools... always demangle C++ names, > only succeed if 'a' matches first instruction of function, > and don't show offsets. */ > Bool VG_(get_fnname_if_entry) ( Addr a, Char* buf, Int nbuf ) >@@ -1680,28 +1777,28 @@ > v->size = VG_(st_sizeof)(sym->type); > > if (debug && 0) >- VG_(printf)("sym->name=%s sym->kind=%d offset=%d\n", sym->name, sym->kind, sym->offset); >+ VG_(printf)("sym->name=%s sym->kind=%d offset=%d\n", sym->name, sym->kind, sym->u.offset); > switch(sym->kind) { > UInt reg; > > case SyGlobal: > case SyStatic: >- if (sym->addr == 0) { >+ if (sym->u.addr == 0) { > /* XXX lookup value */ > } >- v->valuep = sym->addr; >+ v->valuep = sym->u.addr; > break; > > case SyReg: >- v->valuep = (Addr)regaddr(tid, sym->regno); >+ v->valuep = (Addr)regaddr(tid, sym->u.regno); > break; > > case SyEBPrel: > case SyESPrel: > reg = *regaddr(tid, sym->kind == SyESPrel ? R_ESP : R_EBP); > if (debug) >- VG_(printf)("reg=%p+%d=%p\n", reg, sym->offset, reg+sym->offset); >- v->valuep = (Addr)(reg + sym->offset); >+ VG_(printf)("reg=%p+%d=%p\n", reg, sym->u.offset, reg+sym->u.offset); >+ v->valuep = (Addr)(reg + sym->u.offset); > break; > > case SyType: >@@ -1810,84 +1907,305 @@ > > > /*------------------------------------------------------------*/ >-/*--- Find interesting glibc entry points. ---*/ >+/*--- General purpose redirection. ---*/ > /*------------------------------------------------------------*/ > >-CodeRedirect VG_(code_redirect_table)[VG_N_CODE_REDIRECTS]; >+/* Set to True for debug printing. */ >+static const Bool verbose_redir = False; > >-Int VG_(setup_code_redirect_table) ( void ) >+ >+/* resolved redirections, indexed by from_addr */ >+typedef struct _CodeRedirect { >+ const Char *from_lib; /* library qualifier pattern */ >+ const Char *from_sym; /* symbol */ >+ Addr from_addr; /* old addr */ >+ >+ const Char *to_lib; /* library qualifier pattern */ >+ const Char *to_sym; /* symbol */ >+ Addr to_addr; /* new addr */ >+ >+ struct _CodeRedirect *next; /* next pointer on unresolved list */ >+} CodeRedirect; >+ >+static Int addrcmp(const void *ap, const void *bp) > { >-# define N_SUBSTS 6 >+ Addr a = *(Addr *)ap; >+ Addr b = *(Addr *)bp; >+ Int ret; >+ >+ if (a == b) >+ ret = 0; >+ else >+ ret = (a < b) ? -1 : 1; > >- Int i, j; >- Addr a_libc, a_pth; >- SegInfo *si, *si_libc, *si_pth; >- >- /* Original entry points to look for in libc. */ >- static Char* libc_names[N_SUBSTS] >- = { "__GI___errno_location" >- , "__errno_location" >- , "__GI___h_errno_location" >- , "__h_errno_location" >- , "__GI___res_state" >- , "__res_state" >- }; >- >- /* Corresponding substitute address in our pthread lib. */ >- static Char* pth_names[N_SUBSTS] >- = { "__errno_location" >- , "__errno_location" >- , "__h_errno_location" >- , "__h_errno_location" >- , "__res_state" >- , "__res_state" >- }; >+ return ret; >+} > >- /* Look for the SegInfo for glibc and our pthread library. */ >+static Char *straddr(void *p) >+{ >+ static Char buf[16]; > >- si_libc = si_pth = NULL; >+ VG_(sprintf)(buf, "%p", *(Addr *)p); > >- for (si = segInfo; si != NULL; si = si->next) { >- if (VG_(strstr)(si->filename, "/libc-2.2.93.so") >- || VG_(strstr)(si->filename, "/libc-2.3.1.so") >- || VG_(strstr)(si->filename, "/libc-2.3.2.so") >- || VG_(strstr)(si->filename, "/libc.so")) >- si_libc = si; >- if (VG_(strstr)(si->filename, "/libpthread.so")) >- si_pth = si; >+ return buf; >+} >+ >+static SkipList sk_resolved_redir = SKIPLIST_INIT(CodeRedirect, from_addr, >+ addrcmp, straddr, VG_AR_SYMTAB); >+static CodeRedirect *unresolved_redir = NULL; >+ >+static Bool match_lib(const Char *pattern, const SegInfo *si) >+{ >+ /* pattern == NULL matches everything, otherwise use globbing >+ >+ If the pattern starts with: >+ file:, then match filename >+ soname:, then match soname >+ something else, match filename >+ */ >+ const Char *name = si->filename; >+ >+ if (pattern == NULL) >+ return True; >+ >+ if (VG_(strncmp)(pattern, "file:", 5) == 0) { >+ pattern += 5; >+ name = si->filename; > } >+ if (VG_(strncmp)(pattern, "soname:", 7) == 0) { >+ pattern += 7; >+ name = si->soname; >+ } >+ >+ if (name == NULL) >+ return False; >+ >+ return VG_(string_match)(pattern, name); >+} > >- if (si_libc == NULL || si_pth == NULL) >- return 0; >+/* Resolve a redir using si if possible, and add it to the resolved >+ list */ >+static Bool resolve_redir(CodeRedirect *redir, const SegInfo *si) >+{ >+ Bool resolved; > >- /* Build the substitution table. */ >- vg_assert(N_SUBSTS <= VG_N_CODE_REDIRECTS-1); >+ vg_assert(si != NULL); >+ vg_assert(si->seg != NULL); > >- j = 0; >- VG_(code_redirect_table)[j].entry_pt_orig = 0; >+ /* no redirection from Valgrind segments */ >+ if (si->seg->flags & SF_VALGRIND) >+ return False; > >- for (i = 0; i < N_SUBSTS; i++) { >- a_libc = reverse_search_one_symtab(si_libc, libc_names[i]); >- a_pth = reverse_search_one_symtab(si_pth, pth_names[i]); >- if (a_libc == 0 || a_pth == 0) >- continue; >- /* We've found a substitution pair. */ >- VG_(code_redirect_table)[j].entry_pt_orig = a_libc; >- VG_(code_redirect_table)[j].entry_pt_subst = a_pth; >- j++; >- vg_assert(j < VG_N_CODE_REDIRECTS); >- /* Set end marker. */ >- VG_(code_redirect_table)[j].entry_pt_orig = 0; >- if (VG_(clo_verbosity) >= 2) >- VG_(message)(Vg_UserMsg, >- "REPLACING libc(%s) with libpthread(%s)", >- libc_names[i], pth_names[i] >- ); >+ resolved = (redir->from_addr != 0) && (redir->to_addr != 0); >+ >+ if (0 && verbose_redir) >+ VG_(printf)(" consider FROM binding %s:%s -> %s:%s in %s(%s)\n", >+ redir->from_lib, redir->from_sym, >+ redir->to_lib, redir->to_sym, >+ si->filename, si->soname); >+ >+ vg_assert(!resolved); >+ >+ if (redir->from_addr == 0) { >+ vg_assert(redir->from_sym != NULL); >+ >+ if (match_lib(redir->from_lib, si)) { >+ redir->from_addr = reverse_search_one_symtab(si, redir->from_sym); >+ if (verbose_redir && redir->from_addr != 0) >+ VG_(printf)(" bind FROM: %p = %s:%s\n", >+ redir->from_addr,redir->from_lib, redir->from_sym ); >+ } >+ } >+ >+ if (redir->to_addr == 0) { >+ vg_assert(redir->to_sym != NULL); >+ >+ if (match_lib(redir->to_lib, si)) { >+ redir->to_addr = reverse_search_one_symtab(si, redir->to_sym); >+ if (verbose_redir && redir->to_addr != 0) >+ VG_(printf)(" bind TO: %p = %s:%s\n", >+ redir->to_addr,redir->to_lib, redir->to_sym ); >+ >+ } >+ } >+ >+ resolved = (redir->from_addr != 0) && (redir->to_addr != 0); >+ >+ if (0 && verbose_redir) >+ VG_(printf)("resolve_redir: %s:%s from=%p %s:%s to=%p\n", >+ redir->from_lib, redir->from_sym, redir->from_addr, >+ redir->to_lib, redir->to_sym, redir->to_addr); >+ >+ if (resolved) { >+ if (VG_(clo_verbosity) > 2 || verbose_redir) { >+ VG_(message)(Vg_DebugMsg, " redir resolved (%s:%s=%p -> ", >+ redir->from_lib, redir->from_sym, redir->from_addr); >+ VG_(message)(Vg_DebugMsg, " %s:%s=%p)", >+ redir->to_lib, redir->to_sym, redir->to_addr); >+ } >+ >+ if (VG_(search_transtab)(redir->from_addr) != 0) { >+ /* For some given (from, to) redir, the "from" function got >+ called before the .so containing "to" became available. We >+ know this because there is already a translation for the >+ entry point of the original "from". So the redirect will >+ never actually take effect unless that translation is >+ discarded. >+ >+ Note, we only really need to discard the first bb of the >+ old entry point, and so we avoid the problem of having to >+ figure out how big that bb was -- since it is at least 1 >+ byte of original code, we can just pass 1 as the original >+ size to invalidate_translations() and it will indeed get >+ rid of the translation. >+ >+ Note, this is potentially expensive -- discarding >+ translations causes complete unchaining. >+ */ >+ if (VG_(clo_verbosity) > 2) { >+ VG_(message)(Vg_UserMsg, >+ "Discarding translation due to redirect of already called function" ); >+ VG_(message)(Vg_UserMsg, >+ " %s (%p -> %p)", >+ redir->from_sym, redir->from_addr, redir->to_addr ); >+ } >+ VG_(invalidate_translations)(redir->from_addr, 1, True); >+ } >+ >+ VG_(SkipList_Insert)(&sk_resolved_redir, redir); > } > >- return j; >+ return resolved; >+} >+ >+/* Go through the complete redir list, resolving as much as possible with this SegInfo. >+ >+ This should be called when a new SegInfo symtab is loaded. >+ */ >+static void resolve_seg_redirs(SegInfo *si) >+{ >+ CodeRedirect **prevp = &unresolved_redir; >+ CodeRedirect *redir, *next; >+ >+ if (verbose_redir) >+ VG_(printf)("Considering redirs to/from %s(soname=%s)\n", >+ si->filename, si->soname); >+ >+ /* visit each unresolved redir - if it becomes resolved, then >+ remove it from the unresolved list */ >+ for(redir = unresolved_redir; redir != NULL; redir = next) { >+ next = redir->next; >+ >+ if (resolve_redir(redir, si)) { >+ *prevp = next; >+ redir->next = NULL; >+ } else >+ prevp = &redir->next; >+ } >+} >+ >+static Bool resolve_redir_allsegs(CodeRedirect *redir) >+{ >+ SegInfo *si; >+ >+ for(si = segInfo; si != NULL; si = si->next) >+ if (resolve_redir(redir, si)) >+ return True; >+ >+ return False; >+} >+ >+/* Redirect a lib/symbol reference to a function at lib/symbol */ >+void VG_(add_redirect_sym)(const Char *from_lib, const Char *from_sym, >+ const Char *to_lib, const Char *to_sym) >+{ >+ CodeRedirect *redir = VG_(SkipNode_Alloc)(&sk_resolved_redir); >+ >+ redir->from_lib = VG_(arena_strdup)(VG_AR_SYMTAB, from_lib); >+ redir->from_sym = VG_(arena_strdup)(VG_AR_SYMTAB, from_sym); >+ redir->from_addr = 0; >+ >+ redir->to_lib = VG_(arena_strdup)(VG_AR_SYMTAB, to_lib); >+ redir->to_sym = VG_(arena_strdup)(VG_AR_SYMTAB, to_sym); >+ redir->to_addr = 0; >+ >+ if (VG_(clo_verbosity) >= 2) >+ VG_(message)(Vg_UserMsg, >+ "REDIRECT %s(%s) to %s(%s)", >+ from_lib, from_sym, to_lib, to_sym); >+ >+ if (!resolve_redir_allsegs(redir)) { >+ /* can't resolve immediately; add to list */ >+ redir->next = unresolved_redir; >+ unresolved_redir = redir; >+ } >+} >+ >+/* Redirect a lib/symbol reference to a function at lib/symbol */ >+void VG_(add_redirect_addr)(const Char *from_lib, const Char *from_sym, >+ Addr to_addr) >+{ >+ CodeRedirect *redir = VG_(SkipNode_Alloc)(&sk_resolved_redir); >+ >+ redir->from_lib = VG_(arena_strdup)(VG_AR_SYMTAB, from_lib); >+ redir->from_sym = VG_(arena_strdup)(VG_AR_SYMTAB, from_sym); >+ redir->from_addr = 0; >+ >+ redir->to_lib = NULL; >+ redir->to_sym = NULL; >+ redir->to_addr = to_addr; >+ >+ if (!resolve_redir_allsegs(redir)) { >+ /* can't resolve immediately; add to list */ >+ redir->next = unresolved_redir; >+ unresolved_redir = redir; >+ } >+} >+ >+Addr VG_(code_redirect)(Addr a) >+{ >+ CodeRedirect *r = VG_(SkipList_Find)(&sk_resolved_redir, &a); >+ >+ if (r == NULL || r->from_addr != a) >+ return a; >+ >+ vg_assert(r->to_addr != 0); >+ >+ return r->to_addr; >+} >+ >+void VG_(setup_code_redirect_table) ( void ) >+{ >+ static const struct { >+ const Char *from, *to; >+ } redirects[] = { >+ { "__GI___errno_location", "__errno_location" }, >+ { "__errno_location", "__errno_location" }, >+ { "__GI___h_errno_location", "__h_errno_location" }, >+ { "__h_errno_location", "__h_errno_location" }, >+ { "__GI___res_state", "__res_state" }, >+ { "__res_state", "__res_state" }, >+ }; >+ Int i; > >-# undef N_SUBSTS >+ for(i = 0; i < sizeof(redirects)/sizeof(*redirects); i++) { >+ VG_(add_redirect_sym)("soname:libc.so.6", redirects[i].from, >+ "soname:libpthread.so.0", redirects[i].to); >+ } >+ >+ /* Overenthusiastic use of PLT bypassing by the glibc people also >+ means we need to patch the following functions to our own >+ implementations of said, in mac_replace_strmem.c. >+ */ >+ VG_(add_redirect_sym)("soname:libc.so.6", "stpcpy", >+ "*vgpreload_memcheck.so*", "stpcpy"); >+ VG_(add_redirect_sym)("soname:libc.so.6", "strnlen", >+ "*vgpreload_memcheck.so*", "strnlen"); >+ >+ VG_(add_redirect_sym)("soname:ld-linux.so.2", "stpcpy", >+ "*vgpreload_memcheck.so*", "stpcpy"); >+ VG_(add_redirect_sym)("soname:ld-linux.so.2", "strchr", >+ "*vgpreload_memcheck.so*", "strchr"); > } > > /*------------------------------------------------------------*/ >diff -ruN valgrind-2.1.0/coregrind/vg_symtab2.h valgrind/coregrind/vg_symtab2.h >--- valgrind-2.1.0/coregrind/vg_symtab2.h 2003-12-13 18:06:18.000000000 -0600 >+++ valgrind/coregrind/vg_symtab2.h 2004-01-06 10:02:29.000000000 -0600 >@@ -6,7 +6,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -97,7 +97,7 @@ > Int offset; /* offset on stack (-ve -> ebp; +ve -> esp) */ > Int regno; /* register number */ > Addr addr; /* static or global address */ >- }; >+ } u; > }; > > struct _Scope { >@@ -120,12 +120,18 @@ > /* A structure which contains information pertaining to one mapped > text segment. (typedef in vg_skin.h) */ > struct _SegInfo { >- struct _SegInfo* next; >+ struct _SegInfo* next; /* list of SegInfos */ >+ >+ Segment *seg; /* first segment we're mapped out of */ >+ Int ref; >+ > /* Description of the mapped segment. */ > Addr start; > UInt size; > Char* filename; /* in mallocville */ > UInt foffset; >+ Char* soname; >+ > /* An expandable array of symbols. */ > RiSym* symtab; > UInt symtab_used; >diff -ruN valgrind-2.1.0/coregrind/vg_symtypes.c valgrind/coregrind/vg_symtypes.c >--- valgrind-2.1.0/coregrind/vg_symtypes.c 2003-10-16 05:10:55.000000000 -0500 >+++ valgrind/coregrind/vg_symtypes.c 2004-01-21 09:08:03.000000000 -0600 >@@ -6,7 +6,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -151,7 +151,7 @@ > SymResolver *resolver; /* symtab reader's resolver */ > void *data; /* data for resolver */ > } t_unresolved; >- }; >+ } u; > }; > > >@@ -186,7 +186,7 @@ > if (st->kind != TyUnresolved) > return; > >- (*st->t_unresolved.resolver)(st, st->t_unresolved.data); >+ (*st->u.t_unresolved.resolver)(st, st->u.t_unresolved.data); > > if (st->kind == TyUnresolved) > st->kind = TyError; >@@ -200,8 +200,8 @@ > > st->kind = TyUnresolved; > st->size = 0; >- st->t_unresolved.resolver = resolver; >- st->t_unresolved.data = data; >+ st->u.t_unresolved.resolver = resolver; >+ st->u.t_unresolved.data = data; > > return st; > } >@@ -211,8 +211,8 @@ > if (st->kind != TyUnresolved) > return; > >- st->t_unresolved.resolver = resolver; >- st->t_unresolved.data = data; >+ st->u.t_unresolved.resolver = resolver; >+ st->u.t_unresolved.data = data; > } > > Bool VG_(st_isresolved)(SymType *st) >@@ -246,7 +246,7 @@ > > st->kind = TyInt; > st->size = size; >- st->t_scalar.issigned = isSigned; >+ st->u.t_scalar.issigned = isSigned; > > return st; > } >@@ -259,7 +259,7 @@ > > st->kind = TyFloat; > st->size = size; >- st->t_scalar.issigned = True; >+ st->u.t_scalar.issigned = True; > > return st; > } >@@ -285,7 +285,7 @@ > > st->kind = TyPointer; > st->size = sizeof(void *); >- st->t_pointer.type = ptr; >+ st->u.t_pointer.type = ptr; > > return st; > } >@@ -298,9 +298,9 @@ > > st->kind = TyRange; > st->size = 0; /* ? */ >- st->t_range.type = ty; >- st->t_range.min = min; >- st->t_range.max = max; >+ st->u.t_range.type = ty; >+ st->u.t_range.min = min; >+ st->u.t_range.max = max; > > return st; > } >@@ -311,16 +311,16 @@ > > vg_assert(st->kind == TyUnresolved || st->kind == TyUnknown || st->kind == TyStruct); > >- vg_assert(st->kind != TyStruct || st->t_struct.nfield == 0); >+ vg_assert(st->kind != TyStruct || st->u.t_struct.nfield == 0); > > st->kind = TyStruct; > st->size = size; >- st->t_struct.nfield = 0; >- st->t_struct.nfieldalloc = nfields; >+ st->u.t_struct.nfield = 0; >+ st->u.t_struct.nfieldalloc = nfields; > if (nfields != 0) >- st->t_struct.fields = VG_(arena_malloc)(VG_AR_SYMTAB, sizeof(StField) * nfields); >+ st->u.t_struct.fields = VG_(arena_malloc)(VG_AR_SYMTAB, sizeof(StField) * nfields); > else >- st->t_struct.fields = NULL; >+ st->u.t_struct.fields = NULL; > > return st; > } >@@ -331,16 +331,16 @@ > > vg_assert(st->kind == TyUnresolved || st->kind == TyUnknown || st->kind == TyUnion); > >- vg_assert(st->kind != TyUnion || st->t_struct.nfield == 0); >+ vg_assert(st->kind != TyUnion || st->u.t_struct.nfield == 0); > > st->kind = TyUnion; > st->size = size; >- st->t_struct.nfield = 0; >- st->t_struct.nfieldalloc = nfields; >+ st->u.t_struct.nfield = 0; >+ st->u.t_struct.nfieldalloc = nfields; > if (nfields != 0) >- st->t_struct.fields = VG_(arena_malloc)(VG_AR_SYMTAB, sizeof(StField) * nfields); >+ st->u.t_struct.fields = VG_(arena_malloc)(VG_AR_SYMTAB, sizeof(StField) * nfields); > else >- st->t_struct.fields = NULL; >+ st->u.t_struct.fields = NULL; > > return st; > } >@@ -351,17 +351,17 @@ > > vg_assert(st->kind == TyStruct || st->kind == TyUnion); > >- if (st->t_struct.nfieldalloc == st->t_struct.nfield) { >+ if (st->u.t_struct.nfieldalloc == st->u.t_struct.nfield) { > StField *n = VG_(arena_malloc)(VG_AR_SYMTAB, >- sizeof(StField) * (st->t_struct.nfieldalloc + 2)); >- VG_(memcpy)(n, st->t_struct.fields, sizeof(*n) * st->t_struct.nfield); >- if (st->t_struct.fields != NULL) >- VG_(arena_free)(VG_AR_SYMTAB, st->t_struct.fields); >- st->t_struct.nfieldalloc++; >- st->t_struct.fields = n; >+ sizeof(StField) * (st->u.t_struct.nfieldalloc + 2)); >+ VG_(memcpy)(n, st->u.t_struct.fields, sizeof(*n) * st->u.t_struct.nfield); >+ if (st->u.t_struct.fields != NULL) >+ VG_(arena_free)(VG_AR_SYMTAB, st->u.t_struct.fields); >+ st->u.t_struct.nfieldalloc++; >+ st->u.t_struct.fields = n; > } > >- f = &st->t_struct.fields[st->t_struct.nfield++]; >+ f = &st->u.t_struct.fields[st->u.t_struct.nfield++]; > f->name = name; > f->type = type; > f->offset = off; >@@ -376,8 +376,8 @@ > vg_assert(st->kind == TyUnresolved || st->kind == TyUnknown || st->kind == TyEnum); > > st->kind = TyEnum; >- st->t_enum.ntag = 0; >- st->t_enum.tags = NULL; >+ st->u.t_enum.ntag = 0; >+ st->u.t_enum.tags = NULL; > > return st; > } >@@ -389,8 +389,8 @@ > vg_assert(st->kind == TyUnresolved || st->kind == TyUnknown); > > st->kind = TyArray; >- st->t_array.type = type; >- st->t_array.idxtype = idxtype; >+ st->u.t_array.type = type; >+ st->u.t_array.idxtype = idxtype; > > return st; > } >@@ -405,7 +405,7 @@ > > st->kind = TyTypedef; > st->name = name; >- st->t_typedef.type = type; >+ st->u.t_typedef.type = type; > > return st; > } >@@ -418,7 +418,7 @@ > resolve(type); > > if (type->kind == TyTypedef) >- type = type->t_typedef.type; >+ type = type->u.t_typedef.type; > } > > return type; >@@ -689,7 +689,7 @@ > else > bufsz *= 2; > >- /* use skin malloc so that the skin client can free it */ >+ /* use tool malloc so that the skin client can free it */ > n = VG_(malloc)(bufsz); > if (buf != NULL && bufidx != 0) > VG_(memcpy)(n, buf, bufidx); >@@ -825,9 +825,9 @@ > Int i; > > if (debug) >- VG_(printf)(" %d fields\n", type->t_struct.nfield); >- for(i = 0; i < type->t_struct.nfield; i++) { >- StField *f = &type->t_struct.fields[i]; >+ VG_(printf)(" %d fields\n", type->u.t_struct.nfield); >+ for(i = 0; i < type->u.t_struct.nfield; i++) { >+ StField *f = &type->u.t_struct.fields[i]; > newvar(f->name, f->type, var->valuep + (f->offset / 8), (f->size + 7) / 8); > } > break; >@@ -837,12 +837,12 @@ > Int i; > Int offset; /* offset of index for non-0-based arrays */ > Int min, max; /* range of indicies we care about (0 based) */ >- SymType *ty = type->t_array.type; >- vg_assert(type->t_array.idxtype->kind == TyRange); >+ SymType *ty = type->u.t_array.type; >+ vg_assert(type->u.t_array.idxtype->kind == TyRange); > >- offset = type->t_array.idxtype->t_range.min; >+ offset = type->u.t_array.idxtype->u.t_range.min; > min = 0; >- max = type->t_array.idxtype->t_range.max - offset; >+ max = type->u.t_array.idxtype->u.t_range.max - offset; > > if ((max-min+1) == 0) { > #if SHADOWCHUNK >@@ -893,7 +893,7 @@ > /* XXX work out a way of telling whether a pointer is > actually a decayed array, and treat it accordingly */ > if (is_valid_addr(var->valuep)) >- newvar(NULL, type->t_pointer.type, *(Addr *)var->valuep, -1); >+ newvar(NULL, type->u.t_pointer.type, *(Addr *)var->valuep, -1); > break; > > case TyUnresolved: >diff -ruN valgrind-2.1.0/coregrind/vg_symtypes.h valgrind/coregrind/vg_symtypes.h >--- valgrind-2.1.0/coregrind/vg_symtypes.h 2003-10-16 05:10:55.000000000 -0500 >+++ valgrind/coregrind/vg_symtypes.h 2004-01-04 10:43:20.000000000 -0600 >@@ -6,7 +6,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >diff -ruN valgrind-2.1.0/coregrind/vg_syscall.S valgrind/coregrind/vg_syscall.S >--- valgrind-2.1.0/coregrind/vg_syscall.S 2003-10-13 17:26:54.000000000 -0500 >+++ valgrind/coregrind/vg_syscall.S 2004-01-04 10:43:20.000000000 -0600 >@@ -8,7 +8,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >diff -ruN valgrind-2.1.0/coregrind/vg_syscalls.c valgrind/coregrind/vg_syscalls.c >--- valgrind-2.1.0/coregrind/vg_syscalls.c 2003-12-12 01:46:54.000000000 -0600 >+++ valgrind/coregrind/vg_syscalls.c 2004-02-10 17:44:15.000000000 -0600 >@@ -7,7 +7,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -117,6 +117,103 @@ > (*atforks[i].child)(tid); > } > >+/* return true if address range entirely contained within client >+ address space */ >+static Bool valid_client_addr(Addr start, UInt size, ThreadId tid, const Char *syscall) >+{ >+ Addr end = start+size; >+ Addr cl_base = VG_(client_base); >+ Bool ret; >+ >+ if (size == 0) >+ return True; >+ >+ if (cl_base < 0x10000) >+ cl_base = 0x10000; >+ >+ ret = >+ (end >= start) && >+ start >= cl_base && start < VG_(client_end) && >+ (end <= VG_(client_end)); >+ >+ if (0) >+ VG_(printf)("%s: test=%p-%p client=%p-%p ret=%d\n", >+ syscall, start, end, cl_base, VG_(client_end), ret); >+ >+ if (!ret && syscall != NULL) { >+ VG_(message)(Vg_UserMsg, "Warning: client syscall %s tried to modify addresses %p-%p", >+ syscall, start, end); >+ >+ if (VG_(clo_verbosity) > 1) { >+ ExeContext *ec = VG_(get_ExeContext)(tid); >+ VG_(pp_ExeContext)(ec); >+ } >+ } >+ >+ return ret; >+} >+ >+/* Walk through a colon-separated environment variable, and remove the >+ entries which matches file_pattern. It slides everything down over >+ the removed entries, and pads the remaining space with '\0'. It >+ modifies the entries in place (in the client address space), but it >+ shouldn't matter too much, since we only do this just before an >+ execve(). >+ >+ This is also careful to mop up any excess ':'s, since empty strings >+ delimited by ':' are considered to be '.' in a path. >+*/ >+void VG_(mash_colon_env)(Char *varp, const Char *remove_pattern) >+{ >+ Char *const start = varp; >+ Char *entry_start = varp; >+ Char *output = varp; >+ >+ if (varp == NULL) >+ return; >+ >+ while(*varp) { >+ if (*varp == ':') { >+ Char prev; >+ Bool match; >+ >+ /* This is a bit subtle: we want to match against the entry >+ we just copied, because it may have overlapped with >+ itself, junking the original. */ >+ >+ prev = *output; >+ *output = '\0'; >+ >+ match = VG_(string_match)(remove_pattern, entry_start); >+ >+ *output = prev; >+ >+ if (match) { >+ output = entry_start; >+ varp++; /* skip ':' after removed entry */ >+ } else >+ entry_start = output+1; /* entry starts after ':' */ >+ } >+ >+ *output++ = *varp++; >+ } >+ >+ /* match against the last entry */ >+ if (VG_(string_match)(remove_pattern, entry_start)) { >+ output = entry_start; >+ if (output > start) { >+ /* remove trailing ':' */ >+ output--; >+ vg_assert(*output == ':'); >+ } >+ } >+ >+ /* pad out the left-overs with '\0' */ >+ while(output < varp) >+ *output++ = '\0'; >+} >+ >+ > /* --------------------------------------------------------------------- > Doing mmap, munmap, mremap, mprotect > ------------------------------------------------------------------ */ >@@ -137,22 +234,34 @@ > static > void mash_addr_and_len( Addr* a, UInt* len) > { >- while (( *a % VKI_BYTES_PER_PAGE) > 0) { (*a)--; (*len)++; } >- while (((*a + *len) % VKI_BYTES_PER_PAGE) > 0) { (*len)++; } >+ Addr ra; >+ >+ ra = PGROUNDDN(*a); >+ *len = PGROUNDUP(*a + *len) - ra; >+ *a = ra; > } > > static >-void mmap_segment ( Addr a, UInt len, UInt prot, Int fd ) >+void mmap_segment ( Addr a, UInt len, UInt prot, UInt mm_flags, Int fd, ULong offset ) > { > Bool rr, ww, xx; >+ UInt flags; > >- /* Records segment, reads debug symbols if necessary */ >- if ((prot & PROT_EXEC) && fd != -1) >- VG_(new_exeseg_mmap) ( a, len ); >- >- rr = prot & PROT_READ; >- ww = prot & PROT_WRITE; >- xx = prot & PROT_EXEC; >+ flags = SF_MMAP; >+ >+ if (mm_flags & VKI_MAP_FIXED) >+ flags |= SF_FIXED; >+ if (!(mm_flags & VKI_MAP_PRIVATE)) >+ flags |= SF_SHARED; >+ >+ if (fd != -1) >+ flags |= SF_FILE; >+ >+ VG_(map_fd_segment)(a, len, prot, flags, fd, offset, NULL); >+ >+ rr = prot & VKI_PROT_READ; >+ ww = prot & VKI_PROT_WRITE; >+ xx = prot & VKI_PROT_EXEC; > > VG_TRACK( new_mem_mmap, a, len, rr, ww, xx ); > } >@@ -164,19 +273,15 @@ > Addr orig_len = len; */ > > mash_addr_and_len(&a, &len); >+ >+ VG_(unmap_range)(a, len); >+ > /* > VG_(printf)("MUNMAP: correct (%p for %d) to (%p for %d) %s\n", > orig_a, orig_len, a, len, (orig_a!=start || orig_len!=length) > ? "CHANGE" : ""); > */ > >- /* Invalidate translations as necessary (also discarding any basic >- block-specific info retained by the skin) and unload any debug >- symbols. */ >- // This doesn't handle partial unmapping of exe segs correctly, if that >- // ever happens... >- VG_(remove_if_exeseg) ( a, len ); >- > VG_TRACK( die_mem_munmap, a, len ); > } > >@@ -185,9 +290,11 @@ > { > Bool rr, ww, xx; > >- rr = prot & PROT_READ; >- ww = prot & PROT_WRITE; >- xx = prot & PROT_EXEC; >+ VG_(mprotect_range)(a, len, prot); >+ >+ rr = prot & VKI_PROT_READ; >+ ww = prot & VKI_PROT_WRITE; >+ xx = prot & VKI_PROT_EXEC; > > // if removing exe permission, should check and remove from exe_seg list > // if adding, should check and add to exe_seg list >@@ -197,34 +304,139 @@ > } > > static >-void mremap_segment ( Addr old_addr, UInt old_size, Addr new_addr, >- UInt new_size ) >+Addr mremap_segment ( Addr old_addr, UInt old_size, >+ Addr new_addr, UInt new_size, >+ UInt flags, ThreadId tid) > { >- /* If the block moves, assume new and old blocks can't overlap; seems to >- * be valid judging from Linux kernel code in mm/mremap.c */ >- vg_assert(old_addr == new_addr || >- old_addr+old_size < new_addr || >- new_addr+new_size < old_addr); >- >- if (new_size < old_size) { >- // if exe_seg >- // unmap old symbols from old_addr+new_size..old_addr+new_size >- // update exe_seg size = new_size >- // update exe_seg addr = new_addr... >- VG_TRACK( copy_mem_remap, old_addr, new_addr, new_size ); >- VG_TRACK( die_mem_munmap, old_addr+new_size, old_size-new_size ); >+ Addr ret; >+ Segment *seg, *next; >+ >+ old_size = PGROUNDUP(old_size); >+ new_size = PGROUNDUP(new_size); >+ >+ if (PGROUNDDN(old_addr) != old_addr) >+ return -VKI_EINVAL; >+ >+ if (!valid_client_addr(old_addr, old_size, tid, "mremap(old_addr)")) >+ return -VKI_EFAULT; >+ >+ /* fixed at the current address means we don't move it */ >+ if ((flags & VKI_MREMAP_FIXED) && (old_addr == new_addr)) >+ flags &= ~(VKI_MREMAP_FIXED|VKI_MREMAP_MAYMOVE); >+ >+ if (flags & VKI_MREMAP_FIXED) { >+ if (PGROUNDDN(new_addr) != new_addr) >+ return -VKI_EINVAL; >+ >+ if (!valid_client_addr(new_addr, new_size, tid, "mremap(new_addr)")) >+ return -VKI_ENOMEM; >+ >+ /* check for overlaps */ >+ if ((old_addr < (new_addr+new_size) && >+ (old_addr+old_size) > new_addr) || >+ (new_addr < (old_addr+new_size) && >+ (new_addr+new_size) > old_addr)) >+ return -VKI_EINVAL; >+ } >+ >+ /* Do nothing */ >+ if (!(flags & VKI_MREMAP_FIXED) && new_size == old_size) >+ return old_addr; >+ >+ seg = VG_(find_segment)(old_addr); >+ >+ /* range must be contained within segment */ >+ if (seg == NULL || !VG_(seg_contains)(seg, old_addr, old_size)) >+ return -VKI_EINVAL; >+ >+ next = VG_(next_segment)(seg); >+ >+ if (0) >+ VG_(printf)("mremap: old_addr+new_size=%p next->addr=%p flags=%d\n", >+ old_addr+new_size, next->addr, flags); >+ >+ if ((flags & VKI_MREMAP_FIXED) || >+ (next != NULL && (old_addr+new_size) > next->addr)) { >+ /* we're moving the block */ >+ Addr a; >+ >+ if ((flags & (VKI_MREMAP_FIXED|VKI_MREMAP_MAYMOVE)) == 0) >+ return -VKI_ENOMEM; /* not allowed to move */ > >+ if ((flags & VKI_MREMAP_FIXED) == 0) >+ new_addr = 0; >+ >+ a = VG_(find_map_space)(new_addr, new_size, True); >+ >+ if ((flags & VKI_MREMAP_FIXED) && a != new_addr) >+ return -VKI_ENOMEM; /* didn't find the place we wanted */ >+ >+ new_addr = a; >+ ret = a; >+ >+ /* we've nailed down the location */ >+ flags |= VKI_MREMAP_FIXED|VKI_MREMAP_MAYMOVE; >+ >+ ret = VG_(do_syscall)(__NR_mremap, old_addr, old_size, new_size, >+ flags, new_addr); >+ >+ if (ret != new_addr) { >+ vg_assert(VG_(is_kerror)(ret)); >+ return ret; >+ } >+ >+ VG_TRACK(copy_mem_remap, old_addr, new_addr, >+ (old_size < new_size) ? old_size : new_size); >+ >+ if (new_size > old_size) >+ VG_TRACK(new_mem_mmap, new_addr+old_size, new_size-old_size, >+ seg->prot & VKI_PROT_READ, >+ seg->prot & VKI_PROT_WRITE, >+ seg->prot & VKI_PROT_EXEC); >+ VG_TRACK(die_mem_munmap, old_addr, old_size); >+ >+ VG_(map_file_segment)(new_addr, new_size, >+ seg->prot, >+ seg->flags, >+ seg->dev, seg->ino, >+ seg->offset, seg->filename); >+ >+ VG_(munmap)((void *)old_addr, old_size); > } else { >- // if exe_seg >- // map new symbols from new_addr+old_size..new_addr+new_size >- // update exe_seg size = new_size >- // update exe_seg addr = new_addr... >- VG_TRACK( copy_mem_remap, old_addr, new_addr, old_size ); >- // what should the permissions on the new extended part be?? >- // using 'rwx' >- VG_TRACK( new_mem_mmap, new_addr+old_size, new_size-old_size, >- True, True, True ); >+ /* staying in place */ >+ ret = old_addr; >+ >+ if (new_size < old_size) { >+ VG_TRACK(die_mem_munmap, old_addr+new_size, old_size-new_size); >+ VG_(munmap)((void *)(old_addr+new_size), old_size-new_size); >+ } else { >+ /* we've nailed down the location */ >+ flags &= ~VKI_MREMAP_MAYMOVE; >+ >+ if (0) >+ VG_(printf)("mremap: old_addr=%p old_size=%d new_size=%d flags=%d\n", >+ old_addr, old_size, new_size, flags); >+ >+ ret = VG_(do_syscall)(__NR_mremap, old_addr, old_size, new_size, >+ flags, 0); >+ >+ if (ret != old_addr) >+ return ret; >+ >+ VG_TRACK(new_mem_mmap, old_addr+old_size, new_size-old_size, >+ seg->prot & VKI_PROT_READ, >+ seg->prot & VKI_PROT_WRITE, >+ seg->prot & VKI_PROT_EXEC); >+ >+ VG_(map_file_segment)(old_addr+old_size, new_size-old_size, >+ seg->prot, >+ seg->flags, >+ seg->dev, seg->ino, >+ seg->offset, seg->filename); >+ } > } >+ >+ return ret; > } > > >@@ -280,8 +492,7 @@ > doesn't exist, we just return NULL. Otherwise, we return a pointer > to the file name, which the caller is responsible for freeing. */ > >-static >-Char *resolve_fname(Int fd) >+Char *VG_(resolve_filename)(Int fd) > { > char tmp[28], buf[PATH_MAX]; > >@@ -291,7 +502,7 @@ > if(VG_(readlink)(tmp, buf, PATH_MAX) == -1) > return NULL; > >- return ((buf[0] == '/') ? VG_(strdup)(buf) : NULL); >+ return ((buf[0] == '/') ? VG_(arena_strdup)(VG_AR_CORE, buf) : NULL); > } > > >@@ -302,6 +513,9 @@ > { > OpenFd *i = allocated_fds; > >+ if (fd > VG_(max_fd)) >+ return; /* Valgrind internal */ >+ > while(i) { > if(i->fd == fd) { > if(i->prev) >@@ -311,8 +525,8 @@ > if(i->next) > i->next->prev = i->prev; > if(i->pathname) >- VG_(free) (i->pathname); >- VG_(free) (i); >+ VG_(arena_free) (VG_AR_CORE, i->pathname); >+ VG_(arena_free) (VG_AR_CORE, i); > fd_count--; > break; > } >@@ -332,14 +546,14 @@ > { > OpenFd *i; > >- if (fd > VG_MAX_FD) >+ if (fd > VG_(max_fd)) > return; /* Valgrind internal */ > > /* Check to see if this fd is already open. */ > i = allocated_fds; > while (i) { > if (i->fd == fd) { >- if (i->pathname) VG_(free)(i->pathname); >+ if (i->pathname) VG_(arena_free)(VG_AR_CORE, i->pathname); > break; > } > i = i->next; >@@ -347,7 +561,7 @@ > > /* Not already one: allocate an OpenFd */ > if (i == NULL) { >- i = VG_(malloc)(sizeof(OpenFd)); >+ i = VG_(arena_malloc)(VG_AR_CORE, sizeof(OpenFd)); > > i->prev = NULL; > i->next = allocated_fds; >@@ -387,7 +601,7 @@ > VG_(sprintf)(name, "%u.%u.%u.%u:%u", > addr & 0xFF, (addr>>8) & 0xFF, > (addr>>16) & 0xFF, (addr>>24) & 0xFF, >- sa->sin_port); >+ ntohs(sa->sin_port)); > } > } > >@@ -535,7 +749,7 @@ > > if(fno != f) > if(VG_(clo_track_fds)) >- record_fd_open(-1, fno, resolve_fname(fno)); >+ record_fd_open(-1, fno, VG_(resolve_filename)(fno)); > } > > VG_(lseek)(f, d.d_off, VKI_SEEK_SET); >@@ -643,7 +857,7 @@ > > for (i = 0; i < fdc; i++) > if(VG_(clo_track_fds)) >- record_fd_open (tid, fds[i], resolve_fname(fds[i])); >+ record_fd_open (tid, fds[i], VG_(resolve_filename)(fds[i])); > } > > cm = CMSG_NXTHDR(msg, cm); >@@ -739,11 +953,11 @@ > void buf_and_len_pre_check( ThreadId tid, Addr buf_p, Addr buflen_p, > Char* buf_s, Char* buflen_s ) > { >- if (VG_(track_events).pre_mem_write) { >+ if (VG_(defined_pre_mem_write)()) { > UInt buflen_in = deref_UInt( tid, buflen_p, buflen_s); > if (buflen_in > 0) { >- VG_(track_events).pre_mem_write ( Vg_CoreSysCall, >- tid, buf_s, buf_p, buflen_in ); >+ SK_(pre_mem_write) ( Vg_CoreSysCall, >+ tid, buf_s, buf_p, buflen_in ); > } > } > } >@@ -752,10 +966,10 @@ > void buf_and_len_post_check( ThreadId tid, Int res, > Addr buf_p, Addr buflen_p, Char* s ) > { >- if (!VG_(is_kerror)(res) && VG_(track_events).post_mem_write) { >+ if (!VG_(is_kerror)(res) && VG_(defined_post_mem_write)()) { > UInt buflen_out = deref_UInt( tid, buflen_p, s); > if (buflen_out > 0 && buf_p != (Addr)NULL) { >- VG_(track_events).post_mem_write ( buf_p, buflen_out ); >+ SK_(post_mem_write) ( buf_p, buflen_out ); > } > } > } >@@ -764,20 +978,76 @@ > Data seg end, for brk() > ------------------------------------------------------------------ */ > >-/* Records the current end of the data segment so we can make sense of >- calls to brk(). */ >-static >-Addr curr_dataseg_end; >- >-void VG_(init_dataseg_end_for_brk) ( void ) >+static Addr do_brk(Addr newbrk) > { >- curr_dataseg_end = (Addr)VG_(brk)(0); >- if (curr_dataseg_end == (Addr)(-1)) >- VG_(core_panic)("can't determine data-seg end for brk()"); >+ Addr ret = VG_(brk_limit); >+ static const Bool debug = False; >+ Segment *seg; >+ >+ if (debug) >+ VG_(printf)("do_brk: brk_base=%p brk_limit=%p newbrk=%p\n", >+ VG_(brk_base), VG_(brk_limit), newbrk); >+ >+ if (newbrk < VG_(brk_base) || newbrk >= VG_(client_end)) >+ return VG_(brk_limit); >+ >+ /* brk isn't allowed to grow over anything else */ >+ seg = VG_(find_segment)(VG_(brk_limit)); >+ >+ vg_assert(seg != NULL); >+ > if (0) >- VG_(printf)("DS END is %p\n", (void*)curr_dataseg_end); >+ VG_(printf)("brk_limit=%p seg->addr=%p seg->end=%p\n", >+ VG_(brk_limit), seg->addr, seg->addr+seg->len); >+ vg_assert(VG_(brk_limit) >= seg->addr && VG_(brk_limit) <= (seg->addr + seg->len)); >+ >+ seg = VG_(next_segment)(seg); >+ if (seg != NULL && newbrk > seg->addr) >+ return VG_(brk_limit); >+ >+ if (PGROUNDDN(newbrk) != PGROUNDDN(VG_(brk_limit))) { >+ Addr current = PGROUNDUP(VG_(brk_limit)); >+ Addr newaddr = PGROUNDUP(newbrk); >+ >+ /* new brk in a new page - fix the mappings */ >+ if (newbrk > VG_(brk_limit)) { >+ >+ if (debug) >+ VG_(printf)(" extending brk: current=%p newaddr=%p delta=%d\n", >+ current, newaddr, newaddr-current); >+ >+ if (newaddr == current) { >+ ret = newbrk; >+ } else if (VG_(mmap)((void *)current , newaddr-current, >+ VKI_PROT_READ | VKI_PROT_WRITE | VKI_PROT_EXEC, >+ VKI_MAP_PRIVATE | VKI_MAP_ANONYMOUS | VKI_MAP_FIXED | VKI_MAP_CLIENT, >+ -1, 0) >= 0) { >+ VG_(map_segment)(current, newaddr-current, VKI_PROT_READ|VKI_PROT_WRITE|VKI_PROT_EXEC, >+ SF_FIXED|SF_BRK); >+ ret = newbrk; >+ } >+ } else { >+ vg_assert(newbrk < VG_(brk_limit)); >+ >+ if (debug) >+ VG_(printf)(" shrinking brk: current=%p newaddr=%p delta=%d\n", >+ current, newaddr, current-newaddr); >+ >+ if (newaddr != current) { >+ VG_(munmap)((void *)newaddr, current - newaddr); >+ VG_(unmap_range)(newaddr, current-newaddr); >+ } >+ ret = newbrk; >+ } >+ } else >+ ret = newbrk; >+ >+ VG_(brk_limit) = ret; >+ >+ return ret; > } > >+ > /* --------------------------------------------------------------------- > Vet file descriptors for sanity > ------------------------------------------------------------------ */ >@@ -785,7 +1055,7 @@ > /* Return true if we're allowed to use or create this fd */ > static Bool fd_allowed(Int fd, const Char *syscall, ThreadId tid) > { >- if (fd < 0 || fd > VG_MAX_FD || fd == VG_(clo_logfile_fd)) { >+ if (fd < 0 || fd > VG_(max_fd) || fd == VG_(clo_logfile_fd)) { > VG_(message)(Vg_UserMsg, > "Warning: invalid file descriptor %d in syscall %s()", > fd, syscall); >@@ -813,7 +1083,6 @@ > #define POST(x) \ > static void after_##x(ThreadId tid, ThreadState *tst) > >-#define STR(x) #x > #define PREALIAS(new, old) \ > PRE(new) __attribute__((alias(STR(before_##old)))) > #define POSTALIAS(new, old) \ >@@ -838,15 +1107,6 @@ > VG_(core_panic)("syscall exit() not caught by the scheduler?!"); > } > >-PRE(clone) >-{ >- VG_(unimplemented) >- ("clone(): not supported by Valgrind.\n " >- "We do now support programs linked against\n " >- "libpthread.so, though. Re-run with -v and ensure that\n " >- "you are picking up Valgrind's implementation of libpthread.so."); >-} >- > PRE(ptrace) > { > /* long ptrace (enum __ptrace_request request, pid_t pid, >@@ -976,6 +1236,33 @@ > } > } > >+PRE(set_thread_area) >+{ >+ MAYBE_PRINTF("set_thread_area ( %p )\n", arg1); >+ >+ SYSCALL_TRACK( pre_mem_read, tid, >+ "set_thread_area(ptr)", arg1, >+ sizeof(struct vki_modify_ldt_ldt_s) ); >+ >+ /* "do" the syscall ourselves; the kernel never sees it */ >+ res = VG_(sys_set_thread_area)( tid, (void *)arg1 ); >+} >+ >+PRE(get_thread_area) >+{ >+ MAYBE_PRINTF("get_thread_area ( %p )\n", arg1); >+ SYSCALL_TRACK( pre_mem_write, tid, >+ "get_thread_area(ptr)", arg1, >+ sizeof(struct vki_modify_ldt_ldt_s) ); >+ >+ /* "do" the syscall ourselves; the kernel never sees it */ >+ res = VG_(sys_get_thread_area)( tid, (void *)arg1 ); >+ >+ if (!VG_(is_kerror)(res)) { >+ VG_TRACK( post_mem_write, arg1, sizeof(struct vki_modify_ldt_ldt_s) ); >+ } >+} >+ > PRE(setresgid) > { > /* int setresgid(gid_t rgid, gid_t egid, gid_t sgid); */ >@@ -1261,15 +1548,11 @@ > PRE(mremap) > { > /* void* mremap(void * old_address, size_t old_size, >- size_t new_size, unsigned long flags); */ >- MAYBE_PRINTF("mremap ( %p, %d, %d, 0x%x )\n", >- arg1, arg2, arg3, arg4); >- SYSCALL_TRACK( pre_mem_write, tid, "mremap(old_address)", arg1, arg2 ); >-} >- >-POST(mremap) >-{ >- mremap_segment( arg1, arg2, (Addr)res, arg3 ); >+ size_t new_size, unsigned long flags, void * new_address); */ >+ MAYBE_PRINTF("mremap ( %p, %d, %d, 0x%x, %p )\n", >+ arg1, arg2, arg3, arg4, arg5); >+ >+ res = mremap_segment((Addr)arg1, arg2, (Addr)arg5, arg3, arg4, tid); > } > > PRE(nice) >@@ -1563,21 +1846,137 @@ > its own new thread.) */ > VG_(nuke_all_threads_except)( VG_INVALID_THREADID ); > >- /* Make any binding for LD_PRELOAD disappear, so that child >- processes don't get traced into. */ >- if (!VG_(clo_trace_children)) { >+ { >+ /* Make the LD_LIBRARY_PATH/LD_PRELOAD disappear so that the >+ child doesn't get our libpthread and other stuff. This is >+ done unconditionally, since if we are tracing the child, >+ stage1/2 will set up the appropriate client environment. */ > Int i; > Char** envp = (Char**)arg3; > Char* ld_preload_str = NULL; > Char* ld_library_path_str = NULL; >- for (i = 0; envp[i] != NULL; i++) { >- if (VG_(strncmp)(envp[i], "LD_PRELOAD=", 11) == 0) >- ld_preload_str = &envp[i][11]; >- if (VG_(strncmp)(envp[i], "LD_LIBRARY_PATH=", 16) == 0) >- ld_library_path_str = &envp[i][16]; >+ >+ if (envp != NULL) { >+ Char *buf; >+ >+ for (i = 0; envp[i] != NULL; i++) { >+ if (VG_(strncmp)(envp[i], "LD_PRELOAD=", 11) == 0) >+ ld_preload_str = &envp[i][11]; >+ if (VG_(strncmp)(envp[i], "LD_LIBRARY_PATH=", 16) == 0) >+ ld_library_path_str = &envp[i][16]; >+ } >+ >+ buf = VG_(arena_malloc)(VG_AR_CORE, VG_(strlen)(VG_(libdir)) + 20); >+ >+ VG_(sprintf)(buf, "%s*/vg_inject.so", VG_(libdir)); >+ VG_(mash_colon_env)(ld_preload_str, buf); >+ >+ VG_(sprintf)(buf, "%s*/vgpreload_*.so", VG_(libdir)); >+ VG_(mash_colon_env)(ld_preload_str, buf); >+ >+ VG_(sprintf)(buf, "%s*", VG_(libdir)); >+ VG_(mash_colon_env)(ld_library_path_str, buf); >+ >+ VG_(env_unsetenv)(envp, VALGRINDCLO); >+ >+ /* XXX if variable becomes empty, remove it completely? */ > } >- VG_(mash_LD_PRELOAD_and_LD_LIBRARY_PATH)( >- ld_preload_str, ld_library_path_str ); >+ } >+ >+ if (VG_(clo_trace_children)) { >+ /* If we're tracing the children, then we need to start it >+ with our starter+arguments. >+ */ >+ Int i; >+ Char *exec = (Char *)arg1; >+ Char **env = (Char **)arg3; >+ Char *cp; >+ Char *exename; >+ Bool sawexec = False; >+ Char *optvar; >+ Int optlen; >+ >+ optlen = 1; >+ for(i = 0; i < VG_(vg_argc); i++) >+ optlen += VG_(strlen)(VG_(vg_argv)[i]) + 1; >+ >+ /* All these are leaked - we're either going to exec, or panic >+ when we fail. */ >+ exename = VG_(arena_malloc)(VG_AR_CORE, 64); >+ exec = VG_(arena_malloc)(VG_AR_CORE, VG_(strlen)(exec) + 7 /* --exec= */ + 1 /* \0 */); >+ >+ VG_(sprintf)(exec, "--exec=%s", (Char *)arg1); >+ VG_(sprintf)(exename, "/proc/self/fd/%d", VG_(vgexecfd)); >+ >+ optlen += VG_(strlen)(exec)+1; >+ >+ optvar = VG_(arena_malloc)(VG_AR_CORE, optlen); >+ >+ /* valgrind arguments */ >+ cp = optvar; >+ >+ for(i = 1; i < VG_(vg_argc); i++) { >+ Char *arg = VG_(vg_argv)[i]; >+ Int len; >+ >+ if (VG_(memcmp)(arg, "--exec=", 7) == 0) { >+ /* replace existing --exec= arg */ >+ sawexec = True; >+ arg = exec; >+ } else if (VG_(strcmp)(VG_(vg_argv)[i], "--") == 0) >+ break; >+ >+ len = VG_(strlen)(arg); >+ VG_(memcpy)(cp, arg, len); >+ cp += len; >+ *cp++ = '\01'; >+ } >+ >+ if (!sawexec) { >+ Int execlen = VG_(strlen)(exec); >+ VG_(memcpy)(cp, exec, execlen); >+ cp += execlen; >+ *cp++ = '\01'; >+ } >+ *cp = '\0'; >+ >+ VG_(env_setenv)(&env, VALGRINDCLO, optvar); >+ >+ arg1 = (UInt)exename; >+ arg3 = (UInt)env; >+ } >+ >+ if (0) { >+ Char **cpp; >+ >+ VG_(printf)("exec: %s\n", (Char *)arg1); >+ for(cpp = (Char **)arg2; cpp && *cpp; cpp++) >+ VG_(printf)("argv: %s\n", *cpp); >+ for(cpp = (Char **)arg3; cpp && *cpp; cpp++) >+ VG_(printf)("env: %s\n", *cpp); >+ } >+ >+ /* Set our real sigmask to match the client's sigmask so that the >+ exec'd child will get the right mask. First we need to clear >+ out any pending signals so they they don't get delivered, which >+ would confuse things. >+ >+ XXX This is a bug - the signals should remain pending, and be >+ delivered to the new process after exec. There's also a >+ race-condition, since if someone delivers us a signal between >+ the sigprocmask and the execve, we'll still get the signal. Oh >+ well. >+ */ >+ { >+ vki_ksigset_t allsigs; >+ vki_ksiginfo_t info; >+ static const struct vki_timespec zero = { 0, 0 }; >+ >+ VG_(ksigfillset)(&allsigs); >+ while(VG_(ksigtimedwait)(&allsigs, &info, &zero) > 0) >+ ; >+ >+ VG_(ksigprocmask)(VKI_SIG_SETMASK, &tst->sig_mask, NULL); > } > > res = VG_(do_syscall)(__NR_execve, arg1, arg2, arg3); >@@ -1605,6 +2004,8 @@ > > PRE(brk) > { >+ Addr brk_limit = VG_(brk_limit); >+ > /* libc says: int brk(void *end_data_segment); > kernel says: void* brk(void* end_data_segment); (more or less) > >@@ -1621,28 +2022,26 @@ > Both will seg fault if you shrink it back into a text segment. > */ > MAYBE_PRINTF("brk ( %p ) --> ",arg1); >-} > >-POST(brk) >-{ >+ res = do_brk(arg1); >+ > MAYBE_PRINTF("0x%x\n", res); > > if (res == arg1) { > /* brk() succeeded */ >- if (res < curr_dataseg_end) { >+ if (res < brk_limit) { > /* successfully shrunk the data segment. */ > VG_TRACK( die_mem_brk, (Addr)arg1, >- curr_dataseg_end-arg1 ); >+ brk_limit-arg1 ); > } else >- if (res > curr_dataseg_end && res != 0) { >+ if (res > brk_limit) { > /* successfully grew the data segment */ >- VG_TRACK( new_mem_brk, curr_dataseg_end, >- arg1-curr_dataseg_end ); >+ VG_TRACK( new_mem_brk, brk_limit, >+ arg1-brk_limit ); > } >- curr_dataseg_end = res; > } else { > /* brk() failed */ >- vg_assert(curr_dataseg_end == res); >+ vg_assert(brk_limit == res); > } > } > >@@ -1699,7 +2098,7 @@ > res = -VKI_EMFILE; > } else { > if(VG_(clo_track_fds)) >- record_fd_open(tid, res, resolve_fname(res)); >+ record_fd_open(tid, res, VG_(resolve_filename)(res)); > } > } > >@@ -1717,7 +2116,7 @@ > VG_(getpid)(), > arg1, arg2, res); > if(VG_(clo_track_fds)) >- record_fd_open(tid, res, resolve_fname(res)); >+ record_fd_open(tid, res, VG_(resolve_filename)(res)); > } > > PRE(fcntl) >@@ -1729,8 +2128,8 @@ > POST(fcntl) > { > if (arg2 == VKI_F_DUPFD) >- if(VG_(clo_track_fds)) >- record_fd_open(tid, res, resolve_fname(res)); >+ if (VG_(clo_track_fds)) >+ record_fd_open(tid, res, VG_(resolve_filename)(res)); > } > > PRE(fchdir) >@@ -1763,7 +2162,7 @@ > { > if (arg2 == VKI_F_DUPFD) > if(VG_(clo_track_fds)) >- record_fd_open(tid, res, resolve_fname(res)); >+ record_fd_open(tid, res, VG_(resolve_filename)(res)); > } > > PRE(fstat) >@@ -1821,6 +2220,24 @@ > } > } > >+PRE(clone) >+{ >+ MAYBE_PRINTF("clone ( %d, %p, %p, %p, %p )\n",arg1,arg2,arg3,arg4,arg5); >+ >+ if (arg2 == 0 && >+ arg1 == (VKI_CLONE_CHILD_CLEARTID|VKI_CLONE_CHILD_SETTID|VKI_SIGCHLD)) { >+ before_fork(tid, tst); >+ res = VG_(do_syscall)(SYSNO, arg1, arg2, arg3, arg4, arg5); >+ after_fork(tid, tst); >+ } else { >+ VG_(unimplemented) >+ ("clone(): not supported by Valgrind.\n " >+ "We do now support programs linked against\n " >+ "libpthread.so, though. Re-run with -v and ensure that\n " >+ "you are picking up Valgrind's implementation of libpthread.so."); >+ } >+} >+ > PRE(fsync) > { > /* int fsync(int fd); */ >@@ -2176,9 +2593,20 @@ > } > case 21: /* IPCOP_shmat */ > { >+ UInt shmid = arg2; >+ UInt segmentSize = get_shm_size ( shmid ); >+ >+ /* If they didn't ask for a particular address, then place it >+ like an mmap. */ >+ if (arg5 == 0) >+ arg5 = VG_(find_map_space)(0, segmentSize, True); >+ else if (!valid_client_addr(arg5, segmentSize, tid, "shmat")) >+ res = -VKI_EINVAL; > break; > } > case 22: /* IPCOP_shmdt */ >+ if (!valid_client_addr(arg1, 1, tid, "shmdt")) >+ res = -VKI_EINVAL; > break; > case 23: /* IPCOP_shmget */ > break; >@@ -2287,10 +2715,9 @@ > case 21: /* IPCOP_shmat */ > { > Int shmid = arg2; >- /*Int shmflag = arg3;*/ >+ Int shmflag = arg3; > Addr addr; > >- > /* force readability. before the syscall it is > * indeed uninitialized, as can be seen in > * glibc/sysdeps/unix/sysv/linux/shmat.c */ >@@ -2300,21 +2727,31 @@ > if ( addr > 0 ) { > UInt segmentSize = get_shm_size ( shmid ); > if ( segmentSize > 0 ) { >+ UInt prot; > /* we don't distinguish whether it's read-only or > * read-write -- it doesn't matter really. */ > VG_TRACK( new_mem_mmap, addr, segmentSize, > True, True, False ); >+ >+ prot = VKI_PROT_READ|VKI_PROT_WRITE; >+ if (!(shmflag & 010000)) /* = SHM_RDONLY */ >+ prot &= ~VKI_PROT_WRITE; >+ VG_(map_segment)(addr, segmentSize, prot, >+ SF_SHARED | SF_SHM); > } > } > break; > } > case 22: /* IPCOP_shmdt */ >- /* ### FIXME: this should call make_noaccess on the >- * area passed to shmdt. But there's no way to >- * figure out the size of the shared memory segment >- * just from the address... Maybe we want to keep a >- * copy of the exiting mappings inside valgrind? */ >+ { >+ Segment *s = VG_(find_segment)(arg1); >+ >+ if (s != NULL && (s->flags & SF_SHM) && VG_(seg_contains)(s, arg1, 1)) { >+ VG_TRACK( die_mem_munmap, s->addr, s->len ); >+ VG_(unmap_range)(s->addr, s->len); >+ } > break; >+ } > case 23: /* IPCOP_shmget */ > break; > case 24: /* IPCOP_shmctl */ >@@ -3173,7 +3610,7 @@ > PRE(lstat) > { > /* int lstat(const char *file_name, struct stat *buf); */ >- MAYBE_PRINTF("lstat ( %p, %p )\n",arg1,arg2); >+ MAYBE_PRINTF("lstat ( %p \"%s\", %p )\n",arg1,arg1,arg2); > SYSCALL_TRACK( pre_mem_read_asciiz, tid, "lstat(file_name)", arg1 ); > SYSCALL_TRACK( pre_mem_write, tid, "lstat(buf)", arg2, > sizeof(struct stat) ); >@@ -3189,7 +3626,7 @@ > PRE(lstat64) > { > /* int lstat64(const char *file_name, struct stat64 *buf); */ >- MAYBE_PRINTF("lstat64 ( %p, %p )\n",arg1,arg2); >+ MAYBE_PRINTF("lstat64 ( %p \"%s\", %p )\n",arg1,arg1,arg2); > SYSCALL_TRACK( pre_mem_read_asciiz, tid, "lstat64(file_name)", arg1 ); > SYSCALL_TRACK( pre_mem_write, tid, "lstat64(buf)", arg2, > sizeof(struct stat64) ); >@@ -3209,31 +3646,42 @@ > SYSCALL_TRACK( pre_mem_read_asciiz, tid, "mkdir(pathname)", arg1 ); > } > >-void check_mmap_start(ThreadState* tst, Addr start, Int flags) >-{ >- /* Refuse to mmap the first 64KB of memory, so that the cheap sanity test >- for tools using shadow memory works. */ >- if (start < 65536 && (flags & VKI_MAP_FIXED)) >- tst->m_eax = -VKI_EINVAL; >-} >- > PRE(mmap2) > { > /* My impression is that this is exactly like __NR_mmap > except that all 6 args are passed in regs, rather than in >- a memory-block. */ >+ a memory-block. >+ >+ Almost. The big difference is that the file offset is specified >+ in pagesize units rather than bytes, so that it can be used for >+ files bigger than 2^32 bytes. - JSGF >+ */ > /* void* mmap(void *start, size_t length, int prot, > int flags, int fd, off_t offset); > */ > MAYBE_PRINTF("mmap2 ( %p, %d, %d, %d, %d, %d )\n", > arg1, arg2, arg3, arg4, arg5, arg6 ); > >- check_mmap_start(tst, arg1, arg4); >+ if (arg4 & VKI_MAP_FIXED) { >+ if (!valid_client_addr(arg1, arg2, tid, "mmap2")) >+ res = -VKI_ENOMEM; >+ } else { >+ arg1 = VG_(find_map_space)(arg1, arg2, True); >+ arg4 |= VKI_MAP_FIXED; >+ if (arg1 == 0) >+ res = -VKI_ENOMEM; >+ } > } > > POST(mmap2) > { >- mmap_segment( (Addr)res, arg2, arg3, arg5 ); >+ if (!VG_(is_kerror)(res)) { >+ if (!valid_client_addr(res, arg2, tid, "mmap2")) { >+ VG_(munmap)((void *)res, arg2); >+ res = -VKI_ENOMEM; >+ } else >+ mmap_segment( (Addr)res, arg2, arg3, arg4, arg5, arg6 * (ULong)VKI_BYTES_PER_PAGE ); >+ } > } > > PRE(mmap) >@@ -3256,19 +3704,39 @@ > MAYBE_PRINTF("mmap ( %p, %d, %d, %d, %d, %d )\n", > a1, a2, a3, a4, a5, a6 ); > >- check_mmap_start(tst, a1, a4); >-} >- >-POST(mmap) >-{ >- UInt* arg_block = (UInt*)arg1; >- UInt a2, a3, a5; >- >- a2 = arg_block[1]; >- a3 = arg_block[2]; >- a5 = arg_block[4]; >+ if (a4 & VKI_MAP_FIXED) { >+ if (!valid_client_addr(a1, a2, tid, "mmap")) { >+ MAYBE_PRINTF("mmap failing: %p-%p\n", a1, a1+a2); >+ res = -VKI_ENOMEM; >+ } >+ } else { >+ a1 = VG_(find_map_space)(arg_block[0], arg_block[1], True); >+ if (a1 == 0) >+ res = -VKI_ENOMEM; >+ else >+ a4 |= VKI_MAP_FIXED; >+ } >+ >+ if (res != -VKI_ENOMEM) { >+ UInt new_arg_block[6]; >+ >+ new_arg_block[0] = a1; >+ new_arg_block[1] = a2; >+ new_arg_block[2] = a3; >+ new_arg_block[3] = a4; >+ new_arg_block[4] = a5; >+ new_arg_block[5] = a6; >+ >+ res = VG_(do_syscall)(__NR_mmap, new_arg_block); > >- mmap_segment( (Addr)res, a2, a3, a5 ); >+ if (!VG_(is_kerror)(res)) { >+ if (!valid_client_addr(res, a2, tid, "mmap")) { >+ VG_(munmap)((void *)res, a2); >+ res = -VKI_ENOMEM; >+ } else >+ mmap_segment( (Addr)res, a2, a3, a4, a5, a6 ); >+ } >+ } > } > > PRE(mprotect) >@@ -3276,6 +3744,9 @@ > /* int mprotect(const void *addr, size_t len, int prot); */ > /* should addr .. addr+len-1 be checked before the call? */ > MAYBE_PRINTF("mprotect ( %p, %d, %d )\n", arg1,arg2,arg3); >+ >+ if (!valid_client_addr(arg1, arg2, tid, "mprotect")) >+ res = -VKI_ENOMEM; > } > > POST(mprotect) >@@ -3288,6 +3759,9 @@ > /* int munmap(void *start, size_t length); */ > /* should start .. start+length-1 be checked before the call? */ > MAYBE_PRINTF("munmap ( %p, %d )\n", arg1,arg2); >+ >+ if (!valid_client_addr(arg1, arg2, tid, "munmap")) >+ res = -VKI_EINVAL; > } > > POST(munmap) >@@ -3295,6 +3769,20 @@ > munmap_segment( arg1, arg2 ); > } > >+PRE(mincore) >+{ >+ /* int mincore(void *start, size_t length, unsigned char *vec); */ >+ MAYBE_PRINTF("mincore ( %p, %d, %p )\n", arg1,arg2,arg3); >+ SYSCALL_TRACK(pre_mem_write, tid, "mincore(vec)", >+ arg3, (arg2 + 4096 - 1) / 4096); >+} >+ >+POST(mincore) >+{ >+ if (!VG_(is_kerror)(res)) >+ VG_TRACK( post_mem_write, arg3, (arg2 + 4096 - 1) / 4096 ); >+} >+ > PRE(nanosleep) > { > /* int nanosleep(const struct timespec *req, struct timespec *rem); */ >@@ -3350,7 +3838,7 @@ > res = -VKI_EMFILE; > } else { > if(VG_(clo_track_fds)) >- record_fd_open(tid, res, VG_(strdup)((Char*)arg1)); >+ record_fd_open(tid, res, VG_(arena_strdup)(VG_AR_CORE, (Char*)arg1)); > } > MAYBE_PRINTF("%d\n",res); > } >@@ -3394,7 +3882,7 @@ > res = -VKI_EMFILE; > } else { > if(VG_(clo_track_fds)) >- record_fd_open(tid, res, VG_(strdup)((Char*)arg1)); >+ record_fd_open(tid, res, VG_(arena_strdup)(VG_AR_CORE, (Char*)arg1)); > } > MAYBE_PRINTF("%d\n",res); > } >@@ -3457,6 +3945,52 @@ > } > } > >+PRE(epoll_create) >+{ >+ /* int epoll_create(int size) */ >+ MAYBE_PRINTF("epoll_create ( %d )\n", arg1); >+} >+ >+POST(epoll_create) >+{ >+ if (!fd_allowed(res, "open", tid)) { >+ VG_(close)(res); >+ res = -VKI_EMFILE; >+ } else { >+ if (VG_(clo_track_fds)) >+ record_fd_open (tid, res, NULL); >+ } >+} >+ >+PRE(epoll_ctl) >+{ >+ /* int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event) */ >+ static const char* epoll_ctl_s[3] = { >+ "EPOLL_CTL_ADD", >+ "EPOLL_CTL_DEL", >+ "EPOLL_CTL_MOD" >+ }; >+ MAYBE_PRINTF("epoll_ctl ( %d, %s, %d, %p )\n", >+ arg1, ( arg2<3 ? epoll_ctl_s[arg2] : "?" ), arg3, arg4); >+ SYSCALL_TRACK( pre_mem_read, tid, "epoll_ctl(event)", >+ arg4, sizeof(struct vki_epoll_event) ); >+} >+ >+PRE(epoll_wait) >+{ >+ /* int epoll_wait(int epfd, struct epoll_event * events, >+ int maxevents, int timeout) */ >+ MAYBE_PRINTF("epoll_wait ( %d, %p, %d, %d )\n", arg1, arg2, arg3, arg4); >+ SYSCALL_TRACK( pre_mem_write, tid, "epoll_wait(events)", >+ arg2, sizeof(struct vki_epoll_event)*arg3); >+} >+ >+POST(epoll_wait) >+{ >+ if (res > 0) >+ VG_TRACK( post_mem_write, arg2, sizeof(struct vki_epoll_event)*res ) ; >+} >+ > PRE(readlink) > { > /* int readlink(const char *path, char *buf, size_t bufsiz); */ >@@ -3917,7 +4451,7 @@ > switch (arg1 /* request */) { > > case SYS_SOCKETPAIR: >- /* XXX TODO: check return fd against VG_MAX_FD */ >+ /* XXX TODO: check return fd against VG_(max_fd) */ > VG_TRACK( post_mem_write, ((UInt*)arg2)[3], 2*sizeof(int) ); > if(VG_(clo_track_fds)) { > record_fd_open(tid, ((UInt*)((UInt*)arg2)[3])[0], NULL); >@@ -4174,7 +4708,7 @@ > PRE(truncate) > { > /* int truncate(const char *path, size_t length); */ >- MAYBE_PRINTF("truncate ( %p, %d )\n", arg1,arg2); >+ MAYBE_PRINTF("truncate ( %p \"%s\", %d )\n", arg1,arg1,arg2); > SYSCALL_TRACK( pre_mem_read_asciiz, tid, "truncate(path)", arg1 ); > } > >@@ -4187,7 +4721,7 @@ > PRE(unlink) > { > /* int unlink(const char *pathname) */ >- MAYBE_PRINTF("ulink ( %p )\n",arg1); >+ MAYBE_PRINTF("unlink ( %p \"%s\" )\n",arg1, arg1); > SYSCALL_TRACK( pre_mem_read_asciiz, tid, "unlink(pathname)", arg1 ); > } > >@@ -4336,6 +4870,27 @@ > sizeof(struct timeval) ); > } > >+PRE(futex) >+{ >+ /* int futex(void *futex, int op, int val, const struct timespec *timeout); */ >+ MAYBE_PRINTF("futex ( %p, %d, %d, %p, %p )\n", arg1,arg2,arg3,arg4,arg5); >+ SYSCALL_TRACK( pre_mem_read, tid, "futex(futex)", arg1, sizeof(int) ); >+ if (arg2 == VKI_FUTEX_WAIT && arg4 != (UInt)NULL) >+ SYSCALL_TRACK( pre_mem_read, tid, "futex(timeout)", arg4, >+ sizeof(struct timespec) ); >+ if (arg2 == VKI_FUTEX_REQUEUE) >+ SYSCALL_TRACK( pre_mem_read, tid, "futex(futex2)", arg4, sizeof(int) ); >+} >+ >+POST(futex) >+{ >+ if (!VG_(is_kerror)(res)) { >+ VG_TRACK( post_mem_write, arg1, sizeof(int) ); >+ if (arg2 == VKI_FUTEX_FD && VG_(clo_track_fds)) >+ record_fd_open(tid, res, NULL); >+ } >+} >+ > #define SIGNAL_SIMULATION 1 > > PRE(pause) >@@ -4511,6 +5066,10 @@ > { > VG_(message) > (Vg_DebugMsg,"WARNING: unhandled syscall: %d", tst->m_eax); >+ if (VG_(clo_verbosity) > 1) { >+ ExeContext *ec = VG_(get_ExeContext)(tid); >+ VG_(pp_ExeContext)(ec); >+ } > VG_(message) > (Vg_DebugMsg,"Do not panic. You may be able to fix this easily."); > VG_(message) >@@ -4532,8 +5091,13 @@ > SYSB_(clone, False), > > SYSB_(modify_ldt, False), >+ SYSB_(set_thread_area, False), >+ SYSB_(get_thread_area, False), > > SYSB_(execve, False), >+ SYSB_(brk, False), >+ SYSB_(mmap, False), >+ SYSB_(mremap, False), > > #if SIGNAL_SIMULATION > SYSBA(sigaltstack, False), >@@ -4581,7 +5145,6 @@ > SYSB_(personality, False), > SYSB_(chroot, False), > SYSB_(madvise, True), >- SYSBA(mremap, False), > SYSB_(nice, False), > SYSB_(setresgid32, False), > SYSB_(setfsuid32, False), >@@ -4620,7 +5183,6 @@ > SYSBA(capget, False), > SYSB_(capset, False), > SYSB_(access, False), >- SYSBA(brk, False), > SYSB_(chdir, False), > SYSB_(chmod, False), > SYSB_(chown32, False), >@@ -4674,10 +5236,9 @@ > SYSBA(lstat, False), > SYSBA(lstat64, False), > SYSB_(mkdir, True), >- SYSBA(mmap2, False), >- SYSBA(mmap, False), > SYSBA(mprotect, False), > SYSBA(munmap, False), >+ SYSBA(mincore, False), > SYSBA(nanosleep, True), > SYSB_(_newselect, True), > SYSBA(open, True), >@@ -4686,6 +5247,9 @@ > SYSBA(creat, True), > SYSBA(pipe, False), > SYSBA(poll, True), >+ SYSBA(epoll_create, False), >+ SYSB_(epoll_ctl, False), >+ SYSBA(epoll_wait, True), > SYSBA(readlink, False), > SYSBA(readv, True), > SYSB_(rename, False), >@@ -4729,7 +5293,9 @@ > SYSB_(writev, True), > SYSB_(prctl, True), > SYSBA(adjtimex, False), >+ SYSBA(mmap2, False), > SYSBA(clock_gettime, False), >+ SYSBA(futex, True), > > /* new signal handling makes these normal blocking syscalls */ > SYSB_(pause, True), >@@ -4869,12 +5435,13 @@ > } > > >-void VG_(post_syscall) ( ThreadId tid ) >+void VG_(post_syscall) ( ThreadId tid, Bool restart ) > { > ThreadState* tst; > UInt syscallno; > const struct sys_info *sys; > Bool special = False; >+ Bool restarted = False; > void *pre_res; > > VGP_PUSHCC(VgpCoreSysWrap); >@@ -4899,27 +5466,45 @@ > special = True; > } > >- if (!VG_(is_kerror)(tst->m_eax) && sys->after != NULL) >- (sys->after)(tst->tid, tst); >- >- /* Do any post-syscall actions */ >- if (VG_(needs).syscall_wrapper) { >- VGP_PUSHCC(VgpSkinSysWrap); >- SK_(post_syscall)(tid, syscallno, pre_res, tst->m_eax, /*isBlocking*/True); // did block >- VGP_POPCC(VgpSkinSysWrap); >- } >- > if (tst->m_eax == -VKI_ERESTARTSYS) { >- /* Applications never expect to see this, so we should actually >- restart the syscall (it means the signal happened before the >- syscall made any progress, so we can safely restart it and >- pretend the signal happened before the syscall even >- started) */ >- VG_(restart_syscall)(tid); >+ /* Applications never expect to see this, so we should either >+ restart the syscall or fail it with EINTR, depending on what >+ our caller wants. Generally they'll want to restart, but if >+ client set the signal state to not restart, then we fail with >+ EINTR. Either way, ERESTARTSYS means the syscall made no >+ progress, and so can be failed or restarted without >+ consequence. */ >+ if (0) >+ VG_(printf)("syscall %d returned ERESTARTSYS; restart=%d\n", >+ syscallno, restart); >+ >+ if (restart) { >+ restarted = True; >+ VG_(restart_syscall)(tid); >+ } else >+ tst->m_eax = -VKI_EINTR; >+ } >+ >+ if (!restarted) { >+ if (!VG_(is_kerror)(tst->m_eax) && sys->after != NULL) >+ (sys->after)(tst->tid, tst); >+ >+ /* Do any post-syscall actions >+ >+ NOTE: this is only called if the syscall completed. If the >+ syscall was restarted, then it will call the Tool's >+ pre_syscall again, without calling post_syscall (ie, more >+ pre's than post's) >+ */ >+ if (VG_(needs).syscall_wrapper) { >+ VGP_PUSHCC(VgpSkinSysWrap); >+ SK_(post_syscall)(tid, syscallno, pre_res, tst->m_eax, /*isBlocking*/True); // did block >+ VGP_POPCC(VgpSkinSysWrap); >+ } > } > > tst->status = VgTs_Runnable; /* runnable again */ >- tst->syscallno = -1; >+ tst->syscallno = -1; /* no current syscall */ > > VGP_POPCC(VgpCoreSysWrap); > } >diff -ruN valgrind-2.1.0/coregrind/vg_to_ucode.c valgrind/coregrind/vg_to_ucode.c >--- valgrind-2.1.0/coregrind/vg_to_ucode.c 2003-12-02 09:25:39.000000000 -0600 >+++ valgrind/coregrind/vg_to_ucode.c 2004-02-11 17:33:27.000000000 -0600 >@@ -1,4 +1,4 @@ >-/* -*- c-basic-offset: 3 -*- */ >+ > /*--------------------------------------------------------------------*/ > /*--- The JITter: translate x86 code to ucode. ---*/ > /*--- vg_to_ucode.c ---*/ >@@ -8,7 +8,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -33,10 +33,280 @@ > > > /*------------------------------------------------------------*/ >-/*--- Renamings of frequently-used global functions. ---*/ >+/*--- Debugging output ---*/ >+/*------------------------------------------------------------*/ >+ >+#define DIP(format, args...) \ >+ if (VG_(print_codegen)) \ >+ VG_(printf)(format, ## args) >+ >+#define DIS(buf, format, args...) \ >+ if (VG_(print_codegen)) \ >+ VG_(sprintf)(buf, format, ## args) >+ >+/*------------------------------------------------------------*/ >+/*--- CPU feature set stuff ---*/ >+/*--- This is a little out of place here, but it will do ---*/ >+/*--- for now. ---*/ > /*------------------------------------------------------------*/ > >-#define dis VG_(print_codegen) >+#define VG_CPU_VENDOR_GENERIC 0 >+#define VG_CPU_VENDOR_INTEL 1 >+#define VG_CPU_VENDOR_AMD 2 >+ >+static Int cpu_vendor = VG_CPU_VENDOR_GENERIC; >+ >+static const struct cpu_vendor { >+ const Char *vendorstr; >+ Int vendorid; >+} cpu_vendors[] = { >+ { "GenuineIntel", VG_CPU_VENDOR_INTEL }, >+ { "AuthenticAMD", VG_CPU_VENDOR_AMD }, >+}; >+ >+static Int cpuid_level = -2; /* -2 -> not initialized */ >+static UInt cpu_features[VG_N_FEATURE_WORDS]; >+ >+/* Standard macro to see if a specific flag is changeable */ >+static inline Bool flag_is_changeable(UInt flag) >+{ >+ UInt f1, f2; >+ >+ asm("pushfl\n\t" >+ "pushfl\n\t" >+ "popl %0\n\t" >+ "movl %0,%1\n\t" >+ "xorl %2,%0\n\t" >+ "pushl %0\n\t" >+ "popfl\n\t" >+ "pushfl\n\t" >+ "popl %0\n\t" >+ "popfl\n\t" >+ : "=&r" (f1), "=&r" (f2) >+ : "ir" (flag)); >+ >+ return ((f1^f2) & flag) != 0; >+} >+ >+ >+/* Probe for the CPUID instruction */ >+static Bool has_cpuid(void) >+{ >+ return flag_is_changeable(EFlagID); >+} >+ >+static inline UInt cpuid_eax(UInt eax) >+{ >+ asm("cpuid" : "=a" (eax) : "0" (eax) : "bx", "cx", "dx"); >+ return eax; >+} >+ >+static inline void cpuid(UInt eax, >+ UInt *eax_ret, UInt *ebx_ret, UInt *ecx_ret, UInt *edx_ret) >+{ >+ UInt ebx, ecx, edx; >+ >+ asm("cpuid" : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) : "0" (eax)); >+ >+ if (eax_ret) >+ *eax_ret = eax; >+ if (ebx_ret) >+ *ebx_ret = ebx; >+ if (ecx_ret) >+ *ecx_ret = ecx; >+ if (edx_ret) >+ *edx_ret = edx; >+} >+ >+static void get_cpu_features(void) >+{ >+ Char vendorstr[13]; >+ Int i; >+ >+ if (!has_cpuid()) { >+ cpuid_level = -1; >+ return; >+ } >+ >+ cpu_features[VG_INT_FEAT] |= (1 << (VG_X86_FEAT_CPUID%32)); >+ >+ cpuid(0, &cpuid_level, (UInt *)&vendorstr[0], (UInt *)&vendorstr[8], (UInt *)&vendorstr[4]); >+ vendorstr[12] = '\0'; >+ >+ for(i = 0; i < sizeof(cpu_vendors)/sizeof(*cpu_vendors); i++) >+ if (VG_(memcmp)(vendorstr, cpu_vendors[i].vendorstr, 12) == 0) { >+ cpu_vendor = cpu_vendors[i].vendorid; >+ break; >+ } >+ >+ if (cpuid_level >= 1) >+ cpuid(1, NULL, NULL, &cpu_features[VG_EXT_FEAT], &cpu_features[VG_X86_FEAT]); >+ >+ switch(cpu_vendor) { >+ case VG_CPU_VENDOR_AMD: >+ /* get AMD-specific flags */ >+ cpuid(0x80000001, NULL, NULL, NULL, &cpu_features[VG_AMD_FEAT]); >+ break; >+ >+ default: >+ break; >+ } >+} >+ >+Bool VG_(cpu_has_feature)(UInt feature) >+{ >+ UInt word = feature / 32; >+ UInt bit = feature % 32; >+ >+ if (cpuid_level == -2) >+ get_cpu_features(); >+ >+ vg_assert(word >= 0 && word < VG_N_FEATURE_WORDS); >+ >+ return !!(cpu_features[word] & (1 << bit)); >+} >+ >+/* The set of features we're willing to support for the client >+ >+ This includes supported instruction set extensions, plus any >+ extensions which don't have any user-mode visible effect (but the >+ client may find interesting). >+ */ >+#define VG_X86_SUPPORTED_FEATURES \ >+ ((1 << VG_X86_FEAT_FPU) | \ >+ (1 << VG_X86_FEAT_VME) | \ >+ (1 << VG_X86_FEAT_DE) | \ >+ (1 << VG_X86_FEAT_PSE) | \ >+ (1 << VG_X86_FEAT_TSC) | \ >+ (0 << VG_X86_FEAT_MSR) | \ >+ (1 << VG_X86_FEAT_PAE) | \ >+ (1 << VG_X86_FEAT_MCE) | \ >+ (1 << VG_X86_FEAT_CX8) | \ >+ (1 << VG_X86_FEAT_APIC) | \ >+ (0 << VG_X86_FEAT_SEP) | \ >+ (1 << VG_X86_FEAT_MTRR) | \ >+ (1 << VG_X86_FEAT_PGE) | \ >+ (1 << VG_X86_FEAT_MCA) | \ >+ (1 << VG_X86_FEAT_CMOV) | \ >+ (1 << VG_X86_FEAT_PAT) | \ >+ (1 << VG_X86_FEAT_PSE36) | \ >+ (0 << VG_X86_FEAT_CLFSH) | \ >+ (1 << VG_X86_FEAT_DS) | \ >+ (1 << VG_X86_FEAT_ACPI) | \ >+ (1 << VG_X86_FEAT_MMX) | \ >+ (1 << VG_X86_FEAT_FXSR) | \ >+ (1 << VG_X86_FEAT_SSE) | \ >+ (1 << VG_X86_FEAT_SSE2) | \ >+ (1 << VG_X86_FEAT_SS) | \ >+ (1 << VG_X86_FEAT_HT) | \ >+ (1 << VG_X86_FEAT_TM) | \ >+ (0 << VG_X86_FEAT_IA64) | \ >+ (1 << VG_X86_FEAT_PBE)) >+ >+#define VG_AMD_SUPPORTED_FEATURES \ >+ ((0 << (VG_AMD_FEAT_SYSCALL % 32)) | \ >+ (0 << (VG_AMD_FEAT_NXP % 32)) | \ >+ (1 << (VG_AMD_FEAT_MMXEXT % 32)) | \ >+ (0 << (VG_AMD_FEAT_FFXSR % 32)) | \ >+ (0 << (VG_AMD_FEAT_LONGMODE % 32)) | \ >+ (0 << (VG_AMD_FEAT_3DNOWEXT % 32)) | \ >+ (0 << (VG_AMD_FEAT_3DNOW % 32)) | \ >+ /* Common bits between standard features and AMD features */ \ >+ (1 << VG_X86_FEAT_FPU) | \ >+ (1 << VG_X86_FEAT_VME) | \ >+ (1 << VG_X86_FEAT_DE) | \ >+ (1 << VG_X86_FEAT_PSE) | \ >+ (1 << VG_X86_FEAT_TSC) | \ >+ (0 << VG_X86_FEAT_MSR) | \ >+ (1 << VG_X86_FEAT_PAE) | \ >+ (1 << VG_X86_FEAT_MCE) | \ >+ (1 << VG_X86_FEAT_CX8) | \ >+ (1 << VG_X86_FEAT_APIC) | \ >+ (1 << VG_X86_FEAT_MTRR) | \ >+ (1 << VG_X86_FEAT_PGE) | \ >+ (1 << VG_X86_FEAT_MCA) | \ >+ (1 << VG_X86_FEAT_CMOV) | \ >+ (1 << VG_X86_FEAT_PAT) | \ >+ (1 << VG_X86_FEAT_PSE36) | \ >+ (1 << VG_X86_FEAT_MMX) | \ >+ (1 << VG_X86_FEAT_FXSR)) >+ >+ >+/* >+ For simulating the cpuid instruction, we will >+ issue a "real" cpuid instruction and then mask out >+ the bits of the features we do not support currently (3dnow mostly). >+ We also claim to not support most CPUID operations. >+ >+ Dirk Mueller <mueller@kde.org> >+ >+ http://www.sandpile.org/ia32/cpuid.htm >+ >+ references: >+ >+ pre-MMX pentium: >+ >+ <werner> cpuid words (0): 0x1 0x756e6547 0x6c65746e 0x49656e69 >+ <werner> cpuid words (1): 0x52b 0x0 0x0 0x1bf >+ >+ Updated to be more extensible about future vendor extensions and >+ vendor-specific parts of CPUID. >+*/ >+void VG_(helperc_CPUID)(UInt op, UInt *eax_ret, UInt *ebx_ret, UInt *ecx_ret, UInt *edx_ret) >+{ >+ UInt eax, ebx, ecx, edx; >+ >+ if (cpuid_level == -2) >+ get_cpu_features(); /* for cpu_vendor */ >+ >+ cpuid(op, &eax, &ebx, &ecx, &edx); >+ >+ /* Common mangling */ >+ switch(op) { >+ case 1: >+ edx &= VG_X86_SUPPORTED_FEATURES; >+ break; >+ >+ case 0xd8000000: { >+ /* Implement some private information at 0xd8000000 */ >+ static const Char valgrind_vendor[] = "ValgrindVCPU"; >+ >+ eax = 0xd8000000; /* max request */ >+ ebx = *(UInt *)&valgrind_vendor[0]; >+ ecx = *(UInt *)&valgrind_vendor[8]; >+ edx = *(UInt *)&valgrind_vendor[4]; >+ } >+ break; >+ } >+ >+ /* Vendor-specific mangling of the results */ >+ switch(cpu_vendor) { >+ case VG_CPU_VENDOR_INTEL: >+ switch(op) { >+ case 1: >+ ecx = 0; /* mask out all extended features for now */ >+ break; >+ >+ case 0x80000001: >+ ebx = ecx = edx = 0; >+ break; >+ } >+ break; >+ >+ case VG_CPU_VENDOR_AMD: >+ switch(op) { >+ case 0x80000001: >+ edx &= VG_AMD_SUPPORTED_FEATURES; >+ break; >+ } >+ break; >+ } >+ >+ *eax_ret = eax; >+ *ebx_ret = ebx; >+ *ecx_ret = ecx; >+ *edx_ret = edx; >+} > > > /*------------------------------------------------------------*/ >@@ -259,7 +529,6 @@ > return 0; /*notreached*/ > } > >- > /*------------------------------------------------------------*/ > /*--- Flag-related helpers. ---*/ > /*------------------------------------------------------------*/ >@@ -298,6 +567,34 @@ > LAST_UINSTR(cb).cond = cond; > } > >+/*------------------------------------------------------------*/ >+/*--- JMP helpers ---*/ >+/*------------------------------------------------------------*/ >+ >+static __inline__ >+void jmp_lit( UCodeBlock* cb, Addr d32 ) >+{ >+ uInstr1 (cb, JMP, 0, Literal, 0); >+ uLiteral(cb, d32); >+ uCond (cb, CondAlways); >+} >+ >+static __inline__ >+void jmp_treg( UCodeBlock* cb, Int t ) >+{ >+ uInstr1 (cb, JMP, 0, TempReg, t); >+ uCond (cb, CondAlways); >+} >+ >+static __inline__ >+void jcc_lit( UCodeBlock* cb, Addr d32, Condcode cond ) >+{ >+ uInstr1 (cb, JMP, 0, Literal, 0); >+ uLiteral (cb, d32); >+ uCond (cb, cond); >+ uFlagsRWU(cb, FlagsOSZACP, FlagsEmpty, FlagsEmpty); >+} >+ > > /*------------------------------------------------------------*/ > /*--- Disassembling addressing modes ---*/ >@@ -352,8 +649,8 @@ > temporary, and the number of bytes in the address mode, are > returned, as a pair (length << 24) | temp. Note that this fn should > not be called if the R/M part of the address denotes a register >- instead of memory. If buf is non-NULL, text of the addressing mode >- is placed therein. */ >+ instead of memory. If VG_(print_codegen) is true, text of the addressing >+ mode is placed therein. */ > > static > UInt disAMode ( UCodeBlock* cb, UChar sorb, Addr eip0, UChar* buf ) >@@ -378,8 +675,7 @@ > { UChar rm = mod_reg_rm; > uInstr2(cb, GET, 4, ArchReg, rm, TempReg, tmp); > handleSegOverride(cb, sorb, tmp); >- if (buf) VG_(sprintf)(buf,"%s(%s)", sorbTxt(sorb), >- nameIReg(4,rm)); >+ DIS(buf, "%s(%s)", sorbTxt(sorb), nameIReg(4,rm)); > return (1<<24 | tmp); > } > >@@ -393,10 +689,9 @@ > UInt d = getSDisp8((Addr)eip); eip++; > uInstr2(cb, GET, 4, ArchReg, rm, TempReg, tmq); > uInstr2(cb, LEA1, 4, TempReg, tmq, TempReg, tmp); >- LAST_UINSTR(cb).lit32 = d; >+ uLiteral(cb, d); > handleSegOverride(cb, sorb, tmp); >- if (buf) VG_(sprintf)(buf,"%s%d(%s)", sorbTxt(sorb), >- d, nameIReg(4,rm)); >+ DIS(buf, "%s%d(%s)", sorbTxt(sorb), d, nameIReg(4,rm)); > return (2<<24 | tmp); > } > >@@ -410,10 +705,9 @@ > UInt d = getUDisp32((Addr)eip); eip += 4; > uInstr2(cb, GET, 4, ArchReg, rm, TempReg, tmq); > uInstr2(cb, LEA1, 4, TempReg, tmq, TempReg, tmp); >- LAST_UINSTR(cb).lit32 = d; >+ uLiteral(cb, d); > handleSegOverride(cb, sorb, tmp); >- if (buf) VG_(sprintf)(buf,"%s0x%x(%s)", sorbTxt(sorb), >- d, nameIReg(4,rm)); >+ DIS(buf, "%s0x%x(%s)", sorbTxt(sorb), d, nameIReg(4,rm)); > return (5<<24 | tmp); > } > >@@ -430,7 +724,7 @@ > uInstr2(cb, MOV, 4, Literal, 0, TempReg, tmp); > uLiteral(cb, d); > handleSegOverride(cb, sorb, tmp); >- if (buf) VG_(sprintf)(buf,"%s(0x%x)", sorbTxt(sorb), d); >+ DIS(buf, "%s(0x%x)", sorbTxt(sorb), d); > return (5<<24 | tmp); > } > >@@ -466,12 +760,11 @@ > uInstr2(cb, GET, 4, ArchReg, base_r, TempReg, base_tmp); > uInstr3(cb, LEA2, 4, TempReg, base_tmp, TempReg, index_tmp, > TempReg, tmp); >- LAST_UINSTR(cb).lit32 = 0; >+ uLiteral(cb, 0); > LAST_UINSTR(cb).extra4b = 1 << scale; > handleSegOverride(cb, sorb, tmp); >- if (buf) VG_(sprintf)(buf,"%s(%s,%s,%d)", sorbTxt(sorb), >- nameIReg(4,base_r), >- nameIReg(4,index_r),1<<scale); >+ DIS(buf, "%s(%s,%s,%d)", sorbTxt(sorb), >+ nameIReg(4,base_r), nameIReg(4,index_r), 1<<scale); > return (2<<24 | tmp); > } > >@@ -483,19 +776,18 @@ > uLiteral(cb, 0); > uInstr3(cb, LEA2, 4, TempReg, tmp, TempReg, index_tmp, > TempReg, tmp); >- LAST_UINSTR(cb).lit32 = d; >+ uLiteral(cb, d); > LAST_UINSTR(cb).extra4b = 1 << scale; > handleSegOverride(cb, sorb, tmp); >- if (buf) VG_(sprintf)(buf,"%s0x%x(,%s,%d)", sorbTxt(sorb), d, >- nameIReg(4,index_r),1<<scale); >+ DIS(buf, "%s0x%x(,%s,%d)", sorbTxt(sorb), d, >+ nameIReg(4,index_r), 1<<scale); > return (6<<24 | tmp); > } > > if (index_r == R_ESP && base_r != R_EBP) { > uInstr2(cb, GET, 4, ArchReg, base_r, TempReg, tmp); > handleSegOverride(cb, sorb, tmp); >- if (buf) VG_(sprintf)(buf,"%s(%s,,)", >- sorbTxt(sorb), nameIReg(4,base_r)); >+ DIS(buf, "%s(%s,,)", sorbTxt(sorb), nameIReg(4,base_r)); > return (2<<24 | tmp); > } > >@@ -504,7 +796,7 @@ > uInstr2(cb, MOV, 4, Literal, 0, TempReg, tmp); > uLiteral(cb, d); > handleSegOverride(cb, sorb, tmp); >- if (buf) VG_(sprintf)(buf,"%s0x%x()", sorbTxt(sorb), d); >+ DIS(buf, "%s0x%x()", sorbTxt(sorb), d); > return (6<<24 | tmp); > } > >@@ -531,10 +823,9 @@ > Int tmq = newTemp(cb); > uInstr2(cb, GET, 4, ArchReg, base_r, TempReg, tmq); > uInstr2(cb, LEA1, 4, TempReg, tmq, TempReg, tmp); >- LAST_UINSTR(cb).lit32 = d; >+ uLiteral(cb, d); > handleSegOverride(cb, sorb, tmp); >- if (buf) VG_(sprintf)(buf,"%s%d(%s,,)", sorbTxt(sorb), >- d, nameIReg(4,base_r)); >+ DIS(buf, "%s%d(%s,,)", sorbTxt(sorb), d, nameIReg(4,base_r)); > return (3<<24 | tmp); > } else { > Int index_tmp = newTemp(cb); >@@ -543,12 +834,11 @@ > uInstr2(cb, GET, 4, ArchReg, base_r, TempReg, base_tmp); > uInstr3(cb, LEA2, 4, TempReg, base_tmp, TempReg, index_tmp, > TempReg, tmp); >- LAST_UINSTR(cb).lit32 = d; >+ uLiteral(cb, d); > LAST_UINSTR(cb).extra4b = 1 << scale; > handleSegOverride(cb, sorb, tmp); >- if (buf) VG_(sprintf)(buf,"%s%d(%s,%s,%d)", >- sorbTxt(sorb), d, nameIReg(4,base_r), >- nameIReg(4,index_r), 1<<scale); >+ DIS(buf, "%s%d(%s,%s,%d)", sorbTxt(sorb), d, >+ nameIReg(4,base_r), nameIReg(4,index_r), 1<<scale); > return (3<<24 | tmp); > } > vg_assert(0); >@@ -574,10 +864,9 @@ > Int tmq = newTemp(cb); > uInstr2(cb, GET, 4, ArchReg, base_r, TempReg, tmq); > uInstr2(cb, LEA1, 4, TempReg, tmq, TempReg, tmp); >- LAST_UINSTR(cb).lit32 = d; >+ uLiteral(cb, d); > handleSegOverride(cb, sorb, tmp); >- if (buf) VG_(sprintf)(buf,"%s%d(%s,,)", >- sorbTxt(sorb), d, nameIReg(4,base_r)); >+ DIS(buf, "%s%d(%s,,)", sorbTxt(sorb), d, nameIReg(4,base_r)); > return (6<<24 | tmp); > } else { > Int index_tmp = newTemp(cb); >@@ -586,12 +875,11 @@ > uInstr2(cb, GET, 4, ArchReg, base_r, TempReg, base_tmp); > uInstr3(cb, LEA2, 4, TempReg, base_tmp, TempReg, index_tmp, > TempReg, tmp); >- LAST_UINSTR(cb).lit32 = d; >+ uLiteral(cb, d); > LAST_UINSTR(cb).extra4b = 1 << scale; > handleSegOverride(cb, sorb, tmp); >- if (buf) VG_(sprintf)(buf,"%s%d(%s,%s,%d)", >- sorbTxt(sorb), d, nameIReg(4,base_r), >- nameIReg(4,index_r), 1<<scale); >+ DIS(buf, "%s%d(%s,%s,%d)", sorbTxt(sorb), d, >+ nameIReg(4,base_r), nameIReg(4,index_r), 1<<scale); > return (6<<24 | tmp); > } > vg_assert(0); >@@ -692,9 +980,8 @@ > void codegen_XOR_reg_with_itself ( UCodeBlock* cb, Int size, > Int ge_reg, Int tmp ) > { >- if (dis) >- VG_(printf)("xor%c %s, %s\n", nameISize(size), >- nameIReg(size,ge_reg), nameIReg(size,ge_reg) ); >+ DIP("xor%c %s, %s\n", nameISize(size), >+ nameIReg(size,ge_reg), nameIReg(size,ge_reg) ); > uInstr2(cb, MOV, size, Literal, 0, TempReg, tmp); > uLiteral(cb, 0); > uInstr2(cb, XOR, size, TempReg, tmp, TempReg, tmp); >@@ -766,9 +1053,9 @@ > } > if (keep) > uInstr2(cb, PUT, size, TempReg, tmp, ArchReg, gregOfRM(rm)); >- if (dis) VG_(printf)("%s%c %s,%s\n", t_x86opc, nameISize(size), >- nameIReg(size,eregOfRM(rm)), >- nameIReg(size,gregOfRM(rm))); >+ DIP("%s%c %s,%s\n", t_x86opc, nameISize(size), >+ nameIReg(size,eregOfRM(rm)), >+ nameIReg(size,gregOfRM(rm))); > return 1+eip0; > } > >@@ -777,7 +1064,7 @@ > = (opc == ADD || opc == OR || opc == AND || opc == XOR || opc == ADC) > ? True : False; > if (reversible) { >- UInt pair = disAMode ( cb, sorb, eip0, dis?dis_buf:NULL); >+ UInt pair = disAMode ( cb, sorb, eip0, dis_buf); > Int tmpa = LOW24(pair); > uInstr2(cb, LOAD, size, TempReg, tmpa, TempReg, tmpa); > >@@ -792,11 +1079,11 @@ > } > if (keep) > uInstr2(cb, PUT, size, TempReg, tmpa, ArchReg, gregOfRM(rm)); >- if (dis) VG_(printf)("%s%c %s,%s\n", t_x86opc, nameISize(size), >- dis_buf,nameIReg(size,gregOfRM(rm))); >+ DIP("%s%c %s,%s\n", t_x86opc, nameISize(size), >+ dis_buf,nameIReg(size,gregOfRM(rm))); > return HI8(pair)+eip0; > } else { >- UInt pair = disAMode ( cb, sorb, eip0, dis?dis_buf:NULL); >+ UInt pair = disAMode ( cb, sorb, eip0, dis_buf); > Int tmpa = LOW24(pair); > Int tmp2 = newTemp(cb); > uInstr2(cb, LOAD, size, TempReg, tmpa, TempReg, tmpa); >@@ -805,8 +1092,8 @@ > setFlagsFromUOpcode(cb, opc); > if (keep) > uInstr2(cb, PUT, size, TempReg, tmp2, ArchReg, gregOfRM(rm)); >- if (dis) VG_(printf)("%s%c %s,%s\n", t_x86opc, nameISize(size), >- dis_buf,nameIReg(size,gregOfRM(rm))); >+ DIP("%s%c %s,%s\n", t_x86opc, nameISize(size), >+ dis_buf,nameIReg(size,gregOfRM(rm))); > return HI8(pair)+eip0; > } > } >@@ -869,15 +1156,15 @@ > } > if (keep) > uInstr2(cb, PUT, size, TempReg, tmp, ArchReg, eregOfRM(rm)); >- if (dis) VG_(printf)("%s%c %s,%s\n", t_x86opc, nameISize(size), >- nameIReg(size,gregOfRM(rm)), >- nameIReg(size,eregOfRM(rm))); >+ DIP("%s%c %s,%s\n", t_x86opc, nameISize(size), >+ nameIReg(size,gregOfRM(rm)), >+ nameIReg(size,eregOfRM(rm))); > return 1+eip0; > } > > /* E refers to memory */ > { >- UInt pair = disAMode ( cb, sorb, eip0, dis?dis_buf:NULL); >+ UInt pair = disAMode ( cb, sorb, eip0, dis_buf); > Int tmpa = LOW24(pair); > Int tmpv = newTemp(cb); > uInstr2(cb, LOAD, size, TempReg, tmpa, TempReg, tmpv); >@@ -894,8 +1181,8 @@ > if (keep) { > uInstr2(cb, STORE, size, TempReg, tmpv, TempReg, tmpa); > } >- if (dis) VG_(printf)("%s%c %s,%s\n", t_x86opc, nameISize(size), >- nameIReg(size,gregOfRM(rm)), dis_buf); >+ DIP("%s%c %s,%s\n", t_x86opc, nameISize(size), >+ nameIReg(size,gregOfRM(rm)), dis_buf); > return HI8(pair)+eip0; > } > } >@@ -930,7 +1217,7 @@ > Int tmpv = newTemp(cb); > uInstr2(cb, GET, size, ArchReg, eregOfRM(rm), TempReg, tmpv); > uInstr2(cb, PUT, size, TempReg, tmpv, ArchReg, gregOfRM(rm)); >- if (dis) VG_(printf)("mov%c %s,%s\n", nameISize(size), >+ DIP("mov%c %s,%s\n", nameISize(size), > nameIReg(size,eregOfRM(rm)), > nameIReg(size,gregOfRM(rm))); > return 1+eip0; >@@ -938,12 +1225,12 @@ > > /* E refers to memory */ > { >- UInt pair = disAMode ( cb, sorb, eip0, dis?dis_buf:NULL); >+ UInt pair = disAMode ( cb, sorb, eip0, dis_buf); > Int tmpa = LOW24(pair); > Int tmpb = newTemp(cb); > uInstr2(cb, LOAD, size, TempReg, tmpa, TempReg, tmpb); > uInstr2(cb, PUT, size, TempReg, tmpb, ArchReg, gregOfRM(rm)); >- if (dis) VG_(printf)("mov%c %s,%s\n", nameISize(size), >+ DIP("mov%c %s,%s\n", nameISize(size), > dis_buf,nameIReg(size,gregOfRM(rm))); > return HI8(pair)+eip0; > } >@@ -979,7 +1266,7 @@ > Int tmpv = newTemp(cb); > uInstr2(cb, GET, size, ArchReg, gregOfRM(rm), TempReg, tmpv); > uInstr2(cb, PUT, size, TempReg, tmpv, ArchReg, eregOfRM(rm)); >- if (dis) VG_(printf)("mov%c %s,%s\n", nameISize(size), >+ DIP("mov%c %s,%s\n", nameISize(size), > nameIReg(size,gregOfRM(rm)), > nameIReg(size,eregOfRM(rm))); > return 1+eip0; >@@ -987,12 +1274,12 @@ > > /* E refers to memory */ > { >- UInt pair = disAMode ( cb, sorb, eip0, dis?dis_buf:NULL); >+ UInt pair = disAMode ( cb, sorb, eip0, dis_buf); > Int tmpa = LOW24(pair); > Int tmpv = newTemp(cb); > uInstr2(cb, GET, size, ArchReg, gregOfRM(rm), TempReg, tmpv); > uInstr2(cb, STORE, size, TempReg, tmpv, TempReg, tmpa); >- if (dis) VG_(printf)("mov%c %s,%s\n", nameISize(size), >+ DIP("mov%c %s,%s\n", nameISize(size), > nameIReg(size,gregOfRM(rm)), dis_buf); > return HI8(pair)+eip0; > } >@@ -1024,8 +1311,8 @@ > } > if (keep) > uInstr2(cb, PUT, size, TempReg, tmp, ArchReg, R_EAX); >- if (dis) VG_(printf)("%s%c $0x%x, %s\n", t_x86opc, nameISize(size), >- lit, nameIReg(size,R_EAX)); >+ DIP("%s%c $0x%x, %s\n", t_x86opc, nameISize(size), >+ lit, nameIReg(size,R_EAX)); > return eip+size; > } > >@@ -1045,28 +1332,25 @@ > LAST_UINSTR(cb).extra4b = szs; > LAST_UINSTR(cb).signed_widen = sign_extend; > uInstr2(cb, PUT, szd, TempReg, tmpv, ArchReg, gregOfRM(rm)); >- if (dis) VG_(printf)("mov%c%c%c %s,%s\n", >- sign_extend ? 's' : 'z', >- nameISize(szs), nameISize(szd), >- nameIReg(szs,eregOfRM(rm)), >- nameIReg(szd,gregOfRM(rm))); >+ DIP("mov%c%c%c %s,%s\n", sign_extend ? 's' : 'z', >+ nameISize(szs), nameISize(szd), >+ nameIReg(szs,eregOfRM(rm)), >+ nameIReg(szd,gregOfRM(rm))); > return 1+eip; > } > > /* E refers to memory */ > { >- UInt pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL); >+ UInt pair = disAMode ( cb, sorb, eip, dis_buf); > Int tmpa = LOW24(pair); > uInstr2(cb, LOAD, szs, TempReg, tmpa, TempReg, tmpa); > uInstr1(cb, WIDEN, szd, TempReg, tmpa); > LAST_UINSTR(cb).extra4b = szs; > LAST_UINSTR(cb).signed_widen = sign_extend; > uInstr2(cb, PUT, szd, TempReg, tmpa, ArchReg, gregOfRM(rm)); >- if (dis) VG_(printf)("mov%c%c%c %s,%s\n", >- sign_extend ? 's' : 'z', >- nameISize(szs), nameISize(szd), >- dis_buf, >- nameIReg(szd,gregOfRM(rm))); >+ DIP("mov%c%c%c %s,%s\n", sign_extend ? 's' : 'z', >+ nameISize(szs), nameISize(szd), >+ dis_buf, nameIReg(szd,gregOfRM(rm))); > return HI8(pair)+eip; > } > } >@@ -1160,12 +1444,10 @@ > if (gregOfRM(modrm) < 7) > uInstr2(cb, PUT, sz, TempReg, t1, ArchReg, eregOfRM(modrm)); > eip += (am_sz + d_sz); >- if (dis) >- VG_(printf)("%s%c $0x%x, %s\n", >- nameGrp1(gregOfRM(modrm)), nameISize(sz), d32, >- nameIReg(sz,eregOfRM(modrm))); >+ DIP("%s%c $0x%x, %s\n", nameGrp1(gregOfRM(modrm)), nameISize(sz), d32, >+ nameIReg(sz,eregOfRM(modrm))); > } else { >- pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL); >+ pair = disAMode ( cb, sorb, eip, dis_buf); > t1 = LOW24(pair); > t2 = newTemp(cb); > eip += HI8(pair); >@@ -1192,10 +1474,8 @@ > if (gregOfRM(modrm) < 7) { > uInstr2(cb, STORE, sz, TempReg, t2, TempReg, t1); > } >- if (dis) >- VG_(printf)("%s%c $0x%x, %s\n", >- nameGrp1(gregOfRM(modrm)), nameISize(sz), d32, >- dis_buf); >+ DIP("%s%c $0x%x, %s\n", nameGrp1(gregOfRM(modrm)), nameISize(sz), >+ d32, dis_buf); > } > return eip; > } >@@ -1247,7 +1527,7 @@ > setFlagsFromUOpcode(cb, uopc); > uInstr2(cb, PUT, sz, TempReg, t1, ArchReg, eregOfRM(modrm)); > eip += (am_sz + d_sz); >- if (dis) { >+ if (VG_(print_codegen)) { > if (orig_src_tag == Literal) > VG_(printf)("%s%c $0x%x, %s\n", > nameGrp2(gregOfRM(modrm)), nameISize(sz), >@@ -1259,7 +1539,7 @@ > nameIReg(sz,eregOfRM(modrm))); > } > } else { >- pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL); >+ pair = disAMode ( cb, sorb, eip, dis_buf); > t1 = LOW24(pair); > t2 = newTemp(cb); > eip += HI8(pair); >@@ -1280,7 +1560,7 @@ > } > setFlagsFromUOpcode(cb, uopc); > uInstr2(cb, STORE, sz, TempReg, t2, TempReg, t1); >- if (dis) { >+ if (VG_(print_codegen)) { > if (orig_src_tag == Literal) > VG_(printf)("%s%c $0x%x, %s\n", > nameGrp2(gregOfRM(modrm)), nameISize(sz), >@@ -1333,7 +1613,7 @@ > And eip on entry points at the modrm byte. */ > Int t1, t2, t_fetched, t_mask; > UInt pair; >- UChar dis_buf[50]; >+ Char dis_buf[50]; > UInt v_mask; > > /* There is no 1-byte form of this instruction, AFAICS. */ >@@ -1382,13 +1662,10 @@ > uInstr2(cb, PUT, sz, TempReg, t2, ArchReg, eregOfRM(modrm)); > > eip += (am_sz + 1); >- if (dis) >- VG_(printf)("%s%c $0x%x, %s\n", >- nameGrp8(gregOfRM(modrm)), nameISize(sz), >- src_val, >- nameIReg(sz,eregOfRM(modrm))); >+ DIP("%s%c $0x%x, %s\n", nameGrp8(gregOfRM(modrm)), nameISize(sz), >+ src_val, nameIReg(sz,eregOfRM(modrm))); > } else { >- pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL); >+ pair = disAMode ( cb, sorb, eip, dis_buf); > t1 = LOW24(pair); > t2 = newTemp(cb); > eip += HI8(pair); >@@ -1402,10 +1679,8 @@ > if (gregOfRM(modrm) != 4 /* BT */) { > uInstr2(cb, STORE, sz, TempReg, t2, TempReg, t1); > } >- if (dis) >- VG_(printf)("%s%c $0x%x, %s\n", >- nameGrp8(gregOfRM(modrm)), nameISize(sz), src_val, >- dis_buf); >+ DIP("%s%c $0x%x, %s\n", nameGrp8(gregOfRM(modrm)), nameISize(sz), >+ src_val, dis_buf); > } > return eip; > >@@ -1449,8 +1724,8 @@ > uInstr2(cb, PUT, 2, TempReg, t1, ArchReg, R_EAX); > } > uInstr0(cb, CALLM_E, 0); >- if (dis) VG_(printf)("%s%c %s\n", signed_multiply ? "imul" : "mul", >- nameISize(sz), nameIReg(sz, eregOfRM(modrm))); >+ DIP("%s%c %s\n", signed_multiply ? "imul" : "mul", >+ nameISize(sz), nameIReg(sz, eregOfRM(modrm))); > > } > >@@ -1488,8 +1763,8 @@ > uInstr2(cb, PUT, 2, TempReg, t1, ArchReg, R_EAX); > } > uInstr0(cb, CALLM_E, 0); >- if (dis) VG_(printf)("%s%c %s\n", signed_multiply ? "imul" : "mul", >- nameISize(sz), dis_buf); >+ DIP("%s%c %s\n", signed_multiply ? "imul" : "mul", >+ nameISize(sz), dis_buf); > } > > >@@ -1516,9 +1791,8 @@ > uLiteral(cb, d32); > uInstr2(cb, AND, sz, TempReg, tao, TempReg, t1); > setFlagsFromUOpcode(cb, AND); >- if (dis) >- VG_(printf)("test%c $0x%x, %s\n", >- nameISize(sz), d32, nameIReg(sz, eregOfRM(modrm))); >+ DIP("test%c $0x%x, %s\n", >+ nameISize(sz), d32, nameIReg(sz, eregOfRM(modrm))); > break; > } > case 2: /* NOT */ >@@ -1527,9 +1801,7 @@ > uInstr1(cb, NOT, sz, TempReg, t1); > setFlagsFromUOpcode(cb, NOT); > uInstr2(cb, PUT, sz, TempReg, t1, ArchReg, eregOfRM(modrm)); >- if (dis) >- VG_(printf)("not%c %s\n", >- nameISize(sz), nameIReg(sz, eregOfRM(modrm))); >+ DIP("not%c %s\n", nameISize(sz), nameIReg(sz, eregOfRM(modrm))); > break; > case 3: /* NEG */ > eip++; >@@ -1537,9 +1809,7 @@ > uInstr1(cb, NEG, sz, TempReg, t1); > setFlagsFromUOpcode(cb, NEG); > uInstr2(cb, PUT, sz, TempReg, t1, ArchReg, eregOfRM(modrm)); >- if (dis) >- VG_(printf)("neg%c %s\n", >- nameISize(sz), nameIReg(sz, eregOfRM(modrm))); >+ DIP("neg%c %s\n", nameISize(sz), nameIReg(sz, eregOfRM(modrm))); > break; > case 4: /* MUL */ > eip++; >@@ -1553,17 +1823,13 @@ > eip++; > uInstr2(cb, GET, sz, ArchReg, eregOfRM(modrm), TempReg, t1); > codegen_div ( cb, sz, t1, False ); >- if (dis) >- VG_(printf)("div%c %s\n", nameISize(sz), >- nameIReg(sz, eregOfRM(modrm))); >+ DIP("div%c %s\n", nameISize(sz), nameIReg(sz, eregOfRM(modrm))); > break; > case 7: /* IDIV */ > eip++; > uInstr2(cb, GET, sz, ArchReg, eregOfRM(modrm), TempReg, t1); > codegen_div ( cb, sz, t1, True ); >- if (dis) >- VG_(printf)("idiv%c %s\n", nameISize(sz), >- nameIReg(sz, eregOfRM(modrm))); >+ DIP("idiv%c %s\n", nameISize(sz), nameIReg(sz, eregOfRM(modrm))); > break; > default: > VG_(printf)( >@@ -1571,7 +1837,7 @@ > VG_(core_panic)("Grp3"); > } > } else { >- pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL ); >+ pair = disAMode ( cb, sorb, eip, dis_buf ); > t2 = LOW24(pair); > t1 = newTemp(cb); > eip += HI8(pair); >@@ -1584,41 +1850,35 @@ > uLiteral(cb, d32); > uInstr2(cb, AND, sz, TempReg, tao, TempReg, t1); > setFlagsFromUOpcode(cb, AND); >- if (dis) >- VG_(printf)("test%c $0x%x, %s\n", >- nameISize(sz), d32, dis_buf); >+ DIP("test%c $0x%x, %s\n", nameISize(sz), d32, dis_buf); > break; > } > case 2: /* NOT */ > uInstr1(cb, NOT, sz, TempReg, t1); > setFlagsFromUOpcode(cb, NOT); > uInstr2(cb, STORE, sz, TempReg, t1, TempReg, t2); >- if (dis) >- VG_(printf)("not%c %s\n", nameISize(sz), dis_buf); >+ DIP("not%c %s\n", nameISize(sz), dis_buf); > break; > case 3: /* NEG */ > uInstr1(cb, NEG, sz, TempReg, t1); > setFlagsFromUOpcode(cb, NEG); > uInstr2(cb, STORE, sz, TempReg, t1, TempReg, t2); >- if (dis) >- VG_(printf)("neg%c %s\n", nameISize(sz), dis_buf); >+ DIP("neg%c %s\n", nameISize(sz), dis_buf); > break; > case 4: /* MUL */ > codegen_mul_A_D_Temp ( cb, sz, t1, False, >- dis?dis_buf:NULL ); >+ dis_buf ); > break; > case 5: /* IMUL */ >- codegen_mul_A_D_Temp ( cb, sz, t1, True, dis?dis_buf:NULL ); >+ codegen_mul_A_D_Temp ( cb, sz, t1, True, dis_buf ); > break; > case 6: /* DIV */ > codegen_div ( cb, sz, t1, False ); >- if (dis) >- VG_(printf)("div%c %s\n", nameISize(sz), dis_buf); >+ DIP("div%c %s\n", nameISize(sz), dis_buf); > break; > case 7: /* IDIV */ > codegen_div ( cb, sz, t1, True ); >- if (dis) >- VG_(printf)("idiv%c %s\n", nameISize(sz), dis_buf); >+ DIP("idiv%c %s\n", nameISize(sz), dis_buf); > break; > default: > VG_(printf)( >@@ -1663,11 +1923,10 @@ > VG_(core_panic)("Grp4"); > } > eip++; >- if (dis) >- VG_(printf)("%sb %s\n", nameGrp4(gregOfRM(modrm)), >- nameIReg(1, eregOfRM(modrm))); >+ DIP("%sb %s\n", nameGrp4(gregOfRM(modrm)), >+ nameIReg(1, eregOfRM(modrm))); > } else { >- pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL ); >+ pair = disAMode ( cb, sorb, eip, dis_buf ); > t2 = LOW24(pair); > t1 = newTemp(cb); > uInstr2(cb, LOAD, 1, TempReg, t2, TempReg, t1); >@@ -1688,8 +1947,7 @@ > VG_(core_panic)("Grp4"); > } > eip += HI8(pair); >- if (dis) >- VG_(printf)("%sb %s\n", nameGrp4(gregOfRM(modrm)), dis_buf); >+ DIP("%sb %s\n", nameGrp4(gregOfRM(modrm)), dis_buf); > } > return eip; > } >@@ -1731,14 +1989,12 @@ > uInstr2(cb, MOV, 4, Literal, 0, TempReg, t4); > uLiteral(cb, eip+1); > uInstr2(cb, STORE, 4, TempReg, t4, TempReg, t3); >- uInstr1(cb, JMP, 0, TempReg, t1); >- uCond(cb, CondAlways); >+ jmp_treg(cb, t1); > LAST_UINSTR(cb).jmpkind = JmpCall; > *isEnd = True; > break; > case 4: /* jmp Ev */ >- uInstr1(cb, JMP, 0, TempReg, t1); >- uCond(cb, CondAlways); >+ jmp_treg(cb, t1); > *isEnd = True; > break; > default: >@@ -1747,11 +2003,10 @@ > VG_(core_panic)("Grp5"); > } > eip++; >- if (dis) >- VG_(printf)("%s%c %s\n", nameGrp5(gregOfRM(modrm)), >- nameISize(sz), nameIReg(sz, eregOfRM(modrm))); >+ DIP("%s%c %s\n", nameGrp5(gregOfRM(modrm)), >+ nameISize(sz), nameIReg(sz, eregOfRM(modrm))); > } else { >- pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL ); >+ pair = disAMode ( cb, sorb, eip, dis_buf ); > t2 = LOW24(pair); > t1 = newTemp(cb); > uInstr2(cb, LOAD, sz, TempReg, t2, TempReg, t1); >@@ -1775,14 +2030,12 @@ > uInstr2(cb, MOV, 4, Literal, 0, TempReg, t4); > uLiteral(cb, eip+HI8(pair)); > uInstr2(cb, STORE, 4, TempReg, t4, TempReg, t3); >- uInstr1(cb, JMP, 0, TempReg, t1); >- uCond(cb, CondAlways); >+ jmp_treg(cb, t1); > LAST_UINSTR(cb).jmpkind = JmpCall; > *isEnd = True; > break; > case 4: /* JMP Ev */ >- uInstr1(cb, JMP, 0, TempReg, t1); >- uCond(cb, CondAlways); >+ jmp_treg(cb, t1); > *isEnd = True; > break; > case 6: /* PUSH Ev */ >@@ -1799,21 +2052,12 @@ > VG_(core_panic)("Grp5"); > } > eip += HI8(pair); >- if (dis) >- VG_(printf)("%s%c %s\n", nameGrp5(gregOfRM(modrm)), >- nameISize(sz), dis_buf); >+ DIP("%s%c %s\n", nameGrp5(gregOfRM(modrm)), >+ nameISize(sz), dis_buf); > } > return eip; > } > >-static __inline__ >-void dis_JMP_d32( UCodeBlock* cb, Addr d32 ) >-{ >- uInstr1(cb, JMP, 0, Literal, 0); >- uLiteral(cb, d32); >- uCond(cb, CondAlways); >-} >- > /*------------------------------------------------------------*/ > /*--- Disassembling string ops (including REP prefixes) ---*/ > /*------------------------------------------------------------*/ >@@ -1847,7 +2091,7 @@ > vg_assert(sorb == 0); > dis_string_op_increment(cb, sz, t_inc); > dis_OP( cb, sz, t_inc ); >- if (dis) VG_(printf)("%s%c\n", name, nameISize(sz)); >+ DIP("%s%c\n", name, nameISize(sz)); > } > > >@@ -1964,16 +2208,12 @@ > dis_OP (cb, sz, t_inc); > > if (cond == CondAlways) { >- dis_JMP_d32 (cb, eip); >+ jmp_lit(cb, eip); > } else { >- uInstr1 (cb, JMP, 0, Literal, 0); >- uLiteral (cb, eip); >- uCond (cb, cond); >- uFlagsRWU (cb, FlagsOSZACP, FlagsEmpty, FlagsEmpty); >- >- dis_JMP_d32 (cb, eip_next); >+ jcc_lit(cb, eip, cond); >+ jmp_lit(cb, eip_next); > } >- if (dis) VG_(printf)("%s%c\n", name, nameISize(sz)); >+ DIP("%s%c\n", name, nameISize(sz)); > } > > /*------------------------------------------------------------*/ >@@ -2001,16 +2241,15 @@ > uInstr2(cb, MUL, size, ArchReg, eregOfRM(rm), TempReg, tg); > setFlagsFromUOpcode(cb, MUL); > uInstr2(cb, PUT, size, TempReg, tg, ArchReg, gregOfRM(rm)); >- if (dis) VG_(printf)("%smul%c %s, %s\n", >- signed_multiply ? "i" : "", >- nameISize(size), >- nameIReg(size,eregOfRM(rm)), >- nameIReg(size,gregOfRM(rm))); >+ DIP("%smul%c %s, %s\n", signed_multiply ? "i" : "", >+ nameISize(size), >+ nameIReg(size,eregOfRM(rm)), >+ nameIReg(size,gregOfRM(rm))); > return 1+eip0; > } else { > UInt pair; > vg_assert(signed_multiply); >- pair = disAMode ( cb, sorb, eip0, dis?dis_buf:NULL); >+ pair = disAMode ( cb, sorb, eip0, dis_buf ); > ta = LOW24(pair); > uInstr2(cb, LOAD, size, TempReg, ta, TempReg, te); > uInstr2(cb, GET, size, ArchReg, gregOfRM(rm), TempReg, tg); >@@ -2018,10 +2257,9 @@ > setFlagsFromUOpcode(cb, MUL); > uInstr2(cb, PUT, size, TempReg, tg, ArchReg, gregOfRM(rm)); > >- if (dis) VG_(printf)("%smul%c %s, %s\n", >- signed_multiply ? "i" : "", >- nameISize(size), >- dis_buf,nameIReg(size,gregOfRM(rm))); >+ DIP("%smul%c %s, %s\n", signed_multiply ? "i" : "", >+ nameISize(size), >+ dis_buf, nameIReg(size,gregOfRM(rm))); > return HI8(pair)+eip0; > } > } >@@ -2036,7 +2274,7 @@ > Int litsize ) > { > Int ta, te, tl, d32; >- UChar dis_buf[50]; >+ Char dis_buf[50]; > UChar rm = getUChar(eip); > ta = INVALID_TEMPREG; > te = newTemp(cb); >@@ -2046,7 +2284,7 @@ > uInstr2(cb, GET, size, ArchReg, eregOfRM(rm), TempReg, te); > eip++; > } else { >- UInt pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL); >+ UInt pair = disAMode ( cb, sorb, eip, dis_buf ); > ta = LOW24(pair); > uInstr2(cb, LOAD, size, TempReg, ta, TempReg, te); > eip += HI8(pair); >@@ -2061,15 +2299,9 @@ > setFlagsFromUOpcode(cb, MUL); > uInstr2(cb, PUT, size, TempReg, te, ArchReg, gregOfRM(rm)); > >- if (dis) { >- if (epartIsReg(rm)) { >- VG_(printf)("imul %d, %s, %s\n", d32, nameIReg(size,eregOfRM(rm)), >- nameIReg(size,gregOfRM(rm))); >- } else { >- VG_(printf)("imul %d, %s, %s\n", d32, dis_buf, >- nameIReg(size,gregOfRM(rm))); >- } >- } >+ DIP("imul %d, %s, %s\n", d32, >+ ( epartIsReg(rm) ? nameIReg(size,eregOfRM(rm)) : dis_buf ), >+ nameIReg(size,gregOfRM(rm)) ); > > return eip; > } >@@ -2089,23 +2321,19 @@ > UChar second_byte = getUChar(eip); > vg_assert(second_byte < 0xC0); > second_byte &= 0x38; >- pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL ); >+ pair = disAMode ( cb, sorb, eip, dis_buf ); > ta = LOW24(pair); > eip += HI8(pair); > uInstr2(cb, is_write ? FPU_W : FPU_R, size, > Lit16, > (((UShort)first_byte) << 8) | ((UShort)second_byte), > TempReg, ta); >- if (dis) { >- if (is_write) >- VG_(printf)("fpu_w_%d 0x%x:0x%x, %s\n", >- size, (UInt)first_byte, >- (UInt)second_byte, dis_buf ); >- else >- VG_(printf)("fpu_r_%d %s, 0x%x:0x%x\n", >- size, dis_buf, >- (UInt)first_byte, >- (UInt)second_byte ); >+ if (is_write) { >+ DIP("fpu_w_%d 0x%x:0x%x, %s\n", >+ size, (UInt)first_byte, (UInt)second_byte, dis_buf ); >+ } else { >+ DIP("fpu_r_%d %s, 0x%x:0x%x\n", >+ size, dis_buf, (UInt)first_byte, (UInt)second_byte ); > } > return eip; > } >@@ -2174,10 +2402,9 @@ > vg_assert(!uses_ZCP); > } > >- if (dis) VG_(printf)("fpu 0x%x:0x%x%s%s\n", >- (UInt)first_byte, (UInt)second_byte, >- uses_ZCP ? " -rZCP" : "", >- sets_ZCP ? " -wZCP" : "" ); >+ DIP("fpu 0x%x:0x%x%s%s\n", (UInt)first_byte, (UInt)second_byte, >+ uses_ZCP ? " -rZCP" : "", >+ sets_ZCP ? " -wZCP" : "" ); > return eip; > } > >@@ -2205,7 +2432,7 @@ > uInstr1(cb, POP, 2, TempReg, t1); > uInstr2(cb, PUT, 2, TempReg, t1, ArchReg, R_EAX); > uInstr0(cb, CALLM_E, 0); >- if (dis) VG_(printf)("fstsw %%ax\n"); >+ DIP("fstsw %%ax\n"); > eip++; > return eip; > } >@@ -2407,13 +2634,11 @@ > uFlagsRWU(cb, FlagsEmpty, FlagsOSZACP, FlagsEmpty); > uInstr1(cb, POP, sz, TempReg, t); > uInstr2(cb, PUT, sz, TempReg, t, ArchReg, eregOfRM(modrm)); >- if (dis) >- VG_(printf)("sh%cd%c %%cl, %s, %s\n", >- ( left_shift ? 'l' : 'r' ), >- nameISize(sz), nameIReg(sz, gregOfRM(modrm)), >- nameIReg(sz, eregOfRM(modrm))); >+ DIP("sh%cd%c %%cl, %s, %s\n", >+ ( left_shift ? 'l' : 'r' ), nameISize(sz), >+ nameIReg(sz, gregOfRM(modrm)), nameIReg(sz, eregOfRM(modrm))); > } else { >- pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL ); >+ pair = disAMode ( cb, sorb, eip, dis_buf ); > ta = LOW24(pair); > eip += HI8(pair); > uInstr2(cb, LOAD, sz, TempReg, ta, TempReg, t2); >@@ -2422,11 +2647,8 @@ > uFlagsRWU(cb, FlagsEmpty, FlagsOSZACP, FlagsEmpty); > uInstr1(cb, POP, sz, TempReg, t); > uInstr2(cb, STORE, sz, TempReg, t, TempReg, ta); >- if (dis) >- VG_(printf)("sh%cd%c %%cl, %s, %s\n", >- ( left_shift ? 'l' : 'r' ), >- nameISize(sz), nameIReg(sz, gregOfRM(modrm)), >- dis_buf); >+ DIP("sh%cd%c %%cl, %s, %s\n", ( left_shift ? 'l' : 'r' ), >+ nameISize(sz), nameIReg(sz, gregOfRM(modrm)), dis_buf); > } > > if (amt_tag == Literal) eip++; >@@ -2460,15 +2682,12 @@ > Int sz, Addr eip, BtOp op ) > { > UInt pair; >- UChar dis_buf[50]; >+ Char dis_buf[50]; > UChar modrm; > > Int t_addr, t_bitno, t_mask, t_fetched, t_esp, temp, lit; > >- /* 2 and 4 are actually possible. */ > vg_assert(sz == 2 || sz == 4); >- /* We only handle 4. */ >- vg_assert(sz == 4); > > t_addr = t_bitno = t_mask > = t_fetched = t_esp = temp = INVALID_TEMPREG; >@@ -2482,18 +2701,24 @@ > > uInstr2(cb, GET, sz, ArchReg, gregOfRM(modrm), TempReg, t_bitno); > >+ if (sz == 2) { >+ uInstr1(cb, WIDEN, 4, TempReg, t_bitno); >+ LAST_UINSTR(cb).extra4b = 2; >+ LAST_UINSTR(cb).signed_widen = False; >+ } >+ > if (epartIsReg(modrm)) { > eip++; > /* Get it onto the client's stack. */ > t_esp = newTemp(cb); > t_addr = newTemp(cb); > uInstr2(cb, GET, 4, ArchReg, R_ESP, TempReg, t_esp); >- uInstr2(cb, SUB, sz, Literal, 0, TempReg, t_esp); >+ uInstr2(cb, SUB, 4, Literal, 0, TempReg, t_esp); > uLiteral(cb, sz); > uInstr2(cb, PUT, 4, TempReg, t_esp, ArchReg, R_ESP); > uInstr2(cb, GET, sz, ArchReg, eregOfRM(modrm), TempReg, temp); > uInstr2(cb, STORE, sz, TempReg, temp, TempReg, t_esp); >- /* Make ta point at it. */ >+ /* Make t_addr point at it. */ > uInstr2(cb, MOV, 4, TempReg, t_esp, TempReg, t_addr); > /* Mask out upper bits of the shift amount, since we're doing a > reg. */ >@@ -2501,12 +2726,12 @@ > uLiteral(cb, sz == 4 ? 31 : 15); > uInstr2(cb, AND, 4, TempReg, lit, TempReg, t_bitno); > } else { >- pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL ); >+ pair = disAMode ( cb, sorb, eip, dis_buf ); > t_addr = LOW24(pair); > eip += HI8(pair); > } > >- /* At this point: ta points to the address being operated on. If >+ /* At this point: t_addr points to the address being operated on. If > it was a reg, we will have pushed it onto the client's stack. > t_bitno is the bit number, suitable masked in the case of a reg. */ > >@@ -2516,12 +2741,12 @@ > uInstr2(cb, SAR, 4, Literal, 0, TempReg, temp); > uLiteral(cb, 3); > uInstr2(cb, ADD, 4, TempReg, temp, TempReg, t_addr); >- /* ta now holds effective address */ >+ /* t_addr now holds effective address */ > > uInstr2(cb, MOV, 4, Literal, 0, TempReg, lit); > uLiteral(cb, 7); > uInstr2(cb, AND, 4, TempReg, lit, TempReg, t_bitno); >- /* bitno contains offset of bit within byte */ >+ /* t_bitno contains offset of bit within byte */ > > if (op != BtOpNone) { > t_mask = newTemp(cb); >@@ -2529,7 +2754,7 @@ > uLiteral(cb, 1); > uInstr2(cb, SHL, 4, TempReg, t_bitno, TempReg, t_mask); > } >- /* mask is now a suitable byte mask */ >+ /* t_mask is now a suitable byte mask */ > > uInstr2(cb, LOAD, 1, TempReg, t_addr, TempReg, t_fetched); > if (op != BtOpNone) { >@@ -2559,44 +2784,33 @@ > uInstr2(cb, MOV, 4, Literal, 0, TempReg, lit); > uLiteral(cb, 1); > uInstr2(cb, AND, 4, TempReg, lit, TempReg, t_fetched); >- /* fetched is now 1 or 0 */ >+ /* t_fetched is now 1 or 0 */ > > /* NEG is a handy way to convert zero/nonzero into the carry > flag. */ > uInstr1(cb, NEG, 4, TempReg, t_fetched); > setFlagsFromUOpcode(cb, NEG); >- /* fetched is now in carry flag */ >+ /* t_fetched is now in carry flag */ > > /* Move reg operand from stack back to reg */ > if (epartIsReg(modrm)) { > /* t_esp still points at it. */ > uInstr2(cb, LOAD, sz, TempReg, t_esp, TempReg, temp); > uInstr2(cb, PUT, sz, TempReg, temp, ArchReg, eregOfRM(modrm)); >- uInstr2(cb, ADD, sz, Literal, 0, TempReg, t_esp); >+ uInstr2(cb, ADD, 4, Literal, 0, TempReg, t_esp); > uLiteral(cb, sz); > uInstr2(cb, PUT, 4, TempReg, t_esp, ArchReg, R_ESP); > } > >- if (epartIsReg(modrm)) { >- if (dis) >- VG_(printf)("bt%s%c %s, %s\n", >- nameBtOp(op), >- nameISize(sz), nameIReg(sz, gregOfRM(modrm)), >- nameIReg(sz, eregOfRM(modrm))); >- } else { >- if (dis) >- VG_(printf)("bt%s%c %s, %s\n", >- nameBtOp(op), >- nameISize(sz), nameIReg(sz, gregOfRM(modrm)), >- dis_buf); >- } >+ DIP("bt%s%c %s, %s\n", >+ nameBtOp(op), nameISize(sz), nameIReg(sz, gregOfRM(modrm)), >+ ( epartIsReg(modrm) ? nameIReg(sz, eregOfRM(modrm)) : dis_buf ) ); > > return eip; > } > > > >- > /* Handle BSF/BSR. Only v-size seems necessary. */ > static > Addr dis_bs_E_G ( UCodeBlock* cb, >@@ -2605,13 +2819,17 @@ > { > Int t, t1, ta, helper; > UInt pair; >- UChar dis_buf[50]; >+ Char dis_buf[50]; > UChar modrm; >+ Bool isReg; > > vg_assert(sz == 2 || sz == 4); >- vg_assert(sz==4); > >- helper = fwds ? VGOFF_(helper_bsf) : VGOFF_(helper_bsr); >+ if (fwds) >+ helper = sz == 2 ? VGOFF_(helper_bsfw) : VGOFF_(helper_bsfl); >+ else >+ helper = sz == 2 ? VGOFF_(helper_bsrw) : VGOFF_(helper_bsrl); >+ > modrm = getUChar(eip); > t1 = newTemp(cb); > t = newTemp(cb); >@@ -2620,25 +2838,20 @@ > uInstr2(cb, GET, sz, ArchReg, gregOfRM(modrm), TempReg, t1); > uInstr1(cb, PUSH, sz, TempReg, t1); > >- if (epartIsReg(modrm)) { >+ isReg = epartIsReg(modrm); >+ if (isReg) { > eip++; > uInstr2(cb, GET, sz, ArchReg, eregOfRM(modrm), TempReg, t); >- if (dis) >- VG_(printf)("bs%c%c %s, %s\n", >- fwds ? 'f' : 'r', >- nameISize(sz), nameIReg(sz, eregOfRM(modrm)), >- nameIReg(sz, gregOfRM(modrm))); > } else { >- pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL ); >+ pair = disAMode ( cb, sorb, eip, dis_buf ); > ta = LOW24(pair); > eip += HI8(pair); > uInstr2(cb, LOAD, sz, TempReg, ta, TempReg, t); >- if (dis) >- VG_(printf)("bs%c%c %s, %s\n", >- fwds ? 'f' : 'r', >- nameISize(sz), dis_buf, >- nameIReg(sz, gregOfRM(modrm))); > } >+ DIP("bs%c%c %s, %s\n", >+ fwds ? 'f' : 'r', nameISize(sz), >+ ( isReg ? nameIReg(sz, eregOfRM(modrm)) : dis_buf ), >+ nameIReg(sz, gregOfRM(modrm))); > > uInstr1(cb, PUSH, sz, TempReg, t); > uInstr1(cb, CALLM, 0, Lit16, helper); >@@ -2663,9 +2876,8 @@ > uInstr2(cb, GET, sz, ArchReg, reg, TempReg, t2); > uInstr2(cb, PUT, sz, TempReg, t2, ArchReg, R_EAX); > uInstr2(cb, PUT, sz, TempReg, t1, ArchReg, reg); >- if (dis) >- VG_(printf)("xchg%c %s, %s\n", nameISize(sz), >- nameIReg(sz, R_EAX), nameIReg(sz, reg)); >+ DIP("xchg%c %s, %s\n", >+ nameISize(sz), nameIReg(sz, R_EAX), nameIReg(sz, reg)); > } > > >@@ -2739,22 +2951,21 @@ > if (epartIsReg(rm)) { > uInstr2(cb, GET, size, ArchReg, eregOfRM(rm), TempReg, dest); > eip0++; >- if (dis) VG_(printf)("cmpxchg%c %s,%s\n", >- nameISize(size), >- nameIReg(size,gregOfRM(rm)), >- nameIReg(size,eregOfRM(rm)) ); >+ DIP("cmpxchg%c %s,%s\n", nameISize(size), >+ nameIReg(size,gregOfRM(rm)), >+ nameIReg(size,eregOfRM(rm)) ); > } else { >- UInt pair = disAMode ( cb, sorb, eip0, dis?dis_buf:NULL ); >+ UInt pair = disAMode ( cb, sorb, eip0, dis_buf ); > ta = LOW24(pair); > uInstr2(cb, LOAD, size, TempReg, ta, TempReg, dest); > eip0 += HI8(pair); >- if (dis) VG_(printf)("cmpxchg%c %s,%s\n", nameISize(size), >- nameIReg(size,gregOfRM(rm)), dis_buf); >+ DIP("cmpxchg%c %s,%s\n", nameISize(size), >+ nameIReg(size,gregOfRM(rm)), dis_buf); > } > > uInstr2(cb, GET, size, ArchReg, gregOfRM(rm), TempReg, src); > uInstr2(cb, GET, size, ArchReg, R_EAX, TempReg, acc); >- uInstr2(cb, MOV, size, TempReg, acc, TempReg, junk); >+ uInstr2(cb, MOV, 4, TempReg, acc, TempReg, junk); > uInstr2(cb, SUB, size, TempReg, dest, TempReg, junk); > setFlagsFromUOpcode(cb, SUB); > >@@ -2776,6 +2987,74 @@ > } > > >+static >+Addr dis_cmpxchg8b ( UCodeBlock* cb, >+ UChar sorb, >+ Addr eip0 ) >+{ >+ Int tal, tah, junkl, junkh, destl, desth, srcl, srch, accl, acch; >+ UChar dis_buf[50]; >+ UChar rm; >+ UInt pair; >+ >+ rm = getUChar(eip0); >+ accl = newTemp(cb); >+ acch = newTemp(cb); >+ srcl = newTemp(cb); >+ srch = newTemp(cb); >+ destl = newTemp(cb); >+ desth = newTemp(cb); >+ junkl = newTemp(cb); >+ junkh = newTemp(cb); >+ >+ vg_assert(!epartIsReg(rm)); >+ >+ pair = disAMode ( cb, sorb, eip0, dis_buf ); >+ tal = LOW24(pair); >+ tah = newTemp(cb); >+ uInstr2(cb, MOV, 4, TempReg, tal, TempReg, tah); >+ uInstr2(cb, ADD, 4, Literal, 0, TempReg, tah); >+ uLiteral(cb, 4); >+ eip0 += HI8(pair); >+ DIP("cmpxchg8b %s\n", dis_buf); >+ >+ uInstr0(cb, CALLM_S, 0); >+ >+ uInstr2(cb, LOAD, 4, TempReg, tah, TempReg, desth); >+ uInstr1(cb, PUSH, 4, TempReg, desth); >+ uInstr2(cb, LOAD, 4, TempReg, tal, TempReg, destl); >+ uInstr1(cb, PUSH, 4, TempReg, destl); >+ uInstr2(cb, GET, 4, ArchReg, R_ECX, TempReg, srch); >+ uInstr1(cb, PUSH, 4, TempReg, srch); >+ uInstr2(cb, GET, 4, ArchReg, R_EBX, TempReg, srcl); >+ uInstr1(cb, PUSH, 4, TempReg, srcl); >+ uInstr2(cb, GET, 4, ArchReg, R_EDX, TempReg, acch); >+ uInstr1(cb, PUSH, 4, TempReg, acch); >+ uInstr2(cb, GET, 4, ArchReg, R_EAX, TempReg, accl); >+ uInstr1(cb, PUSH, 4, TempReg, accl); >+ >+ uInstr1(cb, CALLM, 0, Lit16, VGOFF_(helper_cmpxchg8b)); >+ uFlagsRWU(cb, FlagsEmpty, FlagZ, FlagsEmpty); >+ >+ uInstr1(cb, POP, 4, TempReg, accl); >+ uInstr2(cb, PUT, 4, TempReg, accl, ArchReg, R_EAX); >+ uInstr1(cb, POP, 4, TempReg, acch); >+ uInstr2(cb, PUT, 4, TempReg, acch, ArchReg, R_EDX); >+ uInstr1(cb, POP, 4, TempReg, srcl); >+ uInstr2(cb, PUT, 4, TempReg, srcl, ArchReg, R_EBX); >+ uInstr1(cb, POP, 4, TempReg, srch); >+ uInstr2(cb, PUT, 4, TempReg, srch, ArchReg, R_ECX); >+ uInstr1(cb, POP, 4, TempReg, destl); >+ uInstr2(cb, STORE, 4, TempReg, destl, TempReg, tal); >+ uInstr1(cb, POP, 4, TempReg, desth); >+ uInstr2(cb, STORE, 4, TempReg, desth, TempReg, tah); >+ >+ uInstr0(cb, CALLM_E, 0); >+ >+ return eip0; >+} >+ >+ > /* Handle conditional move instructions of the form > cmovcc E(reg-or-mem), G(reg) > >@@ -2813,17 +3092,16 @@ > uCond(cb, cond); > uFlagsRWU(cb, FlagsOSZACP, FlagsEmpty, FlagsEmpty); > uInstr2(cb, PUT, size, TempReg, tmpd, ArchReg, gregOfRM(rm)); >- if (dis) VG_(printf)("cmov%c%s %s,%s\n", >- nameISize(size), >- VG_(name_UCondcode)(cond), >- nameIReg(size,eregOfRM(rm)), >- nameIReg(size,gregOfRM(rm))); >+ DIP("cmov%c%s %s,%s\n", nameISize(size), >+ VG_(name_UCondcode)(cond), >+ nameIReg(size,eregOfRM(rm)), >+ nameIReg(size,gregOfRM(rm))); > return 1+eip0; > } > > /* E refers to memory */ > { >- UInt pair = disAMode ( cb, sorb, eip0, dis?dis_buf:NULL); >+ UInt pair = disAMode ( cb, sorb, eip0, dis_buf ); > Int tmpa = LOW24(pair); > uInstr2(cb, LOAD, size, TempReg, tmpa, TempReg, tmps); > uInstr2(cb, GET, size, ArchReg, gregOfRM(rm), TempReg, tmpd); >@@ -2831,11 +3109,10 @@ > uCond(cb, cond); > uFlagsRWU(cb, FlagsOSZACP, FlagsEmpty, FlagsEmpty); > uInstr2(cb, PUT, size, TempReg, tmpd, ArchReg, gregOfRM(rm)); >- if (dis) VG_(printf)("cmov%c%s %s,%s\n", >- nameISize(size), >- VG_(name_UCondcode)(cond), >- dis_buf, >- nameIReg(size,gregOfRM(rm))); >+ DIP("cmov%c%s %s,%s\n", nameISize(size), >+ VG_(name_UCondcode)(cond), >+ dis_buf, >+ nameIReg(size,gregOfRM(rm))); > return HI8(pair)+eip0; > } > } >@@ -2860,13 +3137,11 @@ > setFlagsFromUOpcode(cb, ADD); > uInstr2(cb, PUT, sz, TempReg, tmpt, ArchReg, eregOfRM(rm)); > uInstr2(cb, PUT, sz, TempReg, tmpd, ArchReg, gregOfRM(rm)); >- if (dis) >- VG_(printf)("xadd%c %s, %s\n", nameISize(sz), >- nameIReg(sz,gregOfRM(rm)), >- nameIReg(sz,eregOfRM(rm))); >+ DIP("xadd%c %s, %s\n", >+ nameISize(sz), nameIReg(sz,gregOfRM(rm)), nameIReg(sz,eregOfRM(rm))); > return 1+eip0; > } else { >- UInt pair = disAMode ( cb, sorb, eip0, dis?dis_buf:NULL); >+ UInt pair = disAMode ( cb, sorb, eip0, dis_buf ); > Int tmpa = LOW24(pair); > uInstr2(cb, LOAD, sz, TempReg, tmpa, TempReg, tmpd); > uInstr2(cb, GET, sz, ArchReg, gregOfRM(rm), TempReg, tmpt); >@@ -2874,10 +3149,8 @@ > setFlagsFromUOpcode(cb, ADD); > uInstr2(cb, STORE, sz, TempReg, tmpt, TempReg, tmpa); > uInstr2(cb, PUT, sz, TempReg, tmpd, ArchReg, gregOfRM(rm)); >- if (dis) >- VG_(printf)("xadd%c %s, %s\n", nameISize(sz), >- nameIReg(sz,gregOfRM(rm)), >- dis_buf); >+ DIP("xadd%c %s, %s\n", >+ nameISize(sz), nameIReg(sz,gregOfRM(rm)), dis_buf); > return HI8(pair)+eip0; > } > } >@@ -2911,21 +3184,18 @@ > Int tmpv = newTemp(cb); > uInstr2(cb, GET, 2, ArchReg, eregOfRM(rm), TempReg, tmpv); > uInstr2(cb, PUTSEG, 2, TempReg, tmpv, ArchRegS, gregOfRM(rm)); >- if (dis) VG_(printf)("movw %s,%s\n", >- nameIReg(2,eregOfRM(rm)), >- nameSReg(gregOfRM(rm))); >+ DIP("movw %s,%s\n", nameIReg(2,eregOfRM(rm)), nameSReg(gregOfRM(rm))); > return 1+eip0; > } > > /* E refers to memory */ > { >- UInt pair = disAMode ( cb, sorb, eip0, dis?dis_buf:NULL); >+ UInt pair = disAMode ( cb, sorb, eip0, dis_buf ); > Int tmpa = LOW24(pair); > Int tmpb = newTemp(cb); > uInstr2(cb, LOAD, 2, TempReg, tmpa, TempReg, tmpb); > uInstr2(cb, PUTSEG, 2, TempReg, tmpb, ArchRegS, gregOfRM(rm)); >- if (dis) VG_(printf)("movw %s,%s\n", >- dis_buf,nameSReg(gregOfRM(rm))); >+ DIP("movw %s,%s\n", dis_buf,nameSReg(gregOfRM(rm))); > return HI8(pair)+eip0; > } > } >@@ -2959,21 +3229,18 @@ > Int tmpv = newTemp(cb); > uInstr2(cb, GETSEG, 2, ArchRegS, gregOfRM(rm), TempReg, tmpv); > uInstr2(cb, PUT, 2, TempReg, tmpv, ArchReg, eregOfRM(rm)); >- if (dis) VG_(printf)("movw %s,%s\n", >- nameSReg(gregOfRM(rm)), >- nameIReg(2,eregOfRM(rm))); >+ DIP("movw %s,%s\n", nameSReg(gregOfRM(rm)), nameIReg(2,eregOfRM(rm))); > return 1+eip0; > } > > /* E refers to memory */ > { >- UInt pair = disAMode ( cb, sorb, eip0, dis?dis_buf:NULL); >+ UInt pair = disAMode ( cb, sorb, eip0, dis_buf ); > Int tmpa = LOW24(pair); > Int tmpv = newTemp(cb); > uInstr2(cb, GETSEG, 2, ArchRegS, gregOfRM(rm), TempReg, tmpv); > uInstr2(cb, STORE, 2, TempReg, tmpv, TempReg, tmpa); >- if (dis) VG_(printf)("mov %s,%s\n", >- nameSReg(gregOfRM(rm)), dis_buf); >+ DIP("mov %s,%s\n", nameSReg(gregOfRM(rm)), dis_buf); > return HI8(pair)+eip0; > } > } >@@ -2994,35 +3261,30 @@ > Char* name, > Bool show_granularity ) > { >- UChar dis_buf[50]; >- UChar modrm; >- modrm = getUChar(eip); >- if (epartIsReg(modrm)) { >+ Char dis_buf[50]; >+ UChar modrm = getUChar(eip); >+ Bool isReg = epartIsReg(modrm); >+ >+ if (isReg) { > eip++; > uInstr1(cb, MMX2, 0, > Lit16, > (((UShort)(opc)) << 8) | ((UShort)modrm) ); >- if (dis) >- VG_(printf)("%s%s %s, %s\n", >- name, >- show_granularity ? nameMMXGran(opc & 3) : (Char*)"", >- nameMMXReg(eregOfRM(modrm)), >- nameMMXReg(gregOfRM(modrm))); > } else { >- UInt pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL ); >+ UInt pair = disAMode ( cb, sorb, eip, dis_buf ); > Int tmpa = LOW24(pair); > eip += HI8(pair); > uInstr2(cb, MMX2_MemRd, 8, > Lit16, > (((UShort)(opc)) << 8) | ((UShort)modrm), > TempReg, tmpa); >- if (dis) >- VG_(printf)("%s%s %s, %s\n", >- name, >- show_granularity ? nameMMXGran(opc & 3) : (Char*)"", >- dis_buf, >- nameMMXReg(gregOfRM(modrm))); > } >+ >+ DIP("%s%s %s, %s\n", >+ name, show_granularity ? nameMMXGran(opc & 3) : (Char*)"", >+ ( isReg ? nameMMXReg(eregOfRM(modrm)) : dis_buf ), >+ nameMMXReg(gregOfRM(modrm)) ); >+ > return eip; > } > >@@ -3045,32 +3307,31 @@ > UChar opc2, > UChar opc3 ) > { >- UChar dis_buf[50]; >+ Char dis_buf[50]; > UChar modrm = getUChar(eip); >- if (epartIsReg(modrm)) { >+ Bool isReg = epartIsReg(modrm); >+ >+ if (isReg) { > /* Completely internal SSE insn. */ > uInstr2(cb, SSE4, 0, /* ignore sz for internal ops */ > Lit16, (((UShort)opc1) << 8) | (UShort)opc2, > Lit16, (((UShort)opc3) << 8) | (UShort)modrm ); >- if (dis) >- VG_(printf)("%s %s, %s\n", name, >- nameXMMReg(eregOfRM(modrm)), >- nameXMMReg(gregOfRM(modrm)) ); > eip++; > } else { >- UInt pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL ); >+ UInt pair = disAMode ( cb, sorb, eip, dis_buf ); > Int tmpa = LOW24(pair); > eip += HI8(pair); > uInstr3(cb, SSE3a_MemRd, sz, > Lit16, (((UShort)(opc1)) << 8) | ((UShort)opc2), > Lit16, (((UShort)(opc3)) << 8) | ((UShort)modrm), > TempReg, tmpa); >- if (dis) >- VG_(printf)("%s %s, %s\n", >- name, >- dis_buf, >- nameXMMReg(gregOfRM(modrm))); > } >+ >+ DIP("%s %s, %s\n", >+ name, >+ ( isReg ? nameXMMReg(eregOfRM(modrm)) : dis_buf ), >+ nameXMMReg(gregOfRM(modrm)) ); >+ > return eip; > } > >@@ -3091,32 +3352,30 @@ > UChar opc1, > UChar opc2 ) > { >- UChar dis_buf[50]; >+ Char dis_buf[50]; > UChar modrm = getUChar(eip); >- if (epartIsReg(modrm)) { >+ Bool isReg = epartIsReg(modrm); >+ >+ if (isReg) { > /* Completely internal SSE insn. */ > uInstr2(cb, SSE3, 0, /* ignore sz for internal ops */ > Lit16, (((UShort)opc1) << 8) | (UShort)opc2, > Lit16, (UShort)modrm ); >- if (dis) >- VG_(printf)("%s %s, %s\n", name, >- nameXMMReg(eregOfRM(modrm)), >- nameXMMReg(gregOfRM(modrm)) ); > eip++; > } else { >- UInt pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL ); >+ UInt pair = disAMode ( cb, sorb, eip, dis_buf ); > Int tmpa = LOW24(pair); > eip += HI8(pair); > uInstr3(cb, SSE2a_MemRd, sz, > Lit16, (((UShort)(opc1)) << 8) | ((UShort)opc2), > Lit16, (UShort)modrm, > TempReg, tmpa); >- if (dis) >- VG_(printf)("%s %s, %s\n", >- name, >- dis_buf, >- nameXMMReg(gregOfRM(modrm))); > } >+ DIP("%s %s, %s\n", >+ name, >+ ( isReg ? nameXMMReg(eregOfRM(modrm)) : dis_buf ), >+ nameXMMReg(gregOfRM(modrm)) ); >+ > return eip; > } > >@@ -3137,23 +3396,21 @@ > UChar opc1, > UChar opc2 ) > { >- UChar dis_buf[50]; >+ Char dis_buf[50]; > UChar modrm = getUChar(eip); > UChar imm8; >- if (epartIsReg(modrm)) { >+ Bool isReg = epartIsReg(modrm); >+ >+ if (isReg) { > /* Completely internal SSE insn. */ > eip++; > imm8 = getUChar(eip); > uInstr2(cb, SSE4, 0, /* ignore sz for internal ops */ > Lit16, (((UShort)opc1) << 8) | (UShort)opc2, > Lit16, (((UShort)modrm) << 8) | (UShort)imm8 ); >- if (dis) >- VG_(printf)("%s %s, %s, $%d\n", name, >- nameXMMReg(eregOfRM(modrm)), >- nameXMMReg(gregOfRM(modrm)), (Int)imm8 ); > eip++; > } else { >- UInt pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL ); >+ UInt pair = disAMode ( cb, sorb, eip, dis_buf ); > Int tmpa = LOW24(pair); > eip += HI8(pair); > imm8 = getUChar(eip); >@@ -3162,12 +3419,10 @@ > Lit16, (((UShort)(opc1)) << 8) | ((UShort)opc2), > Lit16, (((UShort)(modrm)) << 8) | ((UShort)imm8), > TempReg, tmpa); >- if (dis) >- VG_(printf)("%s %s, %s, $%d\n", >- name, >- dis_buf, >- nameXMMReg(gregOfRM(modrm)), (Int)imm8 ); > } >+ DIP("%s %s, %s, $%d\n", >+ name, ( isReg ? nameXMMReg(eregOfRM(modrm)) : dis_buf ), >+ nameXMMReg(gregOfRM(modrm)), (Int)imm8 ); > return eip; > } > >@@ -3189,10 +3444,12 @@ > UChar opc2, > UChar opc3 ) > { >- UChar dis_buf[50]; >+ Char dis_buf[50]; > UChar modrm = getUChar(eip); > UChar imm8; >- if (epartIsReg(modrm)) { >+ Bool isReg = epartIsReg(modrm); >+ >+ if (isReg) { > /* Completely internal SSE insn. */ > eip++; > imm8 = getUChar(eip); >@@ -3200,13 +3457,9 @@ > Lit16, (((UShort)opc1) << 8) | (UShort)opc2, > Lit16, (((UShort)opc3) << 8) | (UShort)modrm, > Lit16, (UShort)imm8 ); >- if (dis) >- VG_(printf)("%s %s, %s, $%d\n", name, >- nameXMMReg(eregOfRM(modrm)), >- nameXMMReg(gregOfRM(modrm)), (Int)imm8 ); > eip++; > } else { >- UInt pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL ); >+ UInt pair = disAMode ( cb, sorb, eip, dis_buf ); > Int tmpa = LOW24(pair); > eip += HI8(pair); > imm8 = getUChar(eip); >@@ -3216,12 +3469,10 @@ > Lit16, (((UShort)(opc3)) << 8) | ((UShort)modrm), > TempReg, tmpa); > uLiteral(cb, imm8); >- if (dis) >- VG_(printf)("%s %s, %s, $%d\n", >- name, >- dis_buf, >- nameXMMReg(gregOfRM(modrm)), (Int)imm8 ); > } >+ DIP("%s %s, %s, $%d\n", >+ name, ( isReg ? nameXMMReg(eregOfRM(modrm)) : dis_buf ), >+ nameXMMReg(gregOfRM(modrm)), (Int)imm8 ); > return eip; > } > >@@ -3241,39 +3492,38 @@ > UChar insn1, > UChar insn2 ) > { >- UChar dis_buf[50]; >- UChar modrm; >+ Char dis_buf[50]; >+ UChar modrm = getUChar(eip); >+ Bool isReg = epartIsReg(modrm); > UInt pair; > Int t1; >- modrm = getUChar(eip); >- if (epartIsReg(modrm)) { >+ >+ if (isReg) { > /* Completely internal; we can issue SSE4. */ > eip++; > uInstr2(cb, SSE4, 0, /* ignore sz for internal ops */ > Lit16, (((UShort)insn0) << 8) | (UShort)insn1, > Lit16, (((UShort)insn2) << 8) | (UShort)modrm ); >- if (dis && is_store) >- VG_(printf)("%s %s, %s\n", name, >- nameXMMReg(gregOfRM(modrm)), >- nameXMMReg(eregOfRM(modrm)) ); >- if (dis && !is_store) >- VG_(printf)("%s %s, %s\n", name, >- nameXMMReg(eregOfRM(modrm)), >- nameXMMReg(gregOfRM(modrm)) ); > } else { >- pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL ); >+ pair = disAMode ( cb, sorb, eip, dis_buf ); > t1 = LOW24(pair); > eip += HI8(pair); > uInstr3(cb, is_store ? SSE3a_MemWr : SSE3a_MemRd, sz, > Lit16, (((UShort)insn0) << 8) | (UShort)insn1, > Lit16, (((UShort)insn2) << 8) | (UShort)modrm, > TempReg, t1 ); >- if (dis && is_store) >- VG_(printf)("%s %s, %s\n", name, >- nameXMMReg(gregOfRM(modrm)), dis_buf ); >- if (dis && !is_store) >- VG_(printf)("%s %s, %s\n", name, >- dis_buf, nameXMMReg(gregOfRM(modrm)) ); >+ } >+ >+ if (is_store) { >+ DIP("%s %s, %s\n", >+ name, >+ nameXMMReg(gregOfRM(modrm)), >+ ( isReg ? nameXMMReg(eregOfRM(modrm)) : dis_buf ) ); >+ } else { >+ DIP("%s %s, %s\n", >+ name, >+ ( isReg ? nameXMMReg(eregOfRM(modrm)) : dis_buf ), >+ nameXMMReg(gregOfRM(modrm)) ); > } > return eip; > } >@@ -3292,82 +3542,242 @@ > UChar insn0, > UChar insn1 ) > { >- UChar dis_buf[50]; >- UChar modrm; >+ Char dis_buf[50]; >+ UChar modrm = getUChar(eip); >+ Bool isReg = epartIsReg(modrm); > UInt pair; > Int t1; >- modrm = getUChar(eip); >- if (epartIsReg(modrm)) { >+ >+ if (isReg) { > /* Completely internal; we can issue SSE3. */ > eip++; > uInstr2(cb, SSE3, 0, /* ignore sz for internal ops */ > Lit16, (((UShort)insn0) << 8) | (UShort)insn1, > Lit16, (UShort)modrm ); >- if (dis && is_store) >- VG_(printf)("%s %s, %s\n", name, >- nameXMMReg(gregOfRM(modrm)), >- nameXMMReg(eregOfRM(modrm)) ); >- if (dis && !is_store) >- VG_(printf)("%s %s, %s\n", name, >- nameXMMReg(eregOfRM(modrm)), >- nameXMMReg(gregOfRM(modrm)) ); > } else { >- pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL ); >+ pair = disAMode ( cb, sorb, eip, dis_buf ); > t1 = LOW24(pair); > eip += HI8(pair); > uInstr3(cb, is_store ? SSE2a_MemWr : SSE2a_MemRd, sz, > Lit16, (((UShort)insn0) << 8) | (UShort)insn1, > Lit16, (UShort)modrm, > TempReg, t1 ); >- if (dis && is_store) >- VG_(printf)("%s %s, %s\n", name, >- nameXMMReg(gregOfRM(modrm)), dis_buf ); >- if (dis && !is_store) >- VG_(printf)("%s %s, %s\n", name, >- dis_buf, nameXMMReg(gregOfRM(modrm)) ); >+ } >+ >+ if (is_store) { >+ DIP("%s %s, %s\n", >+ name, >+ nameXMMReg(gregOfRM(modrm)), >+ ( isReg ? nameXMMReg(eregOfRM(modrm)) : dis_buf ) ); >+ } else { >+ DIP("%s %s, %s\n", >+ name, >+ ( isReg ? nameXMMReg(eregOfRM(modrm)) : dis_buf ), >+ nameXMMReg(gregOfRM(modrm)) ); > } > return eip; > } > >-static >-void dis_push_segreg ( UCodeBlock* cb, UInt sreg, Int sz ) >-{ >- Int t1 = newTemp(cb), t2 = newTemp(cb); >- vg_assert(sz == 4); >- uInstr2(cb, GETSEG, 2, ArchRegS, sreg, TempReg, t1); >- uInstr2(cb, GET, 4, ArchReg, R_ESP, TempReg, t2); >- uInstr2(cb, SUB, 4, Literal, 0, TempReg, t2); >- uLiteral(cb, 4); >- uInstr2(cb, PUT, 4, TempReg, t2, ArchReg, R_ESP); >- uInstr2(cb, STORE, 2, TempReg, t1, TempReg, t2); >- if (dis) >- VG_(printf)("push %s\n", VG_(name_of_seg_reg)(sreg)); >-} > >+/* Simple SSE operations, either >+ op (src)xmmreg, (dst)mmxreg >+ or >+ op (src)address, (dst)mmxreg >+ 2 opcode bytes. >+ Supplied eip points to the first address mode byte. >+*/ > static >-void dis_pop_segreg ( UCodeBlock* cb, UInt sreg, Int sz ) >+Addr dis_SSE2_to_MMX ( UCodeBlock *cb, >+ UChar sorb, >+ Addr eip, >+ Int sz, >+ Char* name, >+ UChar opc1, >+ UChar opc2 ) > { >- Int t1 = newTemp(cb), t2 = newTemp(cb); >- vg_assert(sz == 4); >- uInstr2(cb, GET, 4, ArchReg, R_ESP, TempReg, t2); >- uInstr2(cb, LOAD, 2, TempReg, t2, TempReg, t1); >- uInstr2(cb, ADD, 4, Literal, 0, TempReg, t2); >- uLiteral(cb, sz); >- uInstr2(cb, PUT, 4, TempReg, t2, ArchReg, R_ESP); >- uInstr2(cb, PUTSEG, 2, TempReg, t1, ArchRegS, sreg); >- if (dis) >- VG_(printf)("pop %s\n", VG_(name_of_seg_reg)(sreg)); >+ UChar dis_buf[50]; >+ UChar modrm = getUChar(eip); >+ if (epartIsReg(modrm)) { >+ /* Completely internal SSE insn. */ >+ uInstr2(cb, SSE3, 0, /* ignore sz for internal ops */ >+ Lit16, (((UShort)opc1) << 8) | (UShort)opc2, >+ Lit16, (UShort)modrm ); >+ DIP("%s %s, %s\n", >+ name, nameXMMReg(eregOfRM(modrm)), nameMMXReg(gregOfRM(modrm)) ); >+ eip++; >+ } else { >+ UInt pair = disAMode ( cb, sorb, eip, dis_buf ); >+ Int tmpa = LOW24(pair); >+ eip += HI8(pair); >+ uInstr3(cb, SSE2a_MemRd, sz, >+ Lit16, (((UShort)(opc1)) << 8) | ((UShort)opc2), >+ Lit16, ((UShort)modrm), >+ TempReg, tmpa); >+ DIP("%s %s, %s\n", name, dis_buf, nameMMXReg(gregOfRM(modrm))); >+ } >+ return eip; > } > >-/*------------------------------------------------------------*/ >-/*--- Disassembling entire basic blocks ---*/ >-/*------------------------------------------------------------*/ >- >-/* Disassemble a single instruction into ucode, returning the updated >- eip, and setting *isEnd to True if this is the last insn in a basic >- block. Also do debug printing if (dis). */ > >-static Addr disInstr ( UCodeBlock* cb, Addr eip, Bool* isEnd ) >+/* Simple SSE operations, either >+ op (src)mmxreg, (dst)xmmreg >+ or >+ op (src)address, (dst)xmmreg >+ 2 opcode bytes. >+ Supplied eip points to the first address mode byte. >+*/ >+static >+Addr dis_SSE2_from_MMX ( UCodeBlock *cb, >+ UChar sorb, >+ Addr eip, >+ Int sz, >+ Char* name, >+ UChar opc1, >+ UChar opc2 ) >+{ >+ UChar dis_buf[50]; >+ UChar modrm = getUChar(eip); >+ if (epartIsReg(modrm)) { >+ /* Completely internal SSE insn. */ >+ uInstr2(cb, SSE3, 0, /* ignore sz for internal ops */ >+ Lit16, (((UShort)opc1) << 8) | (UShort)opc2, >+ Lit16, (UShort)modrm ); >+ DIP("%s %s, %s\n", >+ name, nameMMXReg(eregOfRM(modrm)), nameXMMReg(gregOfRM(modrm)) ); >+ eip++; >+ } else { >+ UInt pair = disAMode ( cb, sorb, eip, dis_buf ); >+ Int tmpa = LOW24(pair); >+ eip += HI8(pair); >+ uInstr3(cb, SSE2a_MemRd, sz, >+ Lit16, (((UShort)(opc1)) << 8) | ((UShort)opc2), >+ Lit16, ((UShort)modrm), >+ TempReg, tmpa); >+ DIP("%s %s, %s\n", name, dis_buf, nameXMMReg(gregOfRM(modrm))); >+ } >+ return eip; >+} >+ >+ >+/* Simple SSE operations, either >+ op (src)xmmreg, (dst)mmxreg >+ or >+ op (src)address, (dst)mmxreg >+ 3 opcode bytes. >+ Supplied eip points to the first address mode byte. >+*/ >+static >+Addr dis_SSE3_to_MMX ( UCodeBlock *cb, >+ UChar sorb, >+ Addr eip, >+ Int sz, >+ Char* name, >+ UChar opc1, >+ UChar opc2, >+ UChar opc3 ) >+{ >+ UChar dis_buf[50]; >+ UChar modrm = getUChar(eip); >+ if (epartIsReg(modrm)) { >+ /* Completely internal SSE insn. */ >+ uInstr2(cb, SSE4, 0, /* ignore sz for internal ops */ >+ Lit16, (((UShort)opc1) << 8) | (UShort)opc2, >+ Lit16, (((UShort)opc3) << 8) | (UShort)modrm ); >+ DIP("%s %s, %s\n", >+ name, nameXMMReg(eregOfRM(modrm)), nameMMXReg(gregOfRM(modrm)) ); >+ eip++; >+ } else { >+ UInt pair = disAMode ( cb, sorb, eip, dis_buf ); >+ Int tmpa = LOW24(pair); >+ eip += HI8(pair); >+ uInstr3(cb, SSE3a_MemRd, sz, >+ Lit16, (((UShort)(opc1)) << 8) | ((UShort)opc2), >+ Lit16, (((UShort)(opc3)) << 8) | ((UShort)modrm), >+ TempReg, tmpa); >+ DIP("%s %s, %s\n", name, dis_buf, nameMMXReg(gregOfRM(modrm))); >+ } >+ return eip; >+} >+ >+ >+/* Simple SSE operations, either >+ op (src)mmxreg, (dst)xmmreg >+ or >+ op (src)address, (dst)xmmreg >+ 3 opcode bytes. >+ Supplied eip points to the first address mode byte. >+*/ >+static >+Addr dis_SSE3_from_MMX ( UCodeBlock *cb, >+ UChar sorb, >+ Addr eip, >+ Int sz, >+ Char* name, >+ UChar opc1, >+ UChar opc2, >+ UChar opc3 ) >+{ >+ UChar dis_buf[50]; >+ UChar modrm = getUChar(eip); >+ if (epartIsReg(modrm)) { >+ /* Completely internal SSE insn. */ >+ uInstr2(cb, SSE4, 0, /* ignore sz for internal ops */ >+ Lit16, (((UShort)opc1) << 8) | (UShort)opc2, >+ Lit16, (((UShort)opc3) << 8) | (UShort)modrm ); >+ DIP("%s %s, %s\n", >+ name, nameMMXReg(eregOfRM(modrm)), nameXMMReg(gregOfRM(modrm)) ); >+ eip++; >+ } else { >+ UInt pair = disAMode ( cb, sorb, eip, dis_buf ); >+ Int tmpa = LOW24(pair); >+ eip += HI8(pair); >+ uInstr3(cb, SSE3a_MemRd, sz, >+ Lit16, (((UShort)(opc1)) << 8) | ((UShort)opc2), >+ Lit16, (((UShort)(opc3)) << 8) | ((UShort)modrm), >+ TempReg, tmpa); >+ DIP("%s %s, %s\n", name, dis_buf, nameXMMReg(gregOfRM(modrm))); >+ } >+ return eip; >+} >+ >+ >+static >+void dis_push_segreg ( UCodeBlock* cb, UInt sreg, Int sz ) >+{ >+ Int t1 = newTemp(cb), t2 = newTemp(cb); >+ vg_assert(sz == 4); >+ uInstr2(cb, GETSEG, 2, ArchRegS, sreg, TempReg, t1); >+ uInstr2(cb, GET, 4, ArchReg, R_ESP, TempReg, t2); >+ uInstr2(cb, SUB, 4, Literal, 0, TempReg, t2); >+ uLiteral(cb, 4); >+ uInstr2(cb, PUT, 4, TempReg, t2, ArchReg, R_ESP); >+ uInstr2(cb, STORE, 2, TempReg, t1, TempReg, t2); >+ DIP("push %s\n", VG_(name_of_seg_reg)(sreg)); >+} >+ >+static >+void dis_pop_segreg ( UCodeBlock* cb, UInt sreg, Int sz ) >+{ >+ Int t1 = newTemp(cb), t2 = newTemp(cb); >+ vg_assert(sz == 4); >+ uInstr2(cb, GET, 4, ArchReg, R_ESP, TempReg, t2); >+ uInstr2(cb, LOAD, 2, TempReg, t2, TempReg, t1); >+ uInstr2(cb, ADD, 4, Literal, 0, TempReg, t2); >+ uLiteral(cb, sz); >+ uInstr2(cb, PUT, 4, TempReg, t2, ArchReg, R_ESP); >+ uInstr2(cb, PUTSEG, 2, TempReg, t1, ArchRegS, sreg); >+ DIP("pop %s\n", VG_(name_of_seg_reg)(sreg)); >+} >+ >+/*------------------------------------------------------------*/ >+/*--- Disassembling entire basic blocks ---*/ >+/*------------------------------------------------------------*/ >+ >+/* Disassemble a single instruction into ucode, returning the updated >+ eip, and setting *isEnd to True if this is the last insn in a basic >+ block. Also do debug printing if necessary. */ >+ >+static Addr disInstr ( UCodeBlock* cb, Addr eip, Bool* isEnd ) > { > UChar opc, modrm, abyte; > UInt d32, pair; >@@ -3393,7 +3803,7 @@ > *isEnd = False; > t1 = t2 = t3 = t4 = INVALID_TEMPREG; > >- if (dis) VG_(printf)("\t0x%x: ", eip); >+ DIP("\t0x%x: ", eip); > > /* Spot the client-request magic sequence. */ > { >@@ -3414,13 +3824,10 @@ > myeip[15] == 0xC1 && myeip[16] == 0xC0 && myeip[17] == 0x13 > ) { > eip += 18; >- uInstr1(cb, JMP, 0, Literal, 0); >- uLiteral(cb, eip); >- uCond(cb, CondAlways); >+ jmp_lit(cb, eip); > LAST_UINSTR(cb).jmpkind = JmpClientReq; > *isEnd = True; >- if (dis) >- VG_(printf)("%%edx = client_request ( %%eax )\n"); >+ DIP("%%edx = client_request ( %%eax )\n"); > return eip; > } > } >@@ -3477,20 +3884,37 @@ > if (VG_(have_ssestate)) { > UChar* insn = (UChar*)eip; > >+ /* FXSAVE/FXRSTOR m32 -- load/store the FPU/MMX/SSE state. */ >+ if (insn[0] == 0x0F && insn[1] == 0xAE >+ && (!epartIsReg(insn[2])) >+ && (gregOfRM(insn[2]) == 1 || gregOfRM(insn[2]) == 0) ) { >+ Bool store = gregOfRM(insn[2]) == 0; >+ vg_assert(sz == 4); >+ pair = disAMode ( cb, sorb, eip+2, dis_buf ); >+ t1 = LOW24(pair); >+ eip += 2+HI8(pair); >+ uInstr3(cb, store ? SSE2a_MemWr : SSE2a_MemRd, 512, >+ Lit16, (((UShort)insn[0]) << 8) | (UShort)insn[1], >+ Lit16, (UShort)insn[2], >+ TempReg, t1 ); >+ DIP("fx%s %s\n", store ? "save" : "rstor", dis_buf ); >+ goto decode_success; >+ } >+ > /* STMXCSR/LDMXCSR m32 -- load/store the MXCSR register. */ > if (insn[0] == 0x0F && insn[1] == 0xAE >+ && (!epartIsReg(insn[2])) > && (gregOfRM(insn[2]) == 3 || gregOfRM(insn[2]) == 2) ) { > Bool store = gregOfRM(insn[2]) == 3; > vg_assert(sz == 4); >- pair = disAMode ( cb, sorb, eip+2, dis?dis_buf:NULL ); >+ pair = disAMode ( cb, sorb, eip+2, dis_buf ); > t1 = LOW24(pair); > eip += 2+HI8(pair); > uInstr3(cb, store ? SSE2a_MemWr : SSE2a_MemRd, 4, > Lit16, (((UShort)insn[0]) << 8) | (UShort)insn[1], > Lit16, (UShort)insn[2], > TempReg, t1 ); >- if (dis) >- VG_(printf)("%smxcsr %s\n", store ? "st" : "ld", dis_buf ); >+ DIP("%smxcsr %s\n", store ? "st" : "ld", dis_buf ); > goto decode_success; > } > >@@ -3504,8 +3928,57 @@ > uInstr2(cb, SSE3, 0, /* ignore sz for internal ops */ > Lit16, (((UShort)0x0F) << 8) | (UShort)0xAE, > Lit16, (UShort)insn[2] ); >- if (dis) >- VG_(printf)("sfence\n"); >+ DIP("sfence\n"); >+ goto decode_success; >+ } >+ >+ /* CLFLUSH -- flush cache line */ >+ if (insn[0] == 0x0F && insn[1] == 0xAE >+ && (!epartIsReg(insn[2])) >+ && (gregOfRM(insn[2]) == 7)) >+ { >+ vg_assert(sz == 4); >+ pair = disAMode ( cb, sorb, eip+2, dis_buf ); >+ t1 = LOW24(pair); >+ eip += 2+HI8(pair); >+ uInstr3(cb, SSE2a_MemRd, 0, /* ignore sz for internal ops */ >+ Lit16, (((UShort)0x0F) << 8) | (UShort)0xAE, >+ Lit16, (UShort)insn[2], >+ TempReg, t1 ); >+ DIP("clflush %s\n", dis_buf); >+ goto decode_success; >+ } >+ >+ /* CVTPI2PS (0x0F,0x2A) -- mm/m64, xmm */ >+ /* CVTPI2PD (0x66,0x0F,0x2A) -- mm/m64, xmm */ >+ if (insn[0] == 0x0F && insn[1] == 0x2A) { >+ if (sz == 4) { >+ eip = dis_SSE2_from_MMX >+ ( cb, sorb, eip+2, 8, "cvtpi2ps", >+ insn[0], insn[1] ); >+ } else { >+ eip = dis_SSE3_from_MMX >+ ( cb, sorb, eip+2, 8, "cvtpi2pd", >+ 0x66, insn[0], insn[1] ); >+ } >+ goto decode_success; >+ } >+ >+ /* CVTTPS2PI (0x0F,0x2C) -- xmm/m64, mm */ >+ /* CVTPS2PI (0x0F,0x2D) -- xmm/m64, mm */ >+ /* CVTTPD2PI (0x66,0x0F,0x2C) -- xmm/m128, mm */ >+ /* CVTPD2PI (0x66,0x0F,0x2D) -- xmm/m128, mm */ >+ if (insn[0] == 0x0F >+ && (insn[1] == 0x2C || insn[1] == 0x2D)) { >+ if (sz == 4) { >+ eip = dis_SSE2_to_MMX >+ ( cb, sorb, eip+2, 8, "cvt{t}ps2pi", >+ insn[0], insn[1] ); >+ } else { >+ eip = dis_SSE3_to_MMX >+ ( cb, sorb, eip+2, 16, "cvt{t}pd2pi", >+ 0x66, insn[0], insn[1] ); >+ } > goto decode_success; > } > >@@ -3537,10 +4010,8 @@ > Lit16, (((UShort)insn[2]) << 8) | (UShort)modrm, > TempReg, t1 ); > uInstr2(cb, PUT, 4, TempReg, t1, ArchReg, gregOfRM(modrm)); >- if (dis) >- VG_(printf)("cvt{t}s{s,d}2si %s, %s\n", >- nameXMMReg(eregOfRM(modrm)), >- nameIReg(4,gregOfRM(modrm)) ); >+ DIP("cvt{t}s{s,d}2si %s, %s\n", >+ nameXMMReg(eregOfRM(modrm)), nameIReg(4,gregOfRM(modrm)) ); > } else { > /* So, we're reading memory and writing an ireg. This calls > for the ultra-horrible SSE3ag_MemRd_RegWr uinstr. We >@@ -3551,7 +4022,7 @@ > /* Destination ireg is GREG. Address goes as EREG as > usual. */ > t1 = newTemp(cb); /* t1 holds value on its way to ireg */ >- pair = disAMode ( cb, sorb, eip+3, dis?dis_buf:NULL ); >+ pair = disAMode ( cb, sorb, eip+3, dis_buf ); > t2 = LOW24(pair); /* t2 holds addr */ > eip += 3+HI8(pair); > uInstr2(cb, SSE3ag_MemRd_RegWr, insn[0]==0xF2 ? 8 : 4, >@@ -3562,10 +4033,8 @@ > | (((UInt)insn[2]) << 8) > | ((UInt)modrm) ); > uInstr2(cb, PUT, 4, TempReg, t1, ArchReg, gregOfRM(modrm)); >- if (dis) >- VG_(printf)("cvt{t}s{s,d}2si %s, %s\n", >- dis_buf, >- nameIReg(4,gregOfRM(modrm)) ); >+ DIP("cvt{t}s{s,d}2si %s, %s\n", >+ dis_buf, nameIReg(4,gregOfRM(modrm)) ); > } > goto decode_success; > } >@@ -3588,22 +4057,32 @@ > Lit16, (((UShort)insn[2]) << 8) | (UShort)modrm, > TempReg, t1 ); > eip += 4; >- if (dis) >- VG_(printf)("cvtsi2s%s %s, %s\n", s_or_d, >- nameIReg(4,eregOfRM(modrm)), >- nameXMMReg(gregOfRM(modrm))); >+ DIP("cvtsi2s%s %s, %s\n", s_or_d, >+ nameIReg(4,eregOfRM(modrm)), nameXMMReg(gregOfRM(modrm))); > } else { >- pair = disAMode ( cb, sorb, eip+3, dis?dis_buf:NULL ); >+ pair = disAMode ( cb, sorb, eip+3, dis_buf ); > t2 = LOW24(pair); > eip += 3+HI8(pair); > uInstr3(cb, SSE3a_MemRd, 4, > Lit16, (((UShort)insn[0]) << 8) | (UShort)insn[1], > Lit16, (((UShort)insn[2]) << 8) | (UShort)modrm, > TempReg, t2 ); >- if (dis) >- VG_(printf)("cvtsi2s%s %s, %s\n", s_or_d, >- dis_buf, >- nameXMMReg(gregOfRM(modrm))); >+ DIP("cvtsi2s%s %s, %s\n", >+ s_or_d, dis_buf, nameXMMReg(gregOfRM(modrm))); >+ } >+ goto decode_success; >+ } >+ >+ /* CVTPS2PD -- convert two packed floats to two packed doubles. */ >+ /* 0x66: CVTPD2PS -- convert two packed doubles to two packed floats. */ >+ if (insn[0] == 0x0F && insn[1] == 0x5A) { >+ vg_assert(sz == 2 || sz == 4); >+ if (sz == 4) { >+ eip = dis_SSE2_reg_or_mem ( cb, sorb, eip+2, 8, "cvtps2pd", >+ insn[0], insn[1] ); >+ } else { >+ eip = dis_SSE3_reg_or_mem ( cb, sorb, eip+2, 16, "cvtpd2ps", >+ 0x66, insn[0], insn[1] ); > } > goto decode_success; > } >@@ -3624,6 +4103,60 @@ > goto decode_success; > } > >+ /* CVTDQ2PS -- convert four ints to four packed floats. */ >+ /* 0x66: CVTPS2DQ -- convert four packed floats to four ints. */ >+ if (insn[0] == 0x0F && insn[1] == 0x5B) { >+ vg_assert(sz == 2 || sz == 4); >+ if (sz == 4) { >+ eip = dis_SSE2_reg_or_mem ( cb, sorb, eip+2, 16, "cvtdq2ps", >+ insn[0], insn[1] ); >+ } else { >+ eip = dis_SSE3_reg_or_mem ( cb, sorb, eip+2, 16, "cvtps2dq", >+ 0x66, insn[0], insn[1] ); >+ } >+ goto decode_success; >+ } >+ >+ /* CVTPD2DQ -- convert two packed doubles to two ints. */ >+ if (sz == 2 >+ && insn[0] == 0x0F && insn[1] == 0xE6) { >+ eip = dis_SSE3_reg_or_mem ( cb, sorb, eip+2, 8, "cvtpd2dq", >+ 0x66, insn[0], insn[1] ); >+ goto decode_success; >+ } >+ >+ /* CVTTPD2DQ -- convert two packed doubles to two ints with truncation. */ >+ if (insn[0] == 0xF2 && insn[1] == 0x0F && insn[2] == 0xE6) { >+ vg_assert(sz == 4); >+ eip = dis_SSE3_reg_or_mem ( cb, sorb, eip+3, 8, "cvttpd2dq", >+ insn[0], insn[1], insn[2] ); >+ goto decode_success; >+ } >+ >+ /* CVTDQ2PD -- convert two ints to two packed doubles. */ >+ if (insn[0] == 0xF3 && insn[1] == 0x0F && insn[2] == 0xE6) { >+ vg_assert(sz == 4); >+ eip = dis_SSE3_reg_or_mem ( cb, sorb, eip+3, 8, "cvtdq2pd", >+ insn[0], insn[1], insn[2] ); >+ goto decode_success; >+ } >+ >+ /* CVTTPS2DQ -- convert four packed floats to four ints with truncation. */ >+ if (insn[0] == 0xF3 && insn[1] == 0x0F && insn[2] == 0x5B) { >+ vg_assert(sz == 4); >+ eip = dis_SSE3_reg_or_mem ( cb, sorb, eip+3, 16, "cvttps2dq", >+ insn[0], insn[1], insn[2] ); >+ goto decode_success; >+ } >+ >+ /* CMPSS -- compare scalar floats. */ >+ if (insn[0] == 0xF3 && insn[1] == 0x0F && insn[2] == 0xC2) { >+ vg_assert(sz == 4); >+ eip = dis_SSE3_reg_or_mem_Imm8 ( cb, sorb, eip+3, 8, "cmpss", >+ insn[0], insn[1], insn[2] ); >+ goto decode_success; >+ } >+ > /* CMPSD -- compare scalar doubles. */ > if (insn[0] == 0xF2 && insn[1] == 0x0F && insn[2] == 0xC2) { > vg_assert(sz == 4); >@@ -3655,10 +4188,26 @@ > goto decode_success; > } > >+ /* PSHUFLW */ >+ if (insn[0] == 0xF2 && insn[1] == 0x0F && insn[2] == 0x70) { >+ eip = dis_SSE3_reg_or_mem_Imm8 ( cb, sorb, eip+3, 16, >+ "pshuflw", >+ insn[0], insn[1], insn[2] ); >+ goto decode_success; >+ } >+ >+ /* PSHUFHW */ >+ if (insn[0] == 0xF3 && insn[1] == 0x0F && insn[2] == 0x70) { >+ eip = dis_SSE3_reg_or_mem_Imm8 ( cb, sorb, eip+3, 16, >+ "pshufhw", >+ insn[0], insn[1], insn[2] ); >+ goto decode_success; >+ } >+ > /* PSHUFW */ > if (sz == 4 > && insn[0] == 0x0F && insn[1] == 0x70) { >- eip = dis_SSE2_reg_or_mem_Imm8 ( cb, sorb, eip+2, 16, >+ eip = dis_SSE2_reg_or_mem_Imm8 ( cb, sorb, eip+2, 8, > "pshufw", > insn[0], insn[1] ); > goto decode_success; >@@ -3795,6 +4344,20 @@ > goto decode_success; > } > >+ /* MINPS */ >+ /* 0x66: MINPD */ >+ if (insn[0] == 0x0F && insn[1] == 0x5D) { >+ vg_assert(sz == 4 || sz == 2); >+ if (sz == 4) { >+ eip = dis_SSE2_reg_or_mem ( cb, sorb, eip+2, 16, "minps", >+ insn[0], insn[1] ); >+ } else { >+ eip = dis_SSE3_reg_or_mem ( cb, sorb, eip+2, 16, "minpd", >+ 0x66, insn[0], insn[1] ); >+ } >+ goto decode_success; >+ } >+ > /* 0xF3: MAXSD */ > /* 0xF3: MAXSS */ > if ((insn[0] == 0xF2 || insn[0] == 0xF3) >@@ -3857,11 +4420,17 @@ > goto decode_success; > } > >- /* ORPD (src)xmmreg-or-mem, (dst)xmmreg */ >- if (sz == 2 >- && insn[0] == 0x0F && insn[1] == 0x56) { >+ /* ORPS */ >+ /* 0x66: ORPD (src)xmmreg-or-mem, (dst)xmmreg */ >+ if (insn[0] == 0x0F && insn[1] == 0x56) { >+ vg_assert(sz == 4 || sz == 2); >+ if (sz == 4) { >+ eip = dis_SSE2_reg_or_mem ( cb, sorb, eip+2, 16, "orps", >+ insn[0], insn[1] ); >+ } else { > eip = dis_SSE3_reg_or_mem ( cb, sorb, eip+2, 16, "orpd", > 0x66, insn[0], insn[1] ); >+ } > goto decode_success; > } > >@@ -3926,23 +4495,25 @@ > 0x66, insn[0], insn[1] ); > goto decode_success; > } >- /* 0xE0: PAVGB(src)xmmreg-or-mem, (dst)xmmreg, size 4 */ >- if (sz == 4 >- && insn[0] == 0x0F >- && insn[1] == 0xE0 ) { >- eip = dis_SSE2_reg_or_mem ( cb, sorb, eip+2, 16, "pavg{b,w}", >- insn[0], insn[1] ); >+ >+ /* 0xF6: PSADBW(src)xmmreg-or-mem, (dst)xmmreg */ >+ if (sz == 2 >+ && insn[0] == 0x0F && insn[1] == 0xF6) { >+ eip = dis_SSE3_reg_or_mem ( cb, sorb, eip+2, 16, "psadbw", >+ 0x66, insn[0], insn[1] ); > goto decode_success; > } > > /* 0x60: PUNPCKLBW (src)xmmreg-or-mem, (dst)xmmreg */ > /* 0x61: PUNPCKLWD (src)xmmreg-or-mem, (dst)xmmreg */ > /* 0x62: PUNPCKLDQ (src)xmmreg-or-mem, (dst)xmmreg */ >+ /* 0x6C: PUNPCKQLQDQ (src)xmmreg-or-mem, (dst)xmmreg */ > if (sz == 2 > && insn[0] == 0x0F >- && (insn[1] == 0x60 || insn[1] == 0x61 || insn[1] == 0x62)) { >+ && (insn[1] == 0x60 || insn[1] == 0x61 >+ || insn[1] == 0x62 || insn[1] == 0x6C)) { > eip = dis_SSE3_reg_or_mem ( cb, sorb, eip+2, 16, >- "punpckl{bw,wd,dq}", >+ "punpckl{bw,wd,dq,qdq}", > 0x66, insn[0], insn[1] ); > goto decode_success; > } >@@ -3950,11 +4521,13 @@ > /* 0x68: PUNPCKHBW (src)xmmreg-or-mem, (dst)xmmreg */ > /* 0x69: PUNPCKHWD (src)xmmreg-or-mem, (dst)xmmreg */ > /* 0x6A: PUNPCKHDQ (src)xmmreg-or-mem, (dst)xmmreg */ >+ /* 0x6D: PUNPCKHQDQ (src)xmmreg-or-mem, (dst)xmmreg */ > if (sz == 2 > && insn[0] == 0x0F >- && (insn[1] == 0x68 || insn[1] == 0x69 || insn[1] == 0x6A)) { >+ && (insn[1] == 0x68 || insn[1] == 0x69 >+ || insn[1] == 0x6A || insn[1] == 0x6D)) { > eip = dis_SSE3_reg_or_mem ( cb, sorb, eip+2, 16, >- "punpckh{bw,wd,dq}", >+ "punpckh{bw,wd,dq,qdq}", > 0x66, insn[0], insn[1] ); > goto decode_success; > } >@@ -4055,12 +4628,21 @@ > goto decode_success; > } > >+ /* 0xE4: PMULHUW(src)xmmreg-or-mem, (dst)xmmreg */ > /* 0xE5: PMULHW(src)xmmreg-or-mem, (dst)xmmreg */ > /* 0xD5: PMULLW(src)xmmreg-or-mem, (dst)xmmreg */ > if (sz == 2 > && insn[0] == 0x0F >- && (insn[1] == 0xE5 || insn[1] == 0xD5)) { >- eip = dis_SSE3_reg_or_mem ( cb, sorb, eip+2, 16, "pmul{h,l}w", >+ && (insn[1] == 0xE4 || insn[1] == 0xE5 || insn[1] == 0xD5)) { >+ eip = dis_SSE3_reg_or_mem ( cb, sorb, eip+2, 16, "pmul{hu,h,l}w", >+ 0x66, insn[0], insn[1] ); >+ goto decode_success; >+ } >+ >+ /* 0xD5: PMULUDQ(src)xmmreg-or-mem, (dst)xmmreg */ >+ if (sz == 2 >+ && insn[0] == 0x0F && insn[1] == 0xF4) { >+ eip = dis_SSE3_reg_or_mem ( cb, sorb, eip+2, 16, "pmuludq", > 0x66, insn[0], insn[1] ); > goto decode_success; > } >@@ -4204,6 +4786,26 @@ > goto decode_success; > } > >+ /* MOVDQ2Q -- move low 4 bytes of XMM reg to MMX reg. */ >+ if (insn[0] == 0xF2 >+ && insn[1] == 0x0F >+ && insn[2] == 0xD6) { >+ eip = dis_SSE3_to_MMX >+ ( cb, sorb, eip+3, 8, "movdq2q", >+ insn[0], insn[1], insn[2] ); >+ goto decode_success; >+ } >+ >+ /* MOVQ2DQ -- move MMX reg to low 4 bytes of XMM reg. */ >+ if (insn[0] == 0xF3 >+ && insn[1] == 0x0F >+ && insn[2] == 0xD6) { >+ eip = dis_SSE3_from_MMX >+ ( cb, sorb, eip+3, 8, "movq2dq", >+ insn[0], insn[1], insn[2] ); >+ goto decode_success; >+ } >+ > /* MOVSS -- move 4 bytes of XMM reg to/from XMM reg or mem. */ > if (insn[0] == 0xF3 > && insn[1] == 0x0F >@@ -4269,19 +4871,6 @@ > goto decode_success; > } > >- /* MOVLPD -- 8-byte load/store. */ >- if (sz == 2 >- && insn[0] == 0x0F >- && (insn[1] == 0x12 || insn[1] == 0x13)) { >- Bool is_store = insn[1]==0x13; >- /* Cannot be used for reg-reg moves, according to Intel docs. */ >- vg_assert(!epartIsReg(insn[2])); >- eip = dis_SSE3_load_store_or_mov >- (cb, sorb, eip+2, 8, is_store, "movlpd", >- 0x66, insn[0], insn[1] ); >- goto decode_success; >- } >- > /* MOVDQU -- unaligned 16-byte load/store. */ > if (insn[0] == 0xF3 > && insn[1] == 0x0F >@@ -4304,6 +4893,27 @@ > goto decode_success; > } > >+ /* MOVNTPS -- 16-byte store with temporal hint (which we >+ ignore). */ >+ if (insn[0] == 0x0F >+ && insn[1] == 0x2B) { >+ eip = dis_SSE2_load_store_or_mov >+ (cb, sorb, eip+2, 16, True /* is_store */, "movntps", >+ insn[0], insn[1] ); >+ goto decode_success; >+ } >+ >+ /* MOVNTPD -- 16-byte store with temporal hint (which we >+ ignore). */ >+ if (sz == 2 >+ && insn[0] == 0x0F >+ && insn[1] == 0x2B) { >+ eip = dis_SSE3_load_store_or_mov >+ (cb, sorb, eip+2, 16, True /* is_store */, "movntpd", >+ 0x66, insn[0], insn[1] ); >+ goto decode_success; >+ } >+ > /* MOVD -- 4-byte move between xmmregs and (ireg or memory). */ > if (sz == 2 > && insn[0] == 0x0F >@@ -4317,10 +4927,8 @@ > Lit16, (((UShort)insn[1]) << 8) | (UShort)modrm, > TempReg, t1 ); > uInstr2(cb, PUT, 4, TempReg, t1, ArchReg, eregOfRM(modrm)); >- if (dis) >- VG_(printf)("movd %s, %s\n", >- nameXMMReg(gregOfRM(modrm)), >- nameIReg(4,eregOfRM(modrm))); >+ DIP("movd %s, %s\n", >+ nameXMMReg(gregOfRM(modrm)), nameIReg(4,eregOfRM(modrm))); > eip += 3; > } else > if (epartIsReg(modrm) && !is_store) { >@@ -4330,10 +4938,8 @@ > Lit16, (((UShort)0x66) << 8) | (UShort)insn[0], > Lit16, (((UShort)insn[1]) << 8) | (UShort)modrm, > TempReg, t1 ); >- if (dis) >- VG_(printf)("movd %s, %s\n", >- nameIReg(4,eregOfRM(modrm)), >- nameXMMReg(gregOfRM(modrm))); >+ DIP("movd %s, %s\n", >+ nameIReg(4,eregOfRM(modrm)), nameXMMReg(gregOfRM(modrm))); > eip += 3; > } else { > eip = dis_SSE3_load_store_or_mov >@@ -4355,10 +4961,9 @@ > TempReg, t1 ); > uLiteral(cb, insn[3]); > uInstr2(cb, PUT, 4, TempReg, t1, ArchReg, gregOfRM(modrm)); >- if (dis) >- VG_(printf)("pextrw %s, %d, %s\n", >- nameXMMReg(eregOfRM(modrm)), (Int)insn[3], >- nameIReg(4, gregOfRM(modrm))); >+ DIP("pextrw %s, %d, %s\n", >+ nameXMMReg(eregOfRM(modrm)), (Int)insn[3], >+ nameIReg(4, gregOfRM(modrm))); > eip += 4; > goto decode_success; > } >@@ -4375,11 +4980,9 @@ > Lit16, (((UShort)insn[1]) << 8) | (UShort)modrm, > TempReg, t1 ); > uLiteral(cb, insn[3]); >- if (dis) >- VG_(printf)("pinsrw %s, %d, %s\n", >- nameIReg(2, eregOfRM(modrm)), >- (Int)insn[3], >- nameXMMReg(gregOfRM(modrm))); >+ DIP("pinsrw %s, %d, %s\n", >+ nameIReg(2, eregOfRM(modrm)), (Int)insn[3], >+ nameXMMReg(gregOfRM(modrm))); > eip += 4; > } else { > VG_(core_panic)("PINSRW mem"); >@@ -4405,17 +5008,12 @@ > goto decode_success; > } > >- /* MOVLPS -- 8-byte load/store. How is this different from MOVLPS >- ? */ >- if (insn[0] == 0x0F >- && (insn[1] == 0x12 || insn[1] == 0x13)) { >- Bool is_store = insn[1]==0x13; >+ /* RSQRTSS: square root reciprocal of scalar float. */ >+ if (insn[0] == 0xF3 && insn[1] == 0x0F && insn[2] == 0x52) { > vg_assert(sz == 4); >- /* Cannot be used for reg-reg moves, according to Intel docs. */ >- // vg_assert(!epartIsReg(insn[2])); >- eip = dis_SSE2_load_store_or_mov >- (cb, sorb, eip+2, 8, is_store, "movlps", >- insn[0], insn[1] ); >+ eip = dis_SSE3_reg_or_mem ( cb, sorb, eip+3, 4, >+ "sqrtss", >+ insn[0], insn[1], insn[2] ); > goto decode_success; > } > >@@ -4430,21 +5028,30 @@ > > /* MOVMSKPD -- extract 2 sign bits from a xmm reg and copy them to > an ireg. Top 30 bits of ireg are set to zero. */ >- if (sz == 2 && insn[0] == 0x0F && insn[1] == 0x50) { >+ /* MOVMSKPS -- extract 4 sign bits from a xmm reg and copy them to >+ an ireg. Top 28 bits of ireg are set to zero. */ >+ if (insn[0] == 0x0F && insn[1] == 0x50) { >+ vg_assert(sz == 4 || sz == 2); > modrm = insn[2]; > /* Intel docs don't say anything about a memory source being > allowed here. */ > vg_assert(epartIsReg(modrm)); > t1 = newTemp(cb); >- uInstr3(cb, SSE3g_RegWr, 4, >- Lit16, (((UShort)0x66) << 8) | (UShort)insn[0], >- Lit16, (((UShort)insn[1]) << 8) | (UShort)modrm, >- TempReg, t1 ); >- uInstr2(cb, PUT, 4, TempReg, t1, ArchReg, gregOfRM(modrm)); >- if (dis) >- VG_(printf)("movmskpd %s, %s\n", >- nameXMMReg(eregOfRM(modrm)), >- nameIReg(4,gregOfRM(modrm))); >+ if (sz == 4) { >+ uInstr3(cb, SSE2g_RegWr, 4, >+ Lit16, (((UShort)insn[0]) << 8) | (UShort)insn[1], >+ Lit16, (UShort)modrm, >+ TempReg, t1 ); >+ uInstr2(cb, PUT, 4, TempReg, t1, ArchReg, gregOfRM(modrm)); >+ } else { >+ uInstr3(cb, SSE3g_RegWr, 4, >+ Lit16, (((UShort)0x66) << 8) | (UShort)insn[0], >+ Lit16, (((UShort)insn[1]) << 8) | (UShort)modrm, >+ TempReg, t1 ); >+ uInstr2(cb, PUT, 4, TempReg, t1, ArchReg, gregOfRM(modrm)); >+ } >+ DIP("movmskp%c %s, %s\n", sz == 4 ? 's' : 'd', >+ nameXMMReg(eregOfRM(modrm)), nameIReg(4,gregOfRM(modrm))); > eip += 3; > goto decode_success; > } >@@ -4463,16 +5070,55 @@ > goto decode_success; > } > >- /* MOVHPD -- 8-byte load/store. */ >- if (sz == 2 >- && insn[0] == 0x0F >+ /* MOVHLPS -- move two packed floats from high quadword to low quadword */ >+ /* MOVLPS -- load/store two packed floats to/from low quadword. */ >+ /* MOVLPD -- load/store packed double to/from low quadword. */ >+ if (insn[0] == 0x0F >+ && (insn[1] == 0x12 || insn[1] == 0x13)) { >+ Bool is_store = insn[1]==0x13; >+ vg_assert(sz == 4 || sz == 2); >+ if (sz == 4) { >+ if (epartIsReg(insn[2])) { >+ vg_assert(insn[1]==0x12); >+ eip = dis_SSE2_reg_or_mem ( cb, sorb, eip+2, 16, "movhlps", >+ insn[0], insn[1] ); >+ } else { >+ eip = dis_SSE2_load_store_or_mov >+ (cb, sorb, eip+2, 8, is_store, "movlps", >+ insn[0], insn[1] ); >+ } >+ } else { >+ vg_assert(!epartIsReg(insn[2])); >+ eip = dis_SSE3_load_store_or_mov >+ (cb, sorb, eip+2, 8, is_store, "movlpd", >+ 0x66, insn[0], insn[1] ); >+ } >+ goto decode_success; >+ } >+ >+ /* MOVLHPS -- move two packed floats from low quadword to high quadword */ >+ /* MOVHPS -- load/store two packed floats to/from high quadword. */ >+ /* MOVHPD -- load/store packed double to/from high quadword. */ >+ if (insn[0] == 0x0F > && (insn[1] == 0x16 || insn[1] == 0x17)) { > Bool is_store = insn[1]==0x17; >- /* Cannot be used for reg-reg moves, according to Intel docs. */ >+ vg_assert(sz == 4 || sz == 2); >+ if (sz == 4) { >+ if (epartIsReg(insn[2])) { >+ vg_assert(insn[1]==0x16); >+ eip = dis_SSE2_reg_or_mem ( cb, sorb, eip+2, 16, "movlhps", >+ insn[0], insn[1] ); >+ } else { >+ eip = dis_SSE2_load_store_or_mov >+ (cb, sorb, eip+2, 8, is_store, "movhps", >+ insn[0], insn[1] ); >+ } >+ } else { > vg_assert(!epartIsReg(insn[2])); > eip = dis_SSE3_load_store_or_mov > (cb, sorb, eip+2, 8, is_store, "movhpd", > 0x66, insn[0], insn[1] ); >+ } > goto decode_success; > } > >@@ -4489,36 +5135,34 @@ > Lit16, (((UShort)insn[1]) << 8) | (UShort)modrm, > TempReg, t1 ); > uInstr2(cb, PUT, 4, TempReg, t1, ArchReg, gregOfRM(modrm)); >- if (dis) >- VG_(printf)("pmovmskb %s, %s\n", >- nameXMMReg(eregOfRM(modrm)), >- nameIReg(4,gregOfRM(modrm))); >+ DIP("pmovmskb %s, %s\n", >+ nameXMMReg(eregOfRM(modrm)), nameIReg(4,gregOfRM(modrm))); > eip += 3; > goto decode_success; > } > >- /* CVTDQ2PD -- convert one single double. to float. */ >- if (insn[0] == 0xF3 && insn[1] == 0x0F && insn[2] == 0xE6) { >- vg_assert(sz == 4); >- eip = dis_SSE3_reg_or_mem ( cb, sorb, eip+3, 8, "cvtdq2pd", >- insn[0], insn[1], insn[2] ); >- goto decode_success; >- } >- >- /* CVTPD2PS -- convert two doubles to two floats. */ >- if (sz == 2 && >- insn[0] == 0x0F && insn[1] == 0x5A) { >- eip = dis_SSE3_reg_or_mem ( cb, sorb, eip+2, 16, "cvtpd2ps", >+ /* sz==4: SQRTPS: square root of packed float. */ >+ /* sz==2: SQRTPD: square root of packed double. */ >+ if (insn[0] == 0x0F && insn[1] == 0x51) { >+ vg_assert(sz == 2 || sz == 4); >+ if (sz == 4) { >+ eip = dis_SSE2_reg_or_mem ( cb, sorb, eip+2, 16, >+ "sqrtps", >+ insn[0], insn[1] ); >+ } else { >+ eip = dis_SSE3_reg_or_mem ( cb, sorb, eip+2, 16, >+ "sqrtpd", > 0x66, insn[0], insn[1] ); >+ } > goto decode_success; > } > >- /* SQRTPD: square root of packed double. */ >- if (sz == 2 >- && insn[0] == 0x0F && insn[1] == 0x51) { >- eip = dis_SSE3_reg_or_mem ( cb, sorb, eip+2, 16, >- "sqrtpd", >- 0x66, insn[0], insn[1] ); >+ /* RSQRTPS: square root reciprocal of packed float. */ >+ if (insn[0] == 0x0F && insn[1] == 0x52) { >+ vg_assert(sz == 4); >+ eip = dis_SSE2_reg_or_mem ( cb, sorb, eip+2, 16, >+ "rsqrtps", >+ insn[0], insn[1] ); > goto decode_success; > } > >@@ -4554,15 +5198,13 @@ > uInstr2(cb, ADD, 4, Literal, 0, TempReg, t1); > uLiteral(cb, 4+d32); > uInstr2(cb, PUT, 4, TempReg, t1, ArchReg, R_ESP); >- uInstr1(cb, JMP, 0, TempReg, t2); >- uCond(cb, CondAlways); >+ jmp_treg(cb, t2); > LAST_UINSTR(cb).jmpkind = JmpRet; > > *isEnd = True; >- if (dis) { >- if (d32 == 0) VG_(printf)("ret\n"); >- else VG_(printf)("ret %d\n", d32); >- } >+ if (d32 == 0) { DIP("ret\n"); } >+ else { DIP("ret %d\n", d32); } >+ > break; > > case 0xE8: /* CALL J4 */ >@@ -4583,8 +5225,7 @@ > uLiteral(cb, eip); > uInstr2(cb, PUT, 4, TempReg, t1, ArchReg, archReg); > eip++; /* Step over the POP */ >- if (dis) >- VG_(printf)("call 0x%x ; popl %s\n",d32,nameIReg(4,archReg)); >+ DIP("call 0x%x ; popl %s\n",d32,nameIReg(4,archReg)); > } else { > /* The normal sequence for a call. */ > t1 = newTemp(cb); t2 = newTemp(cb); t3 = newTemp(cb); >@@ -4596,12 +5237,10 @@ > uInstr2(cb, MOV, 4, Literal, 0, TempReg, t2); > uLiteral(cb, eip); > uInstr2(cb, STORE, 4, TempReg, t2, TempReg, t1); >- uInstr1(cb, JMP, 0, Literal, 0); >- uLiteral(cb, d32); >- uCond(cb, CondAlways); >+ jmp_lit(cb, d32); > LAST_UINSTR(cb).jmpkind = JmpCall; > *isEnd = True; >- if (dis) VG_(printf)("call 0x%x\n",d32); >+ DIP("call 0x%x\n",d32); > } > break; > >@@ -4625,7 +5264,7 @@ > uLiteral(cb, d32); > uInstr2(cb, PUT, 4, TempReg, t2, ArchReg, R_ESP); > } >- if (dis) VG_(printf)("enter 0x%x, 0x%x", d32, abyte); >+ DIP("enter 0x%x, 0x%x", d32, abyte); > break; > > case 0xC9: /* LEAVE */ >@@ -4639,7 +5278,7 @@ > uInstr2(cb, ADD, 4, Literal, 0, TempReg, t1); > uLiteral(cb, 4); > uInstr2(cb, PUT, 4, TempReg, t1, ArchReg, R_ESP); >- if (dis) VG_(printf)("leave"); >+ DIP("leave"); > break; > > /* ---------------- Misc weird-ass insns --------------- */ >@@ -4656,11 +5295,51 @@ > uInstr1(cb, PUSH, 4, TempReg, t1); > uInstr1(cb, CALLM, 0, Lit16, > opc == 0x27 ? VGOFF_(helper_DAA) : VGOFF_(helper_DAS) ); >- uFlagsRWU(cb, FlagsAC, FlagsOSZACP, FlagsEmpty); >+ uFlagsRWU(cb, FlagsAC, FlagsSZACP, FlagO); > uInstr1(cb, POP, 4, TempReg, t1); > uInstr0(cb, CALLM_E, 0); > uInstr2(cb, PUT, 1, TempReg, t1, ArchReg, R_AL); >- if (dis) VG_(printf)(opc == 0x27 ? "daa\n" : "das\n"); >+ DIP(opc == 0x27 ? "daa\n" : "das\n"); >+ break; >+ >+ case 0x37: /* AAA */ >+ case 0x3F: /* AAS */ >+ t1 = newTemp(cb); >+ uInstr2(cb, GET, 2, ArchReg, R_EAX, TempReg, t1); >+ /* Widen %AL to 32 bits, so it's all defined when we push it. */ >+ uInstr1(cb, WIDEN, 4, TempReg, t1); >+ LAST_UINSTR(cb).extra4b = 2; >+ LAST_UINSTR(cb).signed_widen = False; >+ uInstr0(cb, CALLM_S, 0); >+ uInstr1(cb, PUSH, 4, TempReg, t1); >+ uInstr1(cb, CALLM, 0, Lit16, >+ opc == 0x37 ? VGOFF_(helper_AAA) : VGOFF_(helper_AAS) ); >+ uFlagsRWU(cb, FlagA, FlagsAC, FlagsEmpty); >+ uInstr1(cb, POP, 4, TempReg, t1); >+ uInstr0(cb, CALLM_E, 0); >+ uInstr2(cb, PUT, 2, TempReg, t1, ArchReg, R_EAX); >+ DIP(opc == 0x37 ? "aaa\n" : "aas\n"); >+ break; >+ >+ case 0xD4: /* AAM */ >+ case 0xD5: /* AAD */ >+ d32 = getUChar(eip); eip++; >+ if (d32 != 10) VG_(core_panic)("disInstr: AAM/AAD but base not 10 !"); >+ t1 = newTemp(cb); >+ uInstr2(cb, GET, 2, ArchReg, R_EAX, TempReg, t1); >+ /* Widen %AX to 32 bits, so it's all defined when we push it. */ >+ uInstr1(cb, WIDEN, 4, TempReg, t1); >+ LAST_UINSTR(cb).extra4b = 2; >+ LAST_UINSTR(cb).signed_widen = False; >+ uInstr0(cb, CALLM_S, 0); >+ uInstr1(cb, PUSH, 4, TempReg, t1); >+ uInstr1(cb, CALLM, 0, Lit16, >+ opc == 0xD4 ? VGOFF_(helper_AAM) : VGOFF_(helper_AAD) ); >+ uFlagsRWU(cb, FlagsEmpty, FlagsSZP, FlagsEmpty); >+ uInstr1(cb, POP, 4, TempReg, t1); >+ uInstr0(cb, CALLM_E, 0); >+ uInstr2(cb, PUT, 2, TempReg, t1, ArchReg, R_EAX); >+ DIP(opc == 0xD4 ? "aam\n" : "aad\n"); > break; > > /* ------------------------ CWD/CDQ -------------------- */ >@@ -4673,7 +5352,7 @@ > LAST_UINSTR(cb).extra4b = 2; /* the source size */ > LAST_UINSTR(cb).signed_widen = True; > uInstr2(cb, PUT, 4, TempReg, t1, ArchReg, R_EAX); >- if (dis) VG_(printf)("cwd\n"); >+ DIP("cwd\n"); > } else { > vg_assert(sz == 2); > uInstr2(cb, GET, 1, ArchReg, R_EAX, TempReg, t1); >@@ -4681,7 +5360,7 @@ > LAST_UINSTR(cb).extra4b = 1; /* the source size */ > LAST_UINSTR(cb).signed_widen = True; > uInstr2(cb, PUT, 2, TempReg, t1, ArchReg, R_EAX); >- if (dis) VG_(printf)("cbw\n"); >+ DIP("cbw\n"); > } > break; > >@@ -4691,24 +5370,24 @@ > uInstr2(cb, SAR, sz, Literal, 0, TempReg, t1); > uLiteral(cb, sz == 2 ? 15 : 31); > uInstr2(cb, PUT, sz, TempReg, t1, ArchReg, R_EDX); >- if (dis) VG_(printf)(sz == 2 ? "cwdq\n" : "cdqq\n"); >+ DIP(sz == 2 ? "cwdq\n" : "cdqq\n"); > break; > > /* ------------------------ FPU ops -------------------- */ > > case 0x9E: /* SAHF */ > codegen_SAHF ( cb ); >- if (dis) VG_(printf)("sahf\n"); >+ DIP("sahf\n"); > break; > > case 0x9F: /* LAHF */ > codegen_LAHF ( cb ); >- if (dis) VG_(printf)("lahf\n"); >+ DIP("lahf\n"); > break; > > case 0x9B: /* FWAIT */ > /* ignore? */ >- if (dis) VG_(printf)("fwait\n"); >+ DIP("fwait\n"); > break; > > case 0xD8: >@@ -4739,8 +5418,7 @@ > setFlagsFromUOpcode(cb, INC); > uInstr2(cb, PUT, sz, TempReg, t1, ArchReg, > (UInt)(opc - 0x40)); >- if (dis) >- VG_(printf)("inc%c %s\n", nameISize(sz), nameIReg(sz,opc-0x40)); >+ DIP("inc%c %s\n", nameISize(sz), nameIReg(sz,opc-0x40)); > break; > > case 0x48: /* DEC eAX */ >@@ -4758,8 +5436,7 @@ > setFlagsFromUOpcode(cb, DEC); > uInstr2(cb, PUT, sz, TempReg, t1, ArchReg, > (UInt)(opc - 0x48)); >- if (dis) >- VG_(printf)("dec%c %s\n", nameISize(sz), nameIReg(sz,opc-0x48)); >+ DIP("dec%c %s\n", nameISize(sz), nameIReg(sz,opc-0x48)); > break; > > /* ------------------------ INT ------------------------ */ >@@ -4770,34 +5447,26 @@ > /* It's important that all ArchRegs carry their up-to-date value > at this point. So we declare an end-of-block here, which > forces any TempRegs caching ArchRegs to be flushed. */ >- uInstr1(cb, JMP, 0, Literal, 0); >- uLiteral(cb, eip); >- uCond(cb, CondAlways); >+ jmp_lit(cb, eip); > LAST_UINSTR(cb).jmpkind = JmpSyscall; > *isEnd = True; >- if (dis) VG_(printf)("int $0x80\n"); >+ DIP("int $0x80\n"); > break; > > /* ------------------------ Jcond, byte offset --------- */ > > case 0xEB: /* Jb (jump, byte offset) */ > d32 = (eip+1) + getSDisp8(eip); eip++; >- uInstr1(cb, JMP, 0, Literal, 0); >- uLiteral(cb, d32); >- uCond(cb, CondAlways); >+ jmp_lit(cb, d32); > *isEnd = True; >- if (dis) >- VG_(printf)("jmp-8 0x%x\n", d32); >+ DIP("jmp-8 0x%x\n", d32); > break; > > case 0xE9: /* Jv (jump, 16/32 offset) */ > d32 = (eip+sz) + getSDisp(sz,eip); eip += sz; >- uInstr1(cb, JMP, 0, Literal, 0); >- uLiteral(cb, d32); >- uCond(cb, CondAlways); >+ jmp_lit(cb, d32); > *isEnd = True; >- if (dis) >- VG_(printf)("jmp 0x%x\n", d32); >+ DIP("jmp 0x%x\n", d32); > break; > > case 0x70: >@@ -4817,23 +5486,17 @@ > case 0x7E: /* JLEb/JNGb (jump less or equal) */ > case 0x7F: /* JGb/JNLEb (jump greater) */ > d32 = (eip+1) + getSDisp8(eip); eip++; >- uInstr1(cb, JMP, 0, Literal, 0); >- uLiteral(cb, d32); >- uCond(cb, (Condcode)(opc - 0x70)); >- uFlagsRWU(cb, FlagsOSZACP, FlagsEmpty, FlagsEmpty); >+ jcc_lit(cb, d32, (Condcode)(opc - 0x70)); > /* It's actually acceptable not to end this basic block at a > control transfer, reducing the number of jumps through > vg_dispatch, at the expense of possibly translating the insns > following this jump twice. This does give faster code, but > on the whole I don't think the effort is worth it. */ >- uInstr1(cb, JMP, 0, Literal, 0); >- uLiteral(cb, eip); >- uCond(cb, CondAlways); >+ jmp_lit(cb, eip); > *isEnd = True; > /* The above 3 lines would be removed if the bb was not to end > here. */ >- if (dis) >- VG_(printf)("j%s-8 0x%x\n", VG_(name_UCondcode)(opc - 0x70), d32); >+ DIP("j%s-8 0x%x\n", VG_(name_UCondcode)(opc - 0x70), d32); > break; > > case 0xE3: /* JECXZ or perhaps JCXZ, depending on OSO ? Intel >@@ -4844,8 +5507,7 @@ > uInstr2(cb, GET, 4, ArchReg, R_ECX, TempReg, t1); > uInstr2(cb, JIFZ, 4, TempReg, t1, Literal, 0); > uLiteral(cb, d32); >- if (dis) >- VG_(printf)("j%sz 0x%x\n", nameIReg(sz, R_ECX), d32); >+ DIP("j%sz 0x%x\n", nameIReg(sz, R_ECX), d32); > break; > > case 0xE0: /* LOOPNE disp8 */ >@@ -4863,17 +5525,11 @@ > uInstr2(cb, JIFZ, 4, TempReg, t1, Literal, 0); > uLiteral(cb, eip); > if (opc == 0xE0 || opc == 0xE1) { /* LOOPE/LOOPNE */ >- uInstr1(cb, JMP, 0, Literal, 0); >- uLiteral(cb, eip); >- uCond(cb, (opc == 0xE1 ? CondNZ : CondZ)); >- uFlagsRWU(cb, FlagsOSZACP, FlagsEmpty, FlagsEmpty); >+ jcc_lit(cb, eip, (opc == 0xE1 ? CondNZ : CondZ)); > } >- uInstr1(cb, JMP, 0, Literal, 0); >- uLiteral(cb, d32); >- uCond(cb, CondAlways); >+ jmp_lit(cb, d32); > *isEnd = True; >- if (dis) >- VG_(printf)("loop 0x%x\n", d32); >+ DIP("loop 0x%x\n", d32); > break; > > /* ------------------------ IMUL ----------------------- */ >@@ -4910,13 +5566,12 @@ > /* NOTE! this is the one place where a segment override prefix > has no effect on the address calculation. Therefore we pass > zero instead of sorb here. */ >- pair = disAMode ( cb, /*sorb*/ 0, eip, dis?dis_buf:NULL ); >+ pair = disAMode ( cb, /*sorb*/ 0, eip, dis_buf ); > eip += HI8(pair); > t1 = LOW24(pair); > uInstr2(cb, PUT, sz, TempReg, t1, ArchReg, gregOfRM(modrm)); >- if (dis) >- VG_(printf)("lea%c %s, %s\n", nameISize(sz), dis_buf, >- nameIReg(sz,gregOfRM(modrm))); >+ DIP("lea%c %s, %s\n", nameISize(sz), dis_buf, >+ nameIReg(sz,gregOfRM(modrm))); > break; > > case 0x8C: /* MOV Sw,Ew -- MOV from a SEGMENT REGISTER */ >@@ -4938,9 +5593,8 @@ > handleSegOverride(cb, sorb, t2); > uInstr2(cb, LOAD, sz, TempReg, t2, TempReg, t1); > uInstr2(cb, PUT, sz, TempReg, t1, ArchReg, R_EAX); >- if (dis) VG_(printf)("mov%c %s0x%x, %s\n", nameISize(sz), >- sorbTxt(sorb), >- d32, nameIReg(sz,R_EAX)); >+ DIP("mov%c %s0x%x, %s\n", nameISize(sz), sorbTxt(sorb), >+ d32, nameIReg(sz,R_EAX)); > break; > > case 0xA2: /* MOV AL,Ob */ >@@ -4954,9 +5608,8 @@ > uLiteral(cb, d32); > handleSegOverride(cb, sorb, t2); > uInstr2(cb, STORE, sz, TempReg, t1, TempReg, t2); >- if (dis) VG_(printf)("mov%c %s, %s0x%x\n", nameISize(sz), >- nameIReg(sz,R_EAX), >- sorbTxt(sorb), d32); >+ DIP("mov%c %s, %s0x%x\n", nameISize(sz), nameIReg(sz,R_EAX), >+ sorbTxt(sorb), d32); > break; > > case 0xB0: /* MOV imm,AL */ >@@ -4972,8 +5625,7 @@ > uInstr2(cb, MOV, 1, Literal, 0, TempReg, t1); > uLiteral(cb, d32); > uInstr2(cb, PUT, 1, TempReg, t1, ArchReg, opc-0xB0); >- if (dis) VG_(printf)("movb $0x%x,%s\n", d32, >- nameIReg(1,opc-0xB0)); >+ DIP("movb $0x%x,%s\n", d32, nameIReg(1,opc-0xB0)); > break; > > case 0xB8: /* MOV imm,eAX */ >@@ -4989,8 +5641,7 @@ > uInstr2(cb, MOV, sz, Literal, 0, TempReg, t1); > uLiteral(cb, d32); > uInstr2(cb, PUT, sz, TempReg, t1, ArchReg, opc-0xB8); >- if (dis) VG_(printf)("mov%c $0x%x,%s\n", nameISize(sz), d32, >- nameIReg(sz,opc-0xB8)); >+ DIP("mov%c $0x%x,%s\n", nameISize(sz), d32, nameIReg(sz,opc-0xB8)); > break; > > case 0xC6: /* MOV Ib,Eb */ >@@ -5008,10 +5659,10 @@ > uInstr2(cb, MOV, sz, Literal, 0, TempReg, t1); > uLiteral(cb, d32); > uInstr2(cb, PUT, sz, TempReg, t1, ArchReg, eregOfRM(modrm)); >- if (dis) VG_(printf)("mov%c $0x%x, %s\n", nameISize(sz), d32, >- nameIReg(sz,eregOfRM(modrm))); >+ DIP("mov%c $0x%x, %s\n", nameISize(sz), d32, >+ nameIReg(sz,eregOfRM(modrm))); > } else { >- pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL ); >+ pair = disAMode ( cb, sorb, eip, dis_buf ); > eip += HI8(pair); > d32 = getUDisp(sz,eip); eip += sz; > t1 = newTemp(cb); >@@ -5019,7 +5670,7 @@ > uInstr2(cb, MOV, sz, Literal, 0, TempReg, t1); > uLiteral(cb, d32); > uInstr2(cb, STORE, sz, TempReg, t1, TempReg, t2); >- if (dis) VG_(printf)("mov%c $0x%x, %s\n", nameISize(sz), d32, dis_buf); >+ DIP("mov%c $0x%x, %s\n", nameISize(sz), d32, dis_buf); > } > break; > >@@ -5049,6 +5700,9 @@ > case 0x1C: /* SBB Ib, AL */ > eip = dis_op_imm_A(cb, 1, SBB, True, eip, "sbb" ); > break; >+ case 0x1D: /* SBB Iv, eAX */ >+ eip = dis_op_imm_A(cb, sz, SBB, True, eip, "sbb" ); >+ break; > > case 0x24: /* AND Ib, AL */ > eip = dis_op_imm_A(cb, 1, AND, True, eip, "and" ); >@@ -5173,6 +5827,9 @@ > eip = dis_op2_G_E ( cb, sorb, ADC, True, sz, eip, "adc" ); > break; > >+ case 0x18: /* SBB Gb,Eb */ >+ eip = dis_op2_G_E ( cb, sorb, SBB, True, 1, eip, "sbb" ); >+ break; > case 0x19: /* SBB Gv,Ev */ > eip = dis_op2_G_E ( cb, sorb, SBB, True, sz, eip, "sbb" ); > break; >@@ -5222,8 +5879,7 @@ > uLiteral(cb, sz); > uInstr2(cb, PUT, 4, TempReg, t2, ArchReg, R_ESP); > uInstr2(cb, PUT, sz, TempReg, t1, ArchReg, opc-0x58); >- if (dis) >- VG_(printf)("pop%c %s\n", nameISize(sz), nameIReg(sz,opc-0x58)); >+ DIP("pop%c %s\n", nameISize(sz), nameIReg(sz,opc-0x58)); > break; > > case 0x9D: /* POPF */ >@@ -5237,8 +5893,7 @@ > uInstr1(cb, PUTF, sz, TempReg, t1); > /* PUTF writes all the flags we are interested in */ > uFlagsRWU(cb, FlagsEmpty, FlagsALL, FlagsEmpty); >- if (dis) >- VG_(printf)("popf%c\n", nameISize(sz)); >+ DIP("popf%c\n", nameISize(sz)); > break; > > case 0x61: /* POPA */ >@@ -5277,8 +5932,7 @@ > uInstr2(cb, ADD, 4, Literal, 0, TempReg, t3); > uLiteral(cb, sz * 8); /* One 'sz' per register */ > uInstr2(cb, PUT, 4, TempReg, t3, ArchReg, R_ESP); >- if (dis) >- VG_(printf)("popa%c\n", nameISize(sz)); >+ DIP("popa%c\n", nameISize(sz)); > break; > } > >@@ -5309,15 +5963,14 @@ > uInstr2(cb, PUT, 4, TempReg, t1, ArchReg, R_ESP); > > /* resolve MODR/M */ >- pair1 = disAMode ( cb, sorb, eip, dis?dis_buf:NULL); >+ pair1 = disAMode ( cb, sorb, eip, dis_buf ); > > tmpa = LOW24(pair1); > /* uInstr2(cb, LOAD, sz, TempReg, tmpa, TempReg, tmpa); */ > /* store value from stack in memory, M[m32] = t3 */ > uInstr2(cb, STORE, 4, TempReg, t3, TempReg, tmpa); > >- if (dis) >- VG_(printf)("popl %s\n", dis_buf); >+ DIP("popl %s\n", dis_buf); > > eip += HI8(pair1); > break; >@@ -5351,8 +6004,7 @@ > uLiteral(cb, sz); > uInstr2(cb, PUT, 4, TempReg, t2, ArchReg, R_ESP); > uInstr2(cb, STORE, sz, TempReg, t1, TempReg, t2); >- if (dis) >- VG_(printf)("push%c %s\n", nameISize(sz), nameIReg(sz,opc-0x50)); >+ DIP("push%c %s\n", nameISize(sz), nameIReg(sz,opc-0x50)); > break; > > case 0x68: /* PUSH Iv */ >@@ -5370,8 +6022,7 @@ > uInstr2(cb, MOV, sz, Literal, 0, TempReg, t2); > uLiteral(cb, d32); > uInstr2(cb, STORE, sz, TempReg, t2, TempReg, t1); >- if (dis) >- VG_(printf)("push%c $0x%x\n", nameISize(sz), d32); >+ DIP("push%c $0x%x\n", nameISize(sz), d32); > break; > > case 0x9C: /* PUSHF */ >@@ -5386,8 +6037,7 @@ > uLiteral(cb, sz); > uInstr2(cb, PUT, 4, TempReg, t2, ArchReg, R_ESP); > uInstr2(cb, STORE, sz, TempReg, t1, TempReg, t2); >- if (dis) >- VG_(printf)("pushf%c\n", nameISize(sz)); >+ DIP("pushf%c\n", nameISize(sz)); > break; > > case 0x60: /* PUSHA */ >@@ -5429,8 +6079,7 @@ > uLiteral(cb, sz); > uInstr2(cb, STORE, sz, TempReg, t1, TempReg, t2); > } >- if (dis) >- VG_(printf)("pusha%c\n", nameISize(sz)); >+ DIP("pusha%c\n", nameISize(sz)); > break; > } > >@@ -5476,7 +6125,7 @@ > uInstr1(cb, CALLM, 0, Lit16, VGOFF_(helper_CLD)); > uFlagsRWU(cb, FlagsEmpty, FlagD, FlagsEmpty); > uInstr0(cb, CALLM_E, 0); >- if (dis) VG_(printf)("cld\n"); >+ DIP("cld\n"); > break; > > case 0xFD: /* STD */ >@@ -5484,7 +6133,7 @@ > uInstr1(cb, CALLM, 0, Lit16, VGOFF_(helper_STD)); > uFlagsRWU(cb, FlagsEmpty, FlagD, FlagsEmpty); > uInstr0(cb, CALLM_E, 0); >- if (dis) VG_(printf)("std\n"); >+ DIP("std\n"); > break; > > case 0xF8: /* CLC */ >@@ -5492,15 +6141,23 @@ > uInstr1(cb, CALLM, 0, Lit16, VGOFF_(helper_CLC)); > uFlagsRWU(cb, FlagsEmpty, FlagC, FlagsOSZAP); > uInstr0(cb, CALLM_E, 0); >- if (dis) VG_(printf)("clc\n"); >+ DIP("clc\n"); > break; > > case 0xF9: /* STC */ > uInstr0(cb, CALLM_S, 0); > uInstr1(cb, CALLM, 0, Lit16, VGOFF_(helper_STC)); >- uFlagsRWU(cb, FlagsEmpty, FlagC, FlagsOSZCP); >+ uFlagsRWU(cb, FlagsEmpty, FlagC, FlagsOSZAP); >+ uInstr0(cb, CALLM_E, 0); >+ DIP("stc\n"); >+ break; >+ >+ case 0xF5: /* CMC */ >+ uInstr0(cb, CALLM_S, 0); >+ uInstr1(cb, CALLM, 0, Lit16, VGOFF_(helper_CMC)); >+ uFlagsRWU(cb, FlagC, FlagC, FlagsOSZAP); > uInstr0(cb, CALLM_E, 0); >- if (dis) VG_(printf)("stc\n"); >+ DIP("cmc\n"); > break; > > case 0xF2: { /* REPNE prefix insn */ >@@ -5554,8 +6211,11 @@ > } > else > if (abyte == 0x90) { /* REP NOP (PAUSE) */ >- if (dis) VG_(printf)("rep nop (P4 pause)\n"); >- /* do nothing; apparently a hint to the P4 re spin-wait loop */ >+ /* a hint to the P4 re spin-wait loop */ >+ DIP("rep nop (P4 pause)\n"); >+ jmp_lit(cb, eip); >+ LAST_UINSTR(cb).jmpkind = JmpYield; >+ *isEnd = True; > } > else { > goto decode_failure; >@@ -5577,27 +6237,24 @@ > uInstr2(cb, PUT, sz, TempReg, t1, ArchReg, gregOfRM(modrm)); > uInstr2(cb, PUT, sz, TempReg, t2, ArchReg, eregOfRM(modrm)); > eip++; >- if (dis) >- VG_(printf)("xchg%c %s, %s\n", nameISize(sz), >- nameIReg(sz,gregOfRM(modrm)), >- nameIReg(sz,eregOfRM(modrm))); >+ DIP("xchg%c %s, %s\n", >+ nameISize(sz), nameIReg(sz,gregOfRM(modrm)), >+ nameIReg(sz,eregOfRM(modrm))); > } else { >- pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL); >+ pair = disAMode ( cb, sorb, eip, dis_buf ); > t3 = LOW24(pair); > uInstr2(cb, LOAD, sz, TempReg, t3, TempReg, t1); > uInstr2(cb, GET, sz, ArchReg, gregOfRM(modrm), TempReg, t2); > uInstr2(cb, STORE, sz, TempReg, t2, TempReg, t3); > uInstr2(cb, PUT, sz, TempReg, t1, ArchReg, gregOfRM(modrm)); > eip += HI8(pair); >- if (dis) >- VG_(printf)("xchg%c %s, %s\n", nameISize(sz), >- nameIReg(sz,gregOfRM(modrm)), >- dis_buf); >+ DIP("xchg%c %s, %s\n", nameISize(sz), >+ nameIReg(sz,gregOfRM(modrm)), dis_buf); > } > break; > > case 0x90: /* XCHG eAX,eAX */ >- if (dis) VG_(printf)("nop\n"); >+ DIP("nop\n"); > break; > case 0x91: /* XCHG eAX,eCX */ > case 0x92: /* XCHG eAX,eDX */ >@@ -5624,8 +6281,7 @@ > uInstr2(cb, LOAD, 1, TempReg, t1, TempReg, t2); /* get byte at t1 into t2 */ > uInstr2(cb, PUT, 1, TempReg, t2, ArchReg, R_AL); /* put byte into AL */ > >- if (dis) >- VG_(printf)("xlat%c [ebx]\n", nameISize(sz)); >+ DIP("xlat%c [ebx]\n", nameISize(sz)); > break; > > /* ------------------------ IN / OUT ----------------------- */ >@@ -5659,11 +6315,10 @@ > uInstr1(cb, CLEAR, 0, Lit16, 4); > uInstr0(cb, CALLM_E, 0); > uInstr2(cb, PUT, 4, TempReg, t2, ArchReg, R_EAX); >- if (dis) { >- if ( opc == 0xE4 || opc == 0xE5 ) >- VG_(printf)("in 0x%x, %%eax/%%ax/%%al\n", getUChar(eip-1) ); >- else >- VG_(printf)("in (%%dx), %%eax/%%ax/%%al\n"); >+ if ( opc == 0xE4 || opc == 0xE5 ) { >+ DIP("in 0x%x, %%eax/%%ax/%%al\n", getUChar(eip-1) ); >+ } else { >+ DIP("in (%%dx), %%eax/%%ax/%%al\n"); > } > break; > case 0xE6: /* OUT %al,ib */ >@@ -5694,11 +6349,10 @@ > uFlagsRWU(cb, FlagsEmpty, FlagsEmpty, FlagsEmpty); > uInstr1(cb, CLEAR, 0, Lit16, 12); > uInstr0(cb, CALLM_E, 0); >- if (dis) { >- if ( opc == 0xE4 || opc == 0xE5 ) >- VG_(printf)("out %%eax/%%ax/%%al, 0x%x\n", getUChar(eip-1) ); >- else >- VG_(printf)("out %%eax/%%ax/%%al, (%%dx)\n"); >+ if ( opc == 0xE4 || opc == 0xE5 ) { >+ DIP("out %%eax/%%ax/%%al, 0x%x\n", getUChar(eip-1) ); >+ } else { >+ DIP("out %%eax/%%ax/%%al, (%%dx)\n"); > } > break; > >@@ -5841,7 +6495,7 @@ > uInstr2(cb, GET, 4, ArchReg, opc-0xC8, TempReg, t1); > uInstr1(cb, BSWAP, 4, TempReg, t1); > uInstr2(cb, PUT, 4, TempReg, t1, ArchReg, opc-0xC8); >- if (dis) VG_(printf)("bswapl %s\n", nameIReg(4, opc-0xC8)); >+ DIP("bswapl %s\n", nameIReg(4, opc-0xC8)); > break; > > /* =-=-=-=-=-=-=-=-=- BT/BTS/BTR/BTC =-=-=-=-=-=-= */ >@@ -5882,13 +6536,22 @@ > > /* =-=-=-=-=-=-=-=-=- CMPXCHG -=-=-=-=-=-=-=-=-=-= */ > >+ case 0xB0: /* CMPXCHG Gv,Ev */ >+ eip = dis_cmpxchg_G_E ( cb, sorb, 1, eip ); >+ break; > case 0xB1: /* CMPXCHG Gv,Ev */ > eip = dis_cmpxchg_G_E ( cb, sorb, sz, eip ); > break; >+ case 0xC7: /* CMPXCHG8B Gv */ >+ eip = dis_cmpxchg8b ( cb, sorb, eip ); >+ break; > > /* =-=-=-=-=-=-=-=-=- CPUID -=-=-=-=-=-=-=-=-=-=-= */ > > case 0xA2: /* CPUID */ >+ if (!VG_(cpu_has_feature)(VG_X86_FEAT_CPUID)) >+ goto decode_failure; >+ > t1 = newTemp(cb); > t2 = newTemp(cb); > t3 = newTemp(cb); >@@ -5926,7 +6589,7 @@ > uInstr2(cb, PUT, 4, TempReg, t1, ArchReg, R_EAX); > > uInstr0(cb, CALLM_E, 0); >- if (dis) VG_(printf)("cpuid\n"); >+ DIP("cpuid\n"); > break; > > /* =-=-=-=-=-=-=-=-=- MOVZX, MOVSX =-=-=-=-=-=-=-= */ >@@ -5945,6 +6608,21 @@ > eip = dis_movx_E_G ( cb, sorb, eip, 2, 4, True ); > break; > >+ /* =-=-=-=-=-=-=-=-=-=-= MOVNTI -=-=-=-=-=-=-=-=-= */ >+ >+ case 0xC3: /* MOVNTI Gv,Ev */ >+ vg_assert(sz == 4); >+ modrm = getUChar(eip); >+ vg_assert(!epartIsReg(modrm)); >+ t1 = newTemp(cb); >+ uInstr2(cb, GET, 4, ArchReg, gregOfRM(modrm), TempReg, t1); >+ pair = disAMode ( cb, sorb, eip, dis_buf ); >+ t2 = LOW24(pair); >+ eip += HI8(pair); >+ uInstr2(cb, STORE, 4, TempReg, t1, TempReg, t2); >+ DIP("movnti %s,%s\n", nameIReg(4,gregOfRM(modrm)), dis_buf); >+ break; >+ > /* =-=-=-=-=-=-=-=-=- MUL/IMUL =-=-=-=-=-=-=-=-=-= */ > > case 0xAF: /* IMUL Ev, Gv */ >@@ -5969,17 +6647,10 @@ > case 0x8E: /* JLEb/JNGb (jump less or equal) */ > case 0x8F: /* JGb/JNLEb (jump greater) */ > d32 = (eip+4) + getUDisp32(eip); eip += 4; >- uInstr1(cb, JMP, 0, Literal, 0); >- uLiteral(cb, d32); >- uCond(cb, (Condcode)(opc - 0x80)); >- uFlagsRWU(cb, FlagsOSZACP, FlagsEmpty, FlagsEmpty); >- uInstr1(cb, JMP, 0, Literal, 0); >- uLiteral(cb, eip); >- uCond(cb, CondAlways); >+ jcc_lit(cb, d32, (Condcode)(opc - 0x80)); >+ jmp_lit(cb, eip); > *isEnd = True; >- if (dis) >- VG_(printf)("j%s-32 0x%x\n", >- VG_(name_UCondcode)(opc - 0x80), d32); >+ DIP("j%s-32 0x%x\n", VG_(name_UCondcode)(opc - 0x80), d32); > break; > > /* =-=-=-=-=-=-=-=-=- RDTSC -=-=-=-=-=-=-=-=-=-=-= */ >@@ -6002,7 +6673,7 @@ > uInstr1(cb, POP, 4, TempReg, t3); > uInstr2(cb, PUT, 4, TempReg, t3, ArchReg, R_EAX); > uInstr0(cb, CALLM_E, 0); >- if (dis) VG_(printf)("rdtsc\n"); >+ DIP("rdtsc\n"); > break; > > /* =-=-=-=-=-=-=-=-=- SETcc Eb =-=-=-=-=-=-=-=-=-= */ >@@ -6030,20 +6701,17 @@ > uCond(cb, (Condcode)(opc-0x90)); > uFlagsRWU(cb, FlagsOSZACP, FlagsEmpty, FlagsEmpty); > uInstr2(cb, PUT, 1, TempReg, t1, ArchReg, eregOfRM(modrm)); >- if (dis) VG_(printf)("set%s %s\n", >- VG_(name_UCondcode)(opc-0x90), >- nameIReg(1,eregOfRM(modrm))); >+ DIP("set%s %s\n", VG_(name_UCondcode)(opc-0x90), >+ nameIReg(1,eregOfRM(modrm))); > } else { >- pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL ); >+ pair = disAMode ( cb, sorb, eip, dis_buf ); > t2 = LOW24(pair); > eip += HI8(pair); > uInstr1(cb, CC2VAL, 1, TempReg, t1); > uCond(cb, (Condcode)(opc-0x90)); > uFlagsRWU(cb, FlagsOSZACP, FlagsEmpty, FlagsEmpty); > uInstr2(cb, STORE, 1, TempReg, t1, TempReg, t2); >- if (dis) VG_(printf)("set%s %s\n", >- VG_(name_UCondcode)(opc-0x90), >- dis_buf); >+ DIP("set%s %s\n", VG_(name_UCondcode)(opc-0x90), dis_buf); > } > break; > >@@ -6077,6 +6745,9 @@ > > /* =-=-=-=-=-=-=-=-=- CMPXCHG -=-=-=-=-=-=-=-=-=-= */ > >+ case 0xC0: /* XADD Gb,Eb */ >+ eip = dis_xadd_G_E ( cb, sorb, 1, eip ); >+ break; > case 0xC1: /* XADD Gv,Ev */ > eip = dis_xadd_G_E ( cb, sorb, sz, eip ); > break; >@@ -6095,9 +6766,9 @@ > goto decode_failure; > } > eip += lengthAMode(eip); >- if (dis) { >+ if (VG_(print_codegen)) { > UChar* hintstr; >- if(opc == 0x0D) { >+ if (opc == 0x0D) { > switch (gregOfRM(modrm)) { > case 0: hintstr = ""; break; > case 1: hintstr = "w"; break; >@@ -6117,10 +6788,9 @@ > } > break; > >- case 0x71: case 0x72: case 0x73: >+ case 0x71: case 0x72: case 0x73: { > /* (sz==4): PSLL/PSRA/PSRL mmxreg by imm8 */ > /* (sz==2): PSLL/PSRA/PSRL xmmreg by imm8 */ >- { > UChar byte1, byte2, byte3, subopc, mmreg; > vg_assert(sz == 4 || sz == 2); > byte1 = opc; /* 0x71/72/73 */ >@@ -6146,41 +6816,34 @@ > uInstr2(cb, MMX3, 0, > Lit16, (((UShort)byte1) << 8) | ((UShort)byte2), > Lit16, ((UShort)byte3) ); >- if (dis) >- VG_(printf)("ps%s%s $%d, %s\n", >- (subopc == 2 ? "rl" >- : subopc == 6 ? "ll" >- : subopc == 4 ? "ra" >- : "??"), >- nameMMXGran(opc & 3), >- (Int)byte3, >- nameMMXReg(mmreg) ); >+ DIP("ps%s%s $%d, %s\n", >+ ( subopc == 2 ? "rl" >+ : subopc == 6 ? "ll" >+ : subopc == 4 ? "ra" >+ : "??"), >+ nameMMXGran(opc & 3), (Int)byte3, nameMMXReg(mmreg) ); > } else { > /* Whereas we have to include it for SSE. */ > uInstr3(cb, SSE5, 0, > Lit16, (((UShort)0x66) << 8) | ((UShort)0x0F), > Lit16, (((UShort)byte1) << 8) | ((UShort)byte2), > Lit16, ((UShort)byte3) ); >- if (dis) >- VG_(printf)("ps%s%s $%d, %s\n", >- (subopc == 2 ? "rl" >- : subopc == 6 ? "ll" >- : subopc == 4 ? "ra" >- : subopc == 3 ? "(PSRLDQ)" >- : subopc == 7 ? "(PSLLDQ)" >- : "??"), >- nameMMXGran(opc & 3), >- (Int)byte3, >- nameXMMReg(mmreg) ); >- } >+ DIP("ps%s%s $%d, %s\n", >+ ( subopc == 2 ? "rl" >+ : subopc == 6 ? "ll" >+ : subopc == 4 ? "ra" >+ : subopc == 3 ? "(PSRLDQ)" >+ : subopc == 7 ? "(PSLLDQ)" >+ : "??"), >+ nameMMXGran(opc & 3), (Int)byte3, nameXMMReg(mmreg) ); > } > break; >+ } > > case 0x77: /* EMMS */ > vg_assert(sz == 4); > uInstr1(cb, MMX1, 0, Lit16, ((UShort)(opc)) ); >- if (dis) >- VG_(printf)("emms\n"); >+ DIP("emms\n"); > break; > > case 0x7E: /* MOVD (src)mmxreg, (dst)ireg-or-mem */ >@@ -6194,23 +6857,18 @@ > (((UShort)(opc)) << 8) | ((UShort)modrm), > TempReg, t1 ); > uInstr2(cb, PUT, 4, TempReg, t1, ArchReg, eregOfRM(modrm)); >- if (dis) >- VG_(printf)("movd %s, %s\n", >- nameMMXReg(gregOfRM(modrm)), >- nameIReg(4,eregOfRM(modrm))); >+ DIP("movd %s, %s\n", >+ nameMMXReg(gregOfRM(modrm)), nameIReg(4,eregOfRM(modrm))); > } else { > Int tmpa; >- pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL ); >+ pair = disAMode ( cb, sorb, eip, dis_buf ); > tmpa = LOW24(pair); > eip += HI8(pair); > uInstr2(cb, MMX2_MemWr, 4, > Lit16, > (((UShort)(opc)) << 8) | ((UShort)modrm), > TempReg, tmpa); >- if (dis) >- VG_(printf)("movd %s, %s\n", >- nameMMXReg(gregOfRM(modrm)), >- dis_buf); >+ DIP("movd %s, %s\n", nameMMXReg(gregOfRM(modrm)), dis_buf); > } > break; > >@@ -6225,23 +6883,18 @@ > Lit16, > (((UShort)(opc)) << 8) | ((UShort)modrm), > TempReg, t1 ); >- if (dis) >- VG_(printf)("movd %s, %s\n", >- nameIReg(4,eregOfRM(modrm)), >- nameMMXReg(gregOfRM(modrm))); >+ DIP("movd %s, %s\n", >+ nameIReg(4,eregOfRM(modrm)), nameMMXReg(gregOfRM(modrm))); > } else { > Int tmpa; >- pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL ); >+ pair = disAMode ( cb, sorb, eip, dis_buf ); > tmpa = LOW24(pair); > eip += HI8(pair); > uInstr2(cb, MMX2_MemRd, 4, > Lit16, > (((UShort)(opc)) << 8) | ((UShort)modrm), > TempReg, tmpa); >- if (dis) >- VG_(printf)("movd %s, %s\n", >- dis_buf, >- nameMMXReg(gregOfRM(modrm))); >+ DIP("movd %s, %s\n", dis_buf, nameMMXReg(gregOfRM(modrm))); > } > break; > >@@ -6253,23 +6906,19 @@ > uInstr1(cb, MMX2, 0, > Lit16, > (((UShort)(opc)) << 8) | ((UShort)modrm) ); >- if (dis) >- VG_(printf)("movq %s, %s\n", >- nameMMXReg(eregOfRM(modrm)), >- nameMMXReg(gregOfRM(modrm))); >+ DIP("movq %s, %s\n", >+ nameMMXReg(eregOfRM(modrm)), nameMMXReg(gregOfRM(modrm))); > } else { > Int tmpa; >- pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL ); >+ pair = disAMode ( cb, sorb, eip, dis_buf ); > tmpa = LOW24(pair); > eip += HI8(pair); > uInstr2(cb, MMX2_MemRd, 8, > Lit16, > (((UShort)(opc)) << 8) | ((UShort)modrm), > TempReg, tmpa); >- if (dis) >- VG_(printf)("movq %s, %s\n", >- dis_buf, >- nameMMXReg(gregOfRM(modrm))); >+ DIP("movq %s, %s\n", >+ dis_buf, nameMMXReg(gregOfRM(modrm))); > } > break; > >@@ -6278,20 +6927,23 @@ > vg_assert(sz == 4); > modrm = getUChar(eip); > if (epartIsReg(modrm)) { >- goto decode_failure; >+ eip++; >+ uInstr1(cb, MMX2, 0, >+ Lit16, >+ (((UShort)(opc)) << 8) | ((UShort)modrm) ); >+ DIP("movq %s, %s\n", >+ nameMMXReg(gregOfRM(modrm)), nameMMXReg(eregOfRM(modrm))); > } else { > Int tmpa; >- pair = disAMode ( cb, sorb, eip, dis?dis_buf:NULL ); >+ pair = disAMode ( cb, sorb, eip, dis_buf ); > tmpa = LOW24(pair); > eip += HI8(pair); > uInstr2(cb, MMX2_MemWr, 8, > Lit16, > (((UShort)(opc)) << 8) | ((UShort)modrm), > TempReg, tmpa); >- if (dis) >- VG_(printf)("mov(nt)q %s, %s\n", >- nameMMXReg(gregOfRM(modrm)), >- dis_buf); >+ DIP("mov(nt)q %s, %s\n", >+ nameMMXReg(gregOfRM(modrm)), dis_buf); > } > break; > >@@ -6301,6 +6953,12 @@ > eip = dis_MMXop_regmem_to_reg ( cb, sorb, eip, opc, "padd", True ); > break; > >+ case 0xD4: >+ /* PADDQ (src)mmxreg-or-mem, (dst)mmxreg */ >+ vg_assert(sz == 4); >+ eip = dis_MMXop_regmem_to_reg ( cb, sorb, eip, opc, "paddq", False ); >+ break; >+ > case 0xEC: case 0xED: > /* PADDSgg (src)mmxreg-or-mem, (dst)mmxreg */ > vg_assert(sz == 4); >@@ -6313,7 +6971,7 @@ > eip = dis_MMXop_regmem_to_reg ( cb, sorb, eip, opc, "paddus", True ); > break; > >- case 0xF8: case 0xF9: case 0xFA: >+ case 0xF8: case 0xF9: case 0xFA: case 0xFB: > /* PSUBgg (src)mmxreg-or-mem, (dst)mmxreg */ > vg_assert(sz == 4); > eip = dis_MMXop_regmem_to_reg ( cb, sorb, eip, opc, "psub", True ); >@@ -6331,6 +6989,11 @@ > eip = dis_MMXop_regmem_to_reg ( cb, sorb, eip, opc, "psubus", True ); > break; > >+ case 0xE4: /* PMULHUW (src)mmxreg-or-mem, (dst)mmxreg */ >+ vg_assert(sz == 4); >+ eip = dis_MMXop_regmem_to_reg ( cb, sorb, eip, opc, "pmulhuw", False ); >+ break; >+ > case 0xE5: /* PMULHW (src)mmxreg-or-mem, (dst)mmxreg */ > vg_assert(sz == 4); > eip = dis_MMXop_regmem_to_reg ( cb, sorb, eip, opc, "pmulhw", False ); >@@ -6341,6 +7004,11 @@ > eip = dis_MMXop_regmem_to_reg ( cb, sorb, eip, opc, "pmullw", False ); > break; > >+ case 0xF4: /* PMULUDQ (src)mmxreg-or-mem, (dst)mmxreg */ >+ vg_assert(sz == 4); >+ eip = dis_MMXop_regmem_to_reg ( cb, sorb, eip, opc, "pmuludq", False ); >+ break; >+ > case 0xF5: /* PMADDWD (src)mmxreg-or-mem, (dst)mmxreg */ > vg_assert(sz == 4); > eip = dis_MMXop_regmem_to_reg ( cb, sorb, eip, opc, "pmaddwd", False ); >@@ -6423,6 +7091,99 @@ > eip = dis_MMXop_regmem_to_reg ( cb, sorb, eip, opc, "psra", True ); > break; > >+ case 0xDA: >+ /* PMINUB (src)mmxreg-or-mem, (dst)mmxreg */ >+ vg_assert(sz == 4); >+ eip = dis_MMXop_regmem_to_reg ( cb, sorb, eip, opc, "pminub", False ); >+ break; >+ >+ case 0xDE: >+ /* PMAXUB (src)mmxreg-or-mem, (dst)mmxreg */ >+ vg_assert(sz == 4); >+ eip = dis_MMXop_regmem_to_reg ( cb, sorb, eip, opc, "pmaxub", False ); >+ break; >+ >+ case 0xEA: >+ /* PMINSW (src)mmxreg-or-mem, (dst)mmxreg */ >+ vg_assert(sz == 4); >+ eip = dis_MMXop_regmem_to_reg ( cb, sorb, eip, opc, "pminsw", False ); >+ break; >+ >+ case 0xEE: >+ /* PMAXSW (src)mmxreg-or-mem, (dst)mmxreg */ >+ vg_assert(sz == 4); >+ eip = dis_MMXop_regmem_to_reg ( cb, sorb, eip, opc, "pmaxsw", False ); >+ break; >+ >+ case 0xE0: >+ /* PAVGB (src)mmxreg-or-mem, (dst)mmxreg */ >+ vg_assert(sz == 4); >+ eip = dis_MMXop_regmem_to_reg ( cb, sorb, eip, opc, "pavgb", False ); >+ break; >+ >+ case 0xE3: >+ /* PAVGW (src)mmxreg-or-mem, (dst)mmxreg */ >+ vg_assert(sz == 4); >+ eip = dis_MMXop_regmem_to_reg ( cb, sorb, eip, opc, "pavgw", False ); >+ break; >+ >+ case 0xF6: >+ /* PSADBW (src)mmxreg-or-mem, (dst)mmxreg */ >+ vg_assert(sz == 4); >+ eip = dis_MMXop_regmem_to_reg ( cb, sorb, eip, opc, "psadbw", False ); >+ break; >+ >+ case 0xD7: >+ /* PMOVMSKB (src)mmxreg, (dst)ireg */ >+ vg_assert(sz == 4); >+ modrm = getUChar(eip); >+ vg_assert(epartIsReg(modrm)); >+ t1 = newTemp(cb); >+ uInstr3(cb, SSE2g_RegWr, 4, >+ Lit16, (((UShort)(0x0F)) << 8) | (UShort)(opc), >+ Lit16, (UShort)modrm, >+ TempReg, t1 ); >+ uInstr2(cb, PUT, 4, TempReg, t1, ArchReg, gregOfRM(modrm)); >+ DIP("pmovmskb %s, %s\n", >+ nameMMXReg(eregOfRM(modrm)), nameIReg(4,gregOfRM(modrm))); >+ eip++; >+ break; >+ >+ case 0xC5: >+ /* PEXTRW (src)mmxreg, (dst)ireg */ >+ vg_assert(sz == 4); >+ t1 = newTemp(cb); >+ modrm = getUChar(eip); eip++; >+ abyte = getUChar(eip); eip++; >+ vg_assert(epartIsReg(modrm)); >+ uInstr3(cb, SSE2g1_RegWr, 4, >+ Lit16, (((UShort)(0x0F)) << 8) | (UShort)(opc), >+ Lit16, (UShort)modrm, >+ TempReg, t1 ); >+ uLiteral(cb, abyte); >+ uInstr2(cb, PUT, 4, TempReg, t1, ArchReg, gregOfRM(modrm)); >+ DIP("pextrw %s, %d, %s\n", >+ nameMMXReg(eregOfRM(modrm)), (Int)abyte, >+ nameIReg(4, gregOfRM(modrm))); >+ break; >+ >+ case 0xC4: >+ /* PINSRW (src)ireg, (dst)mmxreg */ >+ vg_assert(sz == 4); >+ t1 = newTemp(cb); >+ modrm = getUChar(eip); eip++; >+ abyte = getUChar(eip); eip++; >+ vg_assert(epartIsReg(modrm)); >+ uInstr2(cb, GET, 2, ArchReg, eregOfRM(modrm), TempReg, t1); >+ uInstr3(cb, SSE2e1_RegRd, 2, >+ Lit16, (((UShort)(0x0F)) << 8) | (UShort)(opc), >+ Lit16, (UShort)modrm, >+ TempReg, t1 ); >+ uLiteral(cb, abyte); >+ DIP("pinsrw %s, %d, %s\n", nameIReg(2, eregOfRM(modrm)), >+ (Int)abyte, nameMMXReg(gregOfRM(modrm))); >+ break; >+ > case 0xA1: /* POP %FS */ > dis_pop_segreg( cb, R_FS, sz ); break; > case 0xA9: /* POP %GS */ >@@ -6464,9 +7225,7 @@ > > /* just because everything else insists the last instruction of > a BB is a jmp */ >- uInstr1(cb, JMP, 0, Literal, 0); >- uCond(cb, CondAlways); >- uLiteral(cb, eip); >+ jmp_lit(cb, eip); > *isEnd = True; > break; > return eip; >@@ -6475,11 +7234,10 @@ > > decode_success: > /* All decode successes end up here. */ >- if (dis) >- VG_(printf)("\n"); >+ DIP("\n"); > for (; first_uinstr < cb->used; first_uinstr++) { > Bool sane = VG_(saneUInstr)(True, True, &cb->instrs[first_uinstr]); >- if (dis) >+ if (VG_(print_codegen)) > VG_(pp_UInstr)(first_uinstr, &cb->instrs[first_uinstr]); > else if (!sane) > VG_(up_UInstr)(-1, &cb->instrs[first_uinstr]); >@@ -6500,14 +7258,14 @@ > Bool block_sane; > Int delta = 0; > >- if (dis) VG_(printf)("Original x86 code to UCode:\n\n"); >+ DIP("Original x86 code to UCode:\n\n"); > > /* After every x86 instruction do an INCEIP, except for the final one > * in the basic block. For them we patch in the x86 instruction size > * into the `extra4b' field of the basic-block-ending JMP. > * >- * The INCEIPs and JMP.extra4b fields allows a skin to track x86 >- * instruction sizes, important for some skins (eg. cache simulation). >+ * The INCEIPs and JMP.extra4b fields allows a tool to track x86 >+ * instruction sizes, important for some tools (eg. Cachegrind). > */ > if (VG_(clo_single_step)) { > eip = disInstr ( cb, eip, &isEnd ); >@@ -6516,13 +7274,12 @@ > * already end with a JMP instr. We also need to check for no UCode, > * which occurs if the x86 instr was a nop */ > if (cb->used == 0 || LAST_UINSTR(cb).opcode != JMP) { >- uInstr1(cb, JMP, 0, Literal, 0); >- uLiteral(cb, eip); >- uCond(cb, CondAlways); >+ jmp_lit(cb, eip); > /* Print added JMP */ >- if (dis) VG_(pp_UInstr)(cb->used-1, &cb->instrs[cb->used-1]); >+ if (VG_(print_codegen)) >+ VG_(pp_UInstr)(cb->used-1, &cb->instrs[cb->used-1]); > } >- if (dis) VG_(printf)("\n"); >+ DIP("\n"); > delta = eip - eip0; > > } else { >@@ -6536,20 +7293,21 @@ > if (eip - eip0 > 2000 && !isEnd) { > if (VG_(clo_verbosity) > 2) > VG_(message)(Vg_DebugMsg, >- "Warning: splitting giant basic block into pieces"); >- uInstr1(cb, JMP, 0, Literal, 0); >- uLiteral(cb, eip); >- uCond(cb, CondAlways); >+ "Warning: splitting giant basic block into pieces at %p %(y", >+ eip, eip); >+ jmp_lit(cb, eip); > /* Print added JMP */ >- if (dis) VG_(pp_UInstr)(cb->used-1, &cb->instrs[cb->used-1]); >+ if (VG_(print_codegen)) >+ VG_(pp_UInstr)(cb->used-1, &cb->instrs[cb->used-1]); > isEnd = True; > > } else if (!isEnd) { > uInstr1(cb, INCEIP, 0, Lit16, delta); > /* Print added INCEIP */ >- if (dis) VG_(pp_UInstr)(cb->used-1, &cb->instrs[cb->used-1]); >+ if (VG_(print_codegen)) >+ VG_(pp_UInstr)(cb->used-1, &cb->instrs[cb->used-1]); > } >- if (dis) VG_(printf)("\n"); >+ DIP("\n"); > } > } > >@@ -6565,7 +7323,8 @@ > return eip - eip0; > } > >-#undef dis >+#undef DIP >+#undef DIS > > /*--------------------------------------------------------------------*/ > /*--- end vg_to_ucode.c ---*/ >diff -ruN valgrind-2.1.0/coregrind/vg_translate.c valgrind/coregrind/vg_translate.c >--- valgrind-2.1.0/coregrind/vg_translate.c 2003-10-19 03:18:52.000000000 -0500 >+++ valgrind/coregrind/vg_translate.c 2004-02-11 17:33:28.000000000 -0600 >@@ -8,7 +8,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -414,7 +414,9 @@ > # define SZ42 (u->size == 4 || u->size == 2) > # define SZ48 (u->size == 4 || u->size == 8) > # define SZ416 (u->size == 4 || u->size == 16) >-# define SZsse (u->size == 4 || u->size == 8 || u->size == 16) >+# define SZ816 (u->size == 8 || u->size == 16) >+# define SZsse2 (u->size == 4 || u->size == 8 || u->size == 16 || u->size == 512) >+# define SZsse3 (u->size == 4 || u->size == 8 || u->size == 16) > # define SZi (u->size == 4 || u->size == 2 || u->size == 1) > # define SZf ( u->size == 4 || u->size == 8 || u->size == 2 \ > || u->size == 10 || u->size == 28 || u->size == 108) >@@ -563,22 +565,25 @@ > case MMX2_ERegWr: return LIT0 && SZ4 && CC0 && Ls1 && TR2 && N3 && XOTHER; > > /* Fields checked: lit32 size flags_r/w tag1 tag2 tag3 (rest) */ >- case SSE2a_MemWr: return LIT0 && SZ416 && CC0 && Ls1 && Ls2 && TR3 && XOTHER; >- case SSE2a_MemRd: return LIT0 && SZ416 && CCa && Ls1 && Ls2 && TR3 && XOTHER; >- case SSE2a1_MemRd: return LIT0 && SZ416 && CC0 && Ls1 && Ls2 && TR3 && XOTHER; >- case SSE3a_MemWr: return LIT0 && SZsse && CC0 && Ls1 && Ls2 && TR3 && XOTHER; >- case SSE3a_MemRd: return LIT0 && SZsse && CCa && Ls1 && Ls2 && TR3 && XOTHER; >- case SSE3e_RegRd: return LIT0 && SZ4 && CC0 && Ls1 && Ls2 && TR3 && XOTHER; >- case SSE3e_RegWr: return LIT0 && SZ4 && CC0 && Ls1 && Ls2 && TR3 && XOTHER; >- case SSE3a1_MemRd: return LIT8 && SZ16 && CC0 && Ls1 && Ls2 && TR3 && XOTHER; >- case SSE3g_RegWr: return LIT0 && SZ4 && CC0 && Ls1 && Ls2 && TR3 && XOTHER; >- case SSE3g1_RegWr: return LIT8 && SZ4 && CC0 && Ls1 && Ls2 && TR3 && XOTHER; >- case SSE3e1_RegRd: return LIT8 && SZ2 && CC0 && Ls1 && Ls2 && TR3 && XOTHER; >- case SSE3: return LIT0 && SZ0 && CCa && Ls1 && Ls2 && N3 && XOTHER; >- case SSE4: return LIT0 && SZ0 && CCa && Ls1 && Ls2 && N3 && XOTHER; >- case SSE5: return LIT0 && SZ0 && CC0 && Ls1 && Ls2 && Ls3 && XOTHER; >+ case SSE2a_MemWr: return LIT0 && SZsse2 && CC0 && Ls1 && Ls2 && TR3 && XOTHER; >+ case SSE2a_MemRd: return LIT0 && SZsse2 && CCa && Ls1 && Ls2 && TR3 && XOTHER; >+ case SSE2a1_MemRd: return LIT0 && SZsse3 && CC0 && Ls1 && Ls2 && TR3 && XOTHER; >+ case SSE2g_RegWr: return LIT0 && SZ4 && CC0 && Ls1 && Ls2 && TR3 && XOTHER; >+ case SSE2g1_RegWr: return LIT8 && SZ4 && CC0 && Ls1 && Ls2 && TR3 && XOTHER; >+ case SSE2e1_RegRd: return LIT8 && SZ2 && CC0 && Ls1 && Ls2 && TR3 && XOTHER; >+ case SSE3a_MemWr: return LIT0 && SZsse3 && CC0 && Ls1 && Ls2 && TR3 && XOTHER; >+ case SSE3a_MemRd: return LIT0 && SZsse3 && CCa && Ls1 && Ls2 && TR3 && XOTHER; >+ case SSE3e_RegRd: return LIT0 && SZ4 && CC0 && Ls1 && Ls2 && TR3 && XOTHER; >+ case SSE3e_RegWr: return LIT0 && SZ4 && CC0 && Ls1 && Ls2 && TR3 && XOTHER; >+ case SSE3a1_MemRd: return LIT8 && SZ816 && CC0 && Ls1 && Ls2 && TR3 && XOTHER; >+ case SSE3g_RegWr: return LIT0 && SZ4 && CC0 && Ls1 && Ls2 && TR3 && XOTHER; >+ case SSE3g1_RegWr: return LIT8 && SZ4 && CC0 && Ls1 && Ls2 && TR3 && XOTHER; >+ case SSE3e1_RegRd: return LIT8 && SZ2 && CC0 && Ls1 && Ls2 && TR3 && XOTHER; >+ case SSE3: return LIT0 && SZ0 && CCa && Ls1 && Ls2 && N3 && XOTHER; >+ case SSE4: return LIT0 && SZ0 && CCa && Ls1 && Ls2 && N3 && XOTHER; >+ case SSE5: return LIT0 && SZ0 && CC0 && Ls1 && Ls2 && Ls3 && XOTHER; > case SSE3ag_MemRd_RegWr: >- return SZ48 && CC0 && TR1 && TR2 && N3 && XOTHER; >+ return SZ48 && CC0 && TR1 && TR2 && N3 && XOTHER; > default: > if (VG_(needs).extended_UCode) > return SK_(sane_XUInstr)(beforeRA, beforeLiveness, u); >@@ -602,7 +607,8 @@ > # undef SZ42 > # undef SZ48 > # undef SZ416 >-# undef SZsse >+# undef SZsse2 >+# undef SZsse3 > # undef SZi > # undef SZf > # undef SZ4m >@@ -895,7 +901,10 @@ > case MMX2_ERegWr: return "MMX2_eRWr" ; > case SSE2a_MemWr: return "SSE2a_MWr"; > case SSE2a_MemRd: return "SSE2a_MRd"; >+ case SSE2g_RegWr: return "SSE2g_RWr"; > case SSE2a1_MemRd: return "SSE2a1_MRd"; >+ case SSE2g1_RegWr: return "SSE2g1_RWr"; >+ case SSE2e1_RegRd: return "SSE2e1_RRd"; > case SSE3e_RegRd: return "SSE3e_RRd"; > case SSE3e_RegWr: return "SSE3e_RWr"; > case SSE3g_RegWr: return "SSE3g_RWr"; >@@ -1060,6 +1069,9 @@ > > case SSE2a_MemWr: > case SSE2a_MemRd: >+ case SSE2g_RegWr: >+ case SSE2g1_RegWr: >+ case SSE2e1_RegRd: > VG_(printf)("0x%x:0x%x:0x%x", > (u->val1 >> 8) & 0xFF, u->val1 & 0xFF, u->val2 & 0xFF ); > VG_(pp_UOperand)(u, 3, 4, True); >@@ -1133,6 +1145,7 @@ > case JmpRet: VG_(printf)("-r"); break; > case JmpSyscall: VG_(printf)("-sys"); break; > case JmpClientReq: VG_(printf)("-cli"); break; >+ case JmpYield: VG_(printf)("-yld"); break; > default: break; > } > VG_(pp_UOperand)(u, 1, u->size, False); >@@ -1267,6 +1280,7 @@ > > case SSE3a1_MemRd: > case SSE2a1_MemRd: >+ case SSE2e1_RegRd: > case SSE3e_RegRd: > case SSE3a_MemWr: > case SSE3a_MemRd: >@@ -1274,6 +1288,8 @@ > case SSE3e1_RegRd: > case SSE2a_MemRd: RD(3); break; > >+ case SSE2g_RegWr: >+ case SSE2g1_RegWr: > case SSE3e_RegWr: > case SSE3g1_RegWr: > case SSE3g_RegWr: WR(3); break; >@@ -1438,6 +1454,7 @@ > case MMX2_MemRd: case MMX2_MemWr: > case MMX2_ERegRd: case MMX2_ERegWr: > case SSE2a_MemWr: case SSE2a_MemRd: case SSE2a1_MemRd: >+ case SSE2g_RegWr: case SSE2g1_RegWr: case SSE2e1_RegRd: > case SSE3a_MemWr: case SSE3a_MemRd: case SSE3a1_MemRd: > case SSE3e_RegRd: case SSE3g_RegWr: case SSE3e_RegWr: > case SSE3g1_RegWr: case SSE3e1_RegRd: >@@ -1492,28 +1509,6 @@ > Int* last_live_before; > FlagSet future_dead_flags; > >-# if 0 >- /* DEBUGGING HOOK */ >- { >- static int n_done=0; >- if (VG_(clo_stop_after) > 1000000000) { >- if (n_done > (VG_(clo_stop_after) - 1000000000)) { >- dis=False; >- VG_(clo_trace_codegen) = 0; >- return; >- } >- if (n_done == (VG_(clo_stop_after) - 1000000000)) { >- VG_(printf)("\n"); >- VG_(pp_UCodeBlock) ( cb, "Incoming:" ); >- dis = True; >- VG_(clo_trace_codegen) = 31; >- } >- n_done++; >- } >- } >- /* end DEBUGGING HOOK */ >-# endif /* 0 */ >- > if (dis) > VG_(printf) ("Improvements:\n"); > >@@ -1842,22 +1837,22 @@ > > } else if (PUT == u->opcode && R_ESP == u->val2 && 4 == u->size) { > >-# define DO_GENERIC \ >- if (VG_(track_events).new_mem_stack || \ >- VG_(track_events).die_mem_stack) { \ >- uInstr1(cb, CCALL, 0, TempReg, u->val1); \ >- uCCall(cb, (Addr) VG_(unknown_esp_update), \ >- 1, 1, False); \ >+# define DO_GENERIC \ >+ if (VG_(defined_new_mem_stack)() || \ >+ VG_(defined_die_mem_stack)()) { \ >+ uInstr1(cb, CCALL, 0, TempReg, u->val1); \ >+ uCCall(cb, (Addr) VG_(unknown_esp_update), \ >+ 1, 1, False); \ > } > >-# define DO(kind, size) \ >- if (VG_(track_events).kind##_mem_stack_##size) { \ >- uInstr1(cb, CCALL, 0, TempReg, u->val1); \ >- uCCall(cb, (Addr) VG_(track_events).kind##_mem_stack_##size,\ >- 1, 1, False); \ >- \ >- } else \ >- DO_GENERIC \ >+# define DO(kind, size) \ >+ if (VG_(defined_##kind##_mem_stack_##size)()) { \ >+ uInstr1(cb, CCALL, 0, TempReg, u->val1); \ >+ uCCall(cb, (Addr) VG_(tool_interface).track_##kind##_mem_stack_##size, \ >+ 1, 1, False); \ >+ \ >+ } else \ >+ DO_GENERIC \ > break > > if (u->val1 == t_ESP) { >@@ -2354,12 +2349,14 @@ > /*OUT*/ UInt* trans_size, > /*OUT*/ UShort jumps[VG_MAX_JUMPS]) > { >- Int n_disassembled_bytes, final_code_size, i; >+ Int n_disassembled_bytes, final_code_size; > Bool debugging_translation; > UChar* final_code; > UCodeBlock* cb; > Bool notrace_until_done; > UInt notrace_until_limit = 0; >+ Segment *seg; >+ Addr redir; > > VGP_PUSHCC(VgpTranslate); > debugging_translation >@@ -2367,17 +2364,14 @@ > > /* Look in the code redirect table to see if we should > translate an alternative address for orig_addr. */ >- for (i = 0; VG_(code_redirect_table)[i].entry_pt_orig != 0; i++) { >- if (orig_addr == VG_(code_redirect_table)[i].entry_pt_orig) { >- if (VG_(clo_verbosity) >= 2) >- VG_(message)(Vg_UserMsg, >- "TRANSLATE: %p redirected to %p", >- orig_addr, >- VG_(code_redirect_table)[i].entry_pt_subst ); >- orig_addr = VG_(code_redirect_table)[i].entry_pt_subst; >- break; >- } >- } >+ redir = VG_(code_redirect)(orig_addr); >+ >+ if (redir != orig_addr && VG_(clo_verbosity) >= 2) >+ VG_(message)(Vg_UserMsg, >+ "TRANSLATE: %p redirected to %p", >+ orig_addr, >+ redir ); >+ orig_addr = redir; > > /* If codegen tracing, don't start tracing until > notrace_until_limit blocks have gone by. This avoids printing >@@ -2386,22 +2380,34 @@ > notrace_until_limit to be the number of translations to be made > before --trace-codegen= style printing takes effect. */ > notrace_until_done >- = VG_(overall_in_count) > notrace_until_limit; >+ = VG_(overall_in_count) >= notrace_until_limit; >+ >+ seg = VG_(find_segment)(orig_addr); > > if (!debugging_translation) > VG_TRACK( pre_mem_read, Vg_CoreTranslate, tid, "", orig_addr, 1 ); > >- if (!VG_(is_addressable)(orig_addr, 1)) { >- /* Code address is bad - deliver a signal instead */ >+ if (seg == NULL || >+ !VG_(seg_contains)(seg, orig_addr, 1) || >+ (seg->prot & (VKI_PROT_READ|VKI_PROT_EXEC)) == 0) { > vki_ksiginfo_t info; > >+ /* Code address is bad - deliver a signal instead */ >+ vg_assert(!VG_(is_addressable)(orig_addr, 1)); >+ > info.si_signo = VKI_SIGSEGV; >- info.si_code = 1; /* address not mapped to object */ >+ >+ if (seg != NULL && VG_(seg_contains)(seg, orig_addr, 1)) { >+ vg_assert((seg->prot & VKI_PROT_EXEC) == 0); >+ info.si_code = 2; /* invalid permissions for mapped object */ >+ } else >+ info.si_code = 1; /* address not mapped to object */ > info._sifields._sigfault._addr = (void*)orig_addr; > > VG_(deliver_signal)(tid, &info, False); > return; >- } >+ } else >+ seg->flags |= SF_CODE; /* contains cached code */ > > cb = VG_(alloc_UCodeBlock)(); > cb->orig_eip = orig_addr; >diff -ruN valgrind-2.1.0/coregrind/vg_transtab.c valgrind/coregrind/vg_transtab.c >--- valgrind-2.1.0/coregrind/vg_transtab.c 2003-12-14 09:12:56.000000000 -0600 >+++ valgrind/coregrind/vg_transtab.c 2004-01-04 10:43:20.000000000 -0600 >@@ -8,7 +8,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -378,8 +378,22 @@ > } > for (s = 0; s < VG_TC_N_SECTORS; s++) { > if (vg_tc[s] == NULL) { >+#if 1 > vg_tc[s] = VG_(get_memory_from_mmap) > ( vg_tc_sector_szB, "trans-cache(sector)" ); >+#else >+ Char buf[20]; >+ static Int count = 0; >+ Int fd; >+ >+ VG_(sprintf)(buf, ".transtab.%d", count++); >+ >+ fd = VG_(open)(buf, VKI_O_RDWR|VKI_O_CREAT|VKI_O_TRUNC, 0700); >+ //VG_(unlink)(buf); >+ VG_(do_syscall)(__NR_ftruncate, fd, PGROUNDUP(vg_tc_sector_szB)); >+ vg_tc[s] = VG_(mmap)(0, PGROUNDUP(vg_tc_sector_szB), VKI_PROT_READ|VKI_PROT_WRITE|VKI_PROT_EXEC, VKI_MAP_SHARED, fd, 0); >+ VG_(close)(fd); >+#endif > vg_tc_used[s] = 0; > VG_(sprintf)(msg, "after allocation of sector %d " > "(size %d)", >diff -ruN valgrind-2.1.0/coregrind/vg_unistd.h valgrind/coregrind/vg_unistd.h >--- valgrind-2.1.0/coregrind/vg_unistd.h 2003-10-13 17:26:54.000000000 -0500 >+++ valgrind/coregrind/vg_unistd.h 2004-01-03 21:46:11.000000000 -0600 >@@ -1,3 +1,29 @@ >+ >+/* >+ This file is part of Valgrind, an extensible x86 protected-mode >+ emulator for monitoring program execution on x86-Unixes. >+ >+ Copyright (C) 2000-2004 Julian Seward >+ jseward@acm.org >+ >+ 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 _VG_ASM_I386_UNISTD_H_ > #define _VG_ASM_I386_UNISTD_H_ > /* Taken from Linux 2.6.0-test1 include/asm-i386/unistd.h */ >diff -ruN valgrind-2.1.0/coregrind/vg_unsafe.h valgrind/coregrind/vg_unsafe.h >--- valgrind-2.1.0/coregrind/vg_unsafe.h 2003-11-19 16:07:14.000000000 -0600 >+++ valgrind/coregrind/vg_unsafe.h 2004-02-10 17:44:15.000000000 -0600 >@@ -9,7 +9,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -93,7 +93,6 @@ > > #include <sys/poll.h> > >- > /*--------------------------------------------------------------------*/ > /*--- end vg_unsafe.h ---*/ > /*--------------------------------------------------------------------*/ >diff -ruN valgrind-2.1.0/coregrind/vg_valgrinq_dummy.c valgrind/coregrind/vg_valgrinq_dummy.c >--- valgrind-2.1.0/coregrind/vg_valgrinq_dummy.c 2003-04-15 09:57:51.000000000 -0500 >+++ valgrind/coregrind/vg_valgrinq_dummy.c 1969-12-31 18:00:00.000000000 -0600 >@@ -1,43 +0,0 @@ >- >-/*--------------------------------------------------------------------*/ >-/*--- Used to make a dummy valgrinq.so, which does nothing at all. ---*/ >-/*--- vg_valgrinq_dummy.c ---*/ >-/*--------------------------------------------------------------------*/ >- >-/* >- This file is part of Valgrind, an extensible x86 protected-mode >- emulator for monitoring program execution on x86-Unixes. >- >- Copyright (C) 2000-2003 Julian Seward >- jseward@acm.org >- >- 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. >-*/ >- >-/* For the rationale behind this file, look at >- VG_(mash_LD_PRELOAD_and_LD_LIBRARY_PATH) in vg_main.c. */ >- >-/* Remember not to use a variable of this name in any program you want >- to debug :-) */ >-int dont_mess_with_the_RSCDS = 0; >- >-/* If you are bored, perhaps have a look at http://www.rscds.org. */ >- >-/*--------------------------------------------------------------------*/ >-/*--- end vg_valgrinq_dummy.c ---*/ >-/*--------------------------------------------------------------------*/ >diff -ruN valgrind-2.1.0/coregrind/x86/.cvsignore valgrind/coregrind/x86/.cvsignore >--- valgrind-2.1.0/coregrind/x86/.cvsignore 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/x86/.cvsignore 2003-12-17 07:28:12.000000000 -0600 >@@ -0,0 +1,3 @@ >+Makefile.in >+Makefile >+stage2.lds >diff -ruN valgrind-2.1.0/coregrind/x86/CVS/Entries valgrind/coregrind/x86/CVS/Entries >--- valgrind-2.1.0/coregrind/x86/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/x86/CVS/Entries 2004-02-11 22:51:45.571884264 -0600 >@@ -0,0 +1,7 @@ >+/.cvsignore/1.2/Wed Dec 17 13:28:12 2003// >+/Makefile.am/1.5/Thu Feb 5 14:27:36 2004// >+/ume_archdefs.c/1.2/Sun Jan 4 03:46:11 2004// >+/ume_archdefs.h/1.2/Sun Jan 4 03:46:11 2004// >+/ume_entry.S/1.2/Sun Jan 4 03:46:11 2004// >+/ume_go.c/1.3/Mon Jan 19 21:47:25 2004// >+D >diff -ruN valgrind-2.1.0/coregrind/x86/CVS/Repository valgrind/coregrind/x86/CVS/Repository >--- valgrind-2.1.0/coregrind/x86/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/x86/CVS/Repository 2004-02-11 22:51:45.553887000 -0600 >@@ -0,0 +1 @@ >+valgrind/coregrind/x86 >diff -ruN valgrind-2.1.0/coregrind/x86/CVS/Root valgrind/coregrind/x86/CVS/Root >--- valgrind-2.1.0/coregrind/x86/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/x86/CVS/Root 2004-02-11 22:51:45.552887152 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/coregrind/x86/Makefile.am valgrind/coregrind/x86/Makefile.am >--- valgrind-2.1.0/coregrind/x86/Makefile.am 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/x86/Makefile.am 2004-02-05 08:27:36.000000000 -0600 >@@ -0,0 +1,19 @@ >+noinst_HEADERS = \ >+ ume_archdefs.h >+ >+EXTRA_DIST = \ >+ ume_archdefs.c \ >+ ume_archdefs.h \ >+ ume_entry.S \ >+ ume_go.c >+ >+BUILT_SOURCES = stage2.lds >+CLEANFILES = stage2.lds >+ >+# Extract ld's default linker script and hack it to our needs >+stage2.lds: Makefile >+ $(CC) -Wl,--verbose -nostdlib 2>&1 | sed \ >+ -e '1,/^=====\+$$/d' \ >+ -e '/^=====\+$$/d' \ >+ -e 's/ENTRY(_start)/ENTRY(_ume_entry)/' \ >+ -e 's/0x08048000/kickstart_base/g' > $@ || rm -f $@ >diff -ruN valgrind-2.1.0/coregrind/x86/Makefile.in valgrind/coregrind/x86/Makefile.in >--- valgrind-2.1.0/coregrind/x86/Makefile.in 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/x86/Makefile.in 2004-02-11 22:52:32.089812464 -0600 >@@ -0,0 +1,366 @@ >+# Makefile.in generated by automake 1.8.2 from Makefile.am. >+# @configure_input@ >+ >+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, >+# 2003, 2004 Free Software Foundation, Inc. >+# This Makefile.in is free software; the Free Software Foundation >+# gives unlimited permission to copy and/or distribute it, >+# with or without modifications, as long as this notice is preserved. >+ >+# This program is distributed in the hope that it will be useful, >+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without >+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A >+# PARTICULAR PURPOSE. >+ >+@SET_MAKE@ >+ >+srcdir = @srcdir@ >+top_srcdir = @top_srcdir@ >+VPATH = @srcdir@ >+pkgdatadir = $(datadir)/@PACKAGE@ >+pkglibdir = $(libdir)/@PACKAGE@ >+pkgincludedir = $(includedir)/@PACKAGE@ >+top_builddir = ../.. >+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd >+INSTALL = @INSTALL@ >+install_sh_DATA = $(install_sh) -c -m 644 >+install_sh_PROGRAM = $(install_sh) -c >+install_sh_SCRIPT = $(install_sh) -c >+INSTALL_HEADER = $(INSTALL_DATA) >+transform = $(program_transform_name) >+NORMAL_INSTALL = : >+PRE_INSTALL = : >+POST_INSTALL = : >+NORMAL_UNINSTALL = : >+PRE_UNINSTALL = : >+POST_UNINSTALL = : >+host_triplet = @host@ >+subdir = coregrind/x86 >+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ >+ $(srcdir)/Makefile.in >+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >+am__aclocal_m4_deps = $(top_srcdir)/configure.in >+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ >+ $(ACLOCAL_M4) >+mkinstalldirs = $(mkdir_p) >+CONFIG_HEADER = $(top_builddir)/config.h >+CONFIG_CLEAN_FILES = >+SOURCES = >+DIST_SOURCES = >+HEADERS = $(noinst_HEADERS) >+ETAGS = etags >+CTAGS = ctags >+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) >+ACLOCAL = @ACLOCAL@ >+AMDEP_FALSE = @AMDEP_FALSE@ >+AMDEP_TRUE = @AMDEP_TRUE@ >+AMTAR = @AMTAR@ >+AUTOCONF = @AUTOCONF@ >+AUTOHEADER = @AUTOHEADER@ >+AUTOMAKE = @AUTOMAKE@ >+AWK = @AWK@ >+CC = @CC@ >+CCAS = @CCAS@ >+CCASFLAGS = @CCASFLAGS@ >+CCDEPMODE = @CCDEPMODE@ >+CFLAGS = @CFLAGS@ >+CPP = @CPP@ >+CPPFLAGS = @CPPFLAGS@ >+CXX = @CXX@ >+CXXDEPMODE = @CXXDEPMODE@ >+CXXFLAGS = @CXXFLAGS@ >+CYGPATH_W = @CYGPATH_W@ >+DEFAULT_SUPP = @DEFAULT_SUPP@ >+DEFS = @DEFS@ >+DEPDIR = @DEPDIR@ >+ECHO_C = @ECHO_C@ >+ECHO_N = @ECHO_N@ >+ECHO_T = @ECHO_T@ >+EGREP = @EGREP@ >+EXEEXT = @EXEEXT@ >+GDB = @GDB@ >+INSTALL_DATA = @INSTALL_DATA@ >+INSTALL_PROGRAM = @INSTALL_PROGRAM@ >+INSTALL_SCRIPT = @INSTALL_SCRIPT@ >+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ >+LDFLAGS = @LDFLAGS@ >+LIBOBJS = @LIBOBJS@ >+LIBS = @LIBS@ >+LN_S = @LN_S@ >+LTLIBOBJS = @LTLIBOBJS@ >+MAINT = @MAINT@ >+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ >+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ >+MAKEINFO = @MAKEINFO@ >+OBJEXT = @OBJEXT@ >+PACKAGE = @PACKAGE@ >+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ >+PACKAGE_NAME = @PACKAGE_NAME@ >+PACKAGE_STRING = @PACKAGE_STRING@ >+PACKAGE_TARNAME = @PACKAGE_TARNAME@ >+PACKAGE_VERSION = @PACKAGE_VERSION@ >+PATH_SEPARATOR = @PATH_SEPARATOR@ >+PERL = @PERL@ >+PREFERRED_STACK_BOUNDARY = @PREFERRED_STACK_BOUNDARY@ >+RANLIB = @RANLIB@ >+SET_MAKE = @SET_MAKE@ >+SHELL = @SHELL@ >+STRIP = @STRIP@ >+VERSION = @VERSION@ >+VG_PLATFORM = @VG_PLATFORM@ >+ac_ct_CC = @ac_ct_CC@ >+ac_ct_CXX = @ac_ct_CXX@ >+ac_ct_RANLIB = @ac_ct_RANLIB@ >+ac_ct_STRIP = @ac_ct_STRIP@ >+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ >+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ >+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ >+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ >+am__include = @am__include@ >+am__leading_dot = @am__leading_dot@ >+am__quote = @am__quote@ >+bindir = @bindir@ >+build = @build@ >+build_alias = @build_alias@ >+build_cpu = @build_cpu@ >+build_os = @build_os@ >+build_vendor = @build_vendor@ >+datadir = @datadir@ >+exec_prefix = @exec_prefix@ >+host = @host@ >+host_alias = @host_alias@ >+host_cpu = @host_cpu@ >+host_os = @host_os@ >+host_vendor = @host_vendor@ >+includedir = @includedir@ >+infodir = @infodir@ >+install_sh = @install_sh@ >+libdir = @libdir@ >+libexecdir = @libexecdir@ >+localstatedir = @localstatedir@ >+mandir = @mandir@ >+mkdir_p = @mkdir_p@ >+oldincludedir = @oldincludedir@ >+prefix = @prefix@ >+program_transform_name = @program_transform_name@ >+sbindir = @sbindir@ >+sharedstatedir = @sharedstatedir@ >+sysconfdir = @sysconfdir@ >+target_alias = @target_alias@ >+noinst_HEADERS = \ >+ ume_archdefs.h >+ >+EXTRA_DIST = \ >+ ume_archdefs.c \ >+ ume_archdefs.h \ >+ ume_entry.S \ >+ ume_go.c >+ >+BUILT_SOURCES = stage2.lds >+CLEANFILES = stage2.lds >+all: $(BUILT_SOURCES) >+ $(MAKE) $(AM_MAKEFLAGS) all-am >+ >+.SUFFIXES: >+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) >+ @for dep in $?; do \ >+ case '$(am__configure_deps)' in \ >+ *$$dep*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ >+ && exit 0; \ >+ exit 1;; \ >+ esac; \ >+ done; \ >+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu coregrind/x86/Makefile'; \ >+ cd $(top_srcdir) && \ >+ $(AUTOMAKE) --gnu coregrind/x86/Makefile >+.PRECIOUS: Makefile >+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status >+ @case '$?' in \ >+ *config.status*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ >+ *) \ >+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ >+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ >+ esac; >+ >+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+ >+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+uninstall-info-am: >+ >+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) >+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ >+ unique=`for i in $$list; do \ >+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ >+ done | \ >+ $(AWK) ' { files[$$0] = 1; } \ >+ END { for (i in files) print i; }'`; \ >+ mkid -fID $$unique >+tags: TAGS >+ >+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ >+ $(TAGS_FILES) $(LISP) >+ tags=; \ >+ here=`pwd`; \ >+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ >+ unique=`for i in $$list; do \ >+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ >+ done | \ >+ $(AWK) ' { files[$$0] = 1; } \ >+ END { for (i in files) print i; }'`; \ >+ test -z "$(ETAGS_ARGS)$$tags$$unique" \ >+ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ >+ $$tags $$unique >+ctags: CTAGS >+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ >+ $(TAGS_FILES) $(LISP) >+ tags=; \ >+ here=`pwd`; \ >+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ >+ unique=`for i in $$list; do \ >+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ >+ done | \ >+ $(AWK) ' { files[$$0] = 1; } \ >+ END { for (i in files) print i; }'`; \ >+ test -z "$(CTAGS_ARGS)$$tags$$unique" \ >+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ >+ $$tags $$unique >+ >+GTAGS: >+ here=`$(am__cd) $(top_builddir) && pwd` \ >+ && cd $(top_srcdir) \ >+ && gtags -i $(GTAGS_ARGS) $$here >+ >+distclean-tags: >+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags >+ >+distdir: $(DISTFILES) >+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ >+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ >+ list='$(DISTFILES)'; for file in $$list; do \ >+ case $$file in \ >+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ >+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ >+ esac; \ >+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ >+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ >+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ >+ dir="/$$dir"; \ >+ $(mkdir_p) "$(distdir)$$dir"; \ >+ else \ >+ dir=''; \ >+ fi; \ >+ if test -d $$d/$$file; then \ >+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ >+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ >+ fi; \ >+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ >+ else \ >+ test -f $(distdir)/$$file \ >+ || cp -p $$d/$$file $(distdir)/$$file \ >+ || exit 1; \ >+ fi; \ >+ done >+check-am: all-am >+check: $(BUILT_SOURCES) >+ $(MAKE) $(AM_MAKEFLAGS) check-am >+all-am: Makefile $(HEADERS) >+installdirs: >+install: $(BUILT_SOURCES) >+ $(MAKE) $(AM_MAKEFLAGS) install-am >+install-exec: install-exec-am >+install-data: install-data-am >+uninstall: uninstall-am >+ >+install-am: all-am >+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am >+ >+installcheck: installcheck-am >+install-strip: >+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ >+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ >+ `test -z '$(STRIP)' || \ >+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install >+mostlyclean-generic: >+ >+clean-generic: >+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) >+ >+distclean-generic: >+ -rm -f $(CONFIG_CLEAN_FILES) >+ >+maintainer-clean-generic: >+ @echo "This command is intended for maintainers to use" >+ @echo "it deletes files that may require special tools to rebuild." >+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) >+clean: clean-am >+ >+clean-am: clean-generic mostlyclean-am >+ >+distclean: distclean-am >+ -rm -f Makefile >+distclean-am: clean-am distclean-generic distclean-tags >+ >+dvi: dvi-am >+ >+dvi-am: >+ >+html: html-am >+ >+info: info-am >+ >+info-am: >+ >+install-data-am: >+ >+install-exec-am: >+ >+install-info: install-info-am >+ >+install-man: >+ >+installcheck-am: >+ >+maintainer-clean: maintainer-clean-am >+ -rm -f Makefile >+maintainer-clean-am: distclean-am maintainer-clean-generic >+ >+mostlyclean: mostlyclean-am >+ >+mostlyclean-am: mostlyclean-generic >+ >+pdf: pdf-am >+ >+pdf-am: >+ >+ps: ps-am >+ >+ps-am: >+ >+uninstall-am: uninstall-info-am >+ >+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ >+ ctags distclean distclean-generic distclean-tags distdir dvi \ >+ dvi-am html html-am info info-am install install-am \ >+ install-data install-data-am install-exec install-exec-am \ >+ install-info install-info-am install-man install-strip \ >+ installcheck installcheck-am installdirs maintainer-clean \ >+ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ >+ pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am >+ >+ >+# Extract ld's default linker script and hack it to our needs >+stage2.lds: Makefile >+ $(CC) -Wl,--verbose -nostdlib 2>&1 | sed \ >+ -e '1,/^=====\+$$/d' \ >+ -e '/^=====\+$$/d' \ >+ -e 's/ENTRY(_start)/ENTRY(_ume_entry)/' \ >+ -e 's/0x08048000/kickstart_base/g' > $@ || rm -f $@ >+# Tell versions [3.59,3.63) of GNU make to not export all variables. >+# Otherwise a system limit (for SysV at least) may be exceeded. >+.NOEXPORT: >diff -ruN valgrind-2.1.0/coregrind/x86/ume_archdefs.c valgrind/coregrind/x86/ume_archdefs.c >--- valgrind-2.1.0/coregrind/x86/ume_archdefs.c 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/x86/ume_archdefs.c 2004-01-03 21:46:11.000000000 -0600 >@@ -0,0 +1,29 @@ >+ >+/* >+ This file is part of Valgrind, an extensible x86 protected-mode >+ emulator for monitoring program execution on x86-Unixes. >+ >+ Copyright (C) 2000-2004 Julian Seward >+ jseward@acm.org >+ >+ 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. >+*/ >+ >+#include "ume_archdefs.h" >+ >+const unsigned long CLIENT_START = 0; >diff -ruN valgrind-2.1.0/coregrind/x86/ume_archdefs.h valgrind/coregrind/x86/ume_archdefs.h >--- valgrind-2.1.0/coregrind/x86/ume_archdefs.h 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/x86/ume_archdefs.h 2004-01-03 21:46:11.000000000 -0600 >@@ -0,0 +1,32 @@ >+ >+/* >+ This file is part of Valgrind, an extensible x86 protected-mode >+ emulator for monitoring program execution on x86-Unixes. >+ >+ Copyright (C) 2000-2004 Julian Seward >+ jseward@acm.org >+ >+ 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 UME_ARCHDEFS_H >+#define UME_ARCHDEFS_H >+ >+#define CLIENT_BASE 0x00000000ul /* base address of client address space */ >+ >+#endif /* UME_ARCHDEFS_H */ >diff -ruN valgrind-2.1.0/coregrind/x86/ume_entry.S valgrind/coregrind/x86/ume_entry.S >--- valgrind-2.1.0/coregrind/x86/ume_entry.S 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/x86/ume_entry.S 2004-01-03 21:46:11.000000000 -0600 >@@ -0,0 +1,38 @@ >+ >+/* >+ This file is part of Valgrind, an extensible x86 protected-mode >+ emulator for monitoring program execution on x86-Unixes. >+ >+ Copyright (C) 2000-2004 Julian Seward >+ jseward@acm.org >+ >+ 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. >+*/ >+ >+ .text >+ .globl _ume_entry >+ >+ /* Record the very initial value of %esp before starting the >+ rest of the executable */ >+_ume_entry: >+ movl %esp, ume_exec_esp >+ jmp _start >+ >+ .data >+ .globl ume_exec_esp >+ume_exec_esp: .long 0 >diff -ruN valgrind-2.1.0/coregrind/x86/ume_go.c valgrind/coregrind/x86/ume_go.c >--- valgrind-2.1.0/coregrind/x86/ume_go.c 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/coregrind/x86/ume_go.c 2004-01-19 15:47:25.000000000 -0600 >@@ -0,0 +1,51 @@ >+ >+/* >+ This file is part of Valgrind, an extensible x86 protected-mode >+ emulator for monitoring program execution on x86-Unixes. >+ >+ Copyright (C) 2000-2004 Julian Seward >+ jseward@acm.org >+ >+ 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. >+*/ >+ >+#include "ume_arch.h" >+ >+/* >+ Jump to a particular EIP with a particular ESP. This is intended >+ to simulate the initial CPU state when the kernel starts an program >+ after exec; it therefore also clears all the other registers. >+ */ >+void ume_go(addr_t eip, addr_t esp) >+{ >+ asm volatile ("movl %1, %%esp;" /* set esp */ >+ "pushl %%eax;" /* push esp */ >+ "xorl %%eax,%%eax;" /* clear registers */ >+ "xorl %%ebx,%%ebx;" >+ "xorl %%ecx,%%ecx;" >+ "xorl %%edx,%%edx;" >+ "xorl %%esi,%%esi;" >+ "xorl %%edi,%%edi;" >+ "xorl %%ebp,%%ebp;" >+ >+ "ret" /* return into entry */ >+ : : "a" (eip), "r" (esp)); >+ /* we should never get here */ >+ for(;;) >+ asm volatile("ud2"); >+} >diff -ruN valgrind-2.1.0/default.supp valgrind/default.supp >--- valgrind-2.1.0/default.supp 2003-12-14 09:51:08.000000000 -0600 >+++ valgrind/default.supp 1969-12-31 18:00:00.000000000 -0600 >@@ -1,451 +0,0 @@ >-# This is a generated file, composed of the following suppression rules: >-# >-# glibc-2.3.supp xfree-4.supp xfree-3.supp >-# >- >- >-##----------------------------------------------------------------------## >- >-# Errors to suppress by default with glibc 2.3.x >- >-# Format of this file is: >-# { >-# name_of_suppression >-# tool_name:supp_kind >-# (optional extra info for some suppression types) >-# caller0 name, or /name/of/so/file.so >-# caller1 name, or ditto >-# (optionally: caller2 name) >-# (optionally: caller3 name) >-# } >-# >-# For Memcheck, the supp_kinds are: >-# >-# Param Value1 Value2 Value4 Value8 Value16 >-# Free Addr1 Addr2 Addr4 Addr8 Addr16 >-# Cond (previously known as Value0) >-# >-# and the optional extra info is: >-# if Param: name of system call param >-# if Free: name of free-ing fn) >- >-{ >- __GI___stpcpy/* >- Memcheck:Cond >- fun:__GI___stpcpy >- fun:* >-} >-{ >- strlen/__GI__dl_open/dlopen_doit >- Memcheck:Cond >- fun:strlen >- fun:__GI__dl_open >- fun:dlopen_doit >-} >-{ >- strlen/_dl_signal_cerror/_dl_lookup_symbol_internal/do_dlsym >- Memcheck:Cond >- fun:_dl_signal_cerror >- fun:_dl_lookup_symbol_internal >- fun:do_dlsym >-} >-{ >- strlen/*dl_map_object*(Cond) >- Memcheck:Cond >- fun:strlen >- fun:*dl_map_object* >-} >- >-{ >- strlen/*dl_open_worker*(Cond) >- Memcheck:Cond >- fun:strlen >- fun:*dl_open_worker* >-} >-{ >- strlen/_dl_sym/dlsym_doit >- Memcheck:Cond >- fun:strlen >- fun:_dl_sym >- fun:dlsym_doit >-} >-{ >- realpath is inefficiently coded >- Addrcheck,Memcheck:Overlap >- fun:memcpy >- fun:realpath* >-} >- >-{ >- realpath stupidity part II >- Addrcheck,Memcheck:Overlap >- fun:strcpy >- fun:realpath* >-} >-{ >- strlen/decompose_rpath/_dl_map_object >- Memcheck:Cond >- fun:strlen >- fun:decompose_rpath >- fun:*dl_map_object* >-} >-{ >- stpcpy/_dl_sym* >- Memcheck:Cond >- fun:__stpcpy >- fun:_dl_* >-} >- >-#-------- For R H 8.0 >-{ >- elf_dynamic_do_rel.7/_dl_relocate_object_internal/dl_open_worker(Cond) >- Memcheck:Cond >- fun:elf_dynamic_do_rel.7 >- fun:_dl_relocate_object_internal >- fun:dl_open_worker >-} >-{ >- dl_relocate/dl_open_worker >- Memcheck:Cond >- fun:_dl_relocate_object_internal >- fun:dl_open_worker >-} >- >- >-#-------- Threading bugs? >-# glibc 'knows' that destroying a locked mutex will unlock it >-{ >- pthread_error/__pthread_mutex_destroy/__closedir >- core:PThread >- fun:pthread_error >- fun:__pthread_mutex_destroy >- fun:__closedir >-} >- >-{ >- pthread_error/__pthread_mutex_destroy/_IO_default_finish >- core:PThread >- fun:pthread_error >- fun:__pthread_mutex_destroy >- fun:_IO_default_finish* >-} >- >-{ >- __pthread_mutex_unlock/_IO_funlockfile >- core:PThread >- fun:__pthread_mutex_unlock >- fun:_IO_funlockfile >-} >- >-##----------------------------------------------------------------------## >-## For a leak in Valgrind's own libpthread.so :( >-{ >- my_malloc/get_or_allocate_specifics_ptr/__pthread_key_create(Leak) >- Memcheck:Leak >- fun:my_malloc >- fun:get_or_allocate_specifics_ptr >- fun:__pthread_key_create >-} >- >-##----------------------------------------------------------------------## >-## Bugs in helper library supplied with Intel Icc 7.0 (65) >-## in /opt/intel/compiler70/ia32/lib/libcxa.so.3 >-{ >- Intel compiler70/ia32/lib/libcxa.so.3 below-esp accesses >- Addrcheck,Memcheck:Addr4 >- obj:/opt/intel/compiler70/ia32/lib/libcxa.so.3 >-} >- >-##----------------------------------------------------------------------## >- >-# Errors to suppress by default with XFree86 4.1.0) >- >-# Format of this file is: >-# { >-# name_of_suppression >-# tool_name:supp_kind >-# (optional extra info for some suppression types) >-# caller0 name, or /name/of/so/file.so >-# caller1 name, or ditto >-# (optionally: caller2 name) >-# (optionally: caller3 name) >-# } >-# >-# For memcheck, the supp_kinds are: >-# >-# Param Value1 Value2 Value4 Value8 Value16 >-# Free Addr1 Addr2 Addr4 Addr8 Addr16 >-# Cond (previously known as Value0) >-# >-# and the optional extra info is: >-# if Param: name of system call param >-# if Free: name of free-ing fn) >- >-# Resulting from R H 8.0 >-{ >- *libc_write/libX11.so.6.2/*X11TransWrite(Param) >- Addrcheck,Memcheck:Param >- write(buf) >- fun:*libc_write >- obj:/usr/X11R6/lib/libX11.so.6.2 >- fun:*X11TransWrite >-} >- >-{ >- libX11.so.6.2/libX11.so.6.2/libX11.so.6.2(Cond) >- Memcheck:Cond >- obj:/usr/X11R6/lib/libX11.so.6.2 >- obj:/usr/X11R6/lib/libX11.so.6.2 >- obj:/usr/X11R6/lib/libX11.so.6.2 >-} >- >-{ >- libXt.so.6.2/libXt.so.6.2/libXt.so.6.2(Cond) >- Memcheck:Cond >- obj:/usr/X11R6/lib/libXt.so.6.0 >- obj:/usr/X11R6/lib/libXt.so.6.0 >- obj:/usr/X11R6/lib/libXt.so.6.0 >-} >- >- >-{ >- libXaw.so.7.0/libXaw.so.7.0/libXaw.so.7.0(Cond) >- Memcheck:Cond >- obj:/usr/X11R6/lib/libXaw.so.7.0 >- obj:/usr/X11R6/lib/libXaw.so.7.0 >- obj:/usr/X11R6/lib/libXaw.so.7.0 >-} >- >-{ >- libXmu.so.6.2/libXmu.so.6.2/libXmu.so.6.2(Cond) >- Memcheck:Cond >- obj:/usr/X11R6/lib/libXmu.so.6.2 >- obj:/usr/X11R6/lib/libXmu.so.6.2 >- obj:/usr/X11R6/lib/libXmu.so.6.2 >-} >- >-{ >- libXt.so.6.0/libXt.so.6.0/libXaw.so.7.0(Cond) >- Memcheck:Cond >- obj:/usr/X11R6/lib/libXt.so.6.0 >- obj:/usr/X11R6/lib/libXt.so.6.0 >- obj:/usr/X11R6/lib/libXaw.so.7.0 >-} >- >-{ >- libXaw.so.7.0/libXaw.so.7.0/libXt.so.6.0(Value4) >- Memcheck:Value4 >- obj:/usr/X11R6/lib/libXaw.so.7.0 >- obj:/usr/X11R6/lib/libXaw.so.7.0 >- obj:/usr/X11R6/lib/libXt.so.6.0 >-} >- >-{ >- libXaw.so.7.0/libXaw.so.7.0/libXt.so.6.0(Cond) >- Memcheck:Cond >- obj:/usr/X11R6/lib/libXaw.so.7.0 >- obj:/usr/X11R6/lib/libXaw.so.7.0 >- obj:/usr/X11R6/lib/libXt.so.6.0 >-} >- >-{ >- libX11.so.6.2/libX11.so.6.2/libXaw.so.7.0(Cond) >- Memcheck:Cond >- obj:/usr/X11R6/lib/libX11.so.6.2 >- obj:/usr/X11R6/lib/libX11.so.6.2 >- obj:/usr/X11R6/lib/libXaw.so.7.0 >-} >- >-{ >- libX11.so.6.2/libXaw.so.7.0/libXaw.so.7.0(Cond) >- Memcheck:Cond >- obj:/usr/X11R6/lib/libX11.so.6.2 >- obj:/usr/X11R6/lib/libXaw.so.7.0 >- obj:/usr/X11R6/lib/libXaw.so.7.0 >-} >- >-{ >- libXpm.so.4.11/libXpm.so.4.11/libXpm.so.4.11 >- Memcheck:Cond >- obj:/usr/X11R6/lib/libXpm.so.4.11 >- obj:/usr/X11R6/lib/libXpm.so.4.11 >- obj:/usr/X11R6/lib/libXpm.so.4.11 >-} >- >-{ >- struct with uninitialized paddings >- Memcheck:Param >- writev(vector[...]) >- fun:vgAllRoadsLeadToRome_writev >- fun:__writev >- fun:_X11TransSocketWritev >- fun:_X11TransWritev >-} >- >-{ >- another struct with uninitialized paddings >- Memcheck:Param >- write(buf) >- fun:* >- fun:_IceTransSocketWrite >- fun:_IceTransWrite >- fun:_IceWrite >-} >- >- >-##----------------------------------------------------------------------## >- >- >-##----------------------------------------------------------------------## >- >-# Errors to suppress by default with XFree86 3.3.6) >- >-# Format of this file is: >-# { >-# name_of_suppression >-# tool_name:supp_kind >-# (optional extra info for some suppression types) >-# caller0 name, or /name/of/so/file.so >-# caller1 name, or ditto >-# (optionally: caller2 name) >-# (optionally: caller3 name) >-# } >-# >-# For Memcheck, the supp_kinds are: >-# >-# Param Value1 Value2 Value4 Value8 Value16 >-# Free Addr1 Addr2 Addr4 Addr8 Addr16 >-# Cond (previously known as Value0) >-# >-# and the optional extra info is: >-# if Param: name of system call param >-# if Free: name of free-ing fn) >- >-##----------------------------------------------------------------------## >- >-{ >- X11-Cond-0 >- Memcheck:Cond >- obj:*libXt.so.6.0 >- obj:*libXt.so.6.0 >- obj:*libXt.so.6.0 >-} >-{ >- X11-Cond-1 >- Memcheck:Cond >- fun:__rawmemchr >- obj:*libXt.so.6.0 >- obj:*libXt.so.6.0 >-} >- >- >-# Suppressions for XFree86-3.3.X >- >-{ >- X11-Addr4-1 >- Addrcheck,Memcheck:Addr4 >- obj:/usr/X11R6/lib/libX11.so.6.1 >- obj:/usr/X11R6/lib/libX11.so.6.1 >- obj:/usr/X11R6/lib/libX11.so.6.1 >-} >- >-{ >- X11-Addr4-2 >- Addrcheck,Memcheck:Addr4 >- obj:/usr/X11R6/lib/libX11.so.6.1 >- obj:/usr/X11R6/lib/libX11.so.6.1 >- obj:/usr/X11R6/lib/libXt.so.6.0 >-} >- >-{ >- X11-Addr4-3 >- Addrcheck,Memcheck:Addr4 >- obj:/usr/X11R6/lib/libXt.so.6.0 >- obj:/usr/X11R6/lib/libXt.so.6.0 >- obj:/usr/X11R6/lib/libXt.so.6.0 >-} >- >-{ >- X11-Addr4-4 >- Addrcheck,Memcheck:Addr4 >- obj:/usr/X11R6/lib/libX11.so.6.1 >- obj:/usr/X11R6/lib/libXt.so.6.0 >- obj:/usr/X11R6/lib/libXt.so.6.0 >-} >- >-{ >- X11-Addr4-5 >- Addrcheck,Memcheck:Addr4 >- fun:__rawmemchr >- obj:/usr/X11R6/lib/libXt.so.6.0 >- obj:/usr/X11R6/lib/libXt.so.6.0 >-} >- >-{ >- X11-Addr4-6 >- Addrcheck,Memcheck:Addr4 >- obj:/usr/X11R6/lib/libXmu.so.6.0 >- obj:/usr/X11R6/lib/libXmu.so.6.0 >- obj:/usr/X11R6/lib/libXt.so.6.0 >-} >- >-{ >- X11-Addr4-7 >- Addrcheck,Memcheck:Addr4 >- obj:/usr/X11R6/lib/libXt.so.6.0 >- obj:/usr/X11R6/lib/libXt.so.6.0 >- obj:/usr/X11R6/lib/libXawXpm_posing_as_Xaw.so.6.1 >-} >- >-{ >- X11-Param-1 >- Addrcheck,Memcheck:Param >- write(buf) >- fun:__libc_write >- obj:/usr/X11R6/lib/libX11.so.6.1 >- obj:/usr/X11R6/lib/libX11.so.6.1 >-} >- >-{ >- X11-Addr4-8 >- Addrcheck,Memcheck:Addr4 >- obj:/usr/X11R6/lib/libX11.so.6.1 >- obj:/usr/X11R6/lib/libXpm.so.4.11 >- obj:/usr/X11R6/lib/libXpm.so.4.11 >-} >- >-{ >- X11-Addr4-8 >- Addrcheck,Memcheck:Addr4 >- obj:/usr/X11R6/lib/libXt.so.6.0 >- obj:/usr/X11R6/lib/libXawXpm_posing_as_Xaw.so.6.1 >- obj:/usr/X11R6/lib/libXt.so.6.0 >-} >- >-{ >- X11-Addr4-9 >- Addrcheck,Memcheck:Addr4 >- obj:/usr/X11R6/lib/libXaw.so.6.1 >- obj:/usr/X11R6/lib/libXt.so.6.0 >- obj:/usr/X11R6/lib/libXt.so.6.0 >-} >- >-{ >- X11-Addr4-10 >- Addrcheck,Memcheck:Addr4 >- obj:/usr/X11R6/lib/libXaw.so.6.1 >- obj:/usr/X11R6/lib/libXaw.so.6.1 >- obj:/usr/X11R6/lib/libXt.so.6.0 >-} >- >-{ >- X11-Addr4-11 >- Addrcheck,Memcheck:Addr4 >- obj:/usr/X11R6/lib/libXt.so.6.0 >- obj:/usr/X11R6/lib/libXt.so.6.0 >- obj:/usr/X11R6/lib/libXaw.so.6.1 >-} >- >- >- >-##----------------------------------------------------------------------## >diff -ruN valgrind-2.1.0/demangle/CVS/Entries valgrind/demangle/CVS/Entries >--- valgrind-2.1.0/demangle/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/demangle/CVS/Entries 2004-02-11 22:51:45.572884112 -0600 >@@ -0,0 +1 @@ >+D >diff -ruN valgrind-2.1.0/demangle/CVS/Repository valgrind/demangle/CVS/Repository >--- valgrind-2.1.0/demangle/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/demangle/CVS/Repository 2004-02-11 22:51:45.571884264 -0600 >@@ -0,0 +1 @@ >+valgrind/demangle >diff -ruN valgrind-2.1.0/demangle/CVS/Root valgrind/demangle/CVS/Root >--- valgrind-2.1.0/demangle/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/demangle/CVS/Root 2004-02-11 22:51:45.571884264 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/depcomp valgrind/depcomp >--- valgrind-2.1.0/depcomp 2003-09-23 10:39:40.000000000 -0500 >+++ valgrind/depcomp 2004-02-04 02:07:51.000000000 -0600 >@@ -1,7 +1,9 @@ > #! /bin/sh >- > # depcomp - compile a program generating dependencies as side-effects >-# Copyright 1999, 2000 Free Software Foundation, Inc. >+ >+scriptversion=2003-11-08.23 >+ >+# Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc. > > # 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 >@@ -25,6 +27,36 @@ > > # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. > >+case $1 in >+ '') >+ echo "$0: No command. Try \`$0 --help' for more information." 1>&2 >+ exit 1; >+ ;; >+ -h | --h*) >+ cat <<\EOF >+Usage: depcomp [--help] [--version] PROGRAM [ARGS] >+ >+Run PROGRAMS ARGS to compile a file, generating dependencies >+as side-effects. >+ >+Environment variables: >+ depmode Dependency tracking mode. >+ source Source file read by `PROGRAMS ARGS'. >+ object Object file output by `PROGRAMS ARGS'. >+ depfile Dependency file to output. >+ tmpdepfile Temporary file to use when outputing dependencies. >+ libtool Whether libtool is used (yes/no). >+ >+Report bugs to <bug-automake@gnu.org>. >+EOF >+ exit 0 >+ ;; >+ -v | --v*) >+ echo "depcomp $scriptversion" >+ exit 0 >+ ;; >+esac >+ > if test -z "$depmode" || test -z "$source" || test -z "$object"; then > echo "depcomp: Variables source, object and depmode must be set" 1>&2 > exit 1 >@@ -172,19 +204,25 @@ > > aix) > # The C for AIX Compiler uses -M and outputs the dependencies >- # in a .u file. This file always lives in the current directory. >- # Also, the AIX compiler puts `$object:' at the start of each line; >- # $object doesn't have directory information. >- stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` >+ # in a .u file. In older versions, this file always lives in the >+ # current directory. Also, the AIX compiler puts `$object:' at the >+ # start of each line; $object doesn't have directory information. >+ # Version 6 uses the directory in both cases. >+ stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` > tmpdepfile="$stripped.u" >- outname="$stripped.o" > if test "$libtool" = yes; then > "$@" -Wc,-M > else > "$@" -M > fi >- > stat=$? >+ >+ if test -f "$tmpdepfile"; then : >+ else >+ stripped=`echo "$stripped" | sed 's,^.*/,,'` >+ tmpdepfile="$stripped.u" >+ fi >+ > if test $stat -eq 0; then : > else > rm -f "$tmpdepfile" >@@ -192,6 +230,7 @@ > fi > > if test -f "$tmpdepfile"; then >+ outname="$stripped.o" > # Each line is of the form `foo.o: dependent.h'. > # Do two passes, one to just change these to > # `$object: dependent.h' and one to simply `dependent.h:'. >@@ -278,8 +317,8 @@ > fi > if test -f "$tmpdepfile"; then > sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" >- # That's a space and a tab in the []. >- sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" >+ # That's a tab and a space in the []. >+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" > else > echo "#dummy" > "$depfile" > fi >@@ -292,7 +331,7 @@ > > dashmstdout) > # Important note: in order to support this mode, a compiler *must* >- # always write the proprocessed file to stdout, regardless of -o. >+ # always write the preprocessed file to stdout, regardless of -o. > "$@" || exit $? > > # Remove the call to Libtool. >@@ -388,7 +427,7 @@ > > cpp) > # Important note: in order to support this mode, a compiler *must* >- # always write the proprocessed file to stdout. >+ # always write the preprocessed file to stdout. > "$@" || exit $? > > # Remove the call to Libtool. >@@ -430,7 +469,7 @@ > > msvisualcpp) > # Important note: in order to support this mode, a compiler *must* >- # always write the proprocessed file to stdout, regardless of -o, >+ # always write the preprocessed file to stdout, regardless of -o, > # because we must use -o when running libtool. > "$@" || exit $? > IFS=" " >@@ -470,3 +509,12 @@ > esac > > exit 0 >+ >+# Local Variables: >+# mode: shell-script >+# sh-indentation: 2 >+# eval: (add-hook 'write-file-hooks 'time-stamp) >+# time-stamp-start: "scriptversion=" >+# time-stamp-format: "%:y-%02m-%02d.%02H" >+# time-stamp-end: "$" >+# End: >diff -ruN valgrind-2.1.0/docs/.cvsignore valgrind/docs/.cvsignore >--- valgrind-2.1.0/docs/.cvsignore 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/docs/.cvsignore 2002-04-16 05:52:04.000000000 -0500 >@@ -0,0 +1,2 @@ >+Makefile >+Makefile.in >diff -ruN valgrind-2.1.0/docs/CVS/Entries valgrind/docs/CVS/Entries >--- valgrind-2.1.0/docs/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/docs/CVS/Entries 2004-02-11 22:51:45.656871344 -0600 >@@ -0,0 +1,5 @@ >+/.cvsignore/1.1/Tue Apr 16 10:52:04 2002// >+/Makefile.am/1.3/Wed Nov 13 21:24:55 2002// >+/manual.html/1.47/Wed Jan 21 13:59:22 2004// >+/proxylwp.sxw/1.2/Fri Nov 7 23:09:48 2003// >+D >diff -ruN valgrind-2.1.0/docs/CVS/Repository valgrind/docs/CVS/Repository >--- valgrind-2.1.0/docs/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/docs/CVS/Repository 2004-02-11 22:51:45.572884112 -0600 >@@ -0,0 +1 @@ >+valgrind/docs >diff -ruN valgrind-2.1.0/docs/CVS/Root valgrind/docs/CVS/Root >--- valgrind-2.1.0/docs/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/docs/CVS/Root 2004-02-11 22:51:45.572884112 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/docs/Makefile.in valgrind/docs/Makefile.in >--- valgrind-2.1.0/docs/Makefile.in 2003-12-14 09:50:13.000000000 -0600 >+++ valgrind/docs/Makefile.in 2004-02-11 22:52:32.234790424 -0600 >@@ -1,8 +1,8 @@ >-# Makefile.in generated by automake 1.7.6 from Makefile.am. >+# Makefile.in generated by automake 1.8.2 from Makefile.am. > # @configure_input@ > >-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 >-# Free Software Foundation, Inc. >+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, >+# 2003, 2004 Free Software Foundation, Inc. > # This Makefile.in is free software; the Free Software Foundation > # gives unlimited permission to copy and/or distribute it, > # with or without modifications, as long as this notice is preserved. >@@ -21,7 +21,6 @@ > pkglibdir = $(libdir)/@PACKAGE@ > pkgincludedir = $(includedir)/@PACKAGE@ > top_builddir = .. >- > am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd > INSTALL = @INSTALL@ > install_sh_DATA = $(install_sh) -c -m 644 >@@ -36,6 +35,21 @@ > PRE_UNINSTALL = : > POST_UNINSTALL = : > host_triplet = @host@ >+subdir = docs >+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in >+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >+am__aclocal_m4_deps = $(top_srcdir)/configure.in >+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ >+ $(ACLOCAL_M4) >+mkinstalldirs = $(mkdir_p) >+CONFIG_HEADER = $(top_builddir)/config.h >+CONFIG_CLEAN_FILES = >+SOURCES = >+DIST_SOURCES = >+am__installdirs = $(DESTDIR)$(docdir) >+docDATA_INSTALL = $(INSTALL_DATA) >+DATA = $(doc_DATA) >+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) > ACLOCAL = @ACLOCAL@ > AMDEP_FALSE = @AMDEP_FALSE@ > AMDEP_TRUE = @AMDEP_TRUE@ >@@ -92,6 +106,7 @@ > SHELL = @SHELL@ > STRIP = @STRIP@ > VERSION = @VERSION@ >+VG_PLATFORM = @VG_PLATFORM@ > ac_ct_CC = @ac_ct_CC@ > ac_ct_CXX = @ac_ct_CXX@ > ac_ct_RANLIB = @ac_ct_RANLIB@ >@@ -123,6 +138,7 @@ > libexecdir = @libexecdir@ > localstatedir = @localstatedir@ > mandir = @mandir@ >+mkdir_p = @mkdir_p@ > oldincludedir = @oldincludedir@ > prefix = @prefix@ > program_transform_name = @program_transform_name@ >@@ -131,32 +147,44 @@ > sysconfdir = @sysconfdir@ > target_alias = @target_alias@ > docdir = $(datadir)/doc/valgrind >- > doc_DATA = manual.html >- > EXTRA_DIST = $(doc_DATA) >-subdir = docs >-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs >-CONFIG_HEADER = $(top_builddir)/config.h >-CONFIG_CLEAN_FILES = >-DIST_SOURCES = >-DATA = $(doc_DATA) >- >-DIST_COMMON = Makefile.am Makefile.in > all: all-am > > .SUFFIXES: >-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) >+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) >+ @for dep in $?; do \ >+ case '$(am__configure_deps)' in \ >+ *$$dep*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ >+ && exit 0; \ >+ exit 1;; \ >+ esac; \ >+ done; \ >+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu docs/Makefile'; \ > cd $(top_srcdir) && \ > $(AUTOMAKE) --gnu docs/Makefile >-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status >- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) >+.PRECIOUS: Makefile >+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status >+ @case '$?' in \ >+ *config.status*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ >+ *) \ >+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ >+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ >+ esac; >+ >+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+ >+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh > uninstall-info-am: >-docDATA_INSTALL = $(INSTALL_DATA) > install-docDATA: $(doc_DATA) > @$(NORMAL_INSTALL) >- $(mkinstalldirs) $(DESTDIR)$(docdir) >+ $(mkdir_p) $(DESTDIR)$(docdir) > @list='$(doc_DATA)'; for p in $$list; do \ > if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ > f="`echo $$p | sed -e 's|^.*/||'`"; \ >@@ -177,10 +205,6 @@ > ctags: CTAGS > CTAGS: > >-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) >- >-top_distdir = .. >-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) > > distdir: $(DISTFILES) > @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ >@@ -194,7 +218,7 @@ > dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ > if test "$$dir" != "$$file" && test "$$dir" != "."; then \ > dir="/$$dir"; \ >- $(mkinstalldirs) "$(distdir)$$dir"; \ >+ $(mkdir_p) "$(distdir)$$dir"; \ > else \ > dir=''; \ > fi; \ >@@ -212,9 +236,8 @@ > check-am: all-am > check: check-am > all-am: Makefile $(DATA) >- > installdirs: >- $(mkinstalldirs) $(DESTDIR)$(docdir) >+ $(mkdir_p) $(DESTDIR)$(docdir) > install: install-am > install-exec: install-exec-am > install-data: install-data-am >@@ -226,7 +249,7 @@ > installcheck: installcheck-am > install-strip: > $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ >- INSTALL_STRIP_FLAG=-s \ >+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ > `test -z '$(STRIP)' || \ > echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install > mostlyclean-generic: >@@ -234,7 +257,7 @@ > clean-generic: > > distclean-generic: >- -rm -f Makefile $(CONFIG_CLEAN_FILES) >+ -rm -f $(CONFIG_CLEAN_FILES) > > maintainer-clean-generic: > @echo "This command is intended for maintainers to use" >@@ -244,13 +267,15 @@ > clean-am: clean-generic mostlyclean-am > > distclean: distclean-am >- >+ -rm -f Makefile > distclean-am: clean-am distclean-generic > > dvi: dvi-am > > dvi-am: > >+html: html-am >+ > info: info-am > > info-am: >@@ -266,7 +291,7 @@ > installcheck-am: > > maintainer-clean: maintainer-clean-am >- >+ -rm -f Makefile > maintainer-clean-am: distclean-am maintainer-clean-generic > > mostlyclean: mostlyclean-am >@@ -284,13 +309,14 @@ > uninstall-am: uninstall-docDATA uninstall-info-am > > .PHONY: all all-am check check-am clean clean-generic distclean \ >- distclean-generic distdir dvi dvi-am info info-am install \ >- install-am install-data install-data-am install-docDATA \ >- install-exec install-exec-am install-info install-info-am \ >- install-man install-strip installcheck installcheck-am \ >- installdirs maintainer-clean maintainer-clean-generic \ >- mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ >- uninstall-am uninstall-docDATA uninstall-info-am >+ distclean-generic distdir dvi dvi-am html html-am info info-am \ >+ install install-am install-data install-data-am \ >+ install-docDATA install-exec install-exec-am install-info \ >+ install-info-am install-man install-strip installcheck \ >+ installcheck-am installdirs maintainer-clean \ >+ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ >+ pdf-am ps ps-am uninstall uninstall-am uninstall-docDATA \ >+ uninstall-info-am > > # Tell versions [3.59,3.63) of GNU make to not export all variables. > # Otherwise a system limit (for SysV at least) may be exceeded. >diff -ruN valgrind-2.1.0/docs/manual.html valgrind/docs/manual.html >--- valgrind-2.1.0/docs/manual.html 2003-12-13 19:40:11.000000000 -0600 >+++ valgrind/docs/manual.html 2004-01-21 07:59:22.000000000 -0600 >@@ -26,7 +26,7 @@ > > <a name="title"> </a> > <h1 align=center>Valgrind, version 2.1.0</h1> >-<center>This manual was last updated on 14 December 2003</center> >+<center>This manual was last updated on 21 January 2004</center> > <p> > > <center> >@@ -52,13 +52,9 @@ > An overview of Valgrind</a><br> > 1.2 <a href="coregrind_intro.html#intro-navigation"> > How to navigate this manual</a> >- <br> >- 1.2.1 <a href="coregrind_intro.html#intro-migrating"> >- For users migrating from valgrind-1.0.X</a> > > <h4>2 <a href="coregrind_core.html#core"> >- Using and understanding the Valgrind core services >- </a></h4> >+ Using and understanding the Valgrind core</a></h4> > 2.1 <a href="coregrind_core.html#core-whatdoes"> > What it does with your program</a><br> > 2.2 <a href="coregrind_core.html#started"> >@@ -87,6 +83,8 @@ > How it works -- a rough overview</a><br> > 2.14 <a href="coregrind_core.html#example"> > An example run</a><br> >+ 2.15 <a href="coregrind_core.html#warnings"> >+ Warning messages you might see</a><br> > > <h4>3 <a href="mc_main.html#mc-top"> > Memcheck: a heavyweight memory checker</a></h4> >@@ -110,7 +108,7 @@ > > <p> > The following are not part of the user manual. They describe internal >-details of how Valgrind works. Reading them may rot your mind. You >+details of how Valgrind works. Reading them may rot your brain. You > have been warned. > > <h4>8 <a href="mc_techdocs.html#mc-techdocs"> >Files valgrind-2.1.0/docs/proxylwp.sxw and valgrind/docs/proxylwp.sxw differ >diff -ruN valgrind-2.1.0/example/CVS/Entries valgrind/example/CVS/Entries >--- valgrind-2.1.0/example/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/example/CVS/Entries 2004-02-11 22:51:45.663870280 -0600 >@@ -0,0 +1,3 @@ >+/Makefile.am/1.5/Mon Jan 19 15:45:27 2004// >+/ex_main.c/1.16/Sun Jan 4 16:43:21 2004// >+D >diff -ruN valgrind-2.1.0/example/CVS/Repository valgrind/example/CVS/Repository >--- valgrind-2.1.0/example/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/example/CVS/Repository 2004-02-11 22:51:45.656871344 -0600 >@@ -0,0 +1 @@ >+valgrind/example >diff -ruN valgrind-2.1.0/example/CVS/Root valgrind/example/CVS/Root >--- valgrind-2.1.0/example/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/example/CVS/Root 2004-02-11 22:51:45.656871344 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/example/Makefile.am valgrind/example/Makefile.am >--- valgrind-2.1.0/example/Makefile.am 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/example/Makefile.am 2004-01-19 09:45:27.000000000 -0600 >@@ -0,0 +1,20 @@ >+ >+SUBDIRS = . >+ >+AM_CPPFLAGS = -I$(top_srcdir)/include -DVG_LIBDIR="\"$(libdir)"\" >+AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer \ >+ @PREFERRED_STACK_BOUNDARY@ -g >+ >+valdir = $(libdir)/valgrind >+inplacedir = $(top_srcdir)/.in_place >+ >+val_PROGRAMS = vgskin_example.so >+ >+vgskin_example_so_SOURCES = ex_main.c >+vgskin_example_so_LDFLAGS = -shared >+ >+all-local: >+ mkdir -p $(inplacedir) >+ -rm -f $(addprefix $(inplacedir)/,$(val_PROGRAMS)) >+ ln -f -s $(addprefix $(top_srcdir)/$(subdir)/,$(val_PROGRAMS)) $(inplacedir) >+ >diff -ruN valgrind-2.1.0/example/ex_main.c valgrind/example/ex_main.c >--- valgrind-2.1.0/example/ex_main.c 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/example/ex_main.c 2004-01-04 10:43:21.000000000 -0600 >@@ -0,0 +1,63 @@ >+ >+/*--------------------------------------------------------------------*/ >+/*--- An example tool. ex_main.c ---*/ >+/*--------------------------------------------------------------------*/ >+ >+/* >+ This file is part of Valgrind, an extensible x86 protected-mode >+ emulator for monitoring program execution on x86-Unixes. >+ >+ Copyright (C) 2002-2004 Nicholas Nethercote >+ njn25@cam.ac.uk >+ >+ 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. >+*/ >+ >+#include "vg_skin.h" >+ >+static void SK_(pre_clo_init)() >+{ >+ VG_(details_name) ("Example"); >+ VG_(details_version) ("0.0.1"); >+ VG_(details_description) ("an example Valgrind tool"); >+ VG_(details_copyright_author)( >+ "Copyright (C) 2002-2004, and put in the public domain, by Santa Claus."); >+ VG_(details_bug_reports_to) ("santa.claus@northpole.org"); >+ >+ /* No needs, no core events to track */ >+} >+ >+void SK_(post_clo_init)(void) >+{ >+} >+ >+UCodeBlock* SK_(instrument)(UCodeBlock* cb, Addr a) >+{ >+ return cb; >+} >+ >+void SK_(fini)(exitcode) >+{ >+} >+ >+/* Does not use shadow memory */ >+VG_DETERMINE_INTERFACE_VERSION(SK_(pre_clo_init), 0) >+ >+/*--------------------------------------------------------------------*/ >+/*--- end ex_main.c ---*/ >+/*--------------------------------------------------------------------*/ >diff -ruN valgrind-2.1.0/glibc-2.1.supp valgrind/glibc-2.1.supp >--- valgrind-2.1.0/glibc-2.1.supp 2003-11-14 11:47:51.000000000 -0600 >+++ valgrind/glibc-2.1.supp 2003-12-15 03:00:21.000000000 -0600 >@@ -37,17 +37,17 @@ > ##----------------------------------------------------------------------## > > { >- __pthread_mutex_unlock/__register_frame_info_bases >+ pthread_mutex_unlock/__register_frame_info_bases > core:PThread >- fun:__pthread_mutex_unlock >+ fun:pthread_mutex_unlock > fun:__register_frame_info_bases > } > > { >- socketcall.connect(serv_addr)/__libc_connect/*(Param) >+ socketcall.connect(serv_addr)/connect/*(Param) > Addrcheck,Memcheck:Param > socketcall.connect(serv_addr) >- fun:__libc_connect >+ fun:connect > fun:* > } > >@@ -68,10 +68,10 @@ > } > > { >- llseek(result)/__libc_lseek64/_IO_file_seek(Param) >+ llseek(result)/lseek64/_IO_file_seek(Param) > Addrcheck,Memcheck:Param > llseek(result) >- fun:__libc_lseek64 >+ fun:lseek64 > fun:_IO_file_seek > } > >@@ -164,7 +164,7 @@ > } > > { >- socketcall.connect(serv_addr)/__libc_connect/*(Param) >+ socketcall.connect(serv_addr)/connect/*(Param) > Addrcheck,Memcheck:Param > socketcall.connect(serv_addr) > obj:*libc-2.1.3.so >@@ -174,10 +174,10 @@ > ##----------------------------------------------------------------------## > ## For a leak in Valgrind's own libpthread.so :( > { >- my_malloc/get_or_allocate_specifics_ptr/__pthread_key_create(Leak) >+ my_malloc/get_or_allocate_specifics_ptr/pthread_key_create(Leak) > Memcheck:Leak > fun:my_malloc > fun:get_or_allocate_specifics_ptr >- fun:__pthread_key_create >+ fun:pthread_key_create > } > >diff -ruN valgrind-2.1.0/glibc-2.2.supp valgrind/glibc-2.2.supp >--- valgrind-2.1.0/glibc-2.2.supp 2003-11-14 11:47:51.000000000 -0600 >+++ valgrind/glibc-2.2.supp 2003-12-15 03:00:21.000000000 -0600 >@@ -173,25 +173,25 @@ > #-------- Threading bugs? > # glibc 'knows' that destroying a locked mutex will unlock it > { >- pthread_error/__pthread_mutex_destroy/__closedir >+ pthread_error/pthread_mutex_destroy/__closedir > core:PThread > fun:pthread_error >- fun:__pthread_mutex_destroy >+ fun:pthread_mutex_destroy > fun:__closedir > } > > { >- pthread_error/__pthread_mutex_destroy/_IO_default_finish >+ pthread_error/pthread_mutex_destroy/_IO_default_finish > core:PThread > fun:pthread_error >- fun:__pthread_mutex_destroy >+ fun:pthread_mutex_destroy > fun:_IO_default_finish* > } > > { >- __pthread_mutex_unlock/_IO_funlockfile >+ pthread_mutex_unlock/_IO_funlockfile > core:PThread >- fun:__pthread_mutex_unlock >+ fun:pthread_mutex_unlock > fun:_IO_funlockfile > } > >@@ -345,10 +345,10 @@ > > #------------------- > { >- socketcall.connect(serv_addr)/__libc_connect/* >+ socketcall.connect(serv_addr)/connect/* > Addrcheck,Memcheck:Param > socketcall.connect(serv_addr) >- fun:__libc_connect >+ fun:connect > fun:* > } > { >@@ -361,10 +361,10 @@ > > #---------------------- > { >- write(buf)/__libc_write/libX11.so.6.2/libX11.so.6.2(Param) >+ write(buf)/write/libX11.so.6.2/libX11.so.6.2(Param) > Addrcheck,Memcheck:Param > write(buf) >- fun:__libc_write >+ fun:write > obj:/usr/X11R6/lib/libX11.so.6.2 > obj:/usr/X11R6/lib/libX11.so.6.2 > } >@@ -378,10 +378,10 @@ > } > > #{ >-# llseek(result)/__libc_lseek64/_IO_file_seek(Param) >+# llseek(result)/lseek64/_IO_file_seek(Param) > # Param > # llseek(result) >-# fun:__libc_lseek64 >+# fun:lseek64 > # fun:_IO_file_seek > #} > >@@ -413,11 +413,11 @@ > ##----------------------------------------------------------------------## > ## For a leak in Valgrind's own libpthread.so :( > { >- my_malloc/get_or_allocate_specifics_ptr/__pthread_key_create(Leak) >+ my_malloc/get_or_allocate_specifics_ptr/pthread_key_create(Leak) > Memcheck:Leak > fun:my_malloc > fun:get_or_allocate_specifics_ptr >- fun:__pthread_key_create >+ fun:pthread_key_create > } > > >diff -ruN valgrind-2.1.0/glibc-2.3.supp valgrind/glibc-2.3.supp >--- valgrind-2.1.0/glibc-2.3.supp 2003-11-14 11:47:51.000000000 -0600 >+++ valgrind/glibc-2.3.supp 2004-01-20 19:27:26.000000000 -0600 >@@ -106,40 +106,68 @@ > fun:dl_open_worker > } > >+#-------- glibc 2.3.2/ Fedora Core 1 >+{ >+ dl_relocate/dl_main >+ Memcheck:Cond >+ fun:_dl_relocate_object_internal >+ fun:dl_main >+} >+ >+#-------- Data races >+{ >+ _dl_lookup_symbol_internal/fixup/_dl_runtime_resolve >+ Helgrind:Eraser >+ fun:_dl_lookup_symbol_internal >+ fun:fixup >+ fun:_dl_runtime_resolve >+} >+{ >+ _dl_lookup_versioned_symbol_internal/fixup/_dl_runtime_resolve >+ Helgrind:Eraser >+ fun:_dl_lookup_versioned_symbol_internal >+ fun:fixup >+ fun:_dl_runtime_resolve >+} >+{ >+ _dl_fini >+ Helgrind:Eraser >+ fun:_dl_fini >+} > > #-------- Threading bugs? > # glibc 'knows' that destroying a locked mutex will unlock it > { >- pthread_error/__pthread_mutex_destroy/__closedir >+ pthread_error/pthread_mutex_destroy/__closedir > core:PThread > fun:pthread_error >- fun:__pthread_mutex_destroy >+ fun:pthread_mutex_destroy > fun:__closedir > } > > { >- pthread_error/__pthread_mutex_destroy/_IO_default_finish >+ pthread_error/pthread_mutex_destroy/_IO_default_finish > core:PThread > fun:pthread_error >- fun:__pthread_mutex_destroy >+ fun:pthread_mutex_destroy > fun:_IO_default_finish* > } > > { >- __pthread_mutex_unlock/_IO_funlockfile >+ pthread_mutex_unlock/_IO_funlockfile > core:PThread >- fun:__pthread_mutex_unlock >+ fun:pthread_mutex_unlock > fun:_IO_funlockfile > } > > ##----------------------------------------------------------------------## > ## For a leak in Valgrind's own libpthread.so :( > { >- my_malloc/get_or_allocate_specifics_ptr/__pthread_key_create(Leak) >+ my_malloc/get_or_allocate_specifics_ptr/pthread_key_create(Leak) > Memcheck:Leak > fun:my_malloc > fun:get_or_allocate_specifics_ptr >- fun:__pthread_key_create >+ fun:pthread_key_create > } > > ##----------------------------------------------------------------------## >@@ -150,3 +178,39 @@ > Addrcheck,Memcheck:Addr4 > obj:/opt/intel/compiler70/ia32/lib/libcxa.so.3 > } >+ >+##----------------------------------------------------------------------## >+## SuSE 9 after FV changes (post 2.1.0) >+ >+{ >+ strlen/_dl_init_paths/dl_main/_dl_sysdep_start(Cond) >+ Memcheck:Cond >+ fun:strlen >+ fun:_dl_init_paths >+ fun:dl_main >+ fun:_dl_sysdep_start >+} >+ >+{ >+ Ugly strchr error in /lib/ld-2.3.2.so >+ Memcheck:Cond >+ obj:/lib/ld-2.3.2.so >+} >+ >+##----------------------------------------------------------------------## >+## SuSE 9 after FV changes (post 2.1.0) >+ >+{ >+ strlen/_dl_init_paths/dl_main/_dl_sysdep_start(Cond) >+ Memcheck:Cond >+ fun:strlen >+ fun:_dl_init_paths >+ fun:dl_main >+ fun:_dl_sysdep_start >+} >+ >+{ >+ Ugly strchr error in /lib/ld-2.3.2.so >+ Memcheck:Cond >+ obj:/lib/ld-2.3.2.so >+} >diff -ruN valgrind-2.1.0/helgrind/.cvsignore valgrind/helgrind/.cvsignore >--- valgrind-2.1.0/helgrind/.cvsignore 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/helgrind/.cvsignore 2002-09-23 06:36:32.000000000 -0500 >@@ -0,0 +1,2 @@ >+Makefile.in >+Makefile >diff -ruN valgrind-2.1.0/helgrind/CVS/Entries valgrind/helgrind/CVS/Entries >--- valgrind-2.1.0/helgrind/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/helgrind/CVS/Entries 2004-02-11 22:51:45.949826808 -0600 >@@ -0,0 +1,5 @@ >+/.cvsignore/1.1/Mon Sep 23 11:36:32 2002// >+/Makefile.am/1.45/Mon Jan 19 21:35:52 2004// >+/helgrind.h/1.7/Sun Jan 4 16:43:22 2004// >+/hg_main.c/1.71/Sun Jan 4 23:08:03 2004// >+D >diff -ruN valgrind-2.1.0/helgrind/CVS/Entries.Log valgrind/helgrind/CVS/Entries.Log >--- valgrind-2.1.0/helgrind/CVS/Entries.Log 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/helgrind/CVS/Entries.Log 2004-02-11 22:51:45.972823312 -0600 >@@ -0,0 +1,2 @@ >+A D/docs//// >+A D/tests//// >diff -ruN valgrind-2.1.0/helgrind/CVS/Repository valgrind/helgrind/CVS/Repository >--- valgrind-2.1.0/helgrind/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/helgrind/CVS/Repository 2004-02-11 22:51:45.663870280 -0600 >@@ -0,0 +1 @@ >+valgrind/helgrind >diff -ruN valgrind-2.1.0/helgrind/CVS/Root valgrind/helgrind/CVS/Root >--- valgrind-2.1.0/helgrind/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/helgrind/CVS/Root 2004-02-11 22:51:45.663870280 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/helgrind/Makefile.am valgrind/helgrind/Makefile.am >--- valgrind-2.1.0/helgrind/Makefile.am 2003-06-12 09:12:56.000000000 -0500 >+++ valgrind/helgrind/Makefile.am 2004-01-19 15:35:52.000000000 -0600 >@@ -6,13 +6,23 @@ > @PREFERRED_STACK_BOUNDARY@ -g > > valdir = $(libdir)/valgrind >+inplacedir = $(top_srcdir)/.in_place > >-val_PROGRAMS = vgskin_helgrind.so >+val_PROGRAMS = vgskin_helgrind.so vgpreload_helgrind.so > > vgskin_helgrind_so_SOURCES = hg_main.c > vgskin_helgrind_so_LDFLAGS = -shared >-vgskin_helgrind_so_LDADD = ../coregrind/vg_replace_malloc.o >+ >+vgpreload_helgrind_so_SOURCES = >+vgpreload_helgrind_so_LDADD = $(top_srcdir)/coregrind/vg_replace_malloc.o >+vgpreload_helgrind_so_DEPENDENCIES = $(top_srcdir)/coregrind/vg_replace_malloc.o >+vgpreload_helgrind_so_LDFLAGS = -shared -Wl,-z,interpose,-z,initfirst > > hgincludedir = $(includedir)/valgrind > > hginclude_HEADERS = helgrind.h >+ >+all-local: >+ mkdir -p $(inplacedir) >+ -rm -f $(addprefix $(inplacedir)/,$(val_PROGRAMS)) >+ ln -f -s $(addprefix $(top_srcdir)/$(subdir)/,$(val_PROGRAMS)) $(inplacedir) >diff -ruN valgrind-2.1.0/helgrind/Makefile.in valgrind/helgrind/Makefile.in >--- valgrind-2.1.0/helgrind/Makefile.in 2003-12-14 09:50:14.000000000 -0600 >+++ valgrind/helgrind/Makefile.in 2004-02-11 22:52:32.465755312 -0600 >@@ -1,8 +1,8 @@ >-# Makefile.in generated by automake 1.7.6 from Makefile.am. >+# Makefile.in generated by automake 1.8.2 from Makefile.am. > # @configure_input@ > >-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 >-# Free Software Foundation, Inc. >+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, >+# 2003, 2004 Free Software Foundation, Inc. > # This Makefile.in is free software; the Free Software Foundation > # gives unlimited permission to copy and/or distribute it, > # with or without modifications, as long as this notice is preserved. >@@ -14,6 +14,9 @@ > > @SET_MAKE@ > >+ >+SOURCES = $(vgpreload_helgrind_so_SOURCES) $(vgskin_helgrind_so_SOURCES) >+ > srcdir = @srcdir@ > top_srcdir = @top_srcdir@ > VPATH = @srcdir@ >@@ -21,7 +24,6 @@ > pkglibdir = $(libdir)/@PACKAGE@ > pkgincludedir = $(includedir)/@PACKAGE@ > top_builddir = .. >- > am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd > INSTALL = @INSTALL@ > install_sh_DATA = $(install_sh) -c -m 644 >@@ -36,6 +38,50 @@ > PRE_UNINSTALL = : > POST_UNINSTALL = : > host_triplet = @host@ >+val_PROGRAMS = vgskin_helgrind.so$(EXEEXT) \ >+ vgpreload_helgrind.so$(EXEEXT) >+subdir = helgrind >+DIST_COMMON = $(hginclude_HEADERS) $(srcdir)/Makefile.am \ >+ $(srcdir)/Makefile.in >+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >+am__aclocal_m4_deps = $(top_srcdir)/configure.in >+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ >+ $(ACLOCAL_M4) >+mkinstalldirs = $(mkdir_p) >+CONFIG_HEADER = $(top_builddir)/config.h >+CONFIG_CLEAN_FILES = >+am__installdirs = $(DESTDIR)$(valdir) $(DESTDIR)$(hgincludedir) >+valPROGRAMS_INSTALL = $(INSTALL_PROGRAM) >+PROGRAMS = $(val_PROGRAMS) >+am_vgpreload_helgrind_so_OBJECTS = >+vgpreload_helgrind_so_OBJECTS = $(am_vgpreload_helgrind_so_OBJECTS) >+am_vgskin_helgrind_so_OBJECTS = hg_main.$(OBJEXT) >+vgskin_helgrind_so_OBJECTS = $(am_vgskin_helgrind_so_OBJECTS) >+vgskin_helgrind_so_LDADD = $(LDADD) >+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) >+depcomp = $(SHELL) $(top_srcdir)/depcomp >+am__depfiles_maybe = depfiles >+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/hg_main.Po >+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ >+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) >+CCLD = $(CC) >+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ >+SOURCES = $(vgpreload_helgrind_so_SOURCES) \ >+ $(vgskin_helgrind_so_SOURCES) >+DIST_SOURCES = $(vgpreload_helgrind_so_SOURCES) \ >+ $(vgskin_helgrind_so_SOURCES) >+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ >+ html-recursive info-recursive install-data-recursive \ >+ install-exec-recursive install-info-recursive \ >+ install-recursive installcheck-recursive installdirs-recursive \ >+ pdf-recursive ps-recursive uninstall-info-recursive \ >+ uninstall-recursive >+hgincludeHEADERS_INSTALL = $(INSTALL_HEADER) >+HEADERS = $(hginclude_HEADERS) >+ETAGS = etags >+CTAGS = ctags >+DIST_SUBDIRS = $(SUBDIRS) >+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) > ACLOCAL = @ACLOCAL@ > AMDEP_FALSE = @AMDEP_FALSE@ > AMDEP_TRUE = @AMDEP_TRUE@ >@@ -92,6 +138,7 @@ > SHELL = @SHELL@ > STRIP = @STRIP@ > VERSION = @VERSION@ >+VG_PLATFORM = @VG_PLATFORM@ > ac_ct_CC = @ac_ct_CC@ > ac_ct_CXX = @ac_ct_CXX@ > ac_ct_RANLIB = @ac_ct_RANLIB@ >@@ -123,6 +170,7 @@ > libexecdir = @libexecdir@ > localstatedir = @localstatedir@ > mandir = @mandir@ >+mkdir_p = @mkdir_p@ > oldincludedir = @oldincludedir@ > prefix = @prefix@ > program_transform_name = @program_transform_name@ >@@ -130,71 +178,57 @@ > sharedstatedir = @sharedstatedir@ > sysconfdir = @sysconfdir@ > target_alias = @target_alias@ >- > SUBDIRS = . docs tests >- > AM_CPPFLAGS = -I$(top_srcdir)/include -DVG_LIBDIR="\"$(libdir)"\" > AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer \ > @PREFERRED_STACK_BOUNDARY@ -g > >- > valdir = $(libdir)/valgrind >- >-val_PROGRAMS = vgskin_helgrind.so >- >+inplacedir = $(top_srcdir)/.in_place > vgskin_helgrind_so_SOURCES = hg_main.c > vgskin_helgrind_so_LDFLAGS = -shared >-vgskin_helgrind_so_LDADD = ../coregrind/vg_replace_malloc.o >- >+vgpreload_helgrind_so_SOURCES = >+vgpreload_helgrind_so_LDADD = $(top_srcdir)/coregrind/vg_replace_malloc.o >+vgpreload_helgrind_so_DEPENDENCIES = $(top_srcdir)/coregrind/vg_replace_malloc.o >+vgpreload_helgrind_so_LDFLAGS = -shared -Wl,-z,interpose,-z,initfirst > hgincludedir = $(includedir)/valgrind >- > hginclude_HEADERS = helgrind.h >-subdir = helgrind >-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs >-CONFIG_HEADER = $(top_builddir)/config.h >-CONFIG_CLEAN_FILES = >-val_PROGRAMS = vgskin_helgrind.so$(EXEEXT) >-PROGRAMS = $(val_PROGRAMS) >- >-am_vgskin_helgrind_so_OBJECTS = hg_main.$(OBJEXT) >-vgskin_helgrind_so_OBJECTS = $(am_vgskin_helgrind_so_OBJECTS) >-vgskin_helgrind_so_DEPENDENCIES = ../coregrind/vg_replace_malloc.o >- >-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) >-depcomp = $(SHELL) $(top_srcdir)/depcomp >-am__depfiles_maybe = depfiles >-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/hg_main.Po >-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ >- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) >-CCLD = $(CC) >-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ >-DIST_SOURCES = $(vgskin_helgrind_so_SOURCES) >-HEADERS = $(hginclude_HEADERS) >- >- >-RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ >- ps-recursive install-info-recursive uninstall-info-recursive \ >- all-recursive install-data-recursive install-exec-recursive \ >- installdirs-recursive install-recursive uninstall-recursive \ >- check-recursive installcheck-recursive >-DIST_COMMON = $(hginclude_HEADERS) Makefile.am Makefile.in >-DIST_SUBDIRS = $(SUBDIRS) >-SOURCES = $(vgskin_helgrind_so_SOURCES) >- > all: all-recursive > > .SUFFIXES: > .SUFFIXES: .c .o .obj >-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) >+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) >+ @for dep in $?; do \ >+ case '$(am__configure_deps)' in \ >+ *$$dep*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ >+ && exit 0; \ >+ exit 1;; \ >+ esac; \ >+ done; \ >+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu helgrind/Makefile'; \ > cd $(top_srcdir) && \ > $(AUTOMAKE) --gnu helgrind/Makefile >-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status >- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) >-valPROGRAMS_INSTALL = $(INSTALL_PROGRAM) >+.PRECIOUS: Makefile >+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status >+ @case '$?' in \ >+ *config.status*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ >+ *) \ >+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ >+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ >+ esac; >+ >+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+ >+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh > install-valPROGRAMS: $(val_PROGRAMS) > @$(NORMAL_INSTALL) >- $(mkinstalldirs) $(DESTDIR)$(valdir) >+ $(mkdir_p) $(DESTDIR)$(valdir) > @list='$(val_PROGRAMS)'; for p in $$list; do \ > p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ > if test -f $$p \ >@@ -215,47 +249,40 @@ > > clean-valPROGRAMS: > -test -z "$(val_PROGRAMS)" || rm -f $(val_PROGRAMS) >+vgpreload_helgrind.so$(EXEEXT): $(vgpreload_helgrind_so_OBJECTS) $(vgpreload_helgrind_so_DEPENDENCIES) >+ @rm -f vgpreload_helgrind.so$(EXEEXT) >+ $(LINK) $(vgpreload_helgrind_so_LDFLAGS) $(vgpreload_helgrind_so_OBJECTS) $(vgpreload_helgrind_so_LDADD) $(LIBS) > vgskin_helgrind.so$(EXEEXT): $(vgskin_helgrind_so_OBJECTS) $(vgskin_helgrind_so_DEPENDENCIES) > @rm -f vgskin_helgrind.so$(EXEEXT) > $(LINK) $(vgskin_helgrind_so_LDFLAGS) $(vgskin_helgrind_so_OBJECTS) $(vgskin_helgrind_so_LDADD) $(LIBS) > > mostlyclean-compile: >- -rm -f *.$(OBJEXT) core *.core >+ -rm -f *.$(OBJEXT) > > distclean-compile: > -rm -f *.tab.c > > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hg_main.Po@am__quote@ > >-distclean-depend: >- -rm -rf ./$(DEPDIR) >- > .c.o: >-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ >-@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ >-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ >-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ >-@am__fastdepCC_TRUE@ fi >+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ >+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi > @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >-@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< >+@am__fastdepCC_FALSE@ $(COMPILE) -c $< > > .c.obj: >-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ >-@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ >-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ >-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ >-@am__fastdepCC_TRUE@ fi >+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ >+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi > @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >-@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` >+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` > uninstall-info-am: >-hgincludeHEADERS_INSTALL = $(INSTALL_HEADER) > install-hgincludeHEADERS: $(hginclude_HEADERS) > @$(NORMAL_INSTALL) >- $(mkinstalldirs) $(DESTDIR)$(hgincludedir) >+ $(mkdir_p) $(DESTDIR)$(hgincludedir) > @list='$(hginclude_HEADERS)'; for p in $$list; do \ > if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ > f="`echo $$p | sed -e 's|^.*/||'`"; \ >@@ -330,14 +357,6 @@ > test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ > done > >-ETAGS = etags >-ETAGSFLAGS = >- >-CTAGS = ctags >-CTAGSFLAGS = >- >-tags: TAGS >- > ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) > list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ > unique=`for i in $$list; do \ >@@ -346,6 +365,7 @@ > $(AWK) ' { files[$$0] = 1; } \ > END { for (i in files) print i; }'`; \ > mkid -fID $$unique >+tags: TAGS > > TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ > $(TAGS_FILES) $(LISP) >@@ -371,7 +391,6 @@ > test -z "$(ETAGS_ARGS)$$tags$$unique" \ > || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ > $$tags $$unique >- > ctags: CTAGS > CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ > $(TAGS_FILES) $(LISP) >@@ -394,10 +413,6 @@ > > distclean-tags: > -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags >-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) >- >-top_distdir = .. >-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) > > distdir: $(DISTFILES) > @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ >@@ -411,7 +426,7 @@ > dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ > if test "$$dir" != "$$file" && test "$$dir" != "."; then \ > dir="/$$dir"; \ >- $(mkinstalldirs) "$(distdir)$$dir"; \ >+ $(mkdir_p) "$(distdir)$$dir"; \ > else \ > dir=''; \ > fi; \ >@@ -428,24 +443,23 @@ > done > list='$(SUBDIRS)'; for subdir in $$list; do \ > if test "$$subdir" = .; then :; else \ >- test -d $(distdir)/$$subdir \ >- || mkdir $(distdir)/$$subdir \ >+ test -d "$(distdir)/$$subdir" \ >+ || mkdir "$(distdir)/$$subdir" \ > || exit 1; \ > (cd $$subdir && \ > $(MAKE) $(AM_MAKEFLAGS) \ >- top_distdir="$(top_distdir)" \ >- distdir=../$(distdir)/$$subdir \ >+ top_distdir="../$(top_distdir)" \ >+ distdir="../$(distdir)/$$subdir" \ > distdir) \ > || exit 1; \ > fi; \ > done > check-am: all-am > check: check-recursive >-all-am: Makefile $(PROGRAMS) $(HEADERS) >+all-am: Makefile $(PROGRAMS) $(HEADERS) all-local > installdirs: installdirs-recursive > installdirs-am: >- $(mkinstalldirs) $(DESTDIR)$(valdir) $(DESTDIR)$(hgincludedir) >- >+ $(mkdir_p) $(DESTDIR)$(valdir) $(DESTDIR)$(hgincludedir) > install: install-recursive > install-exec: install-exec-recursive > install-data: install-data-recursive >@@ -457,7 +471,7 @@ > installcheck: installcheck-recursive > install-strip: > $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ >- INSTALL_STRIP_FLAG=-s \ >+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ > `test -z '$(STRIP)' || \ > echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install > mostlyclean-generic: >@@ -465,7 +479,7 @@ > clean-generic: > > distclean-generic: >- -rm -f Makefile $(CONFIG_CLEAN_FILES) >+ -rm -f $(CONFIG_CLEAN_FILES) > > maintainer-clean-generic: > @echo "This command is intended for maintainers to use" >@@ -475,14 +489,17 @@ > clean-am: clean-generic clean-valPROGRAMS mostlyclean-am > > distclean: distclean-recursive >- >-distclean-am: clean-am distclean-compile distclean-depend \ >- distclean-generic distclean-tags >+ -rm -rf ./$(DEPDIR) >+ -rm -f Makefile >+distclean-am: clean-am distclean-compile distclean-generic \ >+ distclean-tags > > dvi: dvi-recursive > > dvi-am: > >+html: html-recursive >+ > info: info-recursive > > info-am: >@@ -498,7 +515,8 @@ > installcheck-am: > > maintainer-clean: maintainer-clean-recursive >- >+ -rm -rf ./$(DEPDIR) >+ -rm -f Makefile > maintainer-clean-am: distclean-am maintainer-clean-generic > > mostlyclean: mostlyclean-recursive >@@ -518,25 +536,26 @@ > > uninstall-info: uninstall-info-recursive > >-.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ >- clean-generic clean-recursive clean-valPROGRAMS ctags \ >- ctags-recursive distclean distclean-compile distclean-depend \ >+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am all-local check \ >+ check-am clean clean-generic clean-recursive clean-valPROGRAMS \ >+ ctags ctags-recursive distclean distclean-compile \ > distclean-generic distclean-recursive distclean-tags distdir \ >- dvi dvi-am dvi-recursive info info-am info-recursive install \ >- install-am install-data install-data-am install-data-recursive \ >- install-exec install-exec-am install-exec-recursive \ >+ dvi dvi-am html html-am info info-am install install-am \ >+ install-data install-data-am install-exec install-exec-am \ > install-hgincludeHEADERS install-info install-info-am \ >- install-info-recursive install-man install-recursive \ >- install-strip install-valPROGRAMS installcheck installcheck-am \ >- installdirs installdirs-am installdirs-recursive \ >- maintainer-clean maintainer-clean-generic \ >- maintainer-clean-recursive mostlyclean mostlyclean-compile \ >- mostlyclean-generic mostlyclean-recursive pdf pdf-am \ >- pdf-recursive ps ps-am ps-recursive tags tags-recursive \ >+ install-man install-strip install-valPROGRAMS installcheck \ >+ installcheck-am installdirs installdirs-am maintainer-clean \ >+ maintainer-clean-generic maintainer-clean-recursive \ >+ mostlyclean mostlyclean-compile mostlyclean-generic \ >+ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ > uninstall uninstall-am uninstall-hgincludeHEADERS \ >- uninstall-info-am uninstall-info-recursive uninstall-recursive \ >- uninstall-valPROGRAMS >+ uninstall-info-am uninstall-valPROGRAMS >+ > >+all-local: >+ mkdir -p $(inplacedir) >+ -rm -f $(addprefix $(inplacedir)/,$(val_PROGRAMS)) >+ ln -f -s $(addprefix $(top_srcdir)/$(subdir)/,$(val_PROGRAMS)) $(inplacedir) > # Tell versions [3.59,3.63) of GNU make to not export all variables. > # Otherwise a system limit (for SysV at least) may be exceeded. > .NOEXPORT: >diff -ruN valgrind-2.1.0/helgrind/docs/.cvsignore valgrind/helgrind/docs/.cvsignore >--- valgrind-2.1.0/helgrind/docs/.cvsignore 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/helgrind/docs/.cvsignore 2002-10-03 05:07:33.000000000 -0500 >@@ -0,0 +1,2 @@ >+Makefile.in >+Makefile >diff -ruN valgrind-2.1.0/helgrind/docs/CVS/Entries valgrind/helgrind/docs/CVS/Entries >--- valgrind-2.1.0/helgrind/docs/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/helgrind/docs/CVS/Entries 2004-02-11 22:51:45.972823312 -0600 >@@ -0,0 +1,4 @@ >+/.cvsignore/1.1/Thu Oct 3 10:07:33 2002// >+/Makefile.am/1.2/Wed Nov 13 21:24:55 2002// >+/hg_main.html/1.4/Fri Nov 14 17:47:53 2003// >+D >diff -ruN valgrind-2.1.0/helgrind/docs/CVS/Repository valgrind/helgrind/docs/CVS/Repository >--- valgrind-2.1.0/helgrind/docs/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/helgrind/docs/CVS/Repository 2004-02-11 22:51:45.949826808 -0600 >@@ -0,0 +1 @@ >+valgrind/helgrind/docs >diff -ruN valgrind-2.1.0/helgrind/docs/CVS/Root valgrind/helgrind/docs/CVS/Root >--- valgrind-2.1.0/helgrind/docs/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/helgrind/docs/CVS/Root 2004-02-11 22:51:45.949826808 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/helgrind/docs/Makefile.in valgrind/helgrind/docs/Makefile.in >--- valgrind-2.1.0/helgrind/docs/Makefile.in 2003-12-14 09:50:14.000000000 -0600 >+++ valgrind/helgrind/docs/Makefile.in 2004-02-11 22:52:32.611733120 -0600 >@@ -1,8 +1,8 @@ >-# Makefile.in generated by automake 1.7.6 from Makefile.am. >+# Makefile.in generated by automake 1.8.2 from Makefile.am. > # @configure_input@ > >-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 >-# Free Software Foundation, Inc. >+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, >+# 2003, 2004 Free Software Foundation, Inc. > # This Makefile.in is free software; the Free Software Foundation > # gives unlimited permission to copy and/or distribute it, > # with or without modifications, as long as this notice is preserved. >@@ -21,7 +21,6 @@ > pkglibdir = $(libdir)/@PACKAGE@ > pkgincludedir = $(includedir)/@PACKAGE@ > top_builddir = ../.. >- > am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd > INSTALL = @INSTALL@ > install_sh_DATA = $(install_sh) -c -m 644 >@@ -36,6 +35,21 @@ > PRE_UNINSTALL = : > POST_UNINSTALL = : > host_triplet = @host@ >+subdir = helgrind/docs >+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in >+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >+am__aclocal_m4_deps = $(top_srcdir)/configure.in >+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ >+ $(ACLOCAL_M4) >+mkinstalldirs = $(mkdir_p) >+CONFIG_HEADER = $(top_builddir)/config.h >+CONFIG_CLEAN_FILES = >+SOURCES = >+DIST_SOURCES = >+am__installdirs = $(DESTDIR)$(docdir) >+docDATA_INSTALL = $(INSTALL_DATA) >+DATA = $(doc_DATA) >+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) > ACLOCAL = @ACLOCAL@ > AMDEP_FALSE = @AMDEP_FALSE@ > AMDEP_TRUE = @AMDEP_TRUE@ >@@ -92,6 +106,7 @@ > SHELL = @SHELL@ > STRIP = @STRIP@ > VERSION = @VERSION@ >+VG_PLATFORM = @VG_PLATFORM@ > ac_ct_CC = @ac_ct_CC@ > ac_ct_CXX = @ac_ct_CXX@ > ac_ct_RANLIB = @ac_ct_RANLIB@ >@@ -123,6 +138,7 @@ > libexecdir = @libexecdir@ > localstatedir = @localstatedir@ > mandir = @mandir@ >+mkdir_p = @mkdir_p@ > oldincludedir = @oldincludedir@ > prefix = @prefix@ > program_transform_name = @program_transform_name@ >@@ -131,32 +147,44 @@ > sysconfdir = @sysconfdir@ > target_alias = @target_alias@ > docdir = $(datadir)/doc/valgrind >- > doc_DATA = hg_main.html >- > EXTRA_DIST = $(doc_DATA) >-subdir = helgrind/docs >-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs >-CONFIG_HEADER = $(top_builddir)/config.h >-CONFIG_CLEAN_FILES = >-DIST_SOURCES = >-DATA = $(doc_DATA) >- >-DIST_COMMON = Makefile.am Makefile.in > all: all-am > > .SUFFIXES: >-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) >+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) >+ @for dep in $?; do \ >+ case '$(am__configure_deps)' in \ >+ *$$dep*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ >+ && exit 0; \ >+ exit 1;; \ >+ esac; \ >+ done; \ >+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu helgrind/docs/Makefile'; \ > cd $(top_srcdir) && \ > $(AUTOMAKE) --gnu helgrind/docs/Makefile >-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status >- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) >+.PRECIOUS: Makefile >+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status >+ @case '$?' in \ >+ *config.status*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ >+ *) \ >+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ >+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ >+ esac; >+ >+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+ >+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh > uninstall-info-am: >-docDATA_INSTALL = $(INSTALL_DATA) > install-docDATA: $(doc_DATA) > @$(NORMAL_INSTALL) >- $(mkinstalldirs) $(DESTDIR)$(docdir) >+ $(mkdir_p) $(DESTDIR)$(docdir) > @list='$(doc_DATA)'; for p in $$list; do \ > if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ > f="`echo $$p | sed -e 's|^.*/||'`"; \ >@@ -177,10 +205,6 @@ > ctags: CTAGS > CTAGS: > >-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) >- >-top_distdir = ../.. >-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) > > distdir: $(DISTFILES) > @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ >@@ -194,7 +218,7 @@ > dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ > if test "$$dir" != "$$file" && test "$$dir" != "."; then \ > dir="/$$dir"; \ >- $(mkinstalldirs) "$(distdir)$$dir"; \ >+ $(mkdir_p) "$(distdir)$$dir"; \ > else \ > dir=''; \ > fi; \ >@@ -212,9 +236,8 @@ > check-am: all-am > check: check-am > all-am: Makefile $(DATA) >- > installdirs: >- $(mkinstalldirs) $(DESTDIR)$(docdir) >+ $(mkdir_p) $(DESTDIR)$(docdir) > install: install-am > install-exec: install-exec-am > install-data: install-data-am >@@ -226,7 +249,7 @@ > installcheck: installcheck-am > install-strip: > $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ >- INSTALL_STRIP_FLAG=-s \ >+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ > `test -z '$(STRIP)' || \ > echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install > mostlyclean-generic: >@@ -234,7 +257,7 @@ > clean-generic: > > distclean-generic: >- -rm -f Makefile $(CONFIG_CLEAN_FILES) >+ -rm -f $(CONFIG_CLEAN_FILES) > > maintainer-clean-generic: > @echo "This command is intended for maintainers to use" >@@ -244,13 +267,15 @@ > clean-am: clean-generic mostlyclean-am > > distclean: distclean-am >- >+ -rm -f Makefile > distclean-am: clean-am distclean-generic > > dvi: dvi-am > > dvi-am: > >+html: html-am >+ > info: info-am > > info-am: >@@ -266,7 +291,7 @@ > installcheck-am: > > maintainer-clean: maintainer-clean-am >- >+ -rm -f Makefile > maintainer-clean-am: distclean-am maintainer-clean-generic > > mostlyclean: mostlyclean-am >@@ -284,13 +309,14 @@ > uninstall-am: uninstall-docDATA uninstall-info-am > > .PHONY: all all-am check check-am clean clean-generic distclean \ >- distclean-generic distdir dvi dvi-am info info-am install \ >- install-am install-data install-data-am install-docDATA \ >- install-exec install-exec-am install-info install-info-am \ >- install-man install-strip installcheck installcheck-am \ >- installdirs maintainer-clean maintainer-clean-generic \ >- mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ >- uninstall-am uninstall-docDATA uninstall-info-am >+ distclean-generic distdir dvi dvi-am html html-am info info-am \ >+ install install-am install-data install-data-am \ >+ install-docDATA install-exec install-exec-am install-info \ >+ install-info-am install-man install-strip installcheck \ >+ installcheck-am installdirs maintainer-clean \ >+ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ >+ pdf-am ps ps-am uninstall uninstall-am uninstall-docDATA \ >+ uninstall-info-am > > # Tell versions [3.59,3.63) of GNU make to not export all variables. > # Otherwise a system limit (for SysV at least) may be exceeded. >diff -ruN valgrind-2.1.0/helgrind/helgrind.h valgrind/helgrind/helgrind.h >--- valgrind-2.1.0/helgrind/helgrind.h 2003-11-14 11:47:53.000000000 -0600 >+++ valgrind/helgrind/helgrind.h 2004-01-04 10:43:22.000000000 -0600 >@@ -11,7 +11,7 @@ > This file is part of helgrind, a Valgrind tool for detecting > data races in threaded programs. > >- Copyright (C) 2002-2003 Nicholas Nethercote. All rights reserved. >+ Copyright (C) 2002-2004 Nicholas Nethercote. All rights reserved. > > Redistribution and use in source and binary forms, with or without > modification, are permitted provided that the following conditions >diff -ruN valgrind-2.1.0/helgrind/hg_main.c valgrind/helgrind/hg_main.c >--- valgrind-2.1.0/helgrind/hg_main.c 2003-12-01 07:11:47.000000000 -0600 >+++ valgrind/helgrind/hg_main.c 2004-01-04 17:08:03.000000000 -0600 >@@ -8,7 +8,7 @@ > This file is part of Helgrind, a Valgrind tool for detecting > data races in threaded programs. > >- Copyright (C) 2002-2003 Nicholas Nethercote >+ Copyright (C) 2002-2004 Nicholas Nethercote > njn25@cam.ac.uk > > This program is free software; you can redistribute it and/or >@@ -32,8 +32,6 @@ > #include "vg_skin.h" > #include "helgrind.h" > >-VG_DETERMINE_INTERFACE_VERSION >- > static UInt n_eraser_warnings = 0; > static UInt n_lockorder_warnings = 0; > >@@ -498,7 +496,7 @@ > although this isn't important, so the following assert is > spurious. (SSS: not true for ESecMaps -- they're 16 pages) */ > sk_assert(0 == (sizeof(ESecMap) % VKI_BYTES_PER_PAGE)); >- map = VG_(get_memory_from_mmap)( sizeof(ESecMap), caller ); >+ map = (ESecMap *)VG_(shadow_alloc)(sizeof(ESecMap)); > > for (i = 0; i < ESEC_MAP_WORDS; i++) > map->swords[i] = virgin_sword; >@@ -2002,26 +2000,12 @@ > /*--- Machinery to support sanity checking ---*/ > /*--------------------------------------------------------------*/ > >-/* Check that nobody has spuriously claimed that the first or last 16 >- pages (64 KB) of address space have become accessible. Failure of >- the following do not per se indicate an internal consistency >- problem, but they are so likely to that we really want to know >- about it if so. */ >- > Bool SK_(cheap_sanity_check) ( void ) > { >- if (VGE_IS_DISTINGUISHED_SM(primary_map[0]) >- /* kludge: kernel drops a page up at top of address range for >- magic "optimized syscalls", so we can no longer check the >- highest page */ >- /* && VGE_IS_DISTINGUISHED_SM(primary_map[65535]) */ >- ) >- return True; >- else >- return False; >+ /* nothing useful we can rapidly check */ >+ return True; > } > >- > Bool SK_(expensive_sanity_check)(void) > { > Int i; >@@ -3237,7 +3221,7 @@ > VG_(details_version) (NULL); > VG_(details_description) ("a data race detector"); > VG_(details_copyright_author)( >- "Copyright (C) 2002-2003, and GNU GPL'd, by Nicholas Nethercote."); >+ "Copyright (C) 2002-2004, and GNU GPL'd, by Nicholas Nethercote."); > VG_(details_bug_reports_to) (VG_BUGS_TO); > VG_(details_avg_translation_sizeB) ( 115 ); > >@@ -3246,34 +3230,35 @@ > VG_(needs_data_syms)(); > VG_(needs_client_requests)(); > VG_(needs_command_line_options)(); >+ VG_(needs_shadow_memory)(); > >- VG_(track_new_mem_startup) (& eraser_new_mem_startup); >+ VG_(init_new_mem_startup) (& eraser_new_mem_startup); > > /* stack ones not decided until VG_(post_clo_init)() */ > >- VG_(track_new_mem_brk) (& make_writable); >- VG_(track_new_mem_mmap) (& eraser_new_mem_startup); >+ VG_(init_new_mem_brk) (& make_writable); >+ VG_(init_new_mem_mmap) (& eraser_new_mem_startup); > >- VG_(track_change_mem_mprotect) (& eraser_set_perms); >+ VG_(init_change_mem_mprotect) (& eraser_set_perms); > >- VG_(track_ban_mem_stack) (NULL); >+ VG_(init_ban_mem_stack) (NULL); > >- VG_(track_die_mem_stack) (NULL); >- VG_(track_die_mem_stack_signal) (NULL); >- VG_(track_die_mem_brk) (NULL); >- VG_(track_die_mem_munmap) (NULL); >+ VG_(init_die_mem_stack) (NULL); >+ VG_(init_die_mem_stack_signal) (NULL); >+ VG_(init_die_mem_brk) (NULL); >+ VG_(init_die_mem_munmap) (NULL); > >- VG_(track_pre_mem_read) (& eraser_pre_mem_read); >- VG_(track_pre_mem_read_asciiz) (& eraser_pre_mem_read_asciiz); >- VG_(track_pre_mem_write) (& eraser_pre_mem_write); >- VG_(track_post_mem_write) (NULL); >+ VG_(init_pre_mem_read) (& eraser_pre_mem_read); >+ VG_(init_pre_mem_read_asciiz) (& eraser_pre_mem_read_asciiz); >+ VG_(init_pre_mem_write) (& eraser_pre_mem_write); >+ VG_(init_post_mem_write) (NULL); > >- VG_(track_post_thread_create) (& hg_thread_create); >- VG_(track_post_thread_join) (& hg_thread_join); >+ VG_(init_post_thread_create) (& hg_thread_create); >+ VG_(init_post_thread_join) (& hg_thread_join); > >- VG_(track_pre_mutex_lock) (& eraser_pre_mutex_lock); >- VG_(track_post_mutex_lock) (& eraser_post_mutex_lock); >- VG_(track_post_mutex_unlock) (& eraser_post_mutex_unlock); >+ VG_(init_pre_mutex_lock) (& eraser_pre_mutex_lock); >+ VG_(init_post_mutex_lock) (& eraser_post_mutex_lock); >+ VG_(init_post_mutex_unlock) (& eraser_post_mutex_unlock); > > VG_(register_compact_helper)((Addr) & eraser_mem_help_read_1); > VG_(register_compact_helper)((Addr) & eraser_mem_help_read_2); >@@ -3392,8 +3377,8 @@ > else > stack_tracker = & eraser_new_mem_stack; > >- VG_(track_new_mem_stack) (stack_tracker); >- VG_(track_new_mem_stack_signal) (stack_tracker); >+ VG_(init_new_mem_stack) (stack_tracker); >+ VG_(init_new_mem_stack_signal) (stack_tracker); > } > > >@@ -3417,6 +3402,9 @@ > ((stk_ld+stk_st)*100) / (stk_ld + stk_st + nonstk_ld + nonstk_st)); > } > >+/* Uses a 1:1 mapping */ >+VG_DETERMINE_INTERFACE_VERSION(SK_(pre_clo_init), 1.0) >+ > /*--------------------------------------------------------------------*/ > /*--- end hg_main.c ---*/ > /*--------------------------------------------------------------------*/ >diff -ruN valgrind-2.1.0/helgrind/tests/.cvsignore valgrind/helgrind/tests/.cvsignore >--- valgrind-2.1.0/helgrind/tests/.cvsignore 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/helgrind/tests/.cvsignore 2003-11-27 05:44:48.000000000 -0600 >@@ -0,0 +1,14 @@ >+Makefile.in >+Makefile >+allok >+allok.stderr.diff >+allok.stderr.out >+deadlock >+deadlock.stderr.out >+deadlock.stdout.out >+inherit >+race >+race2 >+readshared >+inherit.stderr.diff >+inherit.stderr.out >diff -ruN valgrind-2.1.0/helgrind/tests/CVS/Entries valgrind/helgrind/tests/CVS/Entries >--- valgrind-2.1.0/helgrind/tests/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/helgrind/tests/CVS/Entries 2004-02-11 22:51:45.988820880 -0600 >@@ -0,0 +1,22 @@ >+/.cvsignore/1.3/Thu Nov 27 11:44:48 2003// >+/Makefile.am/1.4/Wed Oct 15 22:15:37 2003// >+/allok.c/1.1/Thu Oct 16 06:09:41 2003// >+/allok.stderr.exp/1.1/Wed Oct 15 22:15:37 2003// >+/allok.vgtest/1.1/Wed Oct 15 22:15:37 2003// >+/deadlock.c/1.1/Thu Oct 16 06:09:41 2003// >+/deadlock.stderr.exp/1.5/Mon Dec 15 09:00:21 2003// >+/deadlock.vgtest/1.1/Wed Oct 15 22:15:37 2003// >+/filter_stderr/1.4/Thu Nov 6 11:34:52 2003// >+/inherit.c/1.1/Thu Oct 16 06:09:41 2003// >+/inherit.stderr.exp/1.3/Sat Oct 18 22:27:10 2003// >+/inherit.vgtest/1.1/Wed Oct 15 22:15:37 2003// >+/race.c/1.1/Thu Oct 16 06:09:41 2003// >+/race.stderr.exp/1.4/Thu Nov 13 17:53:43 2003// >+/race.vgtest/1.1/Wed Oct 15 22:15:37 2003// >+/race2.c/1.1/Thu Oct 16 06:09:41 2003// >+/race2.stderr.exp/1.4/Thu Nov 13 17:53:43 2003// >+/race2.vgtest/1.1/Wed Oct 15 22:15:37 2003// >+/readshared.c/1.1/Thu Oct 16 06:09:41 2003// >+/readshared.stderr.exp/1.1/Wed Oct 15 22:15:37 2003// >+/readshared.vgtest/1.1/Wed Oct 15 22:15:37 2003// >+D >diff -ruN valgrind-2.1.0/helgrind/tests/CVS/Repository valgrind/helgrind/tests/CVS/Repository >--- valgrind-2.1.0/helgrind/tests/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/helgrind/tests/CVS/Repository 2004-02-11 22:51:45.972823312 -0600 >@@ -0,0 +1 @@ >+valgrind/helgrind/tests >diff -ruN valgrind-2.1.0/helgrind/tests/CVS/Root valgrind/helgrind/tests/CVS/Root >--- valgrind-2.1.0/helgrind/tests/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/helgrind/tests/CVS/Root 2004-02-11 22:51:45.972823312 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/helgrind/tests/Makefile.in valgrind/helgrind/tests/Makefile.in >--- valgrind-2.1.0/helgrind/tests/Makefile.in 2003-12-14 09:50:15.000000000 -0600 >+++ valgrind/helgrind/tests/Makefile.in 2004-02-11 22:52:32.863694816 -0600 >@@ -1,8 +1,8 @@ >-# Makefile.in generated by automake 1.7.6 from Makefile.am. >+# Makefile.in generated by automake 1.8.2 from Makefile.am. > # @configure_input@ > >-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 >-# Free Software Foundation, Inc. >+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, >+# 2003, 2004 Free Software Foundation, Inc. > # This Makefile.in is free software; the Free Software Foundation > # gives unlimited permission to copy and/or distribute it, > # with or without modifications, as long as this notice is preserved. >@@ -14,6 +14,8 @@ > > @SET_MAKE@ > >+SOURCES = $(allok_SOURCES) $(deadlock_SOURCES) $(inherit_SOURCES) $(race_SOURCES) $(race2_SOURCES) $(readshared_SOURCES) >+ > srcdir = @srcdir@ > top_srcdir = @top_srcdir@ > VPATH = @srcdir@ >@@ -21,7 +23,6 @@ > pkglibdir = $(libdir)/@PACKAGE@ > pkgincludedir = $(includedir)/@PACKAGE@ > top_builddir = ../.. >- > am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd > INSTALL = @INSTALL@ > install_sh_DATA = $(install_sh) -c -m 644 >@@ -36,6 +37,59 @@ > PRE_UNINSTALL = : > POST_UNINSTALL = : > host_triplet = @host@ >+check_PROGRAMS = allok$(EXEEXT) deadlock$(EXEEXT) inherit$(EXEEXT) \ >+ race$(EXEEXT) race2$(EXEEXT) readshared$(EXEEXT) >+subdir = helgrind/tests >+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in >+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >+am__aclocal_m4_deps = $(top_srcdir)/configure.in >+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ >+ $(ACLOCAL_M4) >+mkinstalldirs = $(mkdir_p) >+CONFIG_HEADER = $(top_builddir)/config.h >+CONFIG_CLEAN_FILES = >+am_allok_OBJECTS = allok.$(OBJEXT) >+allok_OBJECTS = $(am_allok_OBJECTS) >+allok_LDADD = $(LDADD) >+allok_DEPENDENCIES = >+am_deadlock_OBJECTS = deadlock.$(OBJEXT) >+deadlock_OBJECTS = $(am_deadlock_OBJECTS) >+deadlock_LDADD = $(LDADD) >+deadlock_DEPENDENCIES = >+am_inherit_OBJECTS = inherit.$(OBJEXT) >+inherit_OBJECTS = $(am_inherit_OBJECTS) >+inherit_LDADD = $(LDADD) >+inherit_DEPENDENCIES = >+am_race_OBJECTS = race.$(OBJEXT) >+race_OBJECTS = $(am_race_OBJECTS) >+race_LDADD = $(LDADD) >+race_DEPENDENCIES = >+am_race2_OBJECTS = race2.$(OBJEXT) >+race2_OBJECTS = $(am_race2_OBJECTS) >+race2_LDADD = $(LDADD) >+race2_DEPENDENCIES = >+am_readshared_OBJECTS = readshared.$(OBJEXT) >+readshared_OBJECTS = $(am_readshared_OBJECTS) >+readshared_LDADD = $(LDADD) >+readshared_DEPENDENCIES = >+SCRIPTS = $(noinst_SCRIPTS) >+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) >+depcomp = $(SHELL) $(top_srcdir)/depcomp >+am__depfiles_maybe = depfiles >+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/allok.Po ./$(DEPDIR)/deadlock.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/inherit.Po ./$(DEPDIR)/race.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/race2.Po ./$(DEPDIR)/readshared.Po >+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ >+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) >+CCLD = $(CC) >+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ >+SOURCES = $(allok_SOURCES) $(deadlock_SOURCES) $(inherit_SOURCES) \ >+ $(race_SOURCES) $(race2_SOURCES) $(readshared_SOURCES) >+DIST_SOURCES = $(allok_SOURCES) $(deadlock_SOURCES) $(inherit_SOURCES) \ >+ $(race_SOURCES) $(race2_SOURCES) $(readshared_SOURCES) >+ETAGS = etags >+CTAGS = ctags >+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) > ACLOCAL = @ACLOCAL@ > AMDEP_FALSE = @AMDEP_FALSE@ > AMDEP_TRUE = @AMDEP_TRUE@ >@@ -92,6 +146,7 @@ > SHELL = @SHELL@ > STRIP = @STRIP@ > VERSION = @VERSION@ >+VG_PLATFORM = @VG_PLATFORM@ > ac_ct_CC = @ac_ct_CC@ > ac_ct_CXX = @ac_ct_CXX@ > ac_ct_RANLIB = @ac_ct_RANLIB@ >@@ -123,6 +178,7 @@ > libexecdir = @libexecdir@ > localstatedir = @localstatedir@ > mandir = @mandir@ >+mkdir_p = @mkdir_p@ > oldincludedir = @oldincludedir@ > prefix = @prefix@ > program_transform_name = @program_transform_name@ >@@ -131,7 +187,6 @@ > sysconfdir = @sysconfdir@ > target_alias = @target_alias@ > noinst_SCRIPTS = filter_stderr >- > EXTRA_DIST = $(noinst_SCRIPTS) \ > allok.stderr.exp allok.vgtest \ > deadlock.stderr.exp deadlock.vgtest \ >@@ -140,11 +195,6 @@ > race2.stderr.exp race2.vgtest \ > readshared.stderr.exp readshared.vgtest > >- >-check_PROGRAMS = \ >- allok deadlock inherit race race2 readshared >- >- > allok_SOURCES = allok.c > deadlock_SOURCES = deadlock.c > inherit_SOURCES = inherit.c >@@ -155,70 +205,39 @@ > # force -gstabs, because we don't print symaddr for DWARF yet > AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -gstabs > LDADD = -lpthread >-subdir = helgrind/tests >-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs >-CONFIG_HEADER = $(top_builddir)/config.h >-CONFIG_CLEAN_FILES = >-check_PROGRAMS = allok$(EXEEXT) deadlock$(EXEEXT) inherit$(EXEEXT) \ >- race$(EXEEXT) race2$(EXEEXT) readshared$(EXEEXT) >-am_allok_OBJECTS = allok.$(OBJEXT) >-allok_OBJECTS = $(am_allok_OBJECTS) >-allok_LDADD = $(LDADD) >-allok_DEPENDENCIES = >-allok_LDFLAGS = >-am_deadlock_OBJECTS = deadlock.$(OBJEXT) >-deadlock_OBJECTS = $(am_deadlock_OBJECTS) >-deadlock_LDADD = $(LDADD) >-deadlock_DEPENDENCIES = >-deadlock_LDFLAGS = >-am_inherit_OBJECTS = inherit.$(OBJEXT) >-inherit_OBJECTS = $(am_inherit_OBJECTS) >-inherit_LDADD = $(LDADD) >-inherit_DEPENDENCIES = >-inherit_LDFLAGS = >-am_race_OBJECTS = race.$(OBJEXT) >-race_OBJECTS = $(am_race_OBJECTS) >-race_LDADD = $(LDADD) >-race_DEPENDENCIES = >-race_LDFLAGS = >-am_race2_OBJECTS = race2.$(OBJEXT) >-race2_OBJECTS = $(am_race2_OBJECTS) >-race2_LDADD = $(LDADD) >-race2_DEPENDENCIES = >-race2_LDFLAGS = >-am_readshared_OBJECTS = readshared.$(OBJEXT) >-readshared_OBJECTS = $(am_readshared_OBJECTS) >-readshared_LDADD = $(LDADD) >-readshared_DEPENDENCIES = >-readshared_LDFLAGS = >-SCRIPTS = $(noinst_SCRIPTS) >- >- >-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) >-depcomp = $(SHELL) $(top_srcdir)/depcomp >-am__depfiles_maybe = depfiles >-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/allok.Po ./$(DEPDIR)/deadlock.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/inherit.Po ./$(DEPDIR)/race.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/race2.Po ./$(DEPDIR)/readshared.Po >-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ >- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) >-CCLD = $(CC) >-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ >-DIST_SOURCES = $(allok_SOURCES) $(deadlock_SOURCES) $(inherit_SOURCES) \ >- $(race_SOURCES) $(race2_SOURCES) $(readshared_SOURCES) >-DIST_COMMON = Makefile.am Makefile.in >-SOURCES = $(allok_SOURCES) $(deadlock_SOURCES) $(inherit_SOURCES) $(race_SOURCES) $(race2_SOURCES) $(readshared_SOURCES) >- > all: all-am > > .SUFFIXES: > .SUFFIXES: .c .o .obj >-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) >+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) >+ @for dep in $?; do \ >+ case '$(am__configure_deps)' in \ >+ *$$dep*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ >+ && exit 0; \ >+ exit 1;; \ >+ esac; \ >+ done; \ >+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu helgrind/tests/Makefile'; \ > cd $(top_srcdir) && \ > $(AUTOMAKE) --gnu helgrind/tests/Makefile >-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status >- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) >+.PRECIOUS: Makefile >+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status >+ @case '$?' in \ >+ *config.status*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ >+ *) \ >+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ >+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ >+ esac; >+ >+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+ >+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh > > clean-checkPROGRAMS: > -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) >@@ -242,7 +261,7 @@ > $(LINK) $(readshared_LDFLAGS) $(readshared_OBJECTS) $(readshared_LDADD) $(LIBS) > > mostlyclean-compile: >- -rm -f *.$(OBJEXT) core *.core >+ -rm -f *.$(OBJEXT) > > distclean-compile: > -rm -f *.tab.c >@@ -254,40 +273,23 @@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/race2.Po@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readshared.Po@am__quote@ > >-distclean-depend: >- -rm -rf ./$(DEPDIR) >- > .c.o: >-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ >-@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ >-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ >-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ >-@am__fastdepCC_TRUE@ fi >+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ >+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi > @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >-@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< >+@am__fastdepCC_FALSE@ $(COMPILE) -c $< > > .c.obj: >-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ >-@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ >-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ >-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ >-@am__fastdepCC_TRUE@ fi >+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ >+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi > @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >-@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` >+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` > uninstall-info-am: > >-ETAGS = etags >-ETAGSFLAGS = >- >-CTAGS = ctags >-CTAGSFLAGS = >- >-tags: TAGS >- > ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) > list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ > unique=`for i in $$list; do \ >@@ -296,6 +298,7 @@ > $(AWK) ' { files[$$0] = 1; } \ > END { for (i in files) print i; }'`; \ > mkid -fID $$unique >+tags: TAGS > > TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ > $(TAGS_FILES) $(LISP) >@@ -310,7 +313,6 @@ > test -z "$(ETAGS_ARGS)$$tags$$unique" \ > || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ > $$tags $$unique >- > ctags: CTAGS > CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ > $(TAGS_FILES) $(LISP) >@@ -333,10 +335,6 @@ > > distclean-tags: > -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags >-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) >- >-top_distdir = ../.. >-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) > > distdir: $(DISTFILES) > @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ >@@ -350,7 +348,7 @@ > dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ > if test "$$dir" != "$$file" && test "$$dir" != "."; then \ > dir="/$$dir"; \ >- $(mkinstalldirs) "$(distdir)$$dir"; \ >+ $(mkdir_p) "$(distdir)$$dir"; \ > else \ > dir=''; \ > fi; \ >@@ -369,7 +367,6 @@ > $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) > check: check-am > all-am: Makefile $(SCRIPTS) >- > installdirs: > install: install-am > install-exec: install-exec-am >@@ -382,7 +379,7 @@ > installcheck: installcheck-am > install-strip: > $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ >- INSTALL_STRIP_FLAG=-s \ >+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ > `test -z '$(STRIP)' || \ > echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install > mostlyclean-generic: >@@ -390,7 +387,7 @@ > clean-generic: > > distclean-generic: >- -rm -f Makefile $(CONFIG_CLEAN_FILES) >+ -rm -f $(CONFIG_CLEAN_FILES) > > maintainer-clean-generic: > @echo "This command is intended for maintainers to use" >@@ -400,14 +397,17 @@ > clean-am: clean-checkPROGRAMS clean-generic mostlyclean-am > > distclean: distclean-am >- >-distclean-am: clean-am distclean-compile distclean-depend \ >- distclean-generic distclean-tags >+ -rm -rf ./$(DEPDIR) >+ -rm -f Makefile >+distclean-am: clean-am distclean-compile distclean-generic \ >+ distclean-tags > > dvi: dvi-am > > dvi-am: > >+html: html-am >+ > info: info-am > > info-am: >@@ -423,7 +423,8 @@ > installcheck-am: > > maintainer-clean: maintainer-clean-am >- >+ -rm -rf ./$(DEPDIR) >+ -rm -f Makefile > maintainer-clean-am: distclean-am maintainer-clean-generic > > mostlyclean: mostlyclean-am >@@ -440,13 +441,13 @@ > > uninstall-am: uninstall-info-am > >-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-checkPROGRAMS \ >- clean-generic ctags distclean distclean-compile \ >- distclean-depend distclean-generic distclean-tags distdir dvi \ >- dvi-am info info-am install install-am install-data \ >- install-data-am install-exec install-exec-am install-info \ >- install-info-am install-man install-strip installcheck \ >- installcheck-am installdirs maintainer-clean \ >+.PHONY: CTAGS GTAGS all all-am check check-am clean \ >+ clean-checkPROGRAMS clean-generic ctags distclean \ >+ distclean-compile distclean-generic distclean-tags distdir dvi \ >+ dvi-am html html-am info info-am install install-am \ >+ install-data install-data-am install-exec install-exec-am \ >+ install-info install-info-am install-man install-strip \ >+ installcheck installcheck-am installdirs maintainer-clean \ > maintainer-clean-generic mostlyclean mostlyclean-compile \ > mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ > uninstall-am uninstall-info-am >diff -ruN valgrind-2.1.0/helgrind/tests/deadlock.stderr.exp valgrind/helgrind/tests/deadlock.stderr.exp >--- valgrind-2.1.0/helgrind/tests/deadlock.stderr.exp 2003-11-13 11:53:43.000000000 -0600 >+++ valgrind/helgrind/tests/deadlock.stderr.exp 2003-12-15 03:00:21.000000000 -0600 >@@ -1,13 +1,13 @@ > > Thread 3: > Mutex 0x........(m1) locked in inconsistent order >- at 0x........: __pthread_mutex_lock (vg_libpthread.c:...) >+ at 0x........: pthread_mutex_lock (vg_libpthread.c:...) > by 0x........: t2 (deadlock.c:20) > by 0x........: thread_wrapper (vg_libpthread.c:...) > by 0x........: do__quit (vg_scheduler.c:...) > while holding locks 0x........(m2) > 0x........(m2) last locked at >- at 0x........: __pthread_mutex_lock (vg_libpthread.c:...) >+ at 0x........: pthread_mutex_lock (vg_libpthread.c:...) > by 0x........: t2 (deadlock.c:19) > by 0x........: thread_wrapper (vg_libpthread.c:...) > by 0x........: do__quit (vg_scheduler.c:...) >diff -ruN valgrind-2.1.0/include/.cvsignore valgrind/include/.cvsignore >--- valgrind-2.1.0/include/.cvsignore 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/include/.cvsignore 2003-12-17 07:28:12.000000000 -0600 >@@ -0,0 +1,3 @@ >+Makefile.in >+Makefile >+vg_skin.h >diff -ruN valgrind-2.1.0/include/CVS/Entries valgrind/include/CVS/Entries >--- valgrind-2.1.0/include/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/include/CVS/Entries 2004-02-11 22:51:46.349766008 -0600 >@@ -0,0 +1,8 @@ >+/.cvsignore/1.2/Wed Dec 17 13:28:12 2003// >+/Makefile.am/1.5/Tue Dec 16 02:05:14 2003// >+/valgrind.h/1.25/Wed Jan 21 15:08:04 2004// >+/vg_constants_skin.h/1.7/Sun Jan 4 16:43:22 2004// >+/vg_kerneliface.h/1.13/Tue Feb 10 23:44:15 2004// >+/vg_profile.c/1.11/Wed Jan 21 15:08:04 2004// >+/vg_skin.h.base/1.12/Wed Feb 11 23:33:28 2004// >+D >diff -ruN valgrind-2.1.0/include/CVS/Repository valgrind/include/CVS/Repository >--- valgrind-2.1.0/include/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/include/CVS/Repository 2004-02-11 22:51:45.988820880 -0600 >@@ -0,0 +1 @@ >+valgrind/include >diff -ruN valgrind-2.1.0/include/CVS/Root valgrind/include/CVS/Root >--- valgrind-2.1.0/include/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/include/CVS/Root 2004-02-11 22:51:45.988820880 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/include/Makefile.am valgrind/include/Makefile.am >--- valgrind-2.1.0/include/Makefile.am 2003-07-24 14:35:00.000000000 -0500 >+++ valgrind/include/Makefile.am 2003-12-15 20:05:14.000000000 -0600 >@@ -1,5 +1,6 @@ > EXTRA_DIST = \ >- vg_profile.c >+ vg_profile.c \ >+ vg_skin.h.base > > incincdir = $(includedir)/valgrind > >@@ -8,3 +9,13 @@ > vg_constants_skin.h \ > vg_skin.h \ > vg_kerneliface.h >+ >+BUILT_SOURCES = vg_skin.h >+CLEANFILES = vg_skin.h >+ >+vg_skin.h: $(srcdir)/vg_skin.h.base \ >+ $(top_srcdir)/coregrind/gen_toolint.pl $(top_srcdir)/coregrind/toolfuncs.def >+ rm -f $@ >+ cat $(srcdir)/vg_skin.h.base > $@ >+ $(PERL) $(top_srcdir)/coregrind/gen_toolint.pl toolproto < $(top_srcdir)/coregrind/toolfuncs.def >> $@ || rm -f $@ >+ $(PERL) $(top_srcdir)/coregrind/gen_toolint.pl initproto < $(top_srcdir)/coregrind/toolfuncs.def >> $@ || rm -f $@ >diff -ruN valgrind-2.1.0/include/Makefile.in valgrind/include/Makefile.in >--- valgrind-2.1.0/include/Makefile.in 2003-12-14 09:50:16.000000000 -0600 >+++ valgrind/include/Makefile.in 2004-02-11 22:52:33.023670496 -0600 >@@ -1,8 +1,8 @@ >-# Makefile.in generated by automake 1.7.6 from Makefile.am. >+# Makefile.in generated by automake 1.8.2 from Makefile.am. > # @configure_input@ > >-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 >-# Free Software Foundation, Inc. >+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, >+# 2003, 2004 Free Software Foundation, Inc. > # This Makefile.in is free software; the Free Software Foundation > # gives unlimited permission to copy and/or distribute it, > # with or without modifications, as long as this notice is preserved. >@@ -21,7 +21,6 @@ > pkglibdir = $(libdir)/@PACKAGE@ > pkgincludedir = $(includedir)/@PACKAGE@ > top_builddir = .. >- > am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd > INSTALL = @INSTALL@ > install_sh_DATA = $(install_sh) -c -m 644 >@@ -36,6 +35,24 @@ > PRE_UNINSTALL = : > POST_UNINSTALL = : > host_triplet = @host@ >+subdir = include >+DIST_COMMON = $(incinc_HEADERS) $(srcdir)/Makefile.am \ >+ $(srcdir)/Makefile.in >+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >+am__aclocal_m4_deps = $(top_srcdir)/configure.in >+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ >+ $(ACLOCAL_M4) >+mkinstalldirs = $(mkdir_p) >+CONFIG_HEADER = $(top_builddir)/config.h >+CONFIG_CLEAN_FILES = >+SOURCES = >+DIST_SOURCES = >+am__installdirs = $(DESTDIR)$(incincdir) >+incincHEADERS_INSTALL = $(INSTALL_HEADER) >+HEADERS = $(incinc_HEADERS) >+ETAGS = etags >+CTAGS = ctags >+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) > ACLOCAL = @ACLOCAL@ > AMDEP_FALSE = @AMDEP_FALSE@ > AMDEP_TRUE = @AMDEP_TRUE@ >@@ -92,6 +109,7 @@ > SHELL = @SHELL@ > STRIP = @STRIP@ > VERSION = @VERSION@ >+VG_PLATFORM = @VG_PLATFORM@ > ac_ct_CC = @ac_ct_CC@ > ac_ct_CXX = @ac_ct_CXX@ > ac_ct_RANLIB = @ac_ct_RANLIB@ >@@ -123,6 +141,7 @@ > libexecdir = @libexecdir@ > localstatedir = @localstatedir@ > mandir = @mandir@ >+mkdir_p = @mkdir_p@ > oldincludedir = @oldincludedir@ > prefix = @prefix@ > program_transform_name = @program_transform_name@ >@@ -131,39 +150,55 @@ > sysconfdir = @sysconfdir@ > target_alias = @target_alias@ > EXTRA_DIST = \ >- vg_profile.c >- >+ vg_profile.c \ >+ vg_skin.h.base > > incincdir = $(includedir)/valgrind >- > incinc_HEADERS = \ > valgrind.h \ > vg_constants_skin.h \ > vg_skin.h \ > vg_kerneliface.h > >-subdir = include >-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs >-CONFIG_HEADER = $(top_builddir)/config.h >-CONFIG_CLEAN_FILES = >-DIST_SOURCES = >-HEADERS = $(incinc_HEADERS) >- >-DIST_COMMON = $(incinc_HEADERS) Makefile.am Makefile.in >-all: all-am >+BUILT_SOURCES = vg_skin.h >+CLEANFILES = vg_skin.h >+all: $(BUILT_SOURCES) >+ $(MAKE) $(AM_MAKEFLAGS) all-am > > .SUFFIXES: >-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) >+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) >+ @for dep in $?; do \ >+ case '$(am__configure_deps)' in \ >+ *$$dep*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ >+ && exit 0; \ >+ exit 1;; \ >+ esac; \ >+ done; \ >+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/Makefile'; \ > cd $(top_srcdir) && \ > $(AUTOMAKE) --gnu include/Makefile >-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status >- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) >+.PRECIOUS: Makefile >+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status >+ @case '$?' in \ >+ *config.status*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ >+ *) \ >+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ >+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ >+ esac; >+ >+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+ >+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh > uninstall-info-am: >-incincHEADERS_INSTALL = $(INSTALL_HEADER) > install-incincHEADERS: $(incinc_HEADERS) > @$(NORMAL_INSTALL) >- $(mkinstalldirs) $(DESTDIR)$(incincdir) >+ $(mkdir_p) $(DESTDIR)$(incincdir) > @list='$(incinc_HEADERS)'; for p in $$list; do \ > if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ > f="`echo $$p | sed -e 's|^.*/||'`"; \ >@@ -179,14 +214,6 @@ > rm -f $(DESTDIR)$(incincdir)/$$f; \ > done > >-ETAGS = etags >-ETAGSFLAGS = >- >-CTAGS = ctags >-CTAGSFLAGS = >- >-tags: TAGS >- > ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) > list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ > unique=`for i in $$list; do \ >@@ -195,6 +222,7 @@ > $(AWK) ' { files[$$0] = 1; } \ > END { for (i in files) print i; }'`; \ > mkid -fID $$unique >+tags: TAGS > > TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ > $(TAGS_FILES) $(LISP) >@@ -209,7 +237,6 @@ > test -z "$(ETAGS_ARGS)$$tags$$unique" \ > || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ > $$tags $$unique >- > ctags: CTAGS > CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ > $(TAGS_FILES) $(LISP) >@@ -232,10 +259,6 @@ > > distclean-tags: > -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags >-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) >- >-top_distdir = .. >-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) > > distdir: $(DISTFILES) > @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ >@@ -249,7 +272,7 @@ > dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ > if test "$$dir" != "$$file" && test "$$dir" != "."; then \ > dir="/$$dir"; \ >- $(mkinstalldirs) "$(distdir)$$dir"; \ >+ $(mkdir_p) "$(distdir)$$dir"; \ > else \ > dir=''; \ > fi; \ >@@ -265,12 +288,13 @@ > fi; \ > done > check-am: all-am >-check: check-am >+check: $(BUILT_SOURCES) >+ $(MAKE) $(AM_MAKEFLAGS) check-am > all-am: Makefile $(HEADERS) >- > installdirs: >- $(mkinstalldirs) $(DESTDIR)$(incincdir) >-install: install-am >+ $(mkdir_p) $(DESTDIR)$(incincdir) >+install: $(BUILT_SOURCES) >+ $(MAKE) $(AM_MAKEFLAGS) install-am > install-exec: install-exec-am > install-data: install-data-am > uninstall: uninstall-am >@@ -281,31 +305,35 @@ > installcheck: installcheck-am > install-strip: > $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ >- INSTALL_STRIP_FLAG=-s \ >+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ > `test -z '$(STRIP)' || \ > echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install > mostlyclean-generic: > > clean-generic: >+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) > > distclean-generic: >- -rm -f Makefile $(CONFIG_CLEAN_FILES) >+ -rm -f $(CONFIG_CLEAN_FILES) > > maintainer-clean-generic: > @echo "This command is intended for maintainers to use" > @echo "it deletes files that may require special tools to rebuild." >+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) > clean: clean-am > > clean-am: clean-generic mostlyclean-am > > distclean: distclean-am >- >+ -rm -f Makefile > distclean-am: clean-am distclean-generic distclean-tags > > dvi: dvi-am > > dvi-am: > >+html: html-am >+ > info: info-am > > info-am: >@@ -321,7 +349,7 @@ > installcheck-am: > > maintainer-clean: maintainer-clean-am >- >+ -rm -f Makefile > maintainer-clean-am: distclean-am maintainer-clean-generic > > mostlyclean: mostlyclean-am >@@ -338,16 +366,23 @@ > > uninstall-am: uninstall-incincHEADERS uninstall-info-am > >-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic ctags \ >- distclean distclean-generic distclean-tags distdir dvi dvi-am \ >- info info-am install install-am install-data install-data-am \ >- install-exec install-exec-am install-incincHEADERS install-info \ >- install-info-am install-man install-strip installcheck \ >- installcheck-am installdirs maintainer-clean \ >- maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ >- pdf-am ps ps-am tags uninstall uninstall-am \ >- uninstall-incincHEADERS uninstall-info-am >- >+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ >+ ctags distclean distclean-generic distclean-tags distdir dvi \ >+ dvi-am html html-am info info-am install install-am \ >+ install-data install-data-am install-exec install-exec-am \ >+ install-incincHEADERS install-info install-info-am install-man \ >+ install-strip installcheck installcheck-am installdirs \ >+ maintainer-clean maintainer-clean-generic mostlyclean \ >+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ >+ uninstall-am uninstall-incincHEADERS uninstall-info-am >+ >+ >+vg_skin.h: $(srcdir)/vg_skin.h.base \ >+ $(top_srcdir)/coregrind/gen_toolint.pl $(top_srcdir)/coregrind/toolfuncs.def >+ rm -f $@ >+ cat $(srcdir)/vg_skin.h.base > $@ >+ $(PERL) $(top_srcdir)/coregrind/gen_toolint.pl toolproto < $(top_srcdir)/coregrind/toolfuncs.def >> $@ || rm -f $@ >+ $(PERL) $(top_srcdir)/coregrind/gen_toolint.pl initproto < $(top_srcdir)/coregrind/toolfuncs.def >> $@ || rm -f $@ > # Tell versions [3.59,3.63) of GNU make to not export all variables. > # Otherwise a system limit (for SysV at least) may be exceeded. > .NOEXPORT: >diff -ruN valgrind-2.1.0/include/valgrind.h valgrind/include/valgrind.h >--- valgrind-2.1.0/include/valgrind.h 2003-11-07 17:09:48.000000000 -0600 >+++ valgrind/include/valgrind.h 2004-01-21 09:08:04.000000000 -0600 >@@ -12,7 +12,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward. All rights reserved. >+ Copyright (C) 2000-2004 Julian Seward. All rights reserved. > > Redistribution and use in source and binary forms, with or without > modification, are permitted provided that the following conditions >@@ -159,7 +159,7 @@ > Valgrind's output to /dev/null and still count errors. */ > VG_USERREQ__COUNT_ERRORS = 0x1201, > >- /* These are useful and can be interpreted by any skin that tracks >+ /* These are useful and can be interpreted by any tool that tracks > malloc() et al, by using vg_replace_malloc.c. */ > VG_USERREQ__MALLOCLIKE_BLOCK = 0x1301, > VG_USERREQ__FREELIKE_BLOCK = 0x1302, >@@ -169,10 +169,13 @@ > VG_USERREQ__PRINTF_BACKTRACE = 0x1402, > } Vg_ClientRequest; > >+#ifndef __GNUC__ >+#define __extension__ >+#endif > > /* Returns 1 if running on Valgrind, 0 if running on the real CPU. > Currently implemented but untested. */ >-#define RUNNING_ON_VALGRIND \ >+#define RUNNING_ON_VALGRIND __extension__ \ > ({unsigned int _qzz_res; \ > VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0 /* returned if not */, \ > VG_USERREQ__RUNNING_ON_VALGRIND, \ >@@ -270,8 +273,8 @@ > }) > > >-/* Counts the number of errors that have been recorded by a skin. Nb: >- the skin must record the errors with VG_(maybe_record_error)() or >+/* Counts the number of errors that have been recorded by a tool. Nb: >+ the tool must record the errors with VG_(maybe_record_error)() or > VG_(unique_error)() for them to be counted. */ > #define VALGRIND_COUNT_ERRORS \ > ({unsigned int _qyy_res; \ >diff -ruN valgrind-2.1.0/include/vg_constants_skin.h valgrind/include/vg_constants_skin.h >--- valgrind-2.1.0/include/vg_constants_skin.h 2003-04-26 15:11:15.000000000 -0500 >+++ valgrind/include/vg_constants_skin.h 2004-01-04 10:43:22.000000000 -0600 >@@ -8,7 +8,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -45,10 +45,17 @@ > #define VGP_(str) VGAPPEND(vgProf_,str) > #define VGOFF_(str) VGAPPEND(vgOff_,str) > #define VGR_(str) VGAPPEND(vgAllRoadsLeadToRome_,str) >+#define VGINJ_(str) VGAPPEND(__vgInject_,str) > > /* Skin specific ones. Note that final name still starts with "vg". */ > #define SK_(str) VGAPPEND(vgSkin_,str) > >+/* This is specifically for stringifying VG_(x) function names. We >+ need to do two macroexpansions to get the VG_ macro expanded before >+ stringifying */ >+#define _STR(x) #x >+#define STR(x) _STR(x) >+ > #endif /* ndef __VG_CONSTANTS_SKIN_H */ > > /*--------------------------------------------------------------------*/ >diff -ruN valgrind-2.1.0/include/vg_kerneliface.h valgrind/include/vg_kerneliface.h >--- valgrind-2.1.0/include/vg_kerneliface.h 2003-11-19 16:07:14.000000000 -0600 >+++ valgrind/include/vg_kerneliface.h 2004-02-10 17:44:15.000000000 -0600 >@@ -9,7 +9,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -305,12 +305,20 @@ > > /* The following are copied from include/asm-i386/mman.h .*/ > >+#define VKI_PROT_NONE 0x0 /* No page permissions */ > #define VKI_PROT_READ 0x1 /* Page can be read. */ > #define VKI_PROT_WRITE 0x2 /* Page can be written. */ > #define VKI_PROT_EXEC 0x4 /* Page can be executed. */ > #define VKI_MAP_ANONYMOUS 0x20 /* Don't use a file. */ >+#define VKI_MAP_SHARED 0x01 /* Share changes. */ > #define VKI_MAP_PRIVATE 0x02 /* Changes are private. */ > #define VKI_MAP_FIXED 0x10 /* Interpret addr exactly */ >+#define VKI_MAP_NOSYMS 0x40000000 /* internal pseudo-flag to disable symbol loading */ >+#define VKI_MAP_CLIENT 0x80000000 /* internal pseudo-flag to distinguish client mappings */ >+ >+/* linux/mman.h */ >+#define VKI_MREMAP_MAYMOVE 1 >+#define VKI_MREMAP_FIXED 2 > > /* Copied from linux-2.4.19/include/asm-i386/fcntl.h */ > >@@ -501,6 +509,19 @@ > #define VKI_POLLNVAL 0x0020 > > >+/* sys/epoll.h */ >+typedef union vki_epoll_data { >+ void *ptr; >+ Int fd; >+ UInt u32; >+ ULong u64; >+} vki_epoll_data_t; >+ >+struct vki_epoll_event { >+ UInt events; /* Epoll events */ >+ vki_epoll_data_t data; /* User data variable */ >+}; >+ > > /* > ./include/asm-i386/posix_types.h:typedef long __kernel_suseconds_t; >@@ -571,6 +592,7 @@ > Logic from /usr/src/linux-2.4.9-31/fs/binfmt_elf.c > and its counterpart in the 2.2.14 kernel sources > in Red Hat 6.2. */ >+#define VKI_AT_NULL 0 > #define VKI_AT_SYSINFO 32 /* address of system info page */ > #define VKI_AT_CLKTCK 17 /* frequency at which times() increments */ > #define VKI_AT_HWCAP 16 /* arch dependent hints at CPU capabilities */ >@@ -622,12 +644,16 @@ > unsigned int limit_in_pages:1; > unsigned int seg_not_present:1; > unsigned int useable:1; >+ unsigned int reserved:25; > } vki_modify_ldt_t; > > #define VKI_MODIFY_LDT_CONTENTS_DATA 0 > #define VKI_MODIFY_LDT_CONTENTS_STACK 1 > #define VKI_MODIFY_LDT_CONTENTS_CODE 2 > >+#define VKI_GDT_TLS_ENTRIES 3 >+#define VKI_GDT_TLS_MIN 6 >+#define VKI_GDT_TLS_MAX (VKI_GDT_TLS_MIN + VKI_GDT_TLS_ENTRIES) > > /* Flags for clone() */ > /* linux/sched.h */ >@@ -717,6 +743,15 @@ > unsigned int f_spare[5]; > }; > >+/* >+ * linux/futex.h >+ */ >+ >+#define VKI_FUTEX_WAIT 0 >+#define VKI_FUTEX_WAKE 1 >+#define VKI_FUTEX_FD 2 >+#define VKI_FUTEX_REQUEUE 3 >+ > > #endif /* __VG_KERNELIFACE_H */ > >diff -ruN valgrind-2.1.0/include/vg_profile.c valgrind/include/vg_profile.c >--- valgrind-2.1.0/include/vg_profile.c 2003-04-15 09:57:57.000000000 -0500 >+++ valgrind/include/vg_profile.c 2004-01-21 09:08:04.000000000 -0600 >@@ -1,7 +1,7 @@ > > /*--------------------------------------------------------------------*/ >-/*--- Profiling machinery. #include this file into a skin to ---*/ >-/*--- enable --profile=yes, but not for release versions of skins, ---*/ >+/*--- Profiling machinery. #include this file into a tool to ---*/ >+/*--- enable --profile=yes, but not for release versions of tools, ---*/ > /*--- because it uses glibc code. ---*/ > /*--- vg_profile.c ---*/ > /*--------------------------------------------------------------------*/ >@@ -10,7 +10,7 @@ > This file is part of Valgrind, an extensible x86 protected-mode > emulator for monitoring program execution on x86-Unixes. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -76,7 +76,7 @@ > if (vgp_names[n] != NULL) { > VG_(printf)("\nProfile event #%d being registered as `%s'\n" > "already registered as `%s'.\n" >- "Note that skin and core event numbers must not overlap.\n", >+ "Note that tool and core event numbers must not overlap.\n", > n, name, vgp_names[n]); > VG_(skin_panic)("profile event already registered"); > } >diff -ruN valgrind-2.1.0/include/vg_skin.h valgrind/include/vg_skin.h >--- valgrind-2.1.0/include/vg_skin.h 2003-11-20 10:20:55.000000000 -0600 >+++ valgrind/include/vg_skin.h 1969-12-31 18:00:00.000000000 -0600 >@@ -1,2096 +0,0 @@ >- >-/*--------------------------------------------------------------------*/ >-/*--- The only header your skin will ever need to #include... ---*/ >-/*--- vg_skin.h ---*/ >-/*--------------------------------------------------------------------*/ >- >-/* >- This file is part of Valgrind, an extensible x86 protected-mode >- emulator for monitoring program execution on x86-Unixes. >- >- Copyright (C) 2000-2003 Julian Seward >- jseward@acm.org >- >- 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 __VG_SKIN_H >-#define __VG_SKIN_H >- >-#include <stdarg.h> /* ANSI varargs stuff */ >-#include <setjmp.h> /* for jmp_buf */ >- >-#include "vg_constants_skin.h" >- >- >-/* --------------------------------------------------------------------- >- Where to send bug reports to. >- ------------------------------------------------------------------ */ >- >-#define VG_BUGS_TO "valgrind.kde.org" >- >- >-/*====================================================================*/ >-/*=== Build options and table sizes. ===*/ >-/*====================================================================*/ >- >-/* You should be able to change these options or sizes, recompile, and >- still have a working system. */ >- >-/* The maximum number of pthreads that we support. This is >- deliberately not very high since our implementation of some of the >- scheduler algorithms is surely O(N) in the number of threads, since >- that's simple, at least. And (in practice) we hope that most >- programs do not need many threads. */ >-#define VG_N_THREADS 100 >- >-/* Maximum number of pthread keys available. Again, we start low until >- the need for a higher number presents itself. */ >-#define VG_N_THREAD_KEYS 50 >- >-/* Total number of integer registers available for allocation -- all of >- them except %esp, %ebp. %ebp permanently points at VG_(baseBlock). >- >- If you increase this you'll have to also change at least these: >- - VG_(rank_to_realreg)() >- - VG_(realreg_to_rank)() >- - ppRegsLiveness() >- - the RegsLive type (maybe -- RegsLive type must have more than >- VG_MAX_REALREGS bits) >- >- You can decrease it, and performance will drop because more spills will >- occur. If you decrease it too much, everything will fall over. >- >- Do not change this unless you really know what you are doing! */ >-#define VG_MAX_REALREGS 6 >- >- >-/*====================================================================*/ >-/*=== Basic types, useful macros ===*/ >-/*====================================================================*/ >- >-typedef unsigned char UChar; >-typedef unsigned short UShort; >-typedef unsigned int UInt; >-typedef unsigned long long int ULong; >- >-typedef signed char Char; >-typedef signed short Short; >-typedef signed int Int; >-typedef signed long long int Long; >- >-typedef unsigned int Addr; >- >-typedef unsigned char Bool; >-#define False ((Bool)0) >-#define True ((Bool)1) >- >- >-#define mycat_wrk(aaa,bbb) aaa##bbb >-#define mycat(aaa,bbb) mycat_wrk(aaa,bbb) >- >-/* No, really. I _am_ that strange. */ >-#define OINK(nnn) VG_(message)(Vg_DebugMsg, "OINK %d",nnn) >- >-/* --------------------------------------------------------------------- >- Now the basic types are set up, we can haul in the kernel-interface >- definitions. >- ------------------------------------------------------------------ */ >- >-#include "vg_kerneliface.h" >- >- >-/*====================================================================*/ >-/*=== Core/skin interface version ===*/ >-/*====================================================================*/ >- >-/* The major version number indicates binary-incompatible changes to the >- interface; if the core and skin major versions don't match, Valgrind >- will abort. The minor version indicates binary-compatible changes. >-*/ >-#define VG_CORE_INTERFACE_MAJOR_VERSION 5 >-#define VG_CORE_INTERFACE_MINOR_VERSION 0 >- >-extern const Int VG_(skin_interface_major_version); >-extern const Int VG_(skin_interface_minor_version); >- >-/* Every skin must include this macro somewhere, exactly once. */ >-#define VG_DETERMINE_INTERFACE_VERSION \ >-const Int VG_(skin_interface_major_version) = VG_CORE_INTERFACE_MAJOR_VERSION; \ >-const Int VG_(skin_interface_minor_version) = VG_CORE_INTERFACE_MINOR_VERSION; >- >- >-/*====================================================================*/ >-/*=== Command-line options ===*/ >-/*====================================================================*/ >- >-/* Use this for normal null-termination-style string comparison */ >-#define VG_STREQ(s1,s2) (s1 != NULL && s2 != NULL \ >- && VG_(strcmp)((s1),(s2))==0) >- >-/* Use these for recognising skin command line options -- stops comparing >- once whitespace is reached. */ >-# define VG_CLO_STREQ(s1,s2) (0==VG_(strcmp_ws)((s1),(s2))) >-# define VG_CLO_STREQN(nn,s1,s2) (0==VG_(strncmp_ws)((s1),(s2),(nn))) >- >-/* Verbosity level: 0 = silent, 1 (default), > 1 = more verbose. */ >-extern Int VG_(clo_verbosity); >- >-/* Profile? */ >-extern Bool VG_(clo_profile); >- >-/* Call this if a recognised option was bad for some reason. >- Note: don't use it just because an option was unrecognised -- return 'False' >- from SKN_(process_cmd_line_option) to indicate that. */ >-extern void VG_(bad_option) ( Char* opt ); >- >-/* Client args */ >-extern Int VG_(client_argc); >-extern Char** VG_(client_argv); >- >-/* Client environment. Can be inspected with VG_(getenv)() */ >-extern Char** VG_(client_envp); >- >- >-/*====================================================================*/ >-/*=== Printing messages for the user ===*/ >-/*====================================================================*/ >- >-/* Print a message prefixed by "??<pid>?? "; '?' depends on the VgMsgKind. >- Should be used for all user output. */ >- >-typedef >- enum { Vg_UserMsg, /* '?' == '=' */ >- Vg_DebugMsg, /* '?' == '-' */ >- Vg_DebugExtraMsg, /* '?' == '+' */ >- Vg_ClientMsg, /* '?' == '*' */ >- } >- VgMsgKind; >- >-/* Functions for building a message from multiple parts. */ >-extern int VG_(start_msg) ( VgMsgKind kind ); >-extern int VG_(add_to_msg) ( Char* format, ... ); >-/* Ends and prints the message. Appends a newline. */ >-extern int VG_(end_msg) ( void ); >- >-/* Send a single-part message. Appends a newline. */ >-extern int VG_(message) ( VgMsgKind kind, Char* format, ... ); >-extern int VG_(vmessage) ( VgMsgKind kind, Char* format, va_list vargs ); >- >- >-/*====================================================================*/ >-/*=== Profiling ===*/ >-/*====================================================================*/ >- >-/* Nb: VGP_(register_profile_event)() relies on VgpUnc being the first one */ >-#define VGP_CORE_LIST \ >- /* These ones depend on the core */ \ >- VGP_PAIR(VgpUnc, "unclassified"), \ >- VGP_PAIR(VgpRun, "running"), \ >- VGP_PAIR(VgpSched, "scheduler"), \ >- VGP_PAIR(VgpMalloc, "low-lev malloc/free"), \ >- VGP_PAIR(VgpCliMalloc, "client malloc/free"), \ >- VGP_PAIR(VgpTranslate, "translate-main"), \ >- VGP_PAIR(VgpToUCode, "to-ucode"), \ >- VGP_PAIR(VgpFromUcode, "from-ucode"), \ >- VGP_PAIR(VgpImprove, "improve"), \ >- VGP_PAIR(VgpESPUpdate, "ESP-update"), \ >- VGP_PAIR(VgpRegAlloc, "reg-alloc"), \ >- VGP_PAIR(VgpLiveness, "liveness-analysis"), \ >- VGP_PAIR(VgpDoLRU, "do-lru"), \ >- VGP_PAIR(VgpSlowFindT, "slow-search-transtab"), \ >- VGP_PAIR(VgpInitMem, "init-memory"), \ >- VGP_PAIR(VgpExeContext, "exe-context"), \ >- VGP_PAIR(VgpReadSyms, "read-syms"), \ >- VGP_PAIR(VgpSearchSyms, "search-syms"), \ >- VGP_PAIR(VgpAddToT, "add-to-transtab"), \ >- VGP_PAIR(VgpCoreSysWrap, "core-syscall-wrapper"), \ >- VGP_PAIR(VgpDemangle, "demangle"), \ >- VGP_PAIR(VgpCoreCheapSanity, "core-cheap-sanity"), \ >- VGP_PAIR(VgpCoreExpensiveSanity, "core-expensive-sanity"), \ >- /* These ones depend on the skin */ \ >- VGP_PAIR(VgpPreCloInit, "pre-clo-init"), \ >- VGP_PAIR(VgpPostCloInit, "post-clo-init"), \ >- VGP_PAIR(VgpInstrument, "instrument"), \ >- VGP_PAIR(VgpSkinSysWrap, "skin-syscall-wrapper"), \ >- VGP_PAIR(VgpSkinCheapSanity, "skin-cheap-sanity"), \ >- VGP_PAIR(VgpSkinExpensiveSanity, "skin-expensive-sanity"), \ >- VGP_PAIR(VgpFini, "fini") >- >-#define VGP_PAIR(n,name) n >-typedef enum { VGP_CORE_LIST } VgpCoreCC; >-#undef VGP_PAIR >- >-/* When registering skin profiling events, ensure that the 'n' value is in >- * the range (VgpFini+1..) */ >-extern void VGP_(register_profile_event) ( Int n, Char* name ); >- >-extern void VGP_(pushcc) ( UInt cc ); >-extern void VGP_(popcc) ( UInt cc ); >- >-/* Define them only if they haven't already been defined by vg_profile.c */ >-#ifndef VGP_PUSHCC >-# define VGP_PUSHCC(x) >-#endif >-#ifndef VGP_POPCC >-# define VGP_POPCC(x) >-#endif >- >- >-/*====================================================================*/ >-/*=== Useful stuff to call from generated code ===*/ >-/*====================================================================*/ >- >-/* ------------------------------------------------------------------ */ >-/* General stuff */ >- >-/* 64-bit counter for the number of basic blocks done. */ >-extern ULong VG_(bbs_done); >- >-/* Get the simulated %esp */ >-extern Addr VG_(get_stack_pointer) ( void ); >- >-/* Detect if an address is within Valgrind's stack, Valgrind's >- m_state_static, or the VG_(threads) array. This is useful for >- memory leak detectors to rule out spurious pointers to a block. */ >-extern Bool VG_(within_stack)(Addr a); >-extern Bool VG_(within_m_state_static_OR_threads)(Addr a); >- >-/* Check if an address is 4-byte aligned */ >-#define IS_ALIGNED4_ADDR(aaa_p) (0 == (((UInt)(aaa_p)) & 3)) >-#define IS_ALIGNED8_ADDR(aaa_p) (0 == (((UInt)(aaa_p)) & 7)) >- >- >-/* ------------------------------------------------------------------ */ >-/* Thread-related stuff */ >- >-/* Special magic value for an invalid ThreadId. It corresponds to >- LinuxThreads using zero as the initial value for >- pthread_mutex_t.__m_owner and pthread_cond_t.__c_waiting. */ >-#define VG_INVALID_THREADID ((ThreadId)(0)) >- >-/* ThreadIds are simply indices into the VG_(threads)[] array. */ >-typedef >- UInt >- ThreadId; >- >-/* When looking for the current ThreadId, this is the safe option and >- probably the one you want. >- >- Details: Use this one from non-generated code, eg. from functions called >- on events like 'new_mem_heap'. In such a case, the "current" thread is >- temporarily suspended as Valgrind's dispatcher is running. This function >- is also suitable to be called from generated code (ie. from UCode, or a C >- function called directly from UCode). >- >- If you use VG_(get_current_tid)() from non-generated code, it will return >- 0 signifying the invalid thread, which is probably not what you want. */ >-extern ThreadId VG_(get_current_or_recent_tid) ( void ); >- >-/* When looking for the current ThreadId, only use this one if you know what >- you are doing. >- >- Details: Use this one from generated code, eg. from C functions called >- from UCode. (VG_(get_current_or_recent_tid)() is also suitable in that >- case.) If you use this function from non-generated code, it will return >- 0 signifying the invalid thread, which is probably not what you want. */ >-extern ThreadId VG_(get_current_tid) ( void ); >- >-/* Searches through all thread's stacks to see if any match. Returns >- VG_INVALID_THREADID if none match. */ >-extern ThreadId VG_(first_matching_thread_stack) >- ( Bool (*p) ( Addr stack_min, Addr stack_max )); >- >- >-/*====================================================================*/ >-/*=== Valgrind's version of libc ===*/ >-/*====================================================================*/ >- >-/* Valgrind doesn't use libc at all, for good reasons (trust us). So here >- are its own versions of C library functions, but with VG_ prefixes. Note >- that the types of some are slightly different to the real ones. Some >- additional useful functions are provided too; descriptions of how they >- work are given below. */ >- >-#if !defined(NULL) >-# define NULL ((void*)0) >-#endif >- >- >-/* ------------------------------------------------------------------ */ >-/* stdio.h >- * >- * Note that they all output to the file descriptor given by the >- * --logfile-fd=N argument, which defaults to 2 (stderr). Hence no >- * need for VG_(fprintf)(). >- */ >-extern UInt VG_(printf) ( const char *format, ... ); >-/* too noisy ... __attribute__ ((format (printf, 1, 2))) ; */ >-extern UInt VG_(sprintf) ( Char* buf, Char *format, ... ); >-extern UInt VG_(vprintf) ( void(*send)(Char), >- const Char *format, va_list vargs ); >- >-extern Int VG_(rename) ( Char* old_name, Char* new_name ); >- >-/* ------------------------------------------------------------------ */ >-/* stdlib.h */ >- >-extern void* VG_(malloc) ( Int nbytes ); >-extern void VG_(free) ( void* p ); >-extern void* VG_(calloc) ( Int n, Int nbytes ); >-extern void* VG_(realloc) ( void* p, Int size ); >-extern void* VG_(malloc_aligned) ( Int align_bytes, Int nbytes ); >- >-extern void VG_(print_malloc_stats) ( void ); >- >- >-extern void VG_(exit)( Int status ) >- __attribute__ ((__noreturn__)); >-/* Prints a panic message (a constant string), appends newline and bug >- reporting info, aborts. */ >-__attribute__ ((__noreturn__)) >-extern void VG_(skin_panic) ( Char* str ); >- >-/* Looks up VG_(client_envp) */ >-extern Char* VG_(getenv) ( Char* name ); >- >-/* Get client resource limit*/ >-extern Int VG_(getrlimit) ( Int resource, struct vki_rlimit *rlim ); >- >-/* Crude stand-in for the glibc system() call. */ >-extern Int VG_(system) ( Char* cmd ); >- >-extern Long VG_(atoll) ( Char* str ); >- >-/* Like atoll(), but converts a number of base 2..36 */ >-extern Long VG_(atoll36) ( UInt base, Char* str ); >- >-/* Like qsort(), but does shell-sort. The size==1/2/4 cases are specialised. */ >-extern void VG_(ssort)( void* base, UInt nmemb, UInt size, >- Int (*compar)(void*, void*) ); >- >- >-/* ------------------------------------------------------------------ */ >-/* ctype.h */ >-extern Bool VG_(isspace) ( Char c ); >-extern Bool VG_(isdigit) ( Char c ); >-extern Char VG_(toupper) ( Char c ); >- >- >-/* ------------------------------------------------------------------ */ >-/* string.h */ >-extern Int VG_(strlen) ( const Char* str ); >-extern Char* VG_(strcat) ( Char* dest, const Char* src ); >-extern Char* VG_(strncat) ( Char* dest, const Char* src, Int n ); >-extern Char* VG_(strpbrk) ( const Char* s, const Char* accept ); >-extern Char* VG_(strcpy) ( Char* dest, const Char* src ); >-extern Char* VG_(strncpy) ( Char* dest, const Char* src, Int ndest ); >-extern Int VG_(strcmp) ( const Char* s1, const Char* s2 ); >-extern Int VG_(strncmp) ( const Char* s1, const Char* s2, Int nmax ); >-extern Char* VG_(strstr) ( const Char* haystack, Char* needle ); >-extern Char* VG_(strchr) ( const Char* s, Char c ); >-extern Char* VG_(strdup) ( const Char* s); >-extern void* VG_(memcpy) ( void *d, const void *s, Int sz ); >-extern void* VG_(memset) ( void *s, Int c, Int sz ); >-extern Int VG_(memcmp) ( const void* s1, const void* s2, Int n ); >- >-/* Like strcmp() and strncmp(), but stop comparing at any whitespace. */ >-extern Int VG_(strcmp_ws) ( const Char* s1, const Char* s2 ); >-extern Int VG_(strncmp_ws) ( const Char* s1, const Char* s2, Int nmax ); >- >-/* Like strncpy(), but if 'src' is longer than 'ndest' inserts a '\0' as the >- last character. */ >-extern void VG_(strncpy_safely) ( Char* dest, const Char* src, Int ndest ); >- >-/* Mini-regexp function. Searches for 'pat' in 'str'. Supports >- * meta-symbols '*' and '?'. '\' escapes meta-symbols. */ >-extern Bool VG_(string_match) ( Char* pat, Char* str ); >- >- >-/* ------------------------------------------------------------------ */ >-/* math.h */ >-/* Returns the base-2 logarithm of x. */ >-extern Int VG_(log2) ( Int x ); >- >- >-/* ------------------------------------------------------------------ */ >-/* unistd.h, fcntl.h, sys/stat.h */ >-extern Int VG_(getdents)( UInt fd, struct vki_dirent *dirp, UInt count ); >-extern Int VG_(readlink)( Char* path, Char* buf, UInt bufsize ); >-extern Int VG_(getpid) ( void ); >-extern Int VG_(getppid) ( void ); >-extern Int VG_(getpgrp) ( void ); >-extern Int VG_(gettid) ( void ); >-extern Int VG_(setpgid) ( Int pid, Int pgrp ); >- >-extern Int VG_(open) ( const Char* pathname, Int flags, Int mode ); >-extern Int VG_(read) ( Int fd, void* buf, Int count); >-extern Int VG_(write) ( Int fd, const void* buf, Int count); >-extern Int VG_(lseek) ( Int fd, Long offset, Int whence); >-extern void VG_(close) ( Int fd ); >- >-extern Int VG_(pipe) ( Int fd[2] ); >- >-/* Nb: VG_(rename)() declared in stdio.h section above */ >-extern Int VG_(unlink) ( Char* file_name ); >-extern Int VG_(stat) ( Char* file_name, struct vki_stat* buf ); >-extern Int VG_(fstat) ( Int fd, struct vki_stat* buf ); >-extern Int VG_(dup2) ( Int oldfd, Int newfd ); >- >-extern Char* VG_(getcwd) ( Char* buf, Int size ); >- >-/* Easier to use than VG_(getcwd)() -- does the buffer fiddling itself. >- String put into 'cwd' is VG_(malloc)'d, and should be VG_(free)'d. >- Returns False if it fails. Will fail if the pathname is > 65535 bytes. */ >-extern Bool VG_(getcwd_alloc) ( Char** cwd ); >- >-/* ------------------------------------------------------------------ */ >-/* assert.h */ >-/* Asserts permanently enabled -- no turning off with NDEBUG. Hurrah! */ >-#define VG__STRING(__str) #__str >- >-#define sk_assert(expr) \ >- ((void) ((expr) ? 0 : \ >- (VG_(skin_assert_fail) (VG__STRING(expr), \ >- __FILE__, __LINE__, \ >- __PRETTY_FUNCTION__), 0))) >- >-__attribute__ ((__noreturn__)) >-extern void VG_(skin_assert_fail) ( const Char* expr, const Char* file, >- Int line, const Char* fn ); >- >- >-/* ------------------------------------------------------------------ */ >-/* system/mman.h */ >-extern void* VG_(mmap)( void* start, UInt length, >- UInt prot, UInt flags, UInt fd, UInt offset ); >-extern Int VG_(munmap)( void* start, Int length ); >- >-/* Get memory by anonymous mmap. */ >-extern void* VG_(get_memory_from_mmap) ( Int nBytes, Char* who ); >- >- >-/* ------------------------------------------------------------------ */ >-/* signal.h. >- >- Note that these use the vk_ (kernel) structure >- definitions, which are different in places from those that glibc >- defines -- hence the 'k' prefix. Since we're operating right at the >- kernel interface, glibc's view of the world is entirely irrelevant. */ >- >-/* --- Signal set ops --- */ >-extern Int VG_(ksigfillset) ( vki_ksigset_t* set ); >-extern Int VG_(ksigemptyset) ( vki_ksigset_t* set ); >- >-extern Bool VG_(kisfullsigset) ( vki_ksigset_t* set ); >-extern Bool VG_(kisemptysigset) ( vki_ksigset_t* set ); >- >-extern Int VG_(ksigaddset) ( vki_ksigset_t* set, Int signum ); >-extern Int VG_(ksigdelset) ( vki_ksigset_t* set, Int signum ); >-extern Int VG_(ksigismember) ( vki_ksigset_t* set, Int signum ); >- >-extern void VG_(ksigaddset_from_set) ( vki_ksigset_t* dst, vki_ksigset_t* src ); >-extern void VG_(ksigdelset_from_set) ( vki_ksigset_t* dst, vki_ksigset_t* src ); >- >-/* --- Mess with the kernel's sig state --- */ >-extern Int VG_(ksigprocmask) ( Int how, const vki_ksigset_t* set, >- vki_ksigset_t* oldset ); >-extern Int VG_(ksigaction) ( Int signum, >- const vki_ksigaction* act, >- vki_ksigaction* oldact ); >- >-extern Int VG_(ksigtimedwait)( const vki_ksigset_t *, vki_ksiginfo_t *, >- const struct vki_timespec * ); >- >-extern Int VG_(ksignal) ( Int signum, void (*sighandler)(Int) ); >-extern Int VG_(ksigaltstack) ( const vki_kstack_t* ss, vki_kstack_t* oss ); >- >-extern Int VG_(kkill) ( Int pid, Int signo ); >-extern Int VG_(ktkill) ( Int pid, Int signo ); >-extern Int VG_(ksigpending) ( vki_ksigset_t* set ); >- >-extern Int VG_(waitpid) ( Int pid, Int *status, Int options ); >- >-/* ------------------------------------------------------------------ */ >-/* socket.h. */ >- >-extern Int VG_(getsockname) ( Int sd, struct vki_sockaddr *name, Int *namelen); >-extern Int VG_(getpeername) ( Int sd, struct vki_sockaddr *name, Int *namelen); >-extern Int VG_(getsockopt) ( Int sd, Int level, Int optname, void *optval, >- Int *optlen); >- >-/* ------------------------------------------------------------------ */ >-/* other, randomly useful functions */ >-extern UInt VG_(read_millisecond_timer) ( void ); >- >-/*====================================================================*/ >-/*=== UCode definition ===*/ >-/*====================================================================*/ >- >-/* Tags which describe what operands are. Must fit into 4 bits, which >- they clearly do. */ >-typedef >-enum { TempReg =0, /* virtual temp-reg */ >- ArchReg =1, /* simulated integer reg */ >- ArchRegS =2, /* simulated segment reg */ >- RealReg =3, /* real machine's real reg */ >- SpillNo =4, /* spill slot location */ >- Literal =5, /* literal; .lit32 field has actual value */ >- Lit16 =6, /* literal; .val[123] field has actual value */ >- NoValue =7 /* operand not in use */ >- } >- Tag; >- >-/* Invalid register numbers (can't be negative) */ >-#define INVALID_TEMPREG 999999999 >-#define INVALID_REALREG 999999999 >- >-/* Microinstruction opcodes. */ >-typedef >- enum { >- NOP, /* Null op */ >- >- LOCK, /* Indicate the existence of a LOCK prefix (functionally NOP) */ >- >- /* Moving values around */ >- GET, PUT, /* simulated register <--> TempReg */ >- GETF, PUTF, /* simulated %eflags <--> TempReg */ >- LOAD, STORE, /* memory <--> TempReg */ >- MOV, /* TempReg <--> TempReg */ >- CMOV, /* Used for cmpxchg and cmov */ >- >- /* Arithmetic/logical ops */ >- MUL, UMUL, /* Multiply */ >- ADD, ADC, SUB, SBB, /* Add/subtract (w/wo carry) */ >- AND, OR, XOR, NOT, /* Boolean ops */ >- SHL, SHR, SAR, ROL, ROR, RCL, RCR, /* Shift/rotate (w/wo carry) */ >- NEG, /* Negate */ >- INC, DEC, /* Increment/decrement */ >- BSWAP, /* Big-endian <--> little-endian */ >- CC2VAL, /* Condition code --> 0 or 1 */ >- WIDEN, /* Signed or unsigned widening */ >- >- /* Conditional or unconditional jump */ >- JMP, >- >- /* FPU ops */ >- FPU, /* Doesn't touch memory */ >- FPU_R, FPU_W, /* Reads/writes memory */ >- >- /* ------------ MMX ops ------------ */ >- /* In this and the SSE encoding, bytes at higher addresses are >- held in bits [7:0] in these 16-bit words. I guess this means >- it is a big-endian encoding. */ >- >- /* 1 byte, no memrefs, no iregdefs, copy exactly to the >- output. Held in val1[7:0]. */ >- MMX1, >- >- /* 2 bytes, no memrefs, no iregdefs, copy exactly to the >- output. Held in val1[15:0]. */ >- MMX2, >- >- /* 3 bytes, no memrefs, no iregdefs, copy exactly to the >- output. Held in val1[15:0] and val2[7:0]. */ >- MMX3, >- >- /* 2 bytes, reads/writes mem. Insns of the form >- bbbbbbbb:mod mmxreg r/m. >- Held in val1[15:0], and mod and rm are to be replaced >- at codegen time by a reference to the Temp/RealReg holding >- the address. Arg2 holds this Temp/Real Reg. >- Transfer is always at size 8. >- */ >- MMX2_MemRd, >- MMX2_MemWr, >- >- /* 2 bytes, reads/writes an integer ("E") register. Insns of the form >- bbbbbbbb:11 mmxreg ireg. >- Held in val1[15:0], and ireg is to be replaced >- at codegen time by a reference to the relevant RealReg. >- Transfer is always at size 4. Arg2 holds this Temp/Real Reg. >- */ >- MMX2_ERegRd, >- MMX2_ERegWr, >- >- /* ------------ SSE/SSE2 ops ------------ */ >- /* In the following: >- >- a digit N indicates the next N bytes are to be copied exactly >- to the output. >- >- 'a' indicates a mod-xmmreg-rm byte, where the mod-rm part is >- to be replaced at codegen time to a Temp/RealReg holding the >- address. >- >- 'e' indicates a byte of the form '11 xmmreg ireg', where ireg >- is read or written, and is to be replaced at codegen time by >- a reference to the relevant RealReg. 'e' because it's the E >- reg in Intel encoding parlance. >- >- 'g' indicates a byte of the form '11 ireg xmmreg', where ireg >- is read or written, and is to be replaced at codegen time by >- a reference to the relevant RealReg. 'g' because it's called >- G in Intel parlance. */ >- >- /* 3 bytes, no memrefs, no iregdefs, copy exactly to the >- output. Held in val1[15:0] and val2[7:0]. */ >- SSE3, >- >- /* 3 bytes, reads/writes mem. Insns of the form >- bbbbbbbb:bbbbbbbb:mod mmxreg r/m. >- Held in val1[15:0] and val2[7:0], and mod and rm are to be >- replaced at codegen time by a reference to the Temp/RealReg >- holding the address. Arg3 holds this Temp/Real Reg. >- Transfer is usually, but not always, at size 16. */ >- SSE2a_MemRd, >- SSE2a_MemWr, >- >- /* 4 bytes, no memrefs, no iregdefs, copy exactly to the >- output. Held in val1[15:0] and val2[15:0]. */ >- SSE4, >- >- /* 4 bytes, reads/writes mem. Insns of the form >- bbbbbbbb:bbbbbbbb:bbbbbbbb:mod mmxreg r/m. >- Held in val1[15:0] and val2[15:0], and mod and rm are to be >- replaced at codegen time by a reference to the Temp/RealReg >- holding the address. Arg3 holds this Temp/Real Reg. >- Transfer is at stated size. */ >- SSE3a_MemRd, >- SSE3a_MemWr, >- >- /* 4 bytes, reads/writes mem. Insns of the form >- bbbbbbbb:bbbbbbbb:mod mmxreg r/m:bbbbbbbb >- Held in val1[15:0] and val2[15:0], and mod and rm are to be >- replaced at codegen time by a reference to the Temp/RealReg >- holding the address. Arg3 holds this Temp/Real Reg. >- Transfer is at stated size. */ >- SSE2a1_MemRd, >- >- /* 4 bytes, writes an integer register. Insns of the form >- bbbbbbbb:bbbbbbbb:bbbbbbbb:11 ireg bbb. >- Held in val1[15:0] and val2[15:0], and ireg is to be replaced >- at codegen time by a reference to the relevant RealReg. >- Transfer is always at size 4. Arg3 holds this Temp/Real Reg. >- */ >- SSE3g_RegWr, >- >- /* 5 bytes, writes an integer register. Insns of the form >- bbbbbbbb:bbbbbbbb:bbbbbbbb: 11 ireg bbb :bbbbbbbb. Held in >- val1[15:0] and val2[15:0] and lit32[7:0], and ireg is to be >- replaced at codegen time by a reference to the relevant >- RealReg. Transfer is always at size 4. Arg3 holds this >- Temp/Real Reg. >- */ >- SSE3g1_RegWr, >- >- /* 4 bytes, reads an integer register. Insns of the form >- bbbbbbbb:bbbbbbbb:bbbbbbbb:11 bbb ireg. >- Held in val1[15:0] and val2[15:0], and ireg is to be replaced >- at codegen time by a reference to the relevant RealReg. >- Transfer is always at size 4. Arg3 holds this Temp/Real Reg. >- */ >- SSE3e_RegRd, >- SSE3e_RegWr, /* variant that writes Ereg, not reads it */ >- >- /* 5 bytes, reads an integer register. Insns of the form >- bbbbbbbb:bbbbbbbb:bbbbbbbb: 11 bbb ireg :bbbbbbbb. Held in >- val1[15:0] and val2[15:0] and lit32[7:0], and ireg is to be >- replaced at codegen time by a reference to the relevant >- RealReg. Transfer is always at size 4. Arg3 holds this >- Temp/Real Reg. >- */ >- SSE3e1_RegRd, >- >- /* 4 bytes, reads memory, writes an integer register, but is >- nevertheless an SSE insn. The insn is of the form >- bbbbbbbb:bbbbbbbb:bbbbbbbb:mod ireg rm where mod indicates >- memory (ie is not 11b) and ireg is the int reg written. The >- first 4 bytes are held in lit32[31:0] since there is >- insufficient space elsewhere. mod and rm are to be replaced >- at codegen time by a reference to the Temp/RealReg holding >- the address. Arg1 holds this Temp/RealReg. ireg is to be >- replaced at codegen time by a reference to the relevant >- RealReg in which the answer is to be written. Arg2 holds >- this Temp/RealReg. Transfer to the destination reg is always >- at size 4. However the memory read can be at sizes 4 or 8 >- and so this is what the sz field holds. Note that the 4th >- byte of the instruction (the modrm byte) is redundant, but we >- store it anyway so as to be consistent with all other SSE >- uinstrs. >- */ >- SSE3ag_MemRd_RegWr, >- >- /* 5 bytes, no memrefs, no iregdefs, copy exactly to the >- output. Held in val1[15:0], val2[15:0] and val3[7:0]. */ >- SSE5, >- >- /* 5 bytes, reads/writes mem. Insns of the form >- bbbbbbbb:bbbbbbbb:bbbbbbbb:mod mmxreg r/m:bbbbbbbb >- Held in val1[15:0], val2[15:0], lit32[7:0]. >- mod and rm are to be replaced at codegen time by a reference >- to the Temp/RealReg holding the address. Arg3 holds this >- Temp/Real Reg. Transfer is always at size 16. */ >- SSE3a1_MemRd, >- >- /* ------------------------ */ >- >- /* Not strictly needed, but improve address calculation translations. */ >- LEA1, /* reg2 := const + reg1 */ >- LEA2, /* reg3 := const + reg1 + reg2 * 1,2,4 or 8 */ >- >- /* Hack for x86 REP insns. Jump to literal if TempReg/RealReg >- is zero. */ >- JIFZ, >- >- /* Advance the simulated %eip by some small (< 128) number. */ >- INCEIP, >- >- /* Dealing with segment registers */ >- GETSEG, PUTSEG, /* simulated segment register <--> TempReg */ >- USESEG, /* (LDT/GDT index, virtual addr) --> linear addr */ >- >- /* Not for translating x86 calls -- only to call helpers */ >- CALLM_S, CALLM_E, /* Mark start/end of CALLM push/pop sequence */ >- PUSH, POP, CLEAR, /* Add/remove/zap args for helpers */ >- CALLM, /* Call assembly-code helper */ >- >- /* Not for translating x86 calls -- only to call C helper functions of >- up to three arguments (or two if the functions has a return value). >- Arguments and return value must be word-sized. More arguments can >- be faked with global variables (eg. use VG_(set_global_var)()). >- >- Seven possibilities: 'arg[123]' show where args go, 'ret' shows >- where return value goes (if present). >- >- CCALL(-, -, - ) void f(void) >- CCALL(arg1, -, - ) void f(UInt arg1) >- CCALL(arg1, arg2, - ) void f(UInt arg1, UInt arg2) >- CCALL(arg1, arg2, arg3) void f(UInt arg1, UInt arg2, UInt arg3) >- CCALL(-, -, ret ) UInt f(UInt) >- CCALL(arg1, -, ret ) UInt f(UInt arg1) >- CCALL(arg1, arg2, ret ) UInt f(UInt arg1, UInt arg2) */ >- CCALL, >- >- /* This opcode makes it easy for skins that extend UCode to do this to >- avoid opcode overlap: >- >- enum { EU_OP1 = DUMMY_FINAL_UOPCODE + 1, ... } >- >- WARNING: Do not add new opcodes after this one! They can be added >- before, though. */ >- DUMMY_FINAL_UOPCODE >- } >- Opcode; >- >- >-/* Condition codes, using the Intel encoding. CondAlways is an extra. */ >-typedef >- enum { >- CondO = 0, /* overflow */ >- CondNO = 1, /* no overflow */ >- CondB = 2, /* below */ >- CondNB = 3, /* not below */ >- CondZ = 4, /* zero */ >- CondNZ = 5, /* not zero */ >- CondBE = 6, /* below or equal */ >- CondNBE = 7, /* not below or equal */ >- CondS = 8, /* negative */ >- CondNS = 9, /* not negative */ >- CondP = 10, /* parity even */ >- CondNP = 11, /* not parity even */ >- CondL = 12, /* jump less */ >- CondNL = 13, /* not less */ >- CondLE = 14, /* less or equal */ >- CondNLE = 15, /* not less or equal */ >- CondAlways = 16 /* Jump always */ >- } >- Condcode; >- >- >-/* Descriptions of additional properties of *unconditional* jumps. */ >-typedef >- enum { >- JmpBoring=0, /* boring unconditional jump */ >- JmpCall=1, /* jump due to an x86 call insn */ >- JmpRet=2, /* jump due to an x86 ret insn */ >- JmpSyscall=3, /* do a system call, then jump */ >- JmpClientReq=4 /* do a client request, then jump */ >- } >- JmpKind; >- >- >-/* Flags. User-level code can only read/write O(verflow), S(ign), >- Z(ero), A(ux-carry), C(arry), P(arity), and may also write >- D(irection). That's a total of 7 flags. A FlagSet is a bitset, >- thusly: >- 76543210 >- DOSZACP >- and bit 7 must always be zero since it is unused. >- >- Note: these Flag? values are **not** the positions in the actual >- %eflags register. */ >- >-typedef UChar FlagSet; >- >-#define FlagD (1<<6) >-#define FlagO (1<<5) >-#define FlagS (1<<4) >-#define FlagZ (1<<3) >-#define FlagA (1<<2) >-#define FlagC (1<<1) >-#define FlagP (1<<0) >- >-#define FlagsOSZACP (FlagO | FlagS | FlagZ | FlagA | FlagC | FlagP) >-#define FlagsOSZAP (FlagO | FlagS | FlagZ | FlagA | FlagP) >-#define FlagsOSZCP (FlagO | FlagS | FlagZ | FlagC | FlagP) >-#define FlagsOSACP (FlagO | FlagS | FlagA | FlagC | FlagP) >-#define FlagsSZACP ( FlagS | FlagZ | FlagA | FlagC | FlagP) >-#define FlagsSZAP ( FlagS | FlagZ | FlagA | FlagP) >-#define FlagsZCP ( FlagZ | FlagC | FlagP) >-#define FlagsOC (FlagO | FlagC ) >-#define FlagsAC ( FlagA | FlagC ) >- >-#define FlagsALL (FlagsOSZACP | FlagD) >-#define FlagsEmpty (FlagSet)0 >- >- >-/* flag positions in eflags */ >-#define EFlagC (1 << 0) /* carry */ >-#define EFlagP (1 << 2) /* parity */ >-#define EFlagA (1 << 4) /* aux carry */ >-#define EFlagZ (1 << 6) /* zero */ >-#define EFlagS (1 << 7) /* sign */ >-#define EFlagD (1 << 10) /* direction */ >-#define EFlagO (1 << 11) /* overflow */ >- >-/* Liveness of general purpose registers, useful for code generation. >- Reg rank order 0..N-1 corresponds to bits 0..N-1, ie. first >- reg's liveness in bit 0, last reg's in bit N-1. Note that >- these rankings don't match the Intel register ordering. */ >-typedef UInt RRegSet; >- >-#define ALL_RREGS_DEAD 0 /* 0000...00b */ >-#define ALL_RREGS_LIVE ((1 << VG_MAX_REALREGS)-1) /* 0011...11b */ >-#define UNIT_RREGSET(rank) (1 << (rank)) >- >-#define IS_RREG_LIVE(rank,rregs_live) (rregs_live & UNIT_RREGSET(rank)) >-#define SET_RREG_LIVENESS(rank,rregs_live,b) \ >- do { RRegSet unit = UNIT_RREGSET(rank); \ >- if (b) rregs_live |= unit; \ >- else rregs_live &= ~unit; \ >- } while(0) >- >- >-/* A Micro (u)-instruction. */ >-typedef >- struct { >- /* word 1 */ >- UInt lit32; /* 32-bit literal */ >- >- /* word 2 */ >- UShort val1; /* first operand */ >- UShort val2; /* second operand */ >- >- /* word 3 */ >- UShort val3; /* third operand */ >- UChar opcode; /* opcode */ >- UChar size; /* data transfer size */ >- >- /* word 4 */ >- FlagSet flags_r; /* :: FlagSet */ >- FlagSet flags_w; /* :: FlagSet */ >- UChar tag1:4; /* first operand tag */ >- UChar tag2:4; /* second operand tag */ >- UChar tag3:4; /* third operand tag */ >- UChar extra4b:4; /* Spare field, used by WIDEN for src >- -size, and by LEA2 for scale (1,2,4 or 8), >- and by JMPs for original x86 instr size */ >- >- /* word 5 */ >- UChar cond; /* condition, for jumps */ >- Bool signed_widen:1; /* signed or unsigned WIDEN ? */ >- JmpKind jmpkind:3; /* additional properties of unconditional JMP */ >- >- /* Additional properties for UInstrs that call C functions: >- - CCALL >- - PUT (when %ESP is the target) >- - possibly skin-specific UInstrs >- */ >- UChar argc:2; /* Number of args, max 3 */ >- UChar regparms_n:2; /* Number of args passed in registers */ >- Bool has_ret_val:1; /* Function has return value? */ >- >- /* RealReg liveness; only sensical after reg alloc and liveness >- analysis done. This info is a little bit arch-specific -- >- VG_MAX_REALREGS can vary on different architectures. Note that >- to use this information requires converting between register ranks >- and the Intel register numbers, using VG_(realreg_to_rank)() >- and/or VG_(rank_to_realreg)() */ >- RRegSet regs_live_after:VG_MAX_REALREGS; >- } >- UInstr; >- >- >-typedef >- struct _UCodeBlock >- UCodeBlock; >- >-extern Int VG_(get_num_instrs) (UCodeBlock* cb); >-extern Int VG_(get_num_temps) (UCodeBlock* cb); >- >-extern UInstr* VG_(get_instr) (UCodeBlock* cb, Int i); >-extern UInstr* VG_(get_last_instr) (UCodeBlock* cb); >- >- >-/*====================================================================*/ >-/*=== Instrumenting UCode ===*/ >-/*====================================================================*/ >- >-/* Maximum number of registers read or written by a single UInstruction. */ >-#define VG_MAX_REGS_USED 3 >- >-/* Find what this instruction does to its regs, useful for >- analysis/optimisation passes. `tag' indicates whether we're considering >- TempRegs (pre-reg-alloc) or RealRegs (post-reg-alloc). `regs' is filled >- with the affected register numbers, `isWrites' parallels it and indicates >- if the reg is read or written. If a reg is read and written, it will >- appear twice in `regs'. `regs' and `isWrites' must be able to fit >- VG_MAX_REGS_USED elements. */ >-extern Int VG_(get_reg_usage) ( UInstr* u, Tag tag, Int* regs, Bool* isWrites ); >- >- >-/* Used to register helper functions to be called from generated code. A >- limited number of compact helpers can be registered; the code generated >- to call them is slightly shorter -- so register the mostly frequently >- called helpers as compact. */ >-extern void VG_(register_compact_helper) ( Addr a ); >-extern void VG_(register_noncompact_helper) ( Addr a ); >- >- >-/* ------------------------------------------------------------------ */ >-/* Virtual register allocation */ >- >-/* Get a new virtual register */ >-extern Int VG_(get_new_temp) ( UCodeBlock* cb ); >- >-/* Get a new virtual shadow register */ >-extern Int VG_(get_new_shadow) ( UCodeBlock* cb ); >- >-/* Get a virtual register's corresponding virtual shadow register */ >-#define SHADOW(tempreg) ((tempreg)+1) >- >- >-/* ------------------------------------------------------------------ */ >-/* Low-level UInstr builders */ >-extern void VG_(new_NOP) ( UInstr* u ); >-extern void VG_(new_UInstr0) ( UCodeBlock* cb, Opcode opcode, Int sz ); >-extern void VG_(new_UInstr1) ( UCodeBlock* cb, Opcode opcode, Int sz, >- Tag tag1, UInt val1 ); >-extern void VG_(new_UInstr2) ( UCodeBlock* cb, Opcode opcode, Int sz, >- Tag tag1, UInt val1, >- Tag tag2, UInt val2 ); >-extern void VG_(new_UInstr3) ( UCodeBlock* cb, Opcode opcode, Int sz, >- Tag tag1, UInt val1, >- Tag tag2, UInt val2, >- Tag tag3, UInt val3 ); >- >-/* Set read/write/undefined flags. Undefined flags are treaten as written, >- but it's worth keeping them logically distinct. */ >-extern void VG_(set_flag_fields) ( UCodeBlock* cb, FlagSet fr, FlagSet fw, >- FlagSet fu); >-extern void VG_(set_lit_field) ( UCodeBlock* cb, UInt lit32 ); >-extern void VG_(set_ccall_fields) ( UCodeBlock* cb, Addr fn, UChar argc, >- UChar regparms_n, Bool has_ret_val ); >-extern void VG_(set_cond_field) ( UCodeBlock* cb, Condcode code ); >- >-extern void VG_(copy_UInstr) ( UCodeBlock* cb, UInstr* instr ); >- >-extern Bool VG_(any_flag_use)( UInstr* u ); >- >-/* Macro versions of the above; just shorter to type. */ >-#define uInstr0 VG_(new_UInstr0) >-#define uInstr1 VG_(new_UInstr1) >-#define uInstr2 VG_(new_UInstr2) >-#define uInstr3 VG_(new_UInstr3) >-#define uLiteral VG_(set_lit_field) >-#define uCCall VG_(set_ccall_fields) >-#define uCond VG_(set_cond_field) >-#define uFlagsRWU VG_(set_flag_fields) >-#define newTemp VG_(get_new_temp) >-#define newShadow VG_(get_new_shadow) >- >-/* Refer to `the last instruction stuffed in' (can be lvalue). */ >-#define LAST_UINSTR(cb) (cb)->instrs[(cb)->used-1] >- >- >-/* ------------------------------------------------------------------ */ >-/* Higher-level UInstr sequence builders */ >-extern void VG_(call_helper_0_0) ( UCodeBlock* cb, Addr f); >-extern void VG_(call_helper_1_0) ( UCodeBlock* cb, Addr f, UInt arg1, >- UInt regparms_n); >-extern void VG_(call_helper_2_0) ( UCodeBlock* cb, Addr f, UInt arg1, UInt arg2, >- UInt regparms_n); >- >-/* One way around the 3-arg C function limit is to pass args via global >- * variables... ugly, but it works. This one puts a literal in there. */ >-extern void VG_(set_global_var) ( UCodeBlock* cb, Addr globvar_ptr, UInt val); >- >-/* This one puts the contents of a TempReg in the global variable. */ >-extern void VG_(set_global_var_tempreg) ( UCodeBlock* cb, Addr globvar_ptr, >- UInt t_val); >- >-/* ------------------------------------------------------------------ */ >-/* Allocating/freeing basic blocks of UCode */ >-extern UCodeBlock* VG_(setup_UCodeBlock) ( UCodeBlock* cb ); >-extern void VG_(free_UCodeBlock) ( UCodeBlock* cb ); >- >-/* ------------------------------------------------------------------ */ >-/* UCode pretty/ugly printing. Probably only useful to call from a skin >- if VG_(needs).extended_UCode == True. */ >- >-/* When True, all generated code is/should be printed. */ >-extern Bool VG_(print_codegen); >- >-/* Pretty/ugly printing functions */ >-extern void VG_(pp_UCodeBlock) ( UCodeBlock* cb, Char* title ); >-extern void VG_(pp_UInstr) ( Int instrNo, UInstr* u ); >-extern void VG_(pp_UInstr_regs) ( Int instrNo, UInstr* u ); >-extern void VG_(up_UInstr) ( Int instrNo, UInstr* u ); >-extern Char* VG_(name_UOpcode) ( Bool upper, Opcode opc ); >-extern Char* VG_(name_UCondcode) ( Condcode cond ); >-extern void VG_(pp_UOperand) ( UInstr* u, Int operandNo, >- Int sz, Bool parens ); >- >-/* ------------------------------------------------------------------ */ >-/* Accessing archregs and their shadows */ >-extern UInt VG_(get_archreg) ( UInt archreg ); >-extern UInt VG_(get_thread_archreg) ( ThreadId tid, UInt archreg ); >- >-extern UInt VG_(get_shadow_archreg) ( UInt archreg ); >-extern void VG_(set_shadow_archreg) ( UInt archreg, UInt val ); >-extern void VG_(set_shadow_eflags) ( UInt val ); >-extern Addr VG_(shadow_archreg_address) ( UInt archreg ); >- >-extern UInt VG_(get_thread_shadow_archreg) ( ThreadId tid, UInt archreg ); >-extern void VG_(set_thread_shadow_archreg) ( ThreadId tid, UInt archreg, >- UInt val ); >- >-/* ------------------------------------------------------------------ */ >-/* Offsets of addresses of helper functions. A "helper" function is one >- which is called from generated code via CALLM. */ >- >-extern Int VGOFF_(helper_idiv_64_32); >-extern Int VGOFF_(helper_div_64_32); >-extern Int VGOFF_(helper_idiv_32_16); >-extern Int VGOFF_(helper_div_32_16); >-extern Int VGOFF_(helper_idiv_16_8); >-extern Int VGOFF_(helper_div_16_8); >- >-extern Int VGOFF_(helper_imul_32_64); >-extern Int VGOFF_(helper_mul_32_64); >-extern Int VGOFF_(helper_imul_16_32); >-extern Int VGOFF_(helper_mul_16_32); >-extern Int VGOFF_(helper_imul_8_16); >-extern Int VGOFF_(helper_mul_8_16); >- >-extern Int VGOFF_(helper_CLD); >-extern Int VGOFF_(helper_STD); >-extern Int VGOFF_(helper_get_dirflag); >- >-extern Int VGOFF_(helper_CLC); >-extern Int VGOFF_(helper_STC); >- >-extern Int VGOFF_(helper_shldl); >-extern Int VGOFF_(helper_shldw); >-extern Int VGOFF_(helper_shrdl); >-extern Int VGOFF_(helper_shrdw); >- >-extern Int VGOFF_(helper_RDTSC); >-extern Int VGOFF_(helper_CPUID); >- >-extern Int VGOFF_(helper_IN); >-extern Int VGOFF_(helper_OUT); >- >-extern Int VGOFF_(helper_bsf); >-extern Int VGOFF_(helper_bsr); >- >-extern Int VGOFF_(helper_fstsw_AX); >-extern Int VGOFF_(helper_SAHF); >-extern Int VGOFF_(helper_LAHF); >-extern Int VGOFF_(helper_DAS); >-extern Int VGOFF_(helper_DAA); >- >- >-/*====================================================================*/ >-/*=== Generating x86 code from UCode ===*/ >-/*====================================================================*/ >- >-/* All this only necessary for skins with VG_(needs).extends_UCode == True. */ >- >-/* This is the Intel register encoding -- integer regs. */ >-#define R_EAX 0 >-#define R_ECX 1 >-#define R_EDX 2 >-#define R_EBX 3 >-#define R_ESP 4 >-#define R_EBP 5 >-#define R_ESI 6 >-#define R_EDI 7 >- >-#define R_AL (0+R_EAX) >-#define R_CL (0+R_ECX) >-#define R_DL (0+R_EDX) >-#define R_BL (0+R_EBX) >-#define R_AH (4+R_EAX) >-#define R_CH (4+R_ECX) >-#define R_DH (4+R_EDX) >-#define R_BH (4+R_EBX) >- >-/* This is the Intel register encoding -- segment regs. */ >-#define R_ES 0 >-#define R_CS 1 >-#define R_SS 2 >-#define R_DS 3 >-#define R_FS 4 >-#define R_GS 5 >- >-/* For pretty printing x86 code */ >-extern const Char* VG_(name_of_mmx_gran) ( UChar gran ); >-extern const Char* VG_(name_of_mmx_reg) ( Int mmxreg ); >-extern const Char* VG_(name_of_seg_reg) ( Int sreg ); >-extern const Char* VG_(name_of_int_reg) ( Int size, Int reg ); >-extern const Char VG_(name_of_int_size) ( Int size ); >- >-/* Shorter macros for convenience */ >-#define nameIReg VG_(name_of_int_reg) >-#define nameISize VG_(name_of_int_size) >-#define nameSReg VG_(name_of_seg_reg) >-#define nameMMXReg VG_(name_of_mmx_reg) >-#define nameMMXGran VG_(name_of_mmx_gran) >-#define nameXMMReg VG_(name_of_xmm_reg) >- >-/* Randomly useful things */ >-extern UInt VG_(extend_s_8to32) ( UInt x ); >- >-/* Code emitters */ >-extern void VG_(emitB) ( UInt b ); >-extern void VG_(emitW) ( UInt w ); >-extern void VG_(emitL) ( UInt l ); >-extern void VG_(new_emit) ( Bool upd_cc, FlagSet uses_flags, FlagSet sets_flags ); >- >-/* Finding offsets */ >-extern Int VG_(helper_offset) ( Addr a ); >-extern Int VG_(shadow_reg_offset) ( Int arch ); >-extern Int VG_(shadow_flags_offset) ( void ); >- >-/* Convert reg ranks <-> Intel register ordering, for using register >- liveness information. */ >-extern Int VG_(realreg_to_rank) ( Int realreg ); >-extern Int VG_(rank_to_realreg) ( Int rank ); >- >-/* Call a subroutine. Does no argument passing, stack manipulations, etc. */ >-extern void VG_(synth_call) ( Bool ensure_shortform, Int word_offset, >- Bool upd_cc, FlagSet use_flags, FlagSet set_flags ); >- >-/* For calling C functions -- saves caller save regs, pushes args, calls, >- clears the stack, restores caller save regs. `fn' must be registered in >- the baseBlock first. Acceptable tags are RealReg and Literal. Optimises >- things, eg. by not preserving non-live caller-save registers. >- >- WARNING: a UInstr should *not* be translated with synth_ccall() followed >- by some other x86 assembly code; this will invalidate the results of >- vg_realreg_liveness_analysis() and everything will fall over. */ >-extern void VG_(synth_ccall) ( Addr fn, Int argc, Int regparms_n, UInt argv[], >- Tag tagv[], Int ret_reg, >- RRegSet regs_live_before, >- RRegSet regs_live_after ); >- >-/* Addressing modes */ >-extern void VG_(emit_amode_offregmem_reg)( Int off, Int regmem, Int reg ); >-extern void VG_(emit_amode_ereg_greg) ( Int e_reg, Int g_reg ); >- >-/* v-size (4, or 2 with OSO) insn emitters */ >-extern void VG_(emit_movv_offregmem_reg) ( Int sz, Int off, Int areg, Int reg ); >-extern void VG_(emit_movv_reg_offregmem) ( Int sz, Int reg, Int off, Int areg ); >-extern void VG_(emit_movv_reg_reg) ( Int sz, Int reg1, Int reg2 ); >-extern void VG_(emit_nonshiftopv_lit_reg)( Bool upd_cc, Int sz, Opcode opc, UInt lit, >- Int reg ); >-extern void VG_(emit_shiftopv_lit_reg) ( Bool upd_cc, Int sz, Opcode opc, UInt lit, >- Int reg ); >-extern void VG_(emit_nonshiftopv_reg_reg)( Bool upd_cc, Int sz, Opcode opc, >- Int reg1, Int reg2 ); >-extern void VG_(emit_movv_lit_reg) ( Int sz, UInt lit, Int reg ); >-extern void VG_(emit_unaryopv_reg) ( Bool upd_cc, Int sz, Opcode opc, Int reg ); >-extern void VG_(emit_pushv_reg) ( Int sz, Int reg ); >-extern void VG_(emit_popv_reg) ( Int sz, Int reg ); >- >-extern void VG_(emit_pushl_lit32) ( UInt int32 ); >-extern void VG_(emit_pushl_lit8) ( Int lit8 ); >-extern void VG_(emit_cmpl_zero_reg) ( Bool upd_cc, Int reg ); >-extern void VG_(emit_swapl_reg_EAX) ( Int reg ); >-extern void VG_(emit_movv_lit_offregmem) ( Int sz, UInt lit, Int off, >- Int memreg ); >- >-/* b-size (1 byte) instruction emitters */ >-extern void VG_(emit_movb_lit_offregmem) ( UInt lit, Int off, Int memreg ); >-extern void VG_(emit_movb_reg_offregmem) ( Int reg, Int off, Int areg ); >-extern void VG_(emit_unaryopb_reg) ( Bool upd_cc, Opcode opc, Int reg ); >-extern void VG_(emit_testb_lit_reg) ( Bool upd_cc, UInt lit, Int reg ); >- >-/* zero-extended load emitters */ >-extern void VG_(emit_movzbl_offregmem_reg) ( Int off, Int regmem, Int reg ); >-extern void VG_(emit_movzwl_offregmem_reg) ( Int off, Int areg, Int reg ); >-extern void VG_(emit_movzwl_regmem_reg) ( Int reg1, Int reg2 ); >- >-/* misc instruction emitters */ >-extern void VG_(emit_call_reg) ( Int reg ); >-extern void VG_(emit_add_lit_to_esp) ( Int lit ); >-extern void VG_(emit_pushal) ( void ); >-extern void VG_(emit_popal) ( void ); >-extern void VG_(emit_AMD_prefetch_reg) ( Int reg ); >- >-/* jump emitters */ >-extern void VG_(init_target) ( Int *tgt ); >- >-extern void VG_(target_back) ( Int *tgt ); >-extern void VG_(target_forward) ( Int *tgt ); >-extern void VG_(emit_target_delta) ( Int *tgt ); >- >-extern void VG_(emit_jcondshort_delta) ( Bool simd_cc, Condcode cond, Int delta ); >-extern void VG_(emit_jcondshort_target)( Bool simd_cc, Condcode cond, Int *tgt ); >- >- >-/*====================================================================*/ >-/*=== Execution contexts ===*/ >-/*====================================================================*/ >- >-/* Generic resolution type used in a few different ways, such as deciding >- how closely to compare two errors for equality. */ >-typedef >- enum { Vg_LowRes, Vg_MedRes, Vg_HighRes } >- VgRes; >- >-typedef >- struct _ExeContext >- ExeContext; >- >-/* Compare two ExeContexts. Number of callers considered depends on `res': >- Vg_LowRes: 2 >- Vg_MedRes: 4 >- Vg_HighRes: all */ >-extern Bool VG_(eq_ExeContext) ( VgRes res, >- ExeContext* e1, ExeContext* e2 ); >- >-/* Print an ExeContext. */ >-extern void VG_(pp_ExeContext) ( ExeContext* ); >- >-/* Take a snapshot of the client's stack. Search our collection of >- ExeContexts to see if we already have it, and if not, allocate a >- new one. Either way, return a pointer to the context. Context size >- controlled by --num-callers option. >- >- If called from generated code, use VG_(get_current_tid)() to get the >- current ThreadId. If called from non-generated code, the current >- ThreadId should be passed in by the core. >-*/ >-extern ExeContext* VG_(get_ExeContext) ( ThreadId tid ); >- >-/* Get the nth EIP from the ExeContext. 0 is the EIP of the top function, 1 >- is its caller, etc. Returns 0 if there isn't one, or if n is greater >- than VG_(clo_backtrace_size), set by the --num-callers option. */ >-extern Addr VG_(get_EIP_from_ExeContext) ( ExeContext* e, UInt n ); >- >-/* Just grab the client's EIP, as a much smaller and cheaper >- indication of where they are. Use is basically same as for >- VG_(get_ExeContext)() above. >-*/ >-extern Addr VG_(get_EIP)( ThreadId tid ); >- >-/* For skins needing more control over stack traces: walks the stack to get >- %eips from the top stack frames for thread 'tid'. Maximum of 'n_eips' >- addresses put into 'eips'; 0 is the top of the stack, 1 is its caller, >- etc. */ >-extern UInt VG_(stack_snapshot) ( ThreadId tid, Addr* eips, UInt n_eips ); >- >-/* Does the same thing as VG_(pp_ExeContext)(), just with slightly >- different input. */ >-extern void VG_(mini_stack_dump) ( Addr eips[], UInt n_eips ); >- >- >-/*====================================================================*/ >-/*=== Error reporting ===*/ >-/*====================================================================*/ >- >-/* ------------------------------------------------------------------ */ >-/* Suppressions describe errors which we want to suppress, ie, not >- show the user, usually because it is caused by a problem in a library >- which we can't fix, replace or work around. Suppressions are read from >- a file at startup time. This gives flexibility so that new >- suppressions can be added to the file as and when needed. >-*/ >- >-typedef >- Int /* Do not make this unsigned! */ >- SuppKind; >- >-/* The skin-relevant parts of a suppression are: >- kind: what kind of suppression; must be in the range (0..) >- string: use is optional. NULL by default. >- extra: use is optional. NULL by default. void* so it's extensible. >-*/ >-typedef >- struct _Supp >- Supp; >- >-/* Useful in SK_(error_matches_suppression)() */ >-SuppKind VG_(get_supp_kind) ( Supp* su ); >-Char* VG_(get_supp_string) ( Supp* su ); >-void* VG_(get_supp_extra) ( Supp* su ); >- >-/* Must be used in VG_(recognised_suppression)() */ >-void VG_(set_supp_kind) ( Supp* su, SuppKind suppkind ); >-/* May be used in VG_(read_extra_suppression_info)() */ >-void VG_(set_supp_string) ( Supp* su, Char* string ); >-void VG_(set_supp_extra) ( Supp* su, void* extra ); >- >- >-/* ------------------------------------------------------------------ */ >-/* Error records contain enough info to generate an error report. The idea >- is that (typically) the same few points in the program generate thousands >- of errors, and we don't want to spew out a fresh error message for each >- one. Instead, we use these structures to common up duplicates. >-*/ >- >-typedef >- Int /* Do not make this unsigned! */ >- ErrorKind; >- >-/* The skin-relevant parts of an Error are: >- kind: what kind of error; must be in the range (0..) >- addr: use is optional. 0 by default. >- string: use is optional. NULL by default. >- extra: use is optional. NULL by default. void* so it's extensible. >-*/ >-typedef >- struct _Error >- Error; >- >-/* Useful in SK_(error_matches_suppression)(), SK_(pp_SkinError)(), etc */ >-ExeContext* VG_(get_error_where) ( Error* err ); >-SuppKind VG_(get_error_kind) ( Error* err ); >-Addr VG_(get_error_address) ( Error* err ); >-Char* VG_(get_error_string) ( Error* err ); >-void* VG_(get_error_extra) ( Error* err ); >- >-/* Call this when an error occurs. It will be recorded if it hasn't been >- seen before. If it has, the existing error record will have its count >- incremented. >- >- 'tid' can be found as for VG_(get_ExeContext)(). The `extra' field can >- be stack-allocated; it will be copied by the core if needed (but it >- won't be copied if it's NULL). >- >- If no 'a', 's' or 'extra' of interest needs to be recorded, just use >- NULL for them. */ >-extern void VG_(maybe_record_error) ( ThreadId tid, ErrorKind ekind, >- Addr a, Char* s, void* extra ); >- >-/* Similar to VG_(maybe_record_error)(), except this one doesn't record the >- error -- useful for errors that can only happen once. The errors can be >- suppressed, though. Return value is True if it was suppressed. >- `print_error' dictates whether to print the error, which is a bit of a >- hack that's useful sometimes if you just want to know if the error would >- be suppressed without possibly printing it. `count_error' dictates >- whether to add the error in the error total count (another mild hack). */ >-extern Bool VG_(unique_error) ( ThreadId tid, ErrorKind ekind, >- Addr a, Char* s, void* extra, >- ExeContext* where, Bool print_error, >- Bool allow_GDB_attach, Bool count_error ); >- >-/* Gets a non-blank, non-comment line of at most nBuf chars from fd. >- Skips leading spaces on the line. Returns True if EOF was hit instead. >- Useful for reading in extra skin-specific suppression lines. */ >-extern Bool VG_(get_line) ( Int fd, Char* buf, Int nBuf ); >- >- >-/*====================================================================*/ >-/*=== Obtaining debug information ===*/ >-/*====================================================================*/ >- >-/* Get the file/function/line number of the instruction at address >- 'a'. For these four, if debug info for the address is found, it >- copies the info into the buffer/UInt and returns True. If not, it >- returns False and nothing is copied. VG_(get_fnname) always >- demangles C++ function names. VG_(get_fnname_w_offset) is the >- same, except it appends "+N" to symbol names to indicate offsets. */ >-extern Bool VG_(get_filename) ( Addr a, Char* filename, Int n_filename ); >-extern Bool VG_(get_fnname) ( Addr a, Char* fnname, Int n_fnname ); >-extern Bool VG_(get_linenum) ( Addr a, UInt* linenum ); >-extern Bool VG_(get_fnname_w_offset) >- ( Addr a, Char* fnname, Int n_fnname ); >- >-/* This one is more efficient if getting both filename and line number, >- because the two lookups are done together. */ >-extern Bool VG_(get_filename_linenum) >- ( Addr a, Char* filename, Int n_filename, >- UInt* linenum ); >- >-/* Succeeds only if we find from debug info that 'a' is the address of the >- first instruction in a function -- as opposed to VG_(get_fnname) which >- succeeds if we find from debug info that 'a' is the address of any >- instruction in a function. Use this to instrument the start of >- a particular function. Nb: if an executable/shared object is stripped >- of its symbols, this function will not be able to recognise function >- entry points within it. */ >-extern Bool VG_(get_fnname_if_entry) ( Addr a, Char* fnname, Int n_fnname ); >- >-/* Succeeds if the address is within a shared object or the main executable. >- It doesn't matter if debug info is present or not. */ >-extern Bool VG_(get_objname) ( Addr a, Char* objname, Int n_objname ); >- >-/* Puts into 'buf' info about the code address %eip: the address, function >- name (if known) and filename/line number (if known), like this: >- >- 0x4001BF05: realloc (vg_replace_malloc.c:339) >- >- 'n_buf' gives length of 'buf'. Returns 'buf'. >-*/ >-extern Char* VG_(describe_eip)(Addr eip, Char* buf, Int n_buf); >- >-/* Returns a string containing an expression for the given >- address. String is malloced with VG_(malloc)() */ >-Char *VG_(describe_addr)(ThreadId, Addr); >- >-/* A way to get information about what segments are mapped */ >-typedef struct _SegInfo SegInfo; >- >-/* Returns NULL if the SegInfo isn't found. It doesn't matter if debug info >- is present or not. */ >-extern SegInfo* VG_(get_obj) ( Addr a ); >- >-extern const SegInfo* VG_(next_seginfo) ( const SegInfo *seg ); >-extern Addr VG_(seg_start) ( const SegInfo *seg ); >-extern UInt VG_(seg_size) ( const SegInfo *seg ); >-extern const UChar* VG_(seg_filename) ( const SegInfo *seg ); >-extern UInt VG_(seg_sym_offset)( const SegInfo *seg ); >- >-typedef >- enum { >- Vg_SectUnknown, >- Vg_SectText, >- Vg_SectData, >- Vg_SectBSS, >- Vg_SectGOT, >- Vg_SectPLT, >- } >- VgSectKind; >- >-extern VgSectKind VG_(seg_sect_kind)(Addr); >- >- >-/*====================================================================*/ >-/*=== Generic hash table ===*/ >-/*====================================================================*/ >- >-/* Generic type for a separately-chained hash table. Via a kind of dodgy >- C-as-C++ style inheritance, skins can extend the VgHashNode type, so long >- as the first two fields match the sizes of these two fields. Requires >- a bit of casting by the skin. */ >-typedef >- struct _VgHashNode { >- struct _VgHashNode * next; >- UInt key; >- } >- VgHashNode; >- >-typedef >- VgHashNode** >- VgHashTable; >- >-/* Make a new table. */ >-extern VgHashTable VG_(HT_construct) ( void ); >- >-/* Count the number of nodes in a table. */ >-extern Int VG_(HT_count_nodes) ( VgHashTable table ); >- >-/* Add a node to the table. */ >-extern void VG_(HT_add_node) ( VgHashTable t, VgHashNode* node ); >- >-/* Looks up a node in the hash table. Also returns the address of the >- previous node's `next' pointer which allows it to be removed from the >- list later without having to look it up again. */ >-extern VgHashNode* VG_(HT_get_node) ( VgHashTable t, UInt key, >- /*OUT*/VgHashNode*** next_ptr ); >- >-/* Allocates an array of pointers to all the shadow chunks of malloc'd >- blocks. Must be freed with VG_(free)(). */ >-extern VgHashNode** VG_(HT_to_array) ( VgHashTable t, /*OUT*/ UInt* n_shadows ); >- >-/* Returns first node that matches predicate `p', or NULL if none do. >- Extra arguments can be implicitly passed to `p' using nested functions; >- see memcheck/mc_errcontext.c for an example. */ >-extern VgHashNode* VG_(HT_first_match) ( VgHashTable t, >- Bool (*p)(VgHashNode*) ); >- >-/* Applies a function f() once to each node. Again, nested functions >- can be very useful. */ >-extern void VG_(HT_apply_to_all_nodes)( VgHashTable t, void (*f)(VgHashNode*) ); >- >-/* Destroy a table. */ >-extern void VG_(HT_destruct) ( VgHashTable t ); >- >- >-/*====================================================================*/ >-/*=== Functions for shadow registers ===*/ >-/*====================================================================*/ >- >-/* Nb: make sure the shadow_regs 'need' is set before using these! */ >- >-/* This one lets you override the shadow of the return value register for a >- syscall. Call it from SK_(post_syscall)() (not SK_(pre_syscall)()!) to >- override the default shadow register value. */ >-extern void VG_(set_return_from_syscall_shadow) ( ThreadId tid, >- UInt ret_shadow ); >- >-/* This can be called from SK_(fini)() to find the shadow of the argument >- to exit(), ie. the shadow of the program's return value. */ >-extern UInt VG_(get_exit_status_shadow) ( void ); >- >- >-/*====================================================================*/ >-/*=== General stuff for replacing functions ===*/ >-/*====================================================================*/ >- >-/* Some skins need to replace the standard definitions of some functions. */ >- >-/* ------------------------------------------------------------------ */ >-/* General stuff, for replacing any functions */ >- >-/* Is the client running on the simulated CPU or the real one? >- >- Nb: If it is, and you want to call a function to be run on the real CPU, >- use one of the VALGRIND_NON_SIMD_CALL[123] macros in valgrind.h to call it. >- >- Nb: don't forget the function parentheses when using this in a >- condition... write this: >- >- if (VG_(is_running_on_simd_CPU)()) { ... } // calls function >- >- not this: >- >- if (VG_(is_running_on_simd_CPU)) { ... } // address of var! >-*/ >-extern Bool VG_(is_running_on_simd_CPU) ( void ); >- >- >-/*====================================================================*/ >-/*=== Specific stuff for replacing malloc() and friends ===*/ >-/*====================================================================*/ >- >-/* If a skin replaces malloc() et al, the easiest way to do so is to link >- with coregrind/vg_replace_malloc.c, and follow the following instructions. >- You can do it from scratch, though, if you enjoy that sort of thing. */ >- >-/* Arena size for valgrind's own malloc(); default value is 0, but can >- be overridden by skin -- but must be done so *statically*, eg: >- >- Int VG_(vg_malloc_redzone_szB) = 4; >- >- It can't be done from a function like SK_(pre_clo_init)(). So it can't, >- for example, be controlled with a command line option, unfortunately. */ >-extern UInt VG_(vg_malloc_redzone_szB); >- >-/* If a skin links with vg_replace_malloc.c, the following functions will be >- called appropriately when malloc() et al are called. */ >-extern void* SK_(malloc) ( Int n ); >-extern void* SK_(__builtin_new) ( Int n ); >-extern void* SK_(__builtin_vec_new) ( Int n ); >-extern void* SK_(memalign) ( Int align, Int n ); >-extern void* SK_(calloc) ( Int nmemb, Int n ); >-extern void SK_(free) ( void* p ); >-extern void SK_(__builtin_delete) ( void* p ); >-extern void SK_(__builtin_vec_delete) ( void* p ); >-extern void* SK_(realloc) ( void* p, Int size ); >- >-/* Can be called from SK_(malloc) et al to do the actual alloc/freeing. */ >-extern void* VG_(cli_malloc) ( UInt align, Int nbytes ); >-extern void VG_(cli_free) ( void* p ); >- >-/* Check if an address is within a range, allowing for redzones at edges */ >-extern Bool VG_(addr_is_in_block)( Addr a, Addr start, UInt size ); >- >-/* ------------------------------------------------------------------ */ >-/* Some options that can be used by a skin if malloc() et al are replaced. >- The skin should call the functions in the appropriate places to give >- control over these aspects of Valgrind's version of malloc(). */ >- >-/* Round malloc sizes upwards to integral number of words? default: NO */ >-extern Bool VG_(clo_sloppy_malloc); >-/* DEBUG: print malloc details? default: NO */ >-extern Bool VG_(clo_trace_malloc); >-/* Minimum alignment in functions that don't specify alignment explicitly. >- default: 0, i.e. use default of the machine (== 4) */ >-extern Int VG_(clo_alignment); >- >-extern Bool VG_(replacement_malloc_process_cmd_line_option) ( Char* arg ); >-extern void VG_(replacement_malloc_print_usage) ( void ); >-extern void VG_(replacement_malloc_print_debug_usage) ( void ); >- >- >-/*====================================================================*/ >-/*=== Skin-specific stuff ===*/ >-/*====================================================================*/ >- >-/* ------------------------------------------------------------------ */ >-/* Details */ >- >-/* Default value for avg_translations_sizeB (in bytes), indicating typical >- code expansion of about 6:1. */ >-#define VG_DEFAULT_TRANS_SIZEB 100 >- >-/* Information used in the startup message. `name' also determines the >- string used for identifying suppressions in a suppression file as >- belonging to this skin. `version' can be NULL, in which case (not >- surprisingly) no version info is printed; this mechanism is designed for >- skins distributed with Valgrind that share a version number with >- Valgrind. Other skins not distributed as part of Valgrind should >- probably have their own version number. */ >-extern void VG_(details_name) ( Char* name ); >-extern void VG_(details_version) ( Char* version ); >-extern void VG_(details_description) ( Char* description ); >-extern void VG_(details_copyright_author) ( Char* copyright_author ); >- >-/* Average size of a translation, in bytes, so that the translation >- storage machinery can allocate memory appropriately. Not critical, >- setting is optional. */ >-extern void VG_(details_avg_translation_sizeB) ( UInt size ); >- >-/* String printed if an `sk_assert' assertion fails or VG_(skin_panic) >- is called. Should probably be an email address. */ >-extern void VG_(details_bug_reports_to) ( Char* bug_reports_to ); >- >-/* ------------------------------------------------------------------ */ >-/* Needs */ >- >-/* Booleans that decide core behaviour, but don't require extra >- operations to be defined if `True' */ >- >-/* Should __libc_freeres() be run? Bugs in it can crash the skin. */ >-extern void VG_(needs_libc_freeres) ( void ); >- >-/* Want to have errors detected by Valgrind's core reported? Includes: >- - pthread API errors (many; eg. unlocking a non-locked mutex) >- - invalid file descriptors to blocking syscalls read() and write() >- - bad signal numbers passed to sigaction() >- - attempt to install signal handler for SIGKILL or SIGSTOP */ >-extern void VG_(needs_core_errors) ( void ); >- >-/* Booleans that indicate extra operations are defined; if these are True, >- the corresponding template functions (given below) must be defined. A >- lot like being a member of a type class. */ >- >-/* Want to report errors from skin? This implies use of suppressions, too. */ >-extern void VG_(needs_skin_errors) ( void ); >- >-/* Is information kept about specific individual basic blocks? (Eg. for >- cachegrind there are cost-centres for every instruction, stored at a >- basic block level.) If so, it sometimes has to be discarded, because >- .so mmap/munmap-ping or self-modifying code (informed by the >- DISCARD_TRANSLATIONS user request) can cause one instruction address >- to be used for more than one instruction in one program run... */ >-extern void VG_(needs_basic_block_discards) ( void ); >- >-/* Skin maintains information about each register? */ >-extern void VG_(needs_shadow_regs) ( void ); >- >-/* Skin defines its own command line options? */ >-extern void VG_(needs_command_line_options) ( void ); >- >-/* Skin defines its own client requests? */ >-extern void VG_(needs_client_requests) ( void ); >- >-/* Skin defines its own UInstrs? */ >-extern void VG_(needs_extended_UCode) ( void ); >- >-/* Skin does stuff before and/or after system calls? */ >-extern void VG_(needs_syscall_wrapper) ( void ); >- >-/* Are skin-state sanity checks performed? */ >-extern void VG_(needs_sanity_checks) ( void ); >- >-/* Do we need to see data symbols? */ >-extern void VG_(needs_data_syms) ( void ); >- >-/* ------------------------------------------------------------------ */ >-/* Core events to track */ >- >-/* Part of the core from which this call was made. Useful for determining >- what kind of error message should be emitted. */ >-typedef >- enum { Vg_CorePThread, Vg_CoreSignal, Vg_CoreSysCall, Vg_CoreTranslate } >- CorePart; >- >-#define EV extern void >- >-/* Events happening in core to track. To be notified, pass a callback >- function to the appropriate function. To ignore an event, don't do >- anything (default is for events to be ignored). >- >- Note that most events aren't passed a ThreadId. To find out the ThreadId >- of the affected thread, use VG_(get_current_or_recent_tid)(). For the >- ones passed a ThreadId, use that instead, since >- VG_(get_current_or_recent_tid)() might not give the right ThreadId in >- that case. >-*/ >- >- >-/* Memory events (Nb: to track heap allocation/freeing, a skin must replace >- malloc() et al. See above how to do this.) */ >- >-/* These ones occur at startup, upon some signals, and upon some syscalls */ >-EV VG_(track_new_mem_startup) ( void (*f)(Addr a, UInt len, >- Bool rr, Bool ww, Bool xx) ); >-EV VG_(track_new_mem_stack_signal) ( void (*f)(Addr a, UInt len) ); >-EV VG_(track_new_mem_brk) ( void (*f)(Addr a, UInt len) ); >-EV VG_(track_new_mem_mmap) ( void (*f)(Addr a, UInt len, >- Bool rr, Bool ww, Bool xx) ); >- >-EV VG_(track_copy_mem_remap) ( void (*f)(Addr from, Addr to, UInt len) ); >-EV VG_(track_change_mem_mprotect) ( void (*f)(Addr a, UInt len, >- Bool rr, Bool ww, Bool xx) ); >-EV VG_(track_die_mem_stack_signal) ( void (*f)(Addr a, UInt len) ); >-EV VG_(track_die_mem_brk) ( void (*f)(Addr a, UInt len) ); >-EV VG_(track_die_mem_munmap) ( void (*f)(Addr a, UInt len) ); >- >- >-/* These ones are called when %esp changes. A skin could track these itself >- (except for ban_mem_stack) but it's much easier to use the core's help. >- >- The specialised ones are called in preference to the general one, if they >- are defined. These functions are called a lot if they are used, so >- specialising can optimise things significantly. If any of the >- specialised cases are defined, the general case must be defined too. >- >- Nb: they must all use the __attribute__((regparm(n))) attribute. */ >-EV VG_(track_new_mem_stack_4) ( void (*f)(Addr new_ESP) ); >-EV VG_(track_new_mem_stack_8) ( void (*f)(Addr new_ESP) ); >-EV VG_(track_new_mem_stack_12) ( void (*f)(Addr new_ESP) ); >-EV VG_(track_new_mem_stack_16) ( void (*f)(Addr new_ESP) ); >-EV VG_(track_new_mem_stack_32) ( void (*f)(Addr new_ESP) ); >-EV VG_(track_new_mem_stack) ( void (*f)(Addr a, UInt len) ); >- >-EV VG_(track_die_mem_stack_4) ( void (*f)(Addr die_ESP) ); >-EV VG_(track_die_mem_stack_8) ( void (*f)(Addr die_ESP) ); >-EV VG_(track_die_mem_stack_12) ( void (*f)(Addr die_ESP) ); >-EV VG_(track_die_mem_stack_16) ( void (*f)(Addr die_ESP) ); >-EV VG_(track_die_mem_stack_32) ( void (*f)(Addr die_ESP) ); >-EV VG_(track_die_mem_stack) ( void (*f)(Addr a, UInt len) ); >- >-/* Used for redzone at end of thread stacks */ >-EV VG_(track_ban_mem_stack) ( void (*f)(Addr a, UInt len) ); >- >-/* These ones occur around syscalls, signal handling, etc */ >-EV VG_(track_pre_mem_read) ( void (*f)(CorePart part, ThreadId tid, >- Char* s, Addr a, UInt size) ); >-EV VG_(track_pre_mem_read_asciiz) ( void (*f)(CorePart part, ThreadId tid, >- Char* s, Addr a) ); >-EV VG_(track_pre_mem_write) ( void (*f)(CorePart part, ThreadId tid, >- Char* s, Addr a, UInt size) ); >-/* Not implemented yet -- have to add in lots of places, which is a >- pain. Won't bother unless/until there's a need. */ >-/* EV VG_(track_post_mem_read) ( void (*f)(ThreadId tid, Char* s, >- Addr a, UInt size) ); */ >-EV VG_(track_post_mem_write) ( void (*f)(Addr a, UInt size) ); >- >- >-/* Register events -- if `shadow_regs' need is set, all should probably be >- used. Use VG_(set_thread_shadow_archreg)() to set the shadow of the >- changed register. */ >- >-/* Use VG_(set_shadow_archreg)() to set the eight general purpose regs, >- and use VG_(set_shadow_eflags)() to set eflags. */ >-EV VG_(track_post_regs_write_init) ( void (*f)() ); >- >-/* Use VG_(set_thread_shadow_archreg)() to set the shadow regs for these >- events. */ >-EV VG_(track_post_reg_write_syscall_return) >- ( void (*f)(ThreadId tid, UInt reg) ); >-EV VG_(track_post_reg_write_deliver_signal) >- ( void (*f)(ThreadId tid, UInt reg) ); >-EV VG_(track_post_reg_write_pthread_return) >- ( void (*f)(ThreadId tid, UInt reg) ); >-EV VG_(track_post_reg_write_clientreq_return) >- ( void (*f)(ThreadId tid, UInt reg) ); >- /* This one is called for malloc() et al if they are replaced by a skin. */ >-EV VG_(track_post_reg_write_clientcall_return) >- ( void (*f)(ThreadId tid, UInt reg, >- Addr called_function) ); >- >- >-/* Scheduler events (not exhaustive) */ >- >-EV VG_(track_thread_run) ( void (*f)(ThreadId tid) ); >- >-/* Thread events (not exhaustive) */ >- >-/* Called during thread create, before the new thread has run any >- instructions (or touched any memory). */ >-EV VG_(track_post_thread_create)( void (*f)(ThreadId tid, ThreadId child) ); >-/* Called once the joinee thread is terminated and the joining thread is >- about to resume. */ >-EV VG_(track_post_thread_join) ( void (*f)(ThreadId joiner, ThreadId joinee) ); >- >- >-/* Mutex events (not exhaustive) */ >- >-/* Called before a thread can block while waiting for a mutex (called >- regardless of whether the thread will block or not). */ >-EV VG_(track_pre_mutex_lock) ( void (*f)(ThreadId tid, >- void* /*pthread_mutex_t* */ mutex) ); >-/* Called once the thread actually holds the mutex (always paired with >- pre_mutex_lock). */ >-EV VG_(track_post_mutex_lock) ( void (*f)(ThreadId tid, >- void* /*pthread_mutex_t* */ mutex) ); >-/* Called after a thread has released a mutex (no need for a corresponding >- pre_mutex_unlock, because unlocking can't block). */ >-EV VG_(track_post_mutex_unlock) ( void (*f)(ThreadId tid, >- void* /*pthread_mutex_t* */ mutex) ); >- >- >-/* Signal events (not exhaustive) */ >- >-/* ... pre_send_signal, post_send_signal ... */ >- >-/* Called before a signal is delivered; `alt_stack' indicates if it is >- delivered on an alternative stack. */ >-EV VG_(track_pre_deliver_signal) ( void (*f)(ThreadId tid, Int sigNum, >- Bool alt_stack) ); >-/* Called after a signal is delivered. Nb: unfortunately, if the signal >- handler longjmps, this won't be called. */ >-EV VG_(track_post_deliver_signal) ( void (*f)(ThreadId tid, Int sigNum ) ); >- >- >-/* Others... condition variables... */ >-/* ... */ >- >-#undef EV >- >-/* ------------------------------------------------------------------ */ >-/* Template functions */ >- >-/* These are the parameterised functions in the core. The default definitions >- are overridden by LD_PRELOADed skin version. At the very least, a skin >- must define the fundamental template functions. Depending on what needs >- are set, extra template functions will be used too. Functions are >- grouped under the needs that govern their use. */ >- >- >-/* ------------------------------------------------------------------ */ >-/* Fundamental template functions */ >- >-/* Initialise skin. Must do the following: >- - initialise the `details' struct, via the VG_(details_*)() functions >- - register any helpers called by generated code >- >- May do the following: >- - initialise the `needs' struct to indicate certain requirements, via >- the VG_(needs_*)() functions >- - initialise the `track' struct to indicate core events of interest, via >- the VG_(track_*)() functions >- - register any skin-specific profiling events >- - any other skin-specific initialisation >-*/ >-extern void SK_(pre_clo_init) ( void ); >- >-/* Do initialisation that can only be done after command line processing. */ >-extern void SK_(post_clo_init)( void ); >- >-/* Instrument a basic block. Must be a true function, ie. the same input >- always results in the same output, because basic blocks can be >- retranslated. Unless you're doing something really strange... >- 'orig_addr' is the address of the first instruction in the block. */ >-extern UCodeBlock* SK_(instrument) ( UCodeBlock* cb, Addr orig_addr ); >- >-/* Finish up, print out any results, etc. `exitcode' is program's exit >- code. The shadow (if the `shadow_regs' need is set) can be found with >- VG_(get_shadow_archreg)(R_EBX), since %ebx holds the argument to the >- exit() syscall. */ >-extern void SK_(fini) ( Int exitcode ); >- >- >-/* ------------------------------------------------------------------ */ >-/* VG_(needs).core_errors */ >- >-/* (none needed) */ >- >-/* ------------------------------------------------------------------ */ >-/* VG_(needs).skin_errors */ >- >-/* Identify if two errors are equal, or equal enough. `res' indicates how >- close is "close enough". `res' should be passed on as necessary, eg. if >- the Error's `extra' part contains an ExeContext, `res' should be >- passed to VG_(eq_ExeContext)() if the ExeContexts are considered. Other >- than that, probably don't worry about it unless you have lots of very >- similar errors occurring. >- */ >-extern Bool SK_(eq_SkinError) ( VgRes res, Error* e1, Error* e2 ); >- >-/* Print error context. */ >-extern void SK_(pp_SkinError) ( Error* err ); >- >-/* Should fill in any details that could be postponed until after the >- decision whether to ignore the error (ie. details not affecting the >- result of SK_(eq_SkinError)()). This saves time when errors are ignored. >- Yuk. >- >- Return value: must be the size of the `extra' part in bytes -- used by >- the core to make a copy. >-*/ >-extern UInt SK_(update_extra) ( Error* err ); >- >-/* Return value indicates recognition. If recognised, must set skind using >- VG_(set_supp_kind)(). */ >-extern Bool SK_(recognised_suppression) ( Char* name, Supp* su ); >- >-/* Read any extra info for this suppression kind. Most likely for filling >- in the `extra' and `string' parts (with VG_(set_supp_{extra,string})()) >- of a suppression if necessary. Should return False if a syntax error >- occurred, True otherwise. */ >-extern Bool SK_(read_extra_suppression_info) ( Int fd, Char* buf, Int nBuf, >- Supp* su ); >- >-/* This should just check the kinds match and maybe some stuff in the >- `string' and `extra' field if appropriate (using VG_(get_supp_*)() to >- get the relevant suppression parts). */ >-extern Bool SK_(error_matches_suppression) ( Error* err, Supp* su ); >- >-/* This should return the suppression name, for --gen-suppressions, or NULL >- if that error type cannot be suppressed. This is the inverse of >- SK_(recognised_suppression)(). */ >-extern Char* SK_(get_error_name) ( Error* err ); >- >-/* This should print any extra info for the error, for --gen-suppressions, >- including the newline. This is the inverse of >- SK_(read_extra_suppression_info)(). */ >-extern void SK_(print_extra_suppression_info) ( Error* err ); >- >- >-/* ------------------------------------------------------------------ */ >-/* VG_(needs).basic_block_discards */ >- >-/* Should discard any information that pertains to specific basic blocks >- or instructions within the address range given. */ >-extern void SK_(discard_basic_block_info) ( Addr a, UInt size ); >- >- >-/* ------------------------------------------------------------------ */ >-/* VG_(needs).shadow_regs */ >- >-/* No functions must be defined, but the post_reg[s]_write_* events should >- be tracked. */ >- >-/* ------------------------------------------------------------------ */ >-/* VG_(needs).command_line_options */ >- >-/* Return True if option was recognised. Presumably sets some state to >- record the option as well. */ >-extern Bool SK_(process_cmd_line_option) ( Char* argv ); >- >-/* Print out command line usage for options for normal skin operation. */ >-extern void SK_(print_usage) ( void ); >- >-/* Print out command line usage for options for debugging the skin. */ >-extern void SK_(print_debug_usage) ( void ); >- >-/* ------------------------------------------------------------------ */ >-/* VG_(needs).client_requests */ >- >-/* If using client requests, the number of the first request should be equal >- to VG_USERREQ_SKIN_BASE('X','Y'), where 'X' and 'Y' form a suitable two >- character identification for the string. The second and subsequent >- requests should follow. */ >- >-/* This function should use the VG_IS_SKIN_USERREQ macro (in >- include/valgrind.h) to first check if it's a request for this skin. Then >- should handle it if it's recognised (and return True), or return False if >- not recognised. arg_block[0] holds the request number, any further args >- from the request are in arg_block[1..]. 'ret' is for the return value... >- it should probably be filled, if only with 0. */ >-extern Bool SK_(handle_client_request) ( ThreadId tid, UInt* arg_block, >- UInt *ret ); >- >- >-/* ------------------------------------------------------------------ */ >-/* VG_(needs).extends_UCode */ >- >-/* Useful to use in VG_(get_Xreg_usage)() */ >-#define VG_UINSTR_READS_REG(ono,regs,isWrites) \ >- { if (mycat(u->tag,ono) == tag) \ >- { regs[n] = mycat(u->val,ono); \ >- isWrites[n] = False; \ >- n++; \ >- } \ >- } >-#define VG_UINSTR_WRITES_REG(ono,regs,isWrites) \ >- { if (mycat(u->tag,ono) == tag) \ >- { regs[n] = mycat(u->val,ono); \ >- isWrites[n] = True; \ >- n++; \ >- } \ >- } >- >-/* 'X' prefix indicates eXtended UCode. */ >-extern Int SK_(get_Xreg_usage) ( UInstr* u, Tag tag, Int* regs, >- Bool* isWrites ); >-extern void SK_(emit_XUInstr) ( UInstr* u, RRegSet regs_live_before ); >-extern Bool SK_(sane_XUInstr) ( Bool beforeRA, Bool beforeLiveness, >- UInstr* u ); >-extern Char* SK_(name_XUOpcode) ( Opcode opc ); >-extern void SK_(pp_XUInstr) ( UInstr* u ); >- >- >-/* ------------------------------------------------------------------ */ >-/* VG_(needs).syscall_wrapper */ >- >-/* If either of the pre_ functions malloc() something to return, the >- * corresponding post_ function had better free() it! >- */ >-extern void* SK_( pre_syscall) ( ThreadId tid, UInt syscallno, >- Bool is_blocking ); >-extern void SK_(post_syscall) ( ThreadId tid, UInt syscallno, >- void* pre_result, Int res, >- Bool is_blocking ); >- >- >-/* --------------------------------------------------------------------- >- VG_(needs).sanity_checks */ >- >-/* Can be useful for ensuring a skin's correctness. SK_(cheap_sanity_check) >- is called very frequently; SK_(expensive_sanity_check) is called less >- frequently and can be more involved. */ >-extern Bool SK_(cheap_sanity_check) ( void ); >-extern Bool SK_(expensive_sanity_check) ( void ); >- >- >-#endif /* NDEF __VG_SKIN_H */ >- >-/*--------------------------------------------------------------------*/ >-/*--- end vg_skin.h ---*/ >-/*--------------------------------------------------------------------*/ >- >diff -ruN valgrind-2.1.0/include/vg_skin.h.base valgrind/include/vg_skin.h.base >--- valgrind-2.1.0/include/vg_skin.h.base 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/include/vg_skin.h.base 2004-02-11 17:33:28.000000000 -0600 >@@ -0,0 +1,1915 @@ >+/*-*- c -*- ----------------------------------------------------------*/ >+/*--- The only header your skin will ever need to #include... ---*/ >+/*--- vg_skin.h ---*/ >+/*--------------------------------------------------------------------*/ >+ >+/* >+ This file is part of Valgrind, an extensible x86 protected-mode >+ emulator for monitoring program execution on x86-Unixes. >+ >+ Copyright (C) 2000-2004 Julian Seward >+ jseward@acm.org >+ >+ 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 __VG_SKIN_H >+#define __VG_SKIN_H >+ >+#include <stdarg.h> /* ANSI varargs stuff */ >+#include <setjmp.h> /* for jmp_buf */ >+ >+#include "vg_constants_skin.h" >+ >+ >+/* --------------------------------------------------------------------- >+ Where to send bug reports to. >+ ------------------------------------------------------------------ */ >+ >+#define VG_BUGS_TO "valgrind.kde.org" >+ >+ >+/*====================================================================*/ >+/*=== Build options and table sizes. ===*/ >+/*====================================================================*/ >+ >+/* You should be able to change these options or sizes, recompile, and >+ still have a working system. */ >+ >+/* The maximum number of pthreads that we support. This is >+ deliberately not very high since our implementation of some of the >+ scheduler algorithms is surely O(N) in the number of threads, since >+ that's simple, at least. And (in practice) we hope that most >+ programs do not need many threads. */ >+#define VG_N_THREADS 100 >+ >+/* Maximum number of pthread keys available. Again, we start low until >+ the need for a higher number presents itself. */ >+#define VG_N_THREAD_KEYS 50 >+ >+/* Total number of integer registers available for allocation -- all of >+ them except %esp, %ebp. %ebp permanently points at VG_(baseBlock). >+ >+ If you increase this you'll have to also change at least these: >+ - VG_(rank_to_realreg)() >+ - VG_(realreg_to_rank)() >+ - ppRegsLiveness() >+ - the RegsLive type (maybe -- RegsLive type must have more than >+ VG_MAX_REALREGS bits) >+ >+ You can decrease it, and performance will drop because more spills will >+ occur. If you decrease it too much, everything will fall over. >+ >+ Do not change this unless you really know what you are doing! */ >+#define VG_MAX_REALREGS 6 >+ >+ >+/*====================================================================*/ >+/*=== Basic types, useful macros ===*/ >+/*====================================================================*/ >+ >+typedef unsigned char UChar; >+typedef unsigned short UShort; >+typedef unsigned int UInt; >+typedef unsigned long long int ULong; >+ >+typedef signed char Char; >+typedef signed short Short; >+typedef signed int Int; >+typedef signed long long int Long; >+ >+typedef unsigned int Addr; >+ >+typedef unsigned char Bool; >+#define False ((Bool)0) >+#define True ((Bool)1) >+ >+ >+#define mycat_wrk(aaa,bbb) aaa##bbb >+#define mycat(aaa,bbb) mycat_wrk(aaa,bbb) >+ >+/* No, really. I _am_ that strange. */ >+#define OINK(nnn) VG_(message)(Vg_DebugMsg, "OINK %d",nnn) >+ >+/* --------------------------------------------------------------------- >+ Now the basic types are set up, we can haul in the kernel-interface >+ definitions. >+ ------------------------------------------------------------------ */ >+ >+#include "vg_kerneliface.h" >+ >+ >+/*====================================================================*/ >+/*=== Core/skin interface version ===*/ >+/*====================================================================*/ >+ >+/* The major version number indicates binary-incompatible changes to the >+ interface; if the core and skin major versions don't match, Valgrind >+ will abort. The minor version indicates binary-compatible changes. >+*/ >+#define VG_CORE_INTERFACE_MAJOR_VERSION 5 >+#define VG_CORE_INTERFACE_MINOR_VERSION 0 >+ >+typedef struct _ToolInfo { >+ Int sizeof_ToolInfo; >+ Int interface_major_version; >+ Int interface_minor_version; >+ >+ /* Initialise skin. Must do the following: >+ - initialise the `details' struct, via the VG_(details_*)() functions >+ - register any helpers called by generated code >+ >+ May do the following: >+ - initialise the `needs' struct to indicate certain requirements, via >+ the VG_(needs_*)() functions >+ - initialize all the tool's entrypoints via the VG_(init_*)() functions >+ - register any skin-specific profiling events >+ - any other skin-specific initialisation >+ */ >+ void (*sk_pre_clo_init) ( void ); >+ >+ /* Specifies how big the shadow segment should be as a ratio to the >+ client address space. 0 for no shadow segment. */ >+ float shadow_ratio; >+} ToolInfo; >+ >+/* Every skin must include this macro somewhere, exactly once. */ >+#define VG_DETERMINE_INTERFACE_VERSION(pre_clo_init, shadow) \ >+ const ToolInfo SK_(tool_info) = { \ >+ .sizeof_ToolInfo = sizeof(ToolInfo), \ >+ .interface_major_version = VG_CORE_INTERFACE_MAJOR_VERSION, \ >+ .interface_minor_version = VG_CORE_INTERFACE_MINOR_VERSION, \ >+ .sk_pre_clo_init = pre_clo_init, \ >+ .shadow_ratio = shadow, \ >+ }; >+ >+/*====================================================================*/ >+/*=== Command-line options ===*/ >+/*====================================================================*/ >+ >+/* Use this for normal null-termination-style string comparison */ >+#define VG_STREQ(s1,s2) (s1 != NULL && s2 != NULL \ >+ && VG_(strcmp)((s1),(s2))==0) >+ >+/* Use these for recognising skin command line options -- stops comparing >+ once whitespace is reached. */ >+# define VG_CLO_STREQ(s1,s2) (0==VG_(strcmp_ws)((s1),(s2))) >+# define VG_CLO_STREQN(nn,s1,s2) (0==VG_(strncmp_ws)((s1),(s2),(nn))) >+ >+/* Verbosity level: 0 = silent, 1 (default), > 1 = more verbose. */ >+extern Int VG_(clo_verbosity); >+ >+/* Profile? */ >+extern Bool VG_(clo_profile); >+ >+/* Call this if a recognised option was bad for some reason. >+ Note: don't use it just because an option was unrecognised -- return 'False' >+ from SKN_(process_cmd_line_option) to indicate that. */ >+extern void VG_(bad_option) ( Char* opt ); >+ >+/* Client args */ >+extern Int VG_(client_argc); >+extern Char** VG_(client_argv); >+ >+/* Client environment. Can be inspected with VG_(getenv)() */ >+extern Char** VG_(client_envp); >+ >+ >+/*====================================================================*/ >+/*=== Printing messages for the user ===*/ >+/*====================================================================*/ >+ >+/* Print a message prefixed by "??<pid>?? "; '?' depends on the VgMsgKind. >+ Should be used for all user output. */ >+ >+typedef >+ enum { Vg_UserMsg, /* '?' == '=' */ >+ Vg_DebugMsg, /* '?' == '-' */ >+ Vg_DebugExtraMsg, /* '?' == '+' */ >+ Vg_ClientMsg, /* '?' == '*' */ >+ } >+ VgMsgKind; >+ >+/* Functions for building a message from multiple parts. */ >+extern int VG_(start_msg) ( VgMsgKind kind ); >+extern int VG_(add_to_msg) ( Char* format, ... ); >+/* Ends and prints the message. Appends a newline. */ >+extern int VG_(end_msg) ( void ); >+ >+/* Send a single-part message. Appends a newline. */ >+extern int VG_(message) ( VgMsgKind kind, Char* format, ... ); >+extern int VG_(vmessage) ( VgMsgKind kind, Char* format, va_list vargs ); >+ >+ >+/*====================================================================*/ >+/*=== Profiling ===*/ >+/*====================================================================*/ >+ >+/* Nb: VGP_(register_profile_event)() relies on VgpUnc being the first one */ >+#define VGP_CORE_LIST \ >+ /* These ones depend on the core */ \ >+ VGP_PAIR(VgpUnc, "unclassified"), \ >+ VGP_PAIR(VgpStartup, "startup"), \ >+ VGP_PAIR(VgpRun, "running"), \ >+ VGP_PAIR(VgpSched, "scheduler"), \ >+ VGP_PAIR(VgpMalloc, "low-lev malloc/free"), \ >+ VGP_PAIR(VgpCliMalloc, "client malloc/free"), \ >+ VGP_PAIR(VgpTranslate, "translate-main"), \ >+ VGP_PAIR(VgpToUCode, "to-ucode"), \ >+ VGP_PAIR(VgpFromUcode, "from-ucode"), \ >+ VGP_PAIR(VgpImprove, "improve"), \ >+ VGP_PAIR(VgpESPUpdate, "ESP-update"), \ >+ VGP_PAIR(VgpRegAlloc, "reg-alloc"), \ >+ VGP_PAIR(VgpLiveness, "liveness-analysis"), \ >+ VGP_PAIR(VgpDoLRU, "do-lru"), \ >+ VGP_PAIR(VgpSlowFindT, "slow-search-transtab"), \ >+ VGP_PAIR(VgpExeContext, "exe-context"), \ >+ VGP_PAIR(VgpReadSyms, "read-syms"), \ >+ VGP_PAIR(VgpSearchSyms, "search-syms"), \ >+ VGP_PAIR(VgpAddToT, "add-to-transtab"), \ >+ VGP_PAIR(VgpCoreSysWrap, "core-syscall-wrapper"), \ >+ VGP_PAIR(VgpDemangle, "demangle"), \ >+ VGP_PAIR(VgpCoreCheapSanity, "core-cheap-sanity"), \ >+ VGP_PAIR(VgpCoreExpensiveSanity, "core-expensive-sanity"), \ >+ /* These ones depend on the skin */ \ >+ VGP_PAIR(VgpPreCloInit, "pre-clo-init"), \ >+ VGP_PAIR(VgpPostCloInit, "post-clo-init"), \ >+ VGP_PAIR(VgpInstrument, "instrument"), \ >+ VGP_PAIR(VgpSkinSysWrap, "skin-syscall-wrapper"), \ >+ VGP_PAIR(VgpSkinCheapSanity, "skin-cheap-sanity"), \ >+ VGP_PAIR(VgpSkinExpensiveSanity, "skin-expensive-sanity"), \ >+ VGP_PAIR(VgpFini, "fini") >+ >+#define VGP_PAIR(n,name) n >+typedef enum { VGP_CORE_LIST } VgpCoreCC; >+#undef VGP_PAIR >+ >+/* When registering skin profiling events, ensure that the 'n' value is in >+ * the range (VgpFini+1..) */ >+extern void VGP_(register_profile_event) ( Int n, Char* name ); >+ >+extern void VGP_(pushcc) ( UInt cc ); >+extern void VGP_(popcc) ( UInt cc ); >+ >+/* Define them only if they haven't already been defined by vg_profile.c */ >+#ifndef VGP_PUSHCC >+# define VGP_PUSHCC(x) >+#endif >+#ifndef VGP_POPCC >+# define VGP_POPCC(x) >+#endif >+ >+ >+/*====================================================================*/ >+/*=== Useful stuff to call from generated code ===*/ >+/*====================================================================*/ >+ >+/* ------------------------------------------------------------------ */ >+/* General stuff */ >+ >+/* 64-bit counter for the number of basic blocks done. */ >+extern ULong VG_(bbs_done); >+ >+/* Get the simulated %esp */ >+extern Addr VG_(get_stack_pointer) ( void ); >+ >+/* Check if an address is 4-byte aligned */ >+#define IS_ALIGNED4_ADDR(aaa_p) (0 == (((UInt)(aaa_p)) & 3)) >+#define IS_ALIGNED8_ADDR(aaa_p) (0 == (((UInt)(aaa_p)) & 7)) >+ >+ >+/* ------------------------------------------------------------------ */ >+/* Thread-related stuff */ >+ >+/* Special magic value for an invalid ThreadId. It corresponds to >+ LinuxThreads using zero as the initial value for >+ pthread_mutex_t.__m_owner and pthread_cond_t.__c_waiting. */ >+#define VG_INVALID_THREADID ((ThreadId)(0)) >+ >+/* ThreadIds are simply indices into the VG_(threads)[] array. */ >+typedef >+ UInt >+ ThreadId; >+ >+/* When looking for the current ThreadId, this is the safe option and >+ probably the one you want. >+ >+ Details: Use this one from non-generated code, eg. from functions called >+ on events like 'new_mem_heap'. In such a case, the "current" thread is >+ temporarily suspended as Valgrind's dispatcher is running. This function >+ is also suitable to be called from generated code (ie. from UCode, or a C >+ function called directly from UCode). >+ >+ If you use VG_(get_current_tid)() from non-generated code, it will return >+ 0 signifying the invalid thread, which is probably not what you want. */ >+extern ThreadId VG_(get_current_or_recent_tid) ( void ); >+ >+/* When looking for the current ThreadId, only use this one if you know what >+ you are doing. >+ >+ Details: Use this one from generated code, eg. from C functions called >+ from UCode. (VG_(get_current_or_recent_tid)() is also suitable in that >+ case.) If you use this function from non-generated code, it will return >+ 0 signifying the invalid thread, which is probably not what you want. */ >+extern ThreadId VG_(get_current_tid) ( void ); >+ >+/* Searches through all thread's stacks to see if any match. Returns >+ VG_INVALID_THREADID if none match. */ >+extern ThreadId VG_(first_matching_thread_stack) >+ ( Bool (*p) ( Addr stack_min, Addr stack_max )); >+ >+ >+/*====================================================================*/ >+/*=== Valgrind's version of libc ===*/ >+/*====================================================================*/ >+ >+/* Valgrind doesn't use libc at all, for good reasons (trust us). So here >+ are its own versions of C library functions, but with VG_ prefixes. Note >+ that the types of some are slightly different to the real ones. Some >+ additional useful functions are provided too; descriptions of how they >+ work are given below. */ >+ >+#if !defined(NULL) >+# define NULL ((void*)0) >+#endif >+ >+ >+/* ------------------------------------------------------------------ */ >+/* stdio.h >+ * >+ * Note that they all output to the file descriptor given by the >+ * --logfile-fd=N argument, which defaults to 2 (stderr). Hence no >+ * need for VG_(fprintf)(). >+ */ >+extern UInt VG_(printf) ( const char *format, ... ); >+/* too noisy ... __attribute__ ((format (printf, 1, 2))) ; */ >+extern UInt VG_(sprintf) ( Char* buf, Char *format, ... ); >+extern UInt VG_(vprintf) ( void(*send)(Char), >+ const Char *format, va_list vargs ); >+ >+extern Int VG_(rename) ( Char* old_name, Char* new_name ); >+ >+/* ------------------------------------------------------------------ */ >+/* stdlib.h */ >+ >+extern void* VG_(malloc) ( Int nbytes ); >+extern void VG_(free) ( void* p ); >+extern void* VG_(calloc) ( Int n, Int nbytes ); >+extern void* VG_(realloc) ( void* p, Int size ); >+extern void* VG_(malloc_aligned) ( Int align_bytes, Int nbytes ); >+ >+extern void VG_(print_malloc_stats) ( void ); >+ >+ >+extern void VG_(exit)( Int status ) >+ __attribute__ ((__noreturn__)); >+/* Prints a panic message (a constant string), appends newline and bug >+ reporting info, aborts. */ >+__attribute__ ((__noreturn__)) >+extern void VG_(skin_panic) ( Char* str ); >+ >+/* Looks up VG_(client_envp) */ >+extern Char* VG_(getenv) ( Char* name ); >+ >+/* Get client resource limit*/ >+extern Int VG_(getrlimit) ( Int resource, struct vki_rlimit *rlim ); >+ >+/* Set client resource limit*/ >+extern Int VG_(setrlimit) ( Int resource, struct vki_rlimit *rlim ); >+ >+/* Crude stand-in for the glibc system() call. */ >+extern Int VG_(system) ( Char* cmd ); >+ >+extern Long VG_(atoll) ( Char* str ); >+ >+/* Like atoll(), but converts a number of base 16 */ >+extern Long VG_(atoll16) ( Char* str ); >+ >+/* Like atoll(), but converts a number of base 2..36 */ >+extern Long VG_(atoll36) ( UInt base, Char* str ); >+ >+/* Like qsort(), but does shell-sort. The size==1/2/4 cases are specialised. */ >+extern void VG_(ssort)( void* base, UInt nmemb, UInt size, >+ Int (*compar)(void*, void*) ); >+ >+ >+/* ------------------------------------------------------------------ */ >+/* ctype.h */ >+extern Bool VG_(isspace) ( Char c ); >+extern Bool VG_(isdigit) ( Char c ); >+extern Char VG_(toupper) ( Char c ); >+ >+ >+/* ------------------------------------------------------------------ */ >+/* string.h */ >+extern Int VG_(strlen) ( const Char* str ); >+extern Char* VG_(strcat) ( Char* dest, const Char* src ); >+extern Char* VG_(strncat) ( Char* dest, const Char* src, Int n ); >+extern Char* VG_(strpbrk) ( const Char* s, const Char* accept ); >+extern Char* VG_(strcpy) ( Char* dest, const Char* src ); >+extern Char* VG_(strncpy) ( Char* dest, const Char* src, Int ndest ); >+extern Int VG_(strcmp) ( const Char* s1, const Char* s2 ); >+extern Int VG_(strncmp) ( const Char* s1, const Char* s2, Int nmax ); >+extern Char* VG_(strstr) ( const Char* haystack, Char* needle ); >+extern Char* VG_(strchr) ( const Char* s, Char c ); >+extern Char* VG_(strdup) ( const Char* s); >+extern void* VG_(memcpy) ( void *d, const void *s, Int sz ); >+extern void* VG_(memset) ( void *s, Int c, Int sz ); >+extern Int VG_(memcmp) ( const void* s1, const void* s2, Int n ); >+ >+/* Like strcmp() and strncmp(), but stop comparing at any whitespace. */ >+extern Int VG_(strcmp_ws) ( const Char* s1, const Char* s2 ); >+extern Int VG_(strncmp_ws) ( const Char* s1, const Char* s2, Int nmax ); >+ >+/* Like strncpy(), but if 'src' is longer than 'ndest' inserts a '\0' as the >+ last character. */ >+extern void VG_(strncpy_safely) ( Char* dest, const Char* src, Int ndest ); >+ >+/* Mini-regexp function. Searches for 'pat' in 'str'. Supports >+ * meta-symbols '*' and '?'. '\' escapes meta-symbols. */ >+extern Bool VG_(string_match) ( const Char* pat, const Char* str ); >+ >+ >+/* ------------------------------------------------------------------ */ >+/* math.h */ >+/* Returns the base-2 logarithm of x. */ >+extern Int VG_(log2) ( Int x ); >+ >+ >+/* ------------------------------------------------------------------ */ >+/* unistd.h, fcntl.h, sys/stat.h */ >+extern Int VG_(getdents)( UInt fd, struct vki_dirent *dirp, UInt count ); >+extern Int VG_(readlink)( Char* path, Char* buf, UInt bufsize ); >+extern Int VG_(getpid) ( void ); >+extern Int VG_(getppid) ( void ); >+extern Int VG_(getpgrp) ( void ); >+extern Int VG_(gettid) ( void ); >+extern Int VG_(setpgid) ( Int pid, Int pgrp ); >+ >+extern Int VG_(open) ( const Char* pathname, Int flags, Int mode ); >+extern Int VG_(read) ( Int fd, void* buf, Int count); >+extern Int VG_(write) ( Int fd, const void* buf, Int count); >+extern Int VG_(lseek) ( Int fd, Long offset, Int whence); >+extern void VG_(close) ( Int fd ); >+ >+extern Int VG_(pipe) ( Int fd[2] ); >+ >+/* Nb: VG_(rename)() declared in stdio.h section above */ >+extern Int VG_(unlink) ( Char* file_name ); >+extern Int VG_(stat) ( Char* file_name, struct vki_stat* buf ); >+extern Int VG_(fstat) ( Int fd, struct vki_stat* buf ); >+extern Int VG_(dup2) ( Int oldfd, Int newfd ); >+ >+extern Char* VG_(getcwd) ( Char* buf, Int size ); >+ >+/* Easier to use than VG_(getcwd)() -- does the buffer fiddling itself. >+ String put into 'cwd' is VG_(malloc)'d, and should be VG_(free)'d. >+ Returns False if it fails. Will fail if the pathname is > 65535 bytes. */ >+extern Bool VG_(getcwd_alloc) ( Char** cwd ); >+ >+/* ------------------------------------------------------------------ */ >+/* assert.h */ >+/* Asserts permanently enabled -- no turning off with NDEBUG. Hurrah! */ >+#define VG__STRING(__str) #__str >+ >+#define sk_assert(expr) \ >+ ((void) ((expr) ? 0 : \ >+ (VG_(skin_assert_fail) (VG__STRING(expr), \ >+ __FILE__, __LINE__, \ >+ __PRETTY_FUNCTION__), 0))) >+ >+__attribute__ ((__noreturn__)) >+extern void VG_(skin_assert_fail) ( const Char* expr, const Char* file, >+ Int line, const Char* fn ); >+ >+ >+/* ------------------------------------------------------------------ */ >+/* Get memory by anonymous mmap. */ >+extern void* VG_(get_memory_from_mmap) ( Int nBytes, Char* who ); >+ >+extern Bool VG_(is_client_addr) (Addr a); >+extern Addr VG_(get_client_base)(void); >+extern Addr VG_(get_client_end) (void); >+extern Addr VG_(get_client_size)(void); >+ >+extern Bool VG_(is_shadow_addr) (Addr a); >+extern Addr VG_(get_shadow_base)(void); >+extern Addr VG_(get_shadow_end) (void); >+extern Addr VG_(get_shadow_size)(void); >+ >+extern void *VG_(shadow_alloc)(UInt size); >+ >+extern Bool VG_(is_addressable)(Addr p, Int sz); >+ >+extern Addr VG_(client_alloc)(Addr base, UInt len, UInt prot, UInt flags); >+extern void VG_(client_free)(Addr addr); >+ >+extern Bool VG_(is_valgrind_addr)(Addr a); >+ >+/* initialize shadow pages in the range [p, p+sz) This calls >+ init_shadow_page for each one. It should be a lot more efficient >+ for bulk-initializing shadow pages than faulting on each one. >+*/ >+extern void VG_(init_shadow_range)(Addr p, UInt sz, Bool call_init); >+ >+/* ------------------------------------------------------------------ */ >+/* signal.h. >+ >+ Note that these use the vk_ (kernel) structure >+ definitions, which are different in places from those that glibc >+ defines -- hence the 'k' prefix. Since we're operating right at the >+ kernel interface, glibc's view of the world is entirely irrelevant. */ >+ >+/* --- Signal set ops --- */ >+extern Int VG_(ksigfillset) ( vki_ksigset_t* set ); >+extern Int VG_(ksigemptyset) ( vki_ksigset_t* set ); >+ >+extern Bool VG_(kisfullsigset) ( vki_ksigset_t* set ); >+extern Bool VG_(kisemptysigset) ( vki_ksigset_t* set ); >+ >+extern Int VG_(ksigaddset) ( vki_ksigset_t* set, Int signum ); >+extern Int VG_(ksigdelset) ( vki_ksigset_t* set, Int signum ); >+extern Int VG_(ksigismember) ( vki_ksigset_t* set, Int signum ); >+ >+extern void VG_(ksigaddset_from_set) ( vki_ksigset_t* dst, vki_ksigset_t* src ); >+extern void VG_(ksigdelset_from_set) ( vki_ksigset_t* dst, vki_ksigset_t* src ); >+ >+/* --- Mess with the kernel's sig state --- */ >+extern Int VG_(ksigprocmask) ( Int how, const vki_ksigset_t* set, >+ vki_ksigset_t* oldset ); >+extern Int VG_(ksigaction) ( Int signum, >+ const vki_ksigaction* act, >+ vki_ksigaction* oldact ); >+ >+extern Int VG_(ksigtimedwait)( const vki_ksigset_t *, vki_ksiginfo_t *, >+ const struct vki_timespec * ); >+ >+extern Int VG_(ksignal) ( Int signum, void (*sighandler)(Int) ); >+extern Int VG_(ksigaltstack) ( const vki_kstack_t* ss, vki_kstack_t* oss ); >+ >+extern Int VG_(kkill) ( Int pid, Int signo ); >+extern Int VG_(ktkill) ( Int pid, Int signo ); >+extern Int VG_(ksigpending) ( vki_ksigset_t* set ); >+ >+extern Int VG_(waitpid) ( Int pid, Int *status, Int options ); >+ >+/* ------------------------------------------------------------------ */ >+/* socket.h. */ >+ >+extern Int VG_(getsockname) ( Int sd, struct vki_sockaddr *name, Int *namelen); >+extern Int VG_(getpeername) ( Int sd, struct vki_sockaddr *name, Int *namelen); >+extern Int VG_(getsockopt) ( Int sd, Int level, Int optname, void *optval, >+ Int *optlen); >+ >+/* ------------------------------------------------------------------ */ >+/* other, randomly useful functions */ >+extern UInt VG_(read_millisecond_timer) ( void ); >+ >+/*====================================================================*/ >+/*=== UCode definition ===*/ >+/*====================================================================*/ >+ >+/* Tags which describe what operands are. Must fit into 4 bits, which >+ they clearly do. */ >+typedef >+enum { TempReg =0, /* virtual temp-reg */ >+ ArchReg =1, /* simulated integer reg */ >+ ArchRegS =2, /* simulated segment reg */ >+ RealReg =3, /* real machine's real reg */ >+ SpillNo =4, /* spill slot location */ >+ Literal =5, /* literal; .lit32 field has actual value */ >+ Lit16 =6, /* literal; .val[123] field has actual value */ >+ NoValue =7 /* operand not in use */ >+ } >+ Tag; >+ >+/* Invalid register numbers (can't be negative) */ >+#define INVALID_TEMPREG 999999999 >+#define INVALID_REALREG 999999999 >+ >+/* Microinstruction opcodes. */ >+typedef >+ enum { >+ NOP, /* Null op */ >+ >+ LOCK, /* Indicate the existence of a LOCK prefix (functionally NOP) */ >+ >+ /* Moving values around */ >+ GET, PUT, /* simulated register <--> TempReg */ >+ GETF, PUTF, /* simulated %eflags <--> TempReg */ >+ LOAD, STORE, /* memory <--> TempReg */ >+ MOV, /* TempReg <--> TempReg */ >+ CMOV, /* Used for cmpxchg and cmov */ >+ >+ /* Arithmetic/logical ops */ >+ MUL, UMUL, /* Multiply */ >+ ADD, ADC, SUB, SBB, /* Add/subtract (w/wo carry) */ >+ AND, OR, XOR, NOT, /* Boolean ops */ >+ SHL, SHR, SAR, ROL, ROR, RCL, RCR, /* Shift/rotate (w/wo carry) */ >+ NEG, /* Negate */ >+ INC, DEC, /* Increment/decrement */ >+ BSWAP, /* Big-endian <--> little-endian */ >+ CC2VAL, /* Condition code --> 0 or 1 */ >+ WIDEN, /* Signed or unsigned widening */ >+ >+ /* Conditional or unconditional jump */ >+ JMP, >+ >+ /* FPU ops */ >+ FPU, /* Doesn't touch memory */ >+ FPU_R, FPU_W, /* Reads/writes memory */ >+ >+ /* ------------ MMX ops ------------ */ >+ /* In this and the SSE encoding, bytes at higher addresses are >+ held in bits [7:0] in these 16-bit words. I guess this means >+ it is a big-endian encoding. */ >+ >+ /* 1 byte, no memrefs, no iregdefs, copy exactly to the >+ output. Held in val1[7:0]. */ >+ MMX1, >+ >+ /* 2 bytes, no memrefs, no iregdefs, copy exactly to the >+ output. Held in val1[15:0]. */ >+ MMX2, >+ >+ /* 3 bytes, no memrefs, no iregdefs, copy exactly to the >+ output. Held in val1[15:0] and val2[7:0]. */ >+ MMX3, >+ >+ /* 2 bytes, reads/writes mem. Insns of the form >+ bbbbbbbb:mod mmxreg r/m. >+ Held in val1[15:0], and mod and rm are to be replaced >+ at codegen time by a reference to the Temp/RealReg holding >+ the address. Arg2 holds this Temp/Real Reg. >+ Transfer is always at size 8. >+ */ >+ MMX2_MemRd, >+ MMX2_MemWr, >+ >+ /* 2 bytes, reads/writes an integer ("E") register. Insns of the form >+ bbbbbbbb:11 mmxreg ireg. >+ Held in val1[15:0], and ireg is to be replaced >+ at codegen time by a reference to the relevant RealReg. >+ Transfer is always at size 4. Arg2 holds this Temp/Real Reg. >+ */ >+ MMX2_ERegRd, >+ MMX2_ERegWr, >+ >+ /* ------------ SSE/SSE2 ops ------------ */ >+ /* In the following: >+ >+ a digit N indicates the next N bytes are to be copied exactly >+ to the output. >+ >+ 'a' indicates a mod-xmmreg-rm byte, where the mod-rm part is >+ to be replaced at codegen time to a Temp/RealReg holding the >+ address. >+ >+ 'e' indicates a byte of the form '11 xmmreg ireg', where ireg >+ is read or written, and is to be replaced at codegen time by >+ a reference to the relevant RealReg. 'e' because it's the E >+ reg in Intel encoding parlance. >+ >+ 'g' indicates a byte of the form '11 ireg xmmreg', where ireg >+ is read or written, and is to be replaced at codegen time by >+ a reference to the relevant RealReg. 'g' because it's called >+ G in Intel parlance. */ >+ >+ /* 3 bytes, no memrefs, no iregdefs, copy exactly to the >+ output. Held in val1[15:0] and val2[7:0]. */ >+ SSE3, >+ >+ /* 3 bytes, reads/writes mem. Insns of the form >+ bbbbbbbb:bbbbbbbb:mod mmxreg r/m. >+ Held in val1[15:0] and val2[7:0], and mod and rm are to be >+ replaced at codegen time by a reference to the Temp/RealReg >+ holding the address. Arg3 holds this Temp/Real Reg. >+ Transfer is usually, but not always, at size 16. */ >+ SSE2a_MemRd, >+ SSE2a_MemWr, >+ >+ /* 4 bytes, writes an integer register. Insns of the form >+ bbbbbbbb:bbbbbbbb:11 ireg bbb. >+ Held in val1[15:0] and val2[7:0], and ireg is to be replaced >+ at codegen time by a reference to the relevant RealReg. >+ Transfer is always at size 4. Arg3 holds this Temp/Real Reg. >+ */ >+ SSE2g_RegWr, >+ >+ /* 5 bytes, writes an integer register. Insns of the form >+ bbbbbbbb:bbbbbbbb:11 ireg bbb :bbbbbbbb. Held in >+ val1[15:0] and val2[7:0] and lit32[7:0], and ireg is to be >+ replaced at codegen time by a reference to the relevant >+ RealReg. Transfer is always at size 4. Arg3 holds this >+ Temp/Real Reg. >+ */ >+ SSE2g1_RegWr, >+ >+ /* 5 bytes, reads an integer register. Insns of the form >+ bbbbbbbb:bbbbbbbb:11 bbb ireg :bbbbbbbb. Held in >+ val1[15:0] and val2[7:0] and lit32[7:0], and ireg is to be >+ replaced at codegen time by a reference to the relevant >+ RealReg. Transfer is always at size 4. Arg3 holds this >+ Temp/Real Reg. >+ */ >+ SSE2e1_RegRd, >+ >+ /* 4 bytes, no memrefs, no iregdefs, copy exactly to the >+ output. Held in val1[15:0] and val2[15:0]. */ >+ SSE4, >+ >+ /* 4 bytes, reads/writes mem. Insns of the form >+ bbbbbbbb:bbbbbbbb:bbbbbbbb:mod mmxreg r/m. >+ Held in val1[15:0] and val2[15:0], and mod and rm are to be >+ replaced at codegen time by a reference to the Temp/RealReg >+ holding the address. Arg3 holds this Temp/Real Reg. >+ Transfer is at stated size. */ >+ SSE3a_MemRd, >+ SSE3a_MemWr, >+ >+ /* 4 bytes, reads/writes mem. Insns of the form >+ bbbbbbbb:bbbbbbbb:mod mmxreg r/m:bbbbbbbb >+ Held in val1[15:0] and val2[15:0], and mod and rm are to be >+ replaced at codegen time by a reference to the Temp/RealReg >+ holding the address. Arg3 holds this Temp/Real Reg. >+ Transfer is at stated size. */ >+ SSE2a1_MemRd, >+ >+ /* 4 bytes, writes an integer register. Insns of the form >+ bbbbbbbb:bbbbbbbb:bbbbbbbb:11 ireg bbb. >+ Held in val1[15:0] and val2[15:0], and ireg is to be replaced >+ at codegen time by a reference to the relevant RealReg. >+ Transfer is always at size 4. Arg3 holds this Temp/Real Reg. >+ */ >+ SSE3g_RegWr, >+ >+ /* 5 bytes, writes an integer register. Insns of the form >+ bbbbbbbb:bbbbbbbb:bbbbbbbb: 11 ireg bbb :bbbbbbbb. Held in >+ val1[15:0] and val2[15:0] and lit32[7:0], and ireg is to be >+ replaced at codegen time by a reference to the relevant >+ RealReg. Transfer is always at size 4. Arg3 holds this >+ Temp/Real Reg. >+ */ >+ SSE3g1_RegWr, >+ >+ /* 4 bytes, reads an integer register. Insns of the form >+ bbbbbbbb:bbbbbbbb:bbbbbbbb:11 bbb ireg. >+ Held in val1[15:0] and val2[15:0], and ireg is to be replaced >+ at codegen time by a reference to the relevant RealReg. >+ Transfer is always at size 4. Arg3 holds this Temp/Real Reg. >+ */ >+ SSE3e_RegRd, >+ SSE3e_RegWr, /* variant that writes Ereg, not reads it */ >+ >+ /* 5 bytes, reads an integer register. Insns of the form >+ bbbbbbbb:bbbbbbbb:bbbbbbbb: 11 bbb ireg :bbbbbbbb. Held in >+ val1[15:0] and val2[15:0] and lit32[7:0], and ireg is to be >+ replaced at codegen time by a reference to the relevant >+ RealReg. Transfer is always at size 4. Arg3 holds this >+ Temp/Real Reg. >+ */ >+ SSE3e1_RegRd, >+ >+ /* 4 bytes, reads memory, writes an integer register, but is >+ nevertheless an SSE insn. The insn is of the form >+ bbbbbbbb:bbbbbbbb:bbbbbbbb:mod ireg rm where mod indicates >+ memory (ie is not 11b) and ireg is the int reg written. The >+ first 4 bytes are held in lit32[31:0] since there is >+ insufficient space elsewhere. mod and rm are to be replaced >+ at codegen time by a reference to the Temp/RealReg holding >+ the address. Arg1 holds this Temp/RealReg. ireg is to be >+ replaced at codegen time by a reference to the relevant >+ RealReg in which the answer is to be written. Arg2 holds >+ this Temp/RealReg. Transfer to the destination reg is always >+ at size 4. However the memory read can be at sizes 4 or 8 >+ and so this is what the sz field holds. Note that the 4th >+ byte of the instruction (the modrm byte) is redundant, but we >+ store it anyway so as to be consistent with all other SSE >+ uinstrs. >+ */ >+ SSE3ag_MemRd_RegWr, >+ >+ /* 5 bytes, no memrefs, no iregdefs, copy exactly to the >+ output. Held in val1[15:0], val2[15:0] and val3[7:0]. */ >+ SSE5, >+ >+ /* 5 bytes, reads/writes mem. Insns of the form >+ bbbbbbbb:bbbbbbbb:bbbbbbbb:mod mmxreg r/m:bbbbbbbb >+ Held in val1[15:0], val2[15:0], lit32[7:0]. >+ mod and rm are to be replaced at codegen time by a reference >+ to the Temp/RealReg holding the address. Arg3 holds this >+ Temp/Real Reg. Transfer is always at size 16. */ >+ SSE3a1_MemRd, >+ >+ /* ------------------------ */ >+ >+ /* Not strictly needed, but improve address calculation translations. */ >+ LEA1, /* reg2 := const + reg1 */ >+ LEA2, /* reg3 := const + reg1 + reg2 * 1,2,4 or 8 */ >+ >+ /* Hack for x86 REP insns. Jump to literal if TempReg/RealReg >+ is zero. */ >+ JIFZ, >+ >+ /* Advance the simulated %eip by some small (< 128) number. */ >+ INCEIP, >+ >+ /* Dealing with segment registers */ >+ GETSEG, PUTSEG, /* simulated segment register <--> TempReg */ >+ USESEG, /* (LDT/GDT index, virtual addr) --> linear addr */ >+ >+ /* Not for translating x86 calls -- only to call helpers */ >+ CALLM_S, CALLM_E, /* Mark start/end of CALLM push/pop sequence */ >+ PUSH, POP, CLEAR, /* Add/remove/zap args for helpers */ >+ CALLM, /* Call assembly-code helper */ >+ >+ /* Not for translating x86 calls -- only to call C helper functions of >+ up to three arguments (or two if the functions has a return value). >+ Arguments and return value must be word-sized. More arguments can >+ be faked with global variables (eg. use VG_(set_global_var)()). >+ >+ Seven possibilities: 'arg[123]' show where args go, 'ret' shows >+ where return value goes (if present). >+ >+ CCALL(-, -, - ) void f(void) >+ CCALL(arg1, -, - ) void f(UInt arg1) >+ CCALL(arg1, arg2, - ) void f(UInt arg1, UInt arg2) >+ CCALL(arg1, arg2, arg3) void f(UInt arg1, UInt arg2, UInt arg3) >+ CCALL(-, -, ret ) UInt f(UInt) >+ CCALL(arg1, -, ret ) UInt f(UInt arg1) >+ CCALL(arg1, arg2, ret ) UInt f(UInt arg1, UInt arg2) */ >+ CCALL, >+ >+ /* This opcode makes it easy for skins that extend UCode to do this to >+ avoid opcode overlap: >+ >+ enum { EU_OP1 = DUMMY_FINAL_UOPCODE + 1, ... } >+ >+ WARNING: Do not add new opcodes after this one! They can be added >+ before, though. */ >+ DUMMY_FINAL_UOPCODE >+ } >+ Opcode; >+ >+ >+/* Condition codes, using the Intel encoding. CondAlways is an extra. */ >+typedef >+ enum { >+ CondO = 0, /* overflow */ >+ CondNO = 1, /* no overflow */ >+ CondB = 2, /* below */ >+ CondNB = 3, /* not below */ >+ CondZ = 4, /* zero */ >+ CondNZ = 5, /* not zero */ >+ CondBE = 6, /* below or equal */ >+ CondNBE = 7, /* not below or equal */ >+ CondS = 8, /* negative */ >+ CondNS = 9, /* not negative */ >+ CondP = 10, /* parity even */ >+ CondNP = 11, /* not parity even */ >+ CondL = 12, /* jump less */ >+ CondNL = 13, /* not less */ >+ CondLE = 14, /* less or equal */ >+ CondNLE = 15, /* not less or equal */ >+ CondAlways = 16 /* Jump always */ >+ } >+ Condcode; >+ >+ >+/* Descriptions of additional properties of *unconditional* jumps. */ >+typedef >+ enum { >+ JmpBoring=0, /* boring unconditional jump */ >+ JmpCall=1, /* jump due to an x86 call insn */ >+ JmpRet=2, /* jump due to an x86 ret insn */ >+ JmpSyscall=3, /* do a system call, then jump */ >+ JmpClientReq=4,/* do a client request, then jump */ >+ JmpYield=5 /* do a yield, then jump */ >+ } >+ JmpKind; >+ >+ >+/* Flags. User-level code can only read/write O(verflow), S(ign), >+ Z(ero), A(ux-carry), C(arry), P(arity), and may also write >+ D(irection). That's a total of 7 flags. A FlagSet is a bitset, >+ thusly: >+ 76543210 >+ DOSZACP >+ and bit 7 must always be zero since it is unused. >+ >+ Note: these Flag? values are **not** the positions in the actual >+ %eflags register. */ >+ >+typedef UChar FlagSet; >+ >+#define FlagD (1<<6) >+#define FlagO (1<<5) >+#define FlagS (1<<4) >+#define FlagZ (1<<3) >+#define FlagA (1<<2) >+#define FlagC (1<<1) >+#define FlagP (1<<0) >+ >+#define FlagsOSZACP (FlagO | FlagS | FlagZ | FlagA | FlagC | FlagP) >+#define FlagsOSZAP (FlagO | FlagS | FlagZ | FlagA | FlagP) >+#define FlagsOSZCP (FlagO | FlagS | FlagZ | FlagC | FlagP) >+#define FlagsOSACP (FlagO | FlagS | FlagA | FlagC | FlagP) >+#define FlagsSZACP ( FlagS | FlagZ | FlagA | FlagC | FlagP) >+#define FlagsSZAP ( FlagS | FlagZ | FlagA | FlagP) >+#define FlagsSZP ( FlagS | FlagZ | FlagP) >+#define FlagsZCP ( FlagZ | FlagC | FlagP) >+#define FlagsOC (FlagO | FlagC ) >+#define FlagsAC ( FlagA | FlagC ) >+ >+#define FlagsALL (FlagsOSZACP | FlagD) >+#define FlagsEmpty (FlagSet)0 >+ >+ >+/* flag positions in eflags */ >+#define EFlagC (1 << 0) /* carry */ >+#define EFlagP (1 << 2) /* parity */ >+#define EFlagA (1 << 4) /* aux carry */ >+#define EFlagZ (1 << 6) /* zero */ >+#define EFlagS (1 << 7) /* sign */ >+#define EFlagD (1 << 10) /* direction */ >+#define EFlagO (1 << 11) /* overflow */ >+#define EFlagID (1 << 21) /* changable if CPUID exists */ >+ >+/* Liveness of general purpose registers, useful for code generation. >+ Reg rank order 0..N-1 corresponds to bits 0..N-1, ie. first >+ reg's liveness in bit 0, last reg's in bit N-1. Note that >+ these rankings don't match the Intel register ordering. */ >+typedef UInt RRegSet; >+ >+#define ALL_RREGS_DEAD 0 /* 0000...00b */ >+#define ALL_RREGS_LIVE ((1 << VG_MAX_REALREGS)-1) /* 0011...11b */ >+#define UNIT_RREGSET(rank) (1 << (rank)) >+ >+#define IS_RREG_LIVE(rank,rregs_live) (rregs_live & UNIT_RREGSET(rank)) >+#define SET_RREG_LIVENESS(rank,rregs_live,b) \ >+ do { RRegSet unit = UNIT_RREGSET(rank); \ >+ if (b) rregs_live |= unit; \ >+ else rregs_live &= ~unit; \ >+ } while(0) >+ >+ >+/* A Micro (u)-instruction. */ >+typedef >+ struct { >+ /* word 1 */ >+ UInt lit32; /* 32-bit literal */ >+ >+ /* word 2 */ >+ UShort val1; /* first operand */ >+ UShort val2; /* second operand */ >+ >+ /* word 3 */ >+ UShort val3; /* third operand */ >+ UChar opcode; /* opcode */ >+ UShort size; /* data transfer size */ >+ >+ /* word 4 */ >+ FlagSet flags_r; /* :: FlagSet */ >+ FlagSet flags_w; /* :: FlagSet */ >+ UChar tag1:4; /* first operand tag */ >+ UChar tag2:4; /* second operand tag */ >+ UChar tag3:4; /* third operand tag */ >+ UChar extra4b:4; /* Spare field, used by WIDEN for src >+ -size, and by LEA2 for scale (1,2,4 or 8), >+ and by JMPs for original x86 instr size */ >+ >+ /* word 5 */ >+ UChar cond; /* condition, for jumps */ >+ Bool signed_widen:1; /* signed or unsigned WIDEN ? */ >+ JmpKind jmpkind:3; /* additional properties of unconditional JMP */ >+ >+ /* Additional properties for UInstrs that call C functions: >+ - CCALL >+ - PUT (when %ESP is the target) >+ - possibly skin-specific UInstrs >+ */ >+ UChar argc:2; /* Number of args, max 3 */ >+ UChar regparms_n:2; /* Number of args passed in registers */ >+ Bool has_ret_val:1; /* Function has return value? */ >+ >+ /* RealReg liveness; only sensical after reg alloc and liveness >+ analysis done. This info is a little bit arch-specific -- >+ VG_MAX_REALREGS can vary on different architectures. Note that >+ to use this information requires converting between register ranks >+ and the Intel register numbers, using VG_(realreg_to_rank)() >+ and/or VG_(rank_to_realreg)() */ >+ RRegSet regs_live_after:VG_MAX_REALREGS; >+ } >+ UInstr; >+ >+ >+typedef >+ struct _UCodeBlock >+ UCodeBlock; >+ >+extern Int VG_(get_num_instrs) (UCodeBlock* cb); >+extern Int VG_(get_num_temps) (UCodeBlock* cb); >+ >+extern UInstr* VG_(get_instr) (UCodeBlock* cb, Int i); >+extern UInstr* VG_(get_last_instr) (UCodeBlock* cb); >+ >+ >+/*====================================================================*/ >+/*=== Instrumenting UCode ===*/ >+/*====================================================================*/ >+ >+/* Maximum number of registers read or written by a single UInstruction. */ >+#define VG_MAX_REGS_USED 3 >+ >+/* Find what this instruction does to its regs, useful for >+ analysis/optimisation passes. `tag' indicates whether we're considering >+ TempRegs (pre-reg-alloc) or RealRegs (post-reg-alloc). `regs' is filled >+ with the affected register numbers, `isWrites' parallels it and indicates >+ if the reg is read or written. If a reg is read and written, it will >+ appear twice in `regs'. `regs' and `isWrites' must be able to fit >+ VG_MAX_REGS_USED elements. */ >+extern Int VG_(get_reg_usage) ( UInstr* u, Tag tag, Int* regs, Bool* isWrites ); >+ >+ >+/* Used to register helper functions to be called from generated code. A >+ limited number of compact helpers can be registered; the code generated >+ to call them is slightly shorter -- so register the mostly frequently >+ called helpers as compact. */ >+extern void VG_(register_compact_helper) ( Addr a ); >+extern void VG_(register_noncompact_helper) ( Addr a ); >+ >+ >+/* ------------------------------------------------------------------ */ >+/* Virtual register allocation */ >+ >+/* Get a new virtual register */ >+extern Int VG_(get_new_temp) ( UCodeBlock* cb ); >+ >+/* Get a new virtual shadow register */ >+extern Int VG_(get_new_shadow) ( UCodeBlock* cb ); >+ >+/* Get a virtual register's corresponding virtual shadow register */ >+#define SHADOW(tempreg) ((tempreg)+1) >+ >+ >+/* ------------------------------------------------------------------ */ >+/* Low-level UInstr builders */ >+extern void VG_(new_NOP) ( UInstr* u ); >+extern void VG_(new_UInstr0) ( UCodeBlock* cb, Opcode opcode, Int sz ); >+extern void VG_(new_UInstr1) ( UCodeBlock* cb, Opcode opcode, Int sz, >+ Tag tag1, UInt val1 ); >+extern void VG_(new_UInstr2) ( UCodeBlock* cb, Opcode opcode, Int sz, >+ Tag tag1, UInt val1, >+ Tag tag2, UInt val2 ); >+extern void VG_(new_UInstr3) ( UCodeBlock* cb, Opcode opcode, Int sz, >+ Tag tag1, UInt val1, >+ Tag tag2, UInt val2, >+ Tag tag3, UInt val3 ); >+ >+/* Set read/write/undefined flags. Undefined flags are treaten as written, >+ but it's worth keeping them logically distinct. */ >+extern void VG_(set_flag_fields) ( UCodeBlock* cb, FlagSet fr, FlagSet fw, >+ FlagSet fu); >+extern void VG_(set_lit_field) ( UCodeBlock* cb, UInt lit32 ); >+extern void VG_(set_ccall_fields) ( UCodeBlock* cb, Addr fn, UChar argc, >+ UChar regparms_n, Bool has_ret_val ); >+extern void VG_(set_cond_field) ( UCodeBlock* cb, Condcode code ); >+ >+extern void VG_(copy_UInstr) ( UCodeBlock* cb, UInstr* instr ); >+ >+extern Bool VG_(any_flag_use)( UInstr* u ); >+ >+/* Macro versions of the above; just shorter to type. */ >+#define uInstr0 VG_(new_UInstr0) >+#define uInstr1 VG_(new_UInstr1) >+#define uInstr2 VG_(new_UInstr2) >+#define uInstr3 VG_(new_UInstr3) >+#define uLiteral VG_(set_lit_field) >+#define uCCall VG_(set_ccall_fields) >+#define uCond VG_(set_cond_field) >+#define uFlagsRWU VG_(set_flag_fields) >+#define newTemp VG_(get_new_temp) >+#define newShadow VG_(get_new_shadow) >+ >+/* Refer to `the last instruction stuffed in' (can be lvalue). */ >+#define LAST_UINSTR(cb) (cb)->instrs[(cb)->used-1] >+ >+ >+/* ------------------------------------------------------------------ */ >+/* Higher-level UInstr sequence builders */ >+extern void VG_(call_helper_0_0) ( UCodeBlock* cb, Addr f); >+extern void VG_(call_helper_1_0) ( UCodeBlock* cb, Addr f, UInt arg1, >+ UInt regparms_n); >+extern void VG_(call_helper_2_0) ( UCodeBlock* cb, Addr f, UInt arg1, UInt arg2, >+ UInt regparms_n); >+ >+/* One way around the 3-arg C function limit is to pass args via global >+ * variables... ugly, but it works. This one puts a literal in there. */ >+extern void VG_(set_global_var) ( UCodeBlock* cb, Addr globvar_ptr, UInt val); >+ >+/* This one puts the contents of a TempReg in the global variable. */ >+extern void VG_(set_global_var_tempreg) ( UCodeBlock* cb, Addr globvar_ptr, >+ UInt t_val); >+ >+/* ------------------------------------------------------------------ */ >+/* Allocating/freeing basic blocks of UCode */ >+extern UCodeBlock* VG_(setup_UCodeBlock) ( UCodeBlock* cb ); >+extern void VG_(free_UCodeBlock) ( UCodeBlock* cb ); >+ >+/* ------------------------------------------------------------------ */ >+/* UCode pretty/ugly printing. Probably only useful to call from a skin >+ if VG_(needs).extended_UCode == True. */ >+ >+/* When True, all generated code is/should be printed. */ >+extern Bool VG_(print_codegen); >+ >+/* Pretty/ugly printing functions */ >+extern void VG_(pp_UCodeBlock) ( UCodeBlock* cb, Char* title ); >+extern void VG_(pp_UInstr) ( Int instrNo, UInstr* u ); >+extern void VG_(pp_UInstr_regs) ( Int instrNo, UInstr* u ); >+extern void VG_(up_UInstr) ( Int instrNo, UInstr* u ); >+extern Char* VG_(name_UOpcode) ( Bool upper, Opcode opc ); >+extern Char* VG_(name_UCondcode) ( Condcode cond ); >+extern void VG_(pp_UOperand) ( UInstr* u, Int operandNo, >+ Int sz, Bool parens ); >+ >+/* ------------------------------------------------------------------ */ >+/* Accessing archregs and their shadows */ >+extern UInt VG_(get_archreg) ( UInt archreg ); >+extern UInt VG_(get_thread_archreg) ( ThreadId tid, UInt archreg ); >+ >+extern UInt VG_(get_shadow_archreg) ( UInt archreg ); >+extern void VG_(set_shadow_archreg) ( UInt archreg, UInt val ); >+extern void VG_(set_shadow_eflags) ( UInt val ); >+extern Addr VG_(shadow_archreg_address) ( UInt archreg ); >+ >+extern UInt VG_(get_thread_shadow_archreg) ( ThreadId tid, UInt archreg ); >+extern void VG_(set_thread_shadow_archreg) ( ThreadId tid, UInt archreg, >+ UInt val ); >+ >+/* ------------------------------------------------------------------ */ >+/* Offsets of addresses of helper functions. A "helper" function is one >+ which is called from generated code via CALLM. */ >+ >+extern Int VGOFF_(helper_idiv_64_32); >+extern Int VGOFF_(helper_div_64_32); >+extern Int VGOFF_(helper_idiv_32_16); >+extern Int VGOFF_(helper_div_32_16); >+extern Int VGOFF_(helper_idiv_16_8); >+extern Int VGOFF_(helper_div_16_8); >+ >+extern Int VGOFF_(helper_imul_32_64); >+extern Int VGOFF_(helper_mul_32_64); >+extern Int VGOFF_(helper_imul_16_32); >+extern Int VGOFF_(helper_mul_16_32); >+extern Int VGOFF_(helper_imul_8_16); >+extern Int VGOFF_(helper_mul_8_16); >+ >+extern Int VGOFF_(helper_CLD); >+extern Int VGOFF_(helper_STD); >+extern Int VGOFF_(helper_get_dirflag); >+ >+extern Int VGOFF_(helper_CLC); >+extern Int VGOFF_(helper_STC); >+extern Int VGOFF_(helper_CMC); >+ >+extern Int VGOFF_(helper_shldl); >+extern Int VGOFF_(helper_shldw); >+extern Int VGOFF_(helper_shrdl); >+extern Int VGOFF_(helper_shrdw); >+ >+extern Int VGOFF_(helper_RDTSC); >+extern Int VGOFF_(helper_CPUID); >+ >+extern Int VGOFF_(helper_IN); >+extern Int VGOFF_(helper_OUT); >+ >+extern Int VGOFF_(helper_bsfw); >+extern Int VGOFF_(helper_bsfl); >+extern Int VGOFF_(helper_bsrw); >+extern Int VGOFF_(helper_bsrl); >+ >+extern Int VGOFF_(helper_fstsw_AX); >+extern Int VGOFF_(helper_SAHF); >+extern Int VGOFF_(helper_LAHF); >+extern Int VGOFF_(helper_DAS); >+extern Int VGOFF_(helper_DAA); >+extern Int VGOFF_(helper_AAS); >+extern Int VGOFF_(helper_AAA); >+extern Int VGOFF_(helper_AAD); >+extern Int VGOFF_(helper_AAM); >+ >+extern Int VGOFF_(helper_cmpxchg8b); >+ >+ >+/*====================================================================*/ >+/*=== Generating x86 code from UCode ===*/ >+/*====================================================================*/ >+ >+/* All this only necessary for skins with VG_(needs).extends_UCode == True. */ >+ >+/* This is the Intel register encoding -- integer regs. */ >+#define R_EAX 0 >+#define R_ECX 1 >+#define R_EDX 2 >+#define R_EBX 3 >+#define R_ESP 4 >+#define R_EBP 5 >+#define R_ESI 6 >+#define R_EDI 7 >+ >+#define R_AL (0+R_EAX) >+#define R_CL (0+R_ECX) >+#define R_DL (0+R_EDX) >+#define R_BL (0+R_EBX) >+#define R_AH (4+R_EAX) >+#define R_CH (4+R_ECX) >+#define R_DH (4+R_EDX) >+#define R_BH (4+R_EBX) >+ >+/* This is the Intel register encoding -- segment regs. */ >+#define R_ES 0 >+#define R_CS 1 >+#define R_SS 2 >+#define R_DS 3 >+#define R_FS 4 >+#define R_GS 5 >+ >+/* For pretty printing x86 code */ >+extern const Char* VG_(name_of_mmx_gran) ( UChar gran ); >+extern const Char* VG_(name_of_mmx_reg) ( Int mmxreg ); >+extern const Char* VG_(name_of_seg_reg) ( Int sreg ); >+extern const Char* VG_(name_of_int_reg) ( Int size, Int reg ); >+extern const Char VG_(name_of_int_size) ( Int size ); >+ >+/* Shorter macros for convenience */ >+#define nameIReg VG_(name_of_int_reg) >+#define nameISize VG_(name_of_int_size) >+#define nameSReg VG_(name_of_seg_reg) >+#define nameMMXReg VG_(name_of_mmx_reg) >+#define nameMMXGran VG_(name_of_mmx_gran) >+#define nameXMMReg VG_(name_of_xmm_reg) >+ >+/* Randomly useful things */ >+extern UInt VG_(extend_s_8to32) ( UInt x ); >+ >+/* Code emitters */ >+extern void VG_(emitB) ( UInt b ); >+extern void VG_(emitW) ( UInt w ); >+extern void VG_(emitL) ( UInt l ); >+extern void VG_(new_emit) ( Bool upd_cc, FlagSet uses_flags, FlagSet sets_flags ); >+ >+/* Finding offsets */ >+extern Int VG_(helper_offset) ( Addr a ); >+extern Int VG_(shadow_reg_offset) ( Int arch ); >+extern Int VG_(shadow_flags_offset) ( void ); >+ >+/* Convert reg ranks <-> Intel register ordering, for using register >+ liveness information. */ >+extern Int VG_(realreg_to_rank) ( Int realreg ); >+extern Int VG_(rank_to_realreg) ( Int rank ); >+ >+/* Call a subroutine. Does no argument passing, stack manipulations, etc. */ >+extern void VG_(synth_call) ( Bool ensure_shortform, Int word_offset, >+ Bool upd_cc, FlagSet use_flags, FlagSet set_flags ); >+ >+/* For calling C functions -- saves caller save regs, pushes args, calls, >+ clears the stack, restores caller save regs. `fn' must be registered in >+ the baseBlock first. Acceptable tags are RealReg and Literal. Optimises >+ things, eg. by not preserving non-live caller-save registers. >+ >+ WARNING: a UInstr should *not* be translated with synth_ccall() followed >+ by some other x86 assembly code; this will invalidate the results of >+ vg_realreg_liveness_analysis() and everything will fall over. */ >+extern void VG_(synth_ccall) ( Addr fn, Int argc, Int regparms_n, UInt argv[], >+ Tag tagv[], Int ret_reg, >+ RRegSet regs_live_before, >+ RRegSet regs_live_after ); >+ >+/* Addressing modes */ >+extern void VG_(emit_amode_offregmem_reg)( Int off, Int regmem, Int reg ); >+extern void VG_(emit_amode_ereg_greg) ( Int e_reg, Int g_reg ); >+ >+/* v-size (4, or 2 with OSO) insn emitters */ >+extern void VG_(emit_movv_offregmem_reg) ( Int sz, Int off, Int areg, Int reg ); >+extern void VG_(emit_movv_reg_offregmem) ( Int sz, Int reg, Int off, Int areg ); >+extern void VG_(emit_movv_reg_reg) ( Int sz, Int reg1, Int reg2 ); >+extern void VG_(emit_nonshiftopv_lit_reg)( Bool upd_cc, Int sz, Opcode opc, UInt lit, >+ Int reg ); >+extern void VG_(emit_shiftopv_lit_reg) ( Bool upd_cc, Int sz, Opcode opc, UInt lit, >+ Int reg ); >+extern void VG_(emit_nonshiftopv_reg_reg)( Bool upd_cc, Int sz, Opcode opc, >+ Int reg1, Int reg2 ); >+extern void VG_(emit_movv_lit_reg) ( Int sz, UInt lit, Int reg ); >+extern void VG_(emit_unaryopv_reg) ( Bool upd_cc, Int sz, Opcode opc, Int reg ); >+extern void VG_(emit_pushv_reg) ( Int sz, Int reg ); >+extern void VG_(emit_popv_reg) ( Int sz, Int reg ); >+ >+extern void VG_(emit_pushl_lit32) ( UInt int32 ); >+extern void VG_(emit_pushl_lit8) ( Int lit8 ); >+extern void VG_(emit_cmpl_zero_reg) ( Bool upd_cc, Int reg ); >+extern void VG_(emit_swapl_reg_EAX) ( Int reg ); >+extern void VG_(emit_movv_lit_offregmem) ( Int sz, UInt lit, Int off, >+ Int memreg ); >+ >+/* b-size (1 byte) instruction emitters */ >+extern void VG_(emit_movb_lit_offregmem) ( UInt lit, Int off, Int memreg ); >+extern void VG_(emit_movb_reg_offregmem) ( Int reg, Int off, Int areg ); >+extern void VG_(emit_unaryopb_reg) ( Bool upd_cc, Opcode opc, Int reg ); >+extern void VG_(emit_testb_lit_reg) ( Bool upd_cc, UInt lit, Int reg ); >+ >+/* zero-extended load emitters */ >+extern void VG_(emit_movzbl_offregmem_reg) ( Bool bounds, Int off, Int regmem, Int reg ); >+extern void VG_(emit_movzwl_offregmem_reg) ( Bool bounds, Int off, Int areg, Int reg ); >+extern void VG_(emit_movzwl_regmem_reg) ( Bool bounds, Int reg1, Int reg2 ); >+ >+/* misc instruction emitters */ >+extern void VG_(emit_call_reg) ( Int reg ); >+extern void VG_(emit_add_lit_to_esp) ( Int lit ); >+extern void VG_(emit_pushal) ( void ); >+extern void VG_(emit_popal) ( void ); >+extern void VG_(emit_AMD_prefetch_reg) ( Int reg ); >+ >+/* jump emitters */ >+extern void VG_(init_target) ( Int *tgt ); >+ >+extern void VG_(target_back) ( Int *tgt ); >+extern void VG_(target_forward) ( Int *tgt ); >+extern void VG_(emit_target_delta) ( Int *tgt ); >+ >+typedef enum { >+ JP_NONE, /* no prediction */ >+ JP_TAKEN, /* predict taken */ >+ JP_NOT_TAKEN, /* predict not taken */ >+} JumpPred; >+ >+extern void VG_(emit_jcondshort_delta) ( Bool simd_cc, Condcode cond, Int delta, JumpPred ); >+extern void VG_(emit_jcondshort_target)( Bool simd_cc, Condcode cond, Int *tgt, JumpPred ); >+ >+ >+/*====================================================================*/ >+/*=== Execution contexts ===*/ >+/*====================================================================*/ >+ >+/* Generic resolution type used in a few different ways, such as deciding >+ how closely to compare two errors for equality. */ >+typedef >+ enum { Vg_LowRes, Vg_MedRes, Vg_HighRes } >+ VgRes; >+ >+typedef >+ struct _ExeContext >+ ExeContext; >+ >+/* Compare two ExeContexts. Number of callers considered depends on `res': >+ Vg_LowRes: 2 >+ Vg_MedRes: 4 >+ Vg_HighRes: all */ >+extern Bool VG_(eq_ExeContext) ( VgRes res, >+ ExeContext* e1, ExeContext* e2 ); >+ >+/* Print an ExeContext. */ >+extern void VG_(pp_ExeContext) ( ExeContext* ); >+ >+/* Take a snapshot of the client's stack. Search our collection of >+ ExeContexts to see if we already have it, and if not, allocate a >+ new one. Either way, return a pointer to the context. Context size >+ controlled by --num-callers option. >+ >+ If called from generated code, use VG_(get_current_tid)() to get the >+ current ThreadId. If called from non-generated code, the current >+ ThreadId should be passed in by the core. >+*/ >+extern ExeContext* VG_(get_ExeContext) ( ThreadId tid ); >+ >+/* Get the nth EIP from the ExeContext. 0 is the EIP of the top function, 1 >+ is its caller, etc. Returns 0 if there isn't one, or if n is greater >+ than VG_(clo_backtrace_size), set by the --num-callers option. */ >+extern Addr VG_(get_EIP_from_ExeContext) ( ExeContext* e, UInt n ); >+ >+/* Just grab the client's EIP, as a much smaller and cheaper >+ indication of where they are. Use is basically same as for >+ VG_(get_ExeContext)() above. >+*/ >+extern Addr VG_(get_EIP)( ThreadId tid ); >+ >+/* For skins needing more control over stack traces: walks the stack to get >+ %eips from the top stack frames for thread 'tid'. Maximum of 'n_eips' >+ addresses put into 'eips'; 0 is the top of the stack, 1 is its caller, >+ etc. */ >+extern UInt VG_(stack_snapshot) ( ThreadId tid, Addr* eips, UInt n_eips ); >+ >+/* Does the same thing as VG_(pp_ExeContext)(), just with slightly >+ different input. */ >+extern void VG_(mini_stack_dump) ( Addr eips[], UInt n_eips ); >+ >+ >+/*====================================================================*/ >+/*=== Error reporting ===*/ >+/*====================================================================*/ >+ >+/* ------------------------------------------------------------------ */ >+/* Suppressions describe errors which we want to suppress, ie, not >+ show the user, usually because it is caused by a problem in a library >+ which we can't fix, replace or work around. Suppressions are read from >+ a file at startup time. This gives flexibility so that new >+ suppressions can be added to the file as and when needed. >+*/ >+ >+typedef >+ Int /* Do not make this unsigned! */ >+ SuppKind; >+ >+/* The skin-relevant parts of a suppression are: >+ kind: what kind of suppression; must be in the range (0..) >+ string: use is optional. NULL by default. >+ extra: use is optional. NULL by default. void* so it's extensible. >+*/ >+typedef >+ struct _Supp >+ Supp; >+ >+/* Useful in SK_(error_matches_suppression)() */ >+SuppKind VG_(get_supp_kind) ( Supp* su ); >+Char* VG_(get_supp_string) ( Supp* su ); >+void* VG_(get_supp_extra) ( Supp* su ); >+ >+/* Must be used in VG_(recognised_suppression)() */ >+void VG_(set_supp_kind) ( Supp* su, SuppKind suppkind ); >+/* May be used in VG_(read_extra_suppression_info)() */ >+void VG_(set_supp_string) ( Supp* su, Char* string ); >+void VG_(set_supp_extra) ( Supp* su, void* extra ); >+ >+ >+/* ------------------------------------------------------------------ */ >+/* Error records contain enough info to generate an error report. The idea >+ is that (typically) the same few points in the program generate thousands >+ of errors, and we don't want to spew out a fresh error message for each >+ one. Instead, we use these structures to common up duplicates. >+*/ >+ >+typedef >+ Int /* Do not make this unsigned! */ >+ ErrorKind; >+ >+/* The skin-relevant parts of an Error are: >+ kind: what kind of error; must be in the range (0..) >+ addr: use is optional. 0 by default. >+ string: use is optional. NULL by default. >+ extra: use is optional. NULL by default. void* so it's extensible. >+*/ >+typedef >+ struct _Error >+ Error; >+ >+/* Useful in SK_(error_matches_suppression)(), SK_(pp_SkinError)(), etc */ >+ExeContext* VG_(get_error_where) ( Error* err ); >+SuppKind VG_(get_error_kind) ( Error* err ); >+Addr VG_(get_error_address) ( Error* err ); >+Char* VG_(get_error_string) ( Error* err ); >+void* VG_(get_error_extra) ( Error* err ); >+ >+/* Call this when an error occurs. It will be recorded if it hasn't been >+ seen before. If it has, the existing error record will have its count >+ incremented. >+ >+ 'tid' can be found as for VG_(get_ExeContext)(). The `extra' field can >+ be stack-allocated; it will be copied by the core if needed (but it >+ won't be copied if it's NULL). >+ >+ If no 'a', 's' or 'extra' of interest needs to be recorded, just use >+ NULL for them. */ >+extern void VG_(maybe_record_error) ( ThreadId tid, ErrorKind ekind, >+ Addr a, Char* s, void* extra ); >+ >+/* Similar to VG_(maybe_record_error)(), except this one doesn't record the >+ error -- useful for errors that can only happen once. The errors can be >+ suppressed, though. Return value is True if it was suppressed. >+ `print_error' dictates whether to print the error, which is a bit of a >+ hack that's useful sometimes if you just want to know if the error would >+ be suppressed without possibly printing it. `count_error' dictates >+ whether to add the error in the error total count (another mild hack). */ >+extern Bool VG_(unique_error) ( ThreadId tid, ErrorKind ekind, >+ Addr a, Char* s, void* extra, >+ ExeContext* where, Bool print_error, >+ Bool allow_GDB_attach, Bool count_error ); >+ >+/* Gets a non-blank, non-comment line of at most nBuf chars from fd. >+ Skips leading spaces on the line. Returns True if EOF was hit instead. >+ Useful for reading in extra skin-specific suppression lines. */ >+extern Bool VG_(get_line) ( Int fd, Char* buf, Int nBuf ); >+ >+ >+/*====================================================================*/ >+/*=== Obtaining debug information ===*/ >+/*====================================================================*/ >+ >+/* Get the file/function/line number of the instruction at address >+ 'a'. For these four, if debug info for the address is found, it >+ copies the info into the buffer/UInt and returns True. If not, it >+ returns False and nothing is copied. VG_(get_fnname) always >+ demangles C++ function names. VG_(get_fnname_w_offset) is the >+ same, except it appends "+N" to symbol names to indicate offsets. */ >+extern Bool VG_(get_filename) ( Addr a, Char* filename, Int n_filename ); >+extern Bool VG_(get_fnname) ( Addr a, Char* fnname, Int n_fnname ); >+extern Bool VG_(get_linenum) ( Addr a, UInt* linenum ); >+extern Bool VG_(get_fnname_w_offset) >+ ( Addr a, Char* fnname, Int n_fnname ); >+ >+/* This one is more efficient if getting both filename and line number, >+ because the two lookups are done together. */ >+extern Bool VG_(get_filename_linenum) >+ ( Addr a, Char* filename, Int n_filename, >+ UInt* linenum ); >+ >+/* Succeeds only if we find from debug info that 'a' is the address of the >+ first instruction in a function -- as opposed to VG_(get_fnname) which >+ succeeds if we find from debug info that 'a' is the address of any >+ instruction in a function. Use this to instrument the start of >+ a particular function. Nb: if an executable/shared object is stripped >+ of its symbols, this function will not be able to recognise function >+ entry points within it. */ >+extern Bool VG_(get_fnname_if_entry) ( Addr a, Char* fnname, Int n_fnname ); >+ >+/* Succeeds if the address is within a shared object or the main executable. >+ It doesn't matter if debug info is present or not. */ >+extern Bool VG_(get_objname) ( Addr a, Char* objname, Int n_objname ); >+ >+/* Puts into 'buf' info about the code address %eip: the address, function >+ name (if known) and filename/line number (if known), like this: >+ >+ 0x4001BF05: realloc (vg_replace_malloc.c:339) >+ >+ 'n_buf' gives length of 'buf'. Returns 'buf'. >+*/ >+extern Char* VG_(describe_eip)(Addr eip, Char* buf, Int n_buf); >+ >+/* Returns a string containing an expression for the given >+ address. String is malloced with VG_(malloc)() */ >+Char *VG_(describe_addr)(ThreadId, Addr); >+ >+/* A way to get information about what segments are mapped */ >+typedef struct _SegInfo SegInfo; >+ >+/* Returns NULL if the SegInfo isn't found. It doesn't matter if debug info >+ is present or not. */ >+extern SegInfo* VG_(get_obj) ( Addr a ); >+ >+extern const SegInfo* VG_(next_seginfo) ( const SegInfo *seg ); >+extern Addr VG_(seg_start) ( const SegInfo *seg ); >+extern UInt VG_(seg_size) ( const SegInfo *seg ); >+extern const UChar* VG_(seg_filename) ( const SegInfo *seg ); >+extern UInt VG_(seg_sym_offset)( const SegInfo *seg ); >+ >+typedef >+ enum { >+ Vg_SectUnknown, >+ Vg_SectText, >+ Vg_SectData, >+ Vg_SectBSS, >+ Vg_SectGOT, >+ Vg_SectPLT, >+ } >+ VgSectKind; >+ >+extern VgSectKind VG_(seg_sect_kind)(Addr); >+ >+ >+/*====================================================================*/ >+/*=== Generic hash table ===*/ >+/*====================================================================*/ >+ >+/* Generic type for a separately-chained hash table. Via a kind of dodgy >+ C-as-C++ style inheritance, skins can extend the VgHashNode type, so long >+ as the first two fields match the sizes of these two fields. Requires >+ a bit of casting by the skin. */ >+typedef >+ struct _VgHashNode { >+ struct _VgHashNode * next; >+ UInt key; >+ } >+ VgHashNode; >+ >+typedef >+ VgHashNode** >+ VgHashTable; >+ >+/* Make a new table. */ >+extern VgHashTable VG_(HT_construct) ( void ); >+ >+/* Count the number of nodes in a table. */ >+extern Int VG_(HT_count_nodes) ( VgHashTable table ); >+ >+/* Add a node to the table. */ >+extern void VG_(HT_add_node) ( VgHashTable t, VgHashNode* node ); >+ >+/* Looks up a node in the hash table. Also returns the address of the >+ previous node's `next' pointer which allows it to be removed from the >+ list later without having to look it up again. */ >+extern VgHashNode* VG_(HT_get_node) ( VgHashTable t, UInt key, >+ /*OUT*/VgHashNode*** next_ptr ); >+ >+/* Allocates an array of pointers to all the shadow chunks of malloc'd >+ blocks. Must be freed with VG_(free)(). */ >+extern VgHashNode** VG_(HT_to_array) ( VgHashTable t, /*OUT*/ UInt* n_shadows ); >+ >+/* Returns first node that matches predicate `p', or NULL if none do. >+ Extra arguments can be implicitly passed to `p' using nested functions; >+ see memcheck/mc_errcontext.c for an example. */ >+extern VgHashNode* VG_(HT_first_match) ( VgHashTable t, >+ Bool (*p)(VgHashNode*) ); >+ >+/* Applies a function f() once to each node. Again, nested functions >+ can be very useful. */ >+extern void VG_(HT_apply_to_all_nodes)( VgHashTable t, void (*f)(VgHashNode*) ); >+ >+/* Destroy a table. */ >+extern void VG_(HT_destruct) ( VgHashTable t ); >+ >+ >+/*====================================================================*/ >+/*=== A generic skiplist ===*/ >+/*====================================================================*/ >+ >+/* >+ The idea here is that the skiplist puts its per-element data at the >+ end of the structure. When you initialize the skiplist, you tell >+ it what structure your list elements are going to be. Then you >+ should allocate them with VG_(SkipNode_Alloc), which will allocate >+ enough memory for the extra bits. >+ */ >+#include <stddef.h> /* for offsetof */ >+ >+typedef struct _SkipList SkipList; >+typedef struct _SkipNode SkipNode; >+ >+typedef Int (*SkipCmp_t)(const void *key1, const void *key2); >+ >+struct _SkipList { >+ const Short arena; /* allocation arena */ >+ const UShort size; /* structure size (not including SkipNode) */ >+ const UShort keyoff; /* key offset */ >+ const SkipCmp_t cmp; /* compare two keys */ >+ Char * (*strkey)(void *); /* stringify a key (for debugging) */ >+ SkipNode *head; /* list head */ >+}; >+ >+/* Use this macro to initialize your skiplist head. The arguments are pretty self explanitory: >+ _type is the type of your element structure >+ _key is the field within that type which you want to use as the key >+ _cmp is the comparison function for keys - it gets two typeof(_key) pointers as args >+ _strkey is a function which can return a string of your key - it's only used for debugging >+ _arena is the arena to use for allocation - -1 is the default >+ */ >+#define SKIPLIST_INIT(_type, _key, _cmp, _strkey, _arena) \ >+ { \ >+ .arena = _arena, \ >+ .size = sizeof(_type), \ >+ .keyoff = offsetof(_type, _key), \ >+ .cmp = _cmp, \ >+ .strkey = _strkey, \ >+ .head = NULL, \ >+ } >+ >+/* List operations: >+ SkipList_Find searchs a list. If it can't find an exact match, it either returns NULL >+ or a pointer to the element before where k would go >+ SkipList_Insert inserts a new element into the list. Duplicates are forbidden. >+ SkipList_Remove removes an element from the list and returns it. It doesn't free the memory. >+ */ >+extern void *VG_(SkipList_Find) (const SkipList *l, void *key); >+extern void VG_(SkipList_Insert)( SkipList *l, void *data); >+extern void *VG_(SkipList_Remove)( SkipList *l, void *key); >+ >+/* Node (element) operations: >+ SkipNode_Alloc: allocate memory for a new element on the list >+ SkipNode_Free: free memory allocated above >+ SkipNode_First: return the first element on the list >+ SkipNode_Next: return the next element after "data" on the list - >+ NULL for none >+ */ >+extern void *VG_(SkipNode_Alloc) (const SkipList *l); >+extern void VG_(SkipNode_Free) (const SkipList *l, void *p); >+extern void *VG_(SkipNode_First) (const SkipList *l); >+extern void *VG_(SkipNode_Next) (const SkipList *l, void *data); >+ >+/*====================================================================*/ >+/*=== Functions for shadow registers ===*/ >+/*====================================================================*/ >+ >+/* Nb: make sure the shadow_regs 'need' is set before using these! */ >+ >+/* This one lets you override the shadow of the return value register for a >+ syscall. Call it from SK_(post_syscall)() (not SK_(pre_syscall)()!) to >+ override the default shadow register value. */ >+extern void VG_(set_return_from_syscall_shadow) ( ThreadId tid, >+ UInt ret_shadow ); >+ >+/* This can be called from SK_(fini)() to find the shadow of the argument >+ to exit(), ie. the shadow of the program's return value. */ >+extern UInt VG_(get_exit_status_shadow) ( void ); >+ >+ >+/*====================================================================*/ >+/*=== General stuff for replacing functions ===*/ >+/*====================================================================*/ >+ >+/* Some skins need to replace the standard definitions of some functions. */ >+ >+/* ------------------------------------------------------------------ */ >+/* General stuff, for replacing any functions */ >+ >+/* Is the client running on the simulated CPU or the real one? >+ >+ Nb: If it is, and you want to call a function to be run on the real CPU, >+ use one of the VALGRIND_NON_SIMD_CALL[123] macros in valgrind.h to call it. >+ >+ Nb: don't forget the function parentheses when using this in a >+ condition... write this: >+ >+ if (VG_(is_running_on_simd_CPU)()) { ... } // calls function >+ >+ not this: >+ >+ if (VG_(is_running_on_simd_CPU)) { ... } // address of var! >+*/ >+extern Bool VG_(is_running_on_simd_CPU) ( void ); >+ >+ >+/*====================================================================*/ >+/*=== Specific stuff for replacing malloc() and friends ===*/ >+/*====================================================================*/ >+ >+/* If a skin replaces malloc() et al, the easiest way to do so is to >+ link with vg_replace_malloc.o into its vgpreload_*.so file, and >+ follow the following instructions. You can do it from scratch, >+ though, if you enjoy that sort of thing. */ >+ >+/* Arena size for valgrind's own malloc(); default value is 0, but can >+ be overridden by skin -- but must be done so *statically*, eg: >+ >+ Int VG_(vg_malloc_redzone_szB) = 4; >+ >+ It can't be done from a function like SK_(pre_clo_init)(). So it can't, >+ for example, be controlled with a command line option, unfortunately. */ >+extern UInt VG_(vg_malloc_redzone_szB); >+ >+/* Can be called from SK_(malloc) et al to do the actual alloc/freeing. */ >+extern void* VG_(cli_malloc) ( UInt align, Int nbytes ); >+extern void VG_(cli_free) ( void* p ); >+ >+/* Check if an address is within a range, allowing for redzones at edges */ >+extern Bool VG_(addr_is_in_block)( Addr a, Addr start, UInt size ); >+ >+/* ------------------------------------------------------------------ */ >+/* Some options that can be used by a skin if malloc() et al are replaced. >+ The skin should call the functions in the appropriate places to give >+ control over these aspects of Valgrind's version of malloc(). */ >+ >+/* Round malloc sizes upwards to integral number of words? default: NO */ >+extern Bool VG_(clo_sloppy_malloc); >+/* DEBUG: print malloc details? default: NO */ >+extern Bool VG_(clo_trace_malloc); >+/* Minimum alignment in functions that don't specify alignment explicitly. >+ default: 0, i.e. use default of the machine (== 4) */ >+extern Int VG_(clo_alignment); >+ >+extern Bool VG_(replacement_malloc_process_cmd_line_option) ( Char* arg ); >+extern void VG_(replacement_malloc_print_usage) ( void ); >+extern void VG_(replacement_malloc_print_debug_usage) ( void ); >+ >+ >+/*====================================================================*/ >+/*=== Skin-specific stuff ===*/ >+/*====================================================================*/ >+ >+/* ------------------------------------------------------------------ */ >+/* Details */ >+ >+/* Default value for avg_translations_sizeB (in bytes), indicating typical >+ code expansion of about 6:1. */ >+#define VG_DEFAULT_TRANS_SIZEB 100 >+ >+/* Information used in the startup message. `name' also determines the >+ string used for identifying suppressions in a suppression file as >+ belonging to this skin. `version' can be NULL, in which case (not >+ surprisingly) no version info is printed; this mechanism is designed for >+ skins distributed with Valgrind that share a version number with >+ Valgrind. Other skins not distributed as part of Valgrind should >+ probably have their own version number. */ >+extern void VG_(details_name) ( Char* name ); >+extern void VG_(details_version) ( Char* version ); >+extern void VG_(details_description) ( Char* description ); >+extern void VG_(details_copyright_author) ( Char* copyright_author ); >+ >+/* Average size of a translation, in bytes, so that the translation >+ storage machinery can allocate memory appropriately. Not critical, >+ setting is optional. */ >+extern void VG_(details_avg_translation_sizeB) ( UInt size ); >+ >+/* String printed if an `sk_assert' assertion fails or VG_(skin_panic) >+ is called. Should probably be an email address. */ >+extern void VG_(details_bug_reports_to) ( Char* bug_reports_to ); >+ >+/* ------------------------------------------------------------------ */ >+/* Needs */ >+ >+/* Booleans that decide core behaviour, but don't require extra >+ operations to be defined if `True' */ >+ >+/* Should __libc_freeres() be run? Bugs in it can crash the skin. */ >+extern void VG_(needs_libc_freeres) ( void ); >+ >+/* Want to have errors detected by Valgrind's core reported? Includes: >+ - pthread API errors (many; eg. unlocking a non-locked mutex) >+ - invalid file descriptors to blocking syscalls read() and write() >+ - bad signal numbers passed to sigaction() >+ - attempt to install signal handler for SIGKILL or SIGSTOP */ >+extern void VG_(needs_core_errors) ( void ); >+ >+/* Booleans that indicate extra operations are defined; if these are True, >+ the corresponding template functions (given below) must be defined. A >+ lot like being a member of a type class. */ >+ >+/* Want to report errors from skin? This implies use of suppressions, too. */ >+extern void VG_(needs_skin_errors) ( void ); >+ >+/* Is information kept about specific individual basic blocks? (Eg. for >+ cachegrind there are cost-centres for every instruction, stored at a >+ basic block level.) If so, it sometimes has to be discarded, because >+ .so mmap/munmap-ping or self-modifying code (informed by the >+ DISCARD_TRANSLATIONS user request) can cause one instruction address >+ to be used for more than one instruction in one program run... */ >+extern void VG_(needs_basic_block_discards) ( void ); >+ >+/* Skin maintains information about each register? */ >+extern void VG_(needs_shadow_regs) ( void ); >+ >+/* Skin defines its own command line options? */ >+extern void VG_(needs_command_line_options) ( void ); >+ >+/* Skin defines its own client requests? */ >+extern void VG_(needs_client_requests) ( void ); >+ >+/* Skin defines its own UInstrs? */ >+extern void VG_(needs_extended_UCode) ( void ); >+ >+/* Skin does stuff before and/or after system calls? */ >+extern void VG_(needs_syscall_wrapper) ( void ); >+ >+/* Are skin-state sanity checks performed? */ >+extern void VG_(needs_sanity_checks) ( void ); >+ >+/* Do we need to see data symbols? */ >+extern void VG_(needs_data_syms) ( void ); >+ >+/* Does the skin need shadow memory allocated (if you set this, you must also statically initialize >+ float SK_(shadow_ratio) = n./m; >+ to define how many shadow bits you need per client address space bit. >+*/ >+extern void VG_(needs_shadow_memory)( void ); >+extern float SK_(shadow_ratio); >+ >+/* ------------------------------------------------------------------ */ >+/* Core events to track */ >+ >+/* Part of the core from which this call was made. Useful for determining >+ what kind of error message should be emitted. */ >+typedef >+ enum { Vg_CorePThread, Vg_CoreSignal, Vg_CoreSysCall, Vg_CoreTranslate } >+ CorePart; >+ >+/* Useful to use in VG_(get_Xreg_usage)() */ >+#define VG_UINSTR_READS_REG(ono,regs,isWrites) \ >+ { if (mycat(u->tag,ono) == tag) \ >+ { regs[n] = mycat(u->val,ono); \ >+ isWrites[n] = False; \ >+ n++; \ >+ } \ >+ } >+#define VG_UINSTR_WRITES_REG(ono,regs,isWrites) \ >+ { if (mycat(u->tag,ono) == tag) \ >+ { regs[n] = mycat(u->val,ono); \ >+ isWrites[n] = True; \ >+ n++; \ >+ } \ >+ } >+ >+#endif /* NDEF __VG_SKIN_H */ >+ >+/* gen_toolint.pl will put the VG_(init_*)() functions here: */ >diff -ruN valgrind-2.1.0/install-sh valgrind/install-sh >--- valgrind-2.1.0/install-sh 2003-09-23 10:39:40.000000000 -0500 >+++ valgrind/install-sh 2004-02-04 02:07:51.000000000 -0600 >@@ -1,7 +1,8 @@ > #!/bin/sh >-# > # install - install a program, script, or datafile >-# >+ >+scriptversion=2004-01-12.10 >+ > # This originates from X11R5 (mit/util/scripts/install.sh), which was > # later released in X11R6 (xc/config/util/install.sh) with the > # following copyright and license. >@@ -41,13 +42,11 @@ > # from scratch. It can only install one file at a time, a restriction > # shared with many OS's install programs. > >- > # set DOITPROG to echo to test this script > > # Don't use :- since 4.3BSD and earlier shells don't like it. > doit="${DOITPROG-}" > >- > # put in absolute paths if you don't have them in your path; or use env. vars. > > mvprog="${MVPROG-mv}" >@@ -59,236 +58,253 @@ > rmprog="${RMPROG-rm}" > mkdirprog="${MKDIRPROG-mkdir}" > >-transformbasename="" >-transform_arg="" >+transformbasename= >+transform_arg= > instcmd="$mvprog" > chmodcmd="$chmodprog 0755" >-chowncmd="" >-chgrpcmd="" >-stripcmd="" >+chowncmd= >+chgrpcmd= >+stripcmd= > rmcmd="$rmprog -f" > mvcmd="$mvprog" >-src="" >-dst="" >-dir_arg="" >- >-while [ x"$1" != x ]; do >- case $1 in >- -c) instcmd=$cpprog >- shift >- continue;; >- >- -d) dir_arg=true >- shift >- continue;; >- >- -m) chmodcmd="$chmodprog $2" >- shift >- shift >- continue;; >- >- -o) chowncmd="$chownprog $2" >- shift >- shift >- continue;; >- >- -g) chgrpcmd="$chgrpprog $2" >- shift >- shift >- continue;; >- >- -s) stripcmd=$stripprog >- shift >- continue;; >- >- -t=*) transformarg=`echo $1 | sed 's/-t=//'` >- shift >- continue;; >- >- -b=*) transformbasename=`echo $1 | sed 's/-b=//'` >- shift >- continue;; >- >- *) if [ x"$src" = x ] >- then >- src=$1 >- else >- # this colon is to work around a 386BSD /bin/sh bug >- : >- dst=$1 >- fi >- shift >- continue;; >- esac >+src= >+dst= >+dir_arg= >+ >+usage="Usage: $0 [OPTION]... SRCFILE DSTFILE >+ or: $0 [OPTION]... SRCFILES... DIRECTORY >+ or: $0 -d DIRECTORIES... >+ >+In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default. >+In the second, create the directory path DIR. >+ >+Options: >+-b=TRANSFORMBASENAME >+-c copy source (using $cpprog) instead of moving (using $mvprog). >+-d create directories instead of installing files. >+-g GROUP $chgrp installed files to GROUP. >+-m MODE $chmod installed files to MODE. >+-o USER $chown installed files to USER. >+-s strip installed files (using $stripprog). >+-t=TRANSFORM >+--help display this help and exit. >+--version display version info and exit. >+ >+Environment variables override the default commands: >+ CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG >+" >+ >+while test -n "$1"; do >+ case $1 in >+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'` >+ shift >+ continue;; >+ >+ -c) instcmd=$cpprog >+ shift >+ continue;; >+ >+ -d) dir_arg=true >+ shift >+ continue;; >+ >+ -g) chgrpcmd="$chgrpprog $2" >+ shift >+ shift >+ continue;; >+ >+ --help) echo "$usage"; exit 0;; >+ >+ -m) chmodcmd="$chmodprog $2" >+ shift >+ shift >+ continue;; >+ >+ -o) chowncmd="$chownprog $2" >+ shift >+ shift >+ continue;; >+ >+ -s) stripcmd=$stripprog >+ shift >+ continue;; >+ >+ -t=*) transformarg=`echo $1 | sed 's/-t=//'` >+ shift >+ continue;; >+ >+ --version) echo "$0 $scriptversion"; exit 0;; >+ >+ *) # When -d is used, all remaining arguments are directories to create. >+ test -n "$dir_arg" && break >+ # Otherwise, the last argument is the destination. Remove it from $@. >+ for arg >+ do >+ if test -n "$dstarg"; then >+ # $@ is not empty: it contains at least $arg. >+ set fnord "$@" "$dstarg" >+ shift # fnord >+ fi >+ shift # arg >+ dstarg=$arg >+ done >+ break;; >+ esac > done > >-if [ x"$src" = x ] >-then >- echo "$0: no input file specified" >&2 >- exit 1 >-else >- : >-fi >- >-if [ x"$dir_arg" != x ]; then >- dst=$src >- src="" >- >- if [ -d "$dst" ]; then >- instcmd=: >- chmodcmd="" >- else >- instcmd=$mkdirprog >- fi >-else >- >-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command >-# might cause directories to be created, which would be especially bad >-# if $src (and thus $dsttmp) contains '*'. >- >- if [ -f "$src" ] || [ -d "$src" ] >- then >- : >- else >- echo "$0: $src does not exist" >&2 >- exit 1 >- fi >- >- if [ x"$dst" = x ] >- then >- echo "$0: no destination specified" >&2 >- exit 1 >- else >- : >- fi >- >-# If destination is a directory, append the input filename; if your system >-# does not like double slashes in filenames, you may need to add some logic >- >- if [ -d "$dst" ] >- then >- dst=$dst/`basename "$src"` >- else >- : >- fi >+if test -z "$1"; then >+ if test -z "$dir_arg"; then >+ echo "$0: no input file specified." >&2 >+ exit 1 >+ fi >+ # It's OK to call `install-sh -d' without argument. >+ # This can happen when creating conditional directories. >+ exit 0 > fi > >-## this sed command emulates the dirname command >-dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` >- >-# Make sure that the destination directory exists. >-# this part is taken from Noah Friedman's mkinstalldirs script >- >-# Skip lots of stat calls in the usual case. >-if [ ! -d "$dstdir" ]; then >-defaultIFS=' >- ' >-IFS="${IFS-$defaultIFS}" >- >-oIFS=$IFS >-# Some sh's can't handle IFS=/ for some reason. >-IFS='%' >-set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` >-IFS=$oIFS >- >-pathcomp='' >- >-while [ $# -ne 0 ] ; do >- pathcomp=$pathcomp$1 >- shift >- >- if [ ! -d "$pathcomp" ] ; >- then >- $mkdirprog "$pathcomp" >- else >- : >- fi >+for src >+do >+ # Protect names starting with `-'. >+ case $src in >+ -*) src=./$src ;; >+ esac >+ >+ if test -n "$dir_arg"; then >+ dst=$src >+ src= >+ >+ if test -d "$dst"; then >+ instcmd=: >+ chmodcmd= >+ else >+ instcmd=$mkdirprog >+ fi >+ else >+ # Waiting for this to be detected by the "$instcmd $src $dsttmp" command >+ # might cause directories to be created, which would be especially bad >+ # if $src (and thus $dsttmp) contains '*'. >+ if test ! -f "$src" && test ! -d "$src"; then >+ echo "$0: $src does not exist." >&2 >+ exit 1 >+ fi >+ >+ if test -z "$dstarg"; then >+ echo "$0: no destination specified." >&2 >+ exit 1 >+ fi >+ >+ dst=$dstarg >+ # Protect names starting with `-'. >+ case $dst in >+ -*) dst=./$dst ;; >+ esac > >- pathcomp=$pathcomp/ >+ # If destination is a directory, append the input filename; won't work >+ # if double slashes aren't ignored. >+ if test -d "$dst"; then >+ dst=$dst/`basename "$src"` >+ fi >+ fi >+ >+ # This sed command emulates the dirname command. >+ dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` >+ >+ # Make sure that the destination directory exists. >+ >+ # Skip lots of stat calls in the usual case. >+ if test ! -d "$dstdir"; then >+ defaultIFS=' >+ ' >+ IFS="${IFS-$defaultIFS}" >+ >+ oIFS=$IFS >+ # Some sh's can't handle IFS=/ for some reason. >+ IFS='%' >+ set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` >+ IFS=$oIFS >+ >+ pathcomp= >+ >+ while test $# -ne 0 ; do >+ pathcomp=$pathcomp$1 >+ shift >+ test -d "$pathcomp" || $mkdirprog "$pathcomp" >+ pathcomp=$pathcomp/ >+ done >+ fi >+ >+ if test -n "$dir_arg"; then >+ $doit $instcmd "$dst" \ >+ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ >+ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ >+ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ >+ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } >+ >+ else >+ # If we're going to rename the final executable, determine the name now. >+ if test -z "$transformarg"; then >+ dstfile=`basename "$dst"` >+ else >+ dstfile=`basename "$dst" $transformbasename \ >+ | sed $transformarg`$transformbasename >+ fi >+ >+ # don't allow the sed command to completely eliminate the filename. >+ test -z "$dstfile" && dstfile=`basename "$dst"` >+ >+ # Make a couple of temp file names in the proper directory. >+ dsttmp=$dstdir/_inst.$$_ >+ rmtmp=$dstdir/_rm.$$_ >+ >+ # Trap to clean up those temp files at exit. >+ trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 >+ trap '(exit $?); exit' 1 2 13 15 >+ >+ # Move or copy the file name to the temp name >+ $doit $instcmd "$src" "$dsttmp" && >+ >+ # and set any options; do chmod last to preserve setuid bits. >+ # >+ # If any of these fail, we abort the whole thing. If we want to >+ # ignore errors from any of these, just make sure not to ignore >+ # errors from the above "$doit $instcmd $src $dsttmp" command. >+ # >+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ >+ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ >+ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ >+ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && >+ >+ # Now remove or move aside any old file at destination location. We >+ # try this two ways since rm can't unlink itself on some systems and >+ # the destination file might be busy for other reasons. In this case, >+ # the final cleanup might fail but the new file should still install >+ # successfully. >+ { >+ if test -f "$dstdir/$dstfile"; then >+ $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ >+ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ >+ || { >+ echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 >+ (exit 1); exit >+ } >+ else >+ : >+ fi >+ } && >+ >+ # Now rename the file to the real destination. >+ $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" >+ fi || { (exit 1); exit; } > done >-fi >- >-if [ x"$dir_arg" != x ] >-then >- $doit $instcmd "$dst" && >- >- if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && >- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && >- if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && >- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi >-else >- >-# If we're going to rename the final executable, determine the name now. >- >- if [ x"$transformarg" = x ] >- then >- dstfile=`basename "$dst"` >- else >- dstfile=`basename "$dst" $transformbasename | >- sed $transformarg`$transformbasename >- fi >- >-# don't allow the sed command to completely eliminate the filename >- >- if [ x"$dstfile" = x ] >- then >- dstfile=`basename "$dst"` >- else >- : >- fi >- >-# Make a couple of temp file names in the proper directory. >- >- dsttmp=$dstdir/_inst.$$_ >- rmtmp=$dstdir/_rm.$$_ >- >-# Trap to clean up temp files at exit. >- >- trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 >- trap '(exit $?); exit' 1 2 13 15 >- >-# Move or copy the file name to the temp name >- >- $doit $instcmd "$src" "$dsttmp" && >- >-# and set any options; do chmod last to preserve setuid bits >- >-# If any of these fail, we abort the whole thing. If we want to >-# ignore errors from any of these, just make sure not to ignore >-# errors from the above "$doit $instcmd $src $dsttmp" command. >- >- if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && >- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && >- if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && >- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && >- >-# Now remove or move aside any old file at destination location. We try this >-# two ways since rm can't unlink itself on some systems and the destination >-# file might be busy for other reasons. In this case, the final cleanup >-# might fail but the new file should still install successfully. >- >-{ >- if [ -f "$dstdir/$dstfile" ] >- then >- $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || >- $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || >- { >- echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 >- (exit 1); exit >- } >- else >- : >- fi >-} && >- >-# Now rename the file to the real destination. >- >- $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" >- >-fi && > > # The final little trick to "correctly" pass the exit status to the exit trap. >- > { >- (exit 0); exit >+ (exit 0); exit > } >+ >+# Local variables: >+# eval: (add-hook 'write-file-hooks 'time-stamp) >+# time-stamp-start: "scriptversion=" >+# time-stamp-format: "%:y-%02m-%02d.%02H" >+# time-stamp-end: "$" >+# End: >diff -ruN valgrind-2.1.0/lackey/.cvsignore valgrind/lackey/.cvsignore >--- valgrind-2.1.0/lackey/.cvsignore 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/lackey/.cvsignore 2002-09-23 06:36:33.000000000 -0500 >@@ -0,0 +1,2 @@ >+Makefile.in >+Makefile >diff -ruN valgrind-2.1.0/lackey/CVS/Entries valgrind/lackey/CVS/Entries >--- valgrind-2.1.0/lackey/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/lackey/CVS/Entries 2004-02-11 22:51:46.367763272 -0600 >@@ -0,0 +1,4 @@ >+/.cvsignore/1.1/Mon Sep 23 11:36:33 2002// >+/Makefile.am/1.42/Tue Dec 16 02:05:14 2003// >+/lk_main.c/1.23/Sun Jan 4 16:43:22 2004// >+D >diff -ruN valgrind-2.1.0/lackey/CVS/Entries.Log valgrind/lackey/CVS/Entries.Log >--- valgrind-2.1.0/lackey/CVS/Entries.Log 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/lackey/CVS/Entries.Log 2004-02-11 22:51:46.380761296 -0600 >@@ -0,0 +1,2 @@ >+A D/docs//// >+A D/tests//// >diff -ruN valgrind-2.1.0/lackey/CVS/Repository valgrind/lackey/CVS/Repository >--- valgrind-2.1.0/lackey/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/lackey/CVS/Repository 2004-02-11 22:51:46.350765856 -0600 >@@ -0,0 +1 @@ >+valgrind/lackey >diff -ruN valgrind-2.1.0/lackey/CVS/Root valgrind/lackey/CVS/Root >--- valgrind-2.1.0/lackey/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/lackey/CVS/Root 2004-02-11 22:51:46.350765856 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/lackey/Makefile.am valgrind/lackey/Makefile.am >--- valgrind-2.1.0/lackey/Makefile.am 2003-06-12 09:12:57.000000000 -0500 >+++ valgrind/lackey/Makefile.am 2003-12-15 20:05:14.000000000 -0600 >@@ -6,9 +6,15 @@ > @PREFERRED_STACK_BOUNDARY@ -g > > valdir = $(libdir)/valgrind >+inplacedir = $(top_srcdir)/.in_place > > val_PROGRAMS = vgskin_lackey.so > > vgskin_lackey_so_SOURCES = lk_main.c > vgskin_lackey_so_LDFLAGS = -shared > >+ >+all-local: >+ mkdir -p $(inplacedir) >+ -rm -f $(inplacedir)/$(val_PROGRAMS) >+ ln -f -s $(top_srcdir)/$(subdir)/$(val_PROGRAMS) $(inplacedir)/$(val_PROGRAMS) >diff -ruN valgrind-2.1.0/lackey/Makefile.in valgrind/lackey/Makefile.in >--- valgrind-2.1.0/lackey/Makefile.in 2003-12-14 09:50:16.000000000 -0600 >+++ valgrind/lackey/Makefile.in 2004-02-11 22:52:33.233638576 -0600 >@@ -1,8 +1,8 @@ >-# Makefile.in generated by automake 1.7.6 from Makefile.am. >+# Makefile.in generated by automake 1.8.2 from Makefile.am. > # @configure_input@ > >-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 >-# Free Software Foundation, Inc. >+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, >+# 2003, 2004 Free Software Foundation, Inc. > # This Makefile.in is free software; the Free Software Foundation > # gives unlimited permission to copy and/or distribute it, > # with or without modifications, as long as this notice is preserved. >@@ -14,6 +14,8 @@ > > @SET_MAKE@ > >+SOURCES = $(vgskin_lackey_so_SOURCES) >+ > srcdir = @srcdir@ > top_srcdir = @top_srcdir@ > VPATH = @srcdir@ >@@ -21,7 +23,6 @@ > pkglibdir = $(libdir)/@PACKAGE@ > pkgincludedir = $(includedir)/@PACKAGE@ > top_builddir = .. >- > am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd > INSTALL = @INSTALL@ > install_sh_DATA = $(install_sh) -c -m 644 >@@ -36,6 +37,42 @@ > PRE_UNINSTALL = : > POST_UNINSTALL = : > host_triplet = @host@ >+val_PROGRAMS = vgskin_lackey.so$(EXEEXT) >+subdir = lackey >+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in >+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >+am__aclocal_m4_deps = $(top_srcdir)/configure.in >+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ >+ $(ACLOCAL_M4) >+mkinstalldirs = $(mkdir_p) >+CONFIG_HEADER = $(top_builddir)/config.h >+CONFIG_CLEAN_FILES = >+am__installdirs = $(DESTDIR)$(valdir) >+valPROGRAMS_INSTALL = $(INSTALL_PROGRAM) >+PROGRAMS = $(val_PROGRAMS) >+am_vgskin_lackey_so_OBJECTS = lk_main.$(OBJEXT) >+vgskin_lackey_so_OBJECTS = $(am_vgskin_lackey_so_OBJECTS) >+vgskin_lackey_so_LDADD = $(LDADD) >+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) >+depcomp = $(SHELL) $(top_srcdir)/depcomp >+am__depfiles_maybe = depfiles >+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/lk_main.Po >+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ >+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) >+CCLD = $(CC) >+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ >+SOURCES = $(vgskin_lackey_so_SOURCES) >+DIST_SOURCES = $(vgskin_lackey_so_SOURCES) >+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ >+ html-recursive info-recursive install-data-recursive \ >+ install-exec-recursive install-info-recursive \ >+ install-recursive installcheck-recursive installdirs-recursive \ >+ pdf-recursive ps-recursive uninstall-info-recursive \ >+ uninstall-recursive >+ETAGS = etags >+CTAGS = ctags >+DIST_SUBDIRS = $(SUBDIRS) >+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) > ACLOCAL = @ACLOCAL@ > AMDEP_FALSE = @AMDEP_FALSE@ > AMDEP_TRUE = @AMDEP_TRUE@ >@@ -92,6 +129,7 @@ > SHELL = @SHELL@ > STRIP = @STRIP@ > VERSION = @VERSION@ >+VG_PLATFORM = @VG_PLATFORM@ > ac_ct_CC = @ac_ct_CC@ > ac_ct_CXX = @ac_ct_CXX@ > ac_ct_RANLIB = @ac_ct_RANLIB@ >@@ -123,6 +161,7 @@ > libexecdir = @libexecdir@ > localstatedir = @localstatedir@ > mandir = @mandir@ >+mkdir_p = @mkdir_p@ > oldincludedir = @oldincludedir@ > prefix = @prefix@ > program_transform_name = @program_transform_name@ >@@ -130,65 +169,51 @@ > sharedstatedir = @sharedstatedir@ > sysconfdir = @sysconfdir@ > target_alias = @target_alias@ >- > SUBDIRS = . docs tests >- > AM_CPPFLAGS = -I$(top_srcdir)/include -DVG_LIBDIR="\"$(libdir)"\" > AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer \ > @PREFERRED_STACK_BOUNDARY@ -g > >- > valdir = $(libdir)/valgrind >- >-val_PROGRAMS = vgskin_lackey.so >- >+inplacedir = $(top_srcdir)/.in_place > vgskin_lackey_so_SOURCES = lk_main.c > vgskin_lackey_so_LDFLAGS = -shared >-subdir = lackey >-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs >-CONFIG_HEADER = $(top_builddir)/config.h >-CONFIG_CLEAN_FILES = >-val_PROGRAMS = vgskin_lackey.so$(EXEEXT) >-PROGRAMS = $(val_PROGRAMS) >- >-am_vgskin_lackey_so_OBJECTS = lk_main.$(OBJEXT) >-vgskin_lackey_so_OBJECTS = $(am_vgskin_lackey_so_OBJECTS) >-vgskin_lackey_so_LDADD = $(LDADD) >-vgskin_lackey_so_DEPENDENCIES = >- >-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) >-depcomp = $(SHELL) $(top_srcdir)/depcomp >-am__depfiles_maybe = depfiles >-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/lk_main.Po >-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ >- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) >-CCLD = $(CC) >-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ >-DIST_SOURCES = $(vgskin_lackey_so_SOURCES) >- >-RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ >- ps-recursive install-info-recursive uninstall-info-recursive \ >- all-recursive install-data-recursive install-exec-recursive \ >- installdirs-recursive install-recursive uninstall-recursive \ >- check-recursive installcheck-recursive >-DIST_COMMON = Makefile.am Makefile.in >-DIST_SUBDIRS = $(SUBDIRS) >-SOURCES = $(vgskin_lackey_so_SOURCES) >- > all: all-recursive > > .SUFFIXES: > .SUFFIXES: .c .o .obj >-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) >+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) >+ @for dep in $?; do \ >+ case '$(am__configure_deps)' in \ >+ *$$dep*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ >+ && exit 0; \ >+ exit 1;; \ >+ esac; \ >+ done; \ >+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lackey/Makefile'; \ > cd $(top_srcdir) && \ > $(AUTOMAKE) --gnu lackey/Makefile >-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status >- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) >-valPROGRAMS_INSTALL = $(INSTALL_PROGRAM) >+.PRECIOUS: Makefile >+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status >+ @case '$?' in \ >+ *config.status*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ >+ *) \ >+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ >+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ >+ esac; >+ >+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+ >+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh > install-valPROGRAMS: $(val_PROGRAMS) > @$(NORMAL_INSTALL) >- $(mkinstalldirs) $(DESTDIR)$(valdir) >+ $(mkdir_p) $(DESTDIR)$(valdir) > @list='$(val_PROGRAMS)'; for p in $$list; do \ > p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ > if test -f $$p \ >@@ -214,37 +239,28 @@ > $(LINK) $(vgskin_lackey_so_LDFLAGS) $(vgskin_lackey_so_OBJECTS) $(vgskin_lackey_so_LDADD) $(LIBS) > > mostlyclean-compile: >- -rm -f *.$(OBJEXT) core *.core >+ -rm -f *.$(OBJEXT) > > distclean-compile: > -rm -f *.tab.c > > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lk_main.Po@am__quote@ > >-distclean-depend: >- -rm -rf ./$(DEPDIR) >- > .c.o: >-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ >-@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ >-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ >-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ >-@am__fastdepCC_TRUE@ fi >+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ >+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi > @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >-@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< >+@am__fastdepCC_FALSE@ $(COMPILE) -c $< > > .c.obj: >-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ >-@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ >-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ >-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ >-@am__fastdepCC_TRUE@ fi >+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ >+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi > @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >-@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` >+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` > uninstall-info-am: > > # This directory's subdirectories are mostly independent; you can cd >@@ -306,14 +322,6 @@ > test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ > done > >-ETAGS = etags >-ETAGSFLAGS = >- >-CTAGS = ctags >-CTAGSFLAGS = >- >-tags: TAGS >- > ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) > list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ > unique=`for i in $$list; do \ >@@ -322,6 +330,7 @@ > $(AWK) ' { files[$$0] = 1; } \ > END { for (i in files) print i; }'`; \ > mkid -fID $$unique >+tags: TAGS > > TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ > $(TAGS_FILES) $(LISP) >@@ -347,7 +356,6 @@ > test -z "$(ETAGS_ARGS)$$tags$$unique" \ > || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ > $$tags $$unique >- > ctags: CTAGS > CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ > $(TAGS_FILES) $(LISP) >@@ -370,10 +378,6 @@ > > distclean-tags: > -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags >-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) >- >-top_distdir = .. >-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) > > distdir: $(DISTFILES) > @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ >@@ -387,7 +391,7 @@ > dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ > if test "$$dir" != "$$file" && test "$$dir" != "."; then \ > dir="/$$dir"; \ >- $(mkinstalldirs) "$(distdir)$$dir"; \ >+ $(mkdir_p) "$(distdir)$$dir"; \ > else \ > dir=''; \ > fi; \ >@@ -404,24 +408,23 @@ > done > list='$(SUBDIRS)'; for subdir in $$list; do \ > if test "$$subdir" = .; then :; else \ >- test -d $(distdir)/$$subdir \ >- || mkdir $(distdir)/$$subdir \ >+ test -d "$(distdir)/$$subdir" \ >+ || mkdir "$(distdir)/$$subdir" \ > || exit 1; \ > (cd $$subdir && \ > $(MAKE) $(AM_MAKEFLAGS) \ >- top_distdir="$(top_distdir)" \ >- distdir=../$(distdir)/$$subdir \ >+ top_distdir="../$(top_distdir)" \ >+ distdir="../$(distdir)/$$subdir" \ > distdir) \ > || exit 1; \ > fi; \ > done > check-am: all-am > check: check-recursive >-all-am: Makefile $(PROGRAMS) >+all-am: Makefile $(PROGRAMS) all-local > installdirs: installdirs-recursive > installdirs-am: >- $(mkinstalldirs) $(DESTDIR)$(valdir) >- >+ $(mkdir_p) $(DESTDIR)$(valdir) > install: install-recursive > install-exec: install-exec-recursive > install-data: install-data-recursive >@@ -433,7 +436,7 @@ > installcheck: installcheck-recursive > install-strip: > $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ >- INSTALL_STRIP_FLAG=-s \ >+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ > `test -z '$(STRIP)' || \ > echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install > mostlyclean-generic: >@@ -441,7 +444,7 @@ > clean-generic: > > distclean-generic: >- -rm -f Makefile $(CONFIG_CLEAN_FILES) >+ -rm -f $(CONFIG_CLEAN_FILES) > > maintainer-clean-generic: > @echo "This command is intended for maintainers to use" >@@ -451,14 +454,17 @@ > clean-am: clean-generic clean-valPROGRAMS mostlyclean-am > > distclean: distclean-recursive >- >-distclean-am: clean-am distclean-compile distclean-depend \ >- distclean-generic distclean-tags >+ -rm -rf ./$(DEPDIR) >+ -rm -f Makefile >+distclean-am: clean-am distclean-compile distclean-generic \ >+ distclean-tags > > dvi: dvi-recursive > > dvi-am: > >+html: html-recursive >+ > info: info-recursive > > info-am: >@@ -474,7 +480,8 @@ > installcheck-am: > > maintainer-clean: maintainer-clean-recursive >- >+ -rm -rf ./$(DEPDIR) >+ -rm -f Makefile > maintainer-clean-am: distclean-am maintainer-clean-generic > > mostlyclean: mostlyclean-recursive >@@ -493,24 +500,25 @@ > > uninstall-info: uninstall-info-recursive > >-.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ >- clean-generic clean-recursive clean-valPROGRAMS ctags \ >- ctags-recursive distclean distclean-compile distclean-depend \ >+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am all-local check \ >+ check-am clean clean-generic clean-recursive clean-valPROGRAMS \ >+ ctags ctags-recursive distclean distclean-compile \ > distclean-generic distclean-recursive distclean-tags distdir \ >- dvi dvi-am dvi-recursive info info-am info-recursive install \ >- install-am install-data install-data-am install-data-recursive \ >- install-exec install-exec-am install-exec-recursive \ >- install-info install-info-am install-info-recursive install-man \ >- install-recursive install-strip install-valPROGRAMS \ >- installcheck installcheck-am installdirs installdirs-am \ >- installdirs-recursive maintainer-clean maintainer-clean-generic \ >+ dvi dvi-am html html-am info info-am install install-am \ >+ install-data install-data-am install-exec install-exec-am \ >+ install-info install-info-am install-man install-strip \ >+ install-valPROGRAMS installcheck installcheck-am installdirs \ >+ installdirs-am maintainer-clean maintainer-clean-generic \ > maintainer-clean-recursive mostlyclean mostlyclean-compile \ >- mostlyclean-generic mostlyclean-recursive pdf pdf-am \ >- pdf-recursive ps ps-am ps-recursive tags tags-recursive \ >- uninstall uninstall-am uninstall-info-am \ >- uninstall-info-recursive uninstall-recursive \ >+ mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \ >+ tags tags-recursive uninstall uninstall-am uninstall-info-am \ > uninstall-valPROGRAMS > >+ >+all-local: >+ mkdir -p $(inplacedir) >+ -rm -f $(inplacedir)/$(val_PROGRAMS) >+ ln -f -s $(top_srcdir)/$(subdir)/$(val_PROGRAMS) $(inplacedir)/$(val_PROGRAMS) > # Tell versions [3.59,3.63) of GNU make to not export all variables. > # Otherwise a system limit (for SysV at least) may be exceeded. > .NOEXPORT: >diff -ruN valgrind-2.1.0/lackey/docs/.cvsignore valgrind/lackey/docs/.cvsignore >--- valgrind-2.1.0/lackey/docs/.cvsignore 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/lackey/docs/.cvsignore 2002-10-03 05:07:34.000000000 -0500 >@@ -0,0 +1,2 @@ >+Makefile.in >+Makefile >diff -ruN valgrind-2.1.0/lackey/docs/CVS/Entries valgrind/lackey/docs/CVS/Entries >--- valgrind-2.1.0/lackey/docs/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/lackey/docs/CVS/Entries 2004-02-11 22:51:46.380761296 -0600 >@@ -0,0 +1,4 @@ >+/.cvsignore/1.1/Thu Oct 3 10:07:34 2002// >+/Makefile.am/1.2/Wed Nov 13 21:24:56 2002// >+/lk_main.html/1.4/Sun Jan 4 16:43:22 2004// >+D >diff -ruN valgrind-2.1.0/lackey/docs/CVS/Repository valgrind/lackey/docs/CVS/Repository >--- valgrind-2.1.0/lackey/docs/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/lackey/docs/CVS/Repository 2004-02-11 22:51:46.368763120 -0600 >@@ -0,0 +1 @@ >+valgrind/lackey/docs >diff -ruN valgrind-2.1.0/lackey/docs/CVS/Root valgrind/lackey/docs/CVS/Root >--- valgrind-2.1.0/lackey/docs/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/lackey/docs/CVS/Root 2004-02-11 22:51:46.368763120 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/lackey/docs/Makefile.in valgrind/lackey/docs/Makefile.in >--- valgrind-2.1.0/lackey/docs/Makefile.in 2003-12-14 09:50:16.000000000 -0600 >+++ valgrind/lackey/docs/Makefile.in 2004-02-11 22:52:33.378616536 -0600 >@@ -1,8 +1,8 @@ >-# Makefile.in generated by automake 1.7.6 from Makefile.am. >+# Makefile.in generated by automake 1.8.2 from Makefile.am. > # @configure_input@ > >-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 >-# Free Software Foundation, Inc. >+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, >+# 2003, 2004 Free Software Foundation, Inc. > # This Makefile.in is free software; the Free Software Foundation > # gives unlimited permission to copy and/or distribute it, > # with or without modifications, as long as this notice is preserved. >@@ -21,7 +21,6 @@ > pkglibdir = $(libdir)/@PACKAGE@ > pkgincludedir = $(includedir)/@PACKAGE@ > top_builddir = ../.. >- > am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd > INSTALL = @INSTALL@ > install_sh_DATA = $(install_sh) -c -m 644 >@@ -36,6 +35,21 @@ > PRE_UNINSTALL = : > POST_UNINSTALL = : > host_triplet = @host@ >+subdir = lackey/docs >+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in >+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >+am__aclocal_m4_deps = $(top_srcdir)/configure.in >+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ >+ $(ACLOCAL_M4) >+mkinstalldirs = $(mkdir_p) >+CONFIG_HEADER = $(top_builddir)/config.h >+CONFIG_CLEAN_FILES = >+SOURCES = >+DIST_SOURCES = >+am__installdirs = $(DESTDIR)$(docdir) >+docDATA_INSTALL = $(INSTALL_DATA) >+DATA = $(doc_DATA) >+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) > ACLOCAL = @ACLOCAL@ > AMDEP_FALSE = @AMDEP_FALSE@ > AMDEP_TRUE = @AMDEP_TRUE@ >@@ -92,6 +106,7 @@ > SHELL = @SHELL@ > STRIP = @STRIP@ > VERSION = @VERSION@ >+VG_PLATFORM = @VG_PLATFORM@ > ac_ct_CC = @ac_ct_CC@ > ac_ct_CXX = @ac_ct_CXX@ > ac_ct_RANLIB = @ac_ct_RANLIB@ >@@ -123,6 +138,7 @@ > libexecdir = @libexecdir@ > localstatedir = @localstatedir@ > mandir = @mandir@ >+mkdir_p = @mkdir_p@ > oldincludedir = @oldincludedir@ > prefix = @prefix@ > program_transform_name = @program_transform_name@ >@@ -131,32 +147,44 @@ > sysconfdir = @sysconfdir@ > target_alias = @target_alias@ > docdir = $(datadir)/doc/valgrind >- > doc_DATA = lk_main.html >- > EXTRA_DIST = $(doc_DATA) >-subdir = lackey/docs >-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs >-CONFIG_HEADER = $(top_builddir)/config.h >-CONFIG_CLEAN_FILES = >-DIST_SOURCES = >-DATA = $(doc_DATA) >- >-DIST_COMMON = Makefile.am Makefile.in > all: all-am > > .SUFFIXES: >-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) >+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) >+ @for dep in $?; do \ >+ case '$(am__configure_deps)' in \ >+ *$$dep*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ >+ && exit 0; \ >+ exit 1;; \ >+ esac; \ >+ done; \ >+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lackey/docs/Makefile'; \ > cd $(top_srcdir) && \ > $(AUTOMAKE) --gnu lackey/docs/Makefile >-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status >- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) >+.PRECIOUS: Makefile >+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status >+ @case '$?' in \ >+ *config.status*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ >+ *) \ >+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ >+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ >+ esac; >+ >+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+ >+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh > uninstall-info-am: >-docDATA_INSTALL = $(INSTALL_DATA) > install-docDATA: $(doc_DATA) > @$(NORMAL_INSTALL) >- $(mkinstalldirs) $(DESTDIR)$(docdir) >+ $(mkdir_p) $(DESTDIR)$(docdir) > @list='$(doc_DATA)'; for p in $$list; do \ > if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ > f="`echo $$p | sed -e 's|^.*/||'`"; \ >@@ -177,10 +205,6 @@ > ctags: CTAGS > CTAGS: > >-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) >- >-top_distdir = ../.. >-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) > > distdir: $(DISTFILES) > @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ >@@ -194,7 +218,7 @@ > dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ > if test "$$dir" != "$$file" && test "$$dir" != "."; then \ > dir="/$$dir"; \ >- $(mkinstalldirs) "$(distdir)$$dir"; \ >+ $(mkdir_p) "$(distdir)$$dir"; \ > else \ > dir=''; \ > fi; \ >@@ -212,9 +236,8 @@ > check-am: all-am > check: check-am > all-am: Makefile $(DATA) >- > installdirs: >- $(mkinstalldirs) $(DESTDIR)$(docdir) >+ $(mkdir_p) $(DESTDIR)$(docdir) > install: install-am > install-exec: install-exec-am > install-data: install-data-am >@@ -226,7 +249,7 @@ > installcheck: installcheck-am > install-strip: > $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ >- INSTALL_STRIP_FLAG=-s \ >+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ > `test -z '$(STRIP)' || \ > echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install > mostlyclean-generic: >@@ -234,7 +257,7 @@ > clean-generic: > > distclean-generic: >- -rm -f Makefile $(CONFIG_CLEAN_FILES) >+ -rm -f $(CONFIG_CLEAN_FILES) > > maintainer-clean-generic: > @echo "This command is intended for maintainers to use" >@@ -244,13 +267,15 @@ > clean-am: clean-generic mostlyclean-am > > distclean: distclean-am >- >+ -rm -f Makefile > distclean-am: clean-am distclean-generic > > dvi: dvi-am > > dvi-am: > >+html: html-am >+ > info: info-am > > info-am: >@@ -266,7 +291,7 @@ > installcheck-am: > > maintainer-clean: maintainer-clean-am >- >+ -rm -f Makefile > maintainer-clean-am: distclean-am maintainer-clean-generic > > mostlyclean: mostlyclean-am >@@ -284,13 +309,14 @@ > uninstall-am: uninstall-docDATA uninstall-info-am > > .PHONY: all all-am check check-am clean clean-generic distclean \ >- distclean-generic distdir dvi dvi-am info info-am install \ >- install-am install-data install-data-am install-docDATA \ >- install-exec install-exec-am install-info install-info-am \ >- install-man install-strip installcheck installcheck-am \ >- installdirs maintainer-clean maintainer-clean-generic \ >- mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ >- uninstall-am uninstall-docDATA uninstall-info-am >+ distclean-generic distdir dvi dvi-am html html-am info info-am \ >+ install install-am install-data install-data-am \ >+ install-docDATA install-exec install-exec-am install-info \ >+ install-info-am install-man install-strip installcheck \ >+ installcheck-am installdirs maintainer-clean \ >+ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ >+ pdf-am ps ps-am uninstall uninstall-am uninstall-docDATA \ >+ uninstall-info-am > > # Tell versions [3.59,3.63) of GNU make to not export all variables. > # Otherwise a system limit (for SysV at least) may be exceeded. >diff -ruN valgrind-2.1.0/lackey/docs/lk_main.html valgrind/lackey/docs/lk_main.html >--- valgrind-2.1.0/lackey/docs/lk_main.html 2003-11-14 11:47:53.000000000 -0600 >+++ valgrind/lackey/docs/lk_main.html 2004-01-04 10:43:22.000000000 -0600 >@@ -31,7 +31,7 @@ > > <center> > <a href="mailto:njn25@cam.ac.uk">njn25@cam.ac.uk</a><br> >-Copyright © 2000-2003 Nicholas Nethercote >+Copyright © 2002-2004 Nicholas Nethercote > <p> > Lackey is licensed under the GNU General Public License, > version 2<br> >diff -ruN valgrind-2.1.0/lackey/lk_main.c valgrind/lackey/lk_main.c >--- valgrind-2.1.0/lackey/lk_main.c 2003-11-20 10:20:55.000000000 -0600 >+++ valgrind/lackey/lk_main.c 2004-01-04 10:43:22.000000000 -0600 >@@ -8,7 +8,7 @@ > This file is part of Lackey, an example Valgrind tool that does > some simple program measurement. > >- Copyright (C) 2002-2003 Nicholas Nethercote >+ Copyright (C) 2002-2004 Nicholas Nethercote > njn25@cam.ac.uk > > This program is free software; you can redistribute it and/or >@@ -31,8 +31,6 @@ > > #include "vg_skin.h" > >-VG_DETERMINE_INTERFACE_VERSION >- > /* Nb: use ULongs because the numbers can get very big */ > static ULong n_dlrr_calls = 0; > static ULong n_BBs = 0; >@@ -80,7 +78,7 @@ > VG_(details_version) (NULL); > VG_(details_description) ("an example Valgrind tool"); > VG_(details_copyright_author)( >- "Copyright (C) 2002-2003, and GNU GPL'd, by Nicholas Nethercote."); >+ "Copyright (C) 2002-2004, and GNU GPL'd, by Nicholas Nethercote."); > VG_(details_bug_reports_to) (VG_BUGS_TO); > VG_(details_avg_translation_sizeB) ( 175 ); > >@@ -224,6 +222,9 @@ > VG_(message)(Vg_UserMsg, "Exit code: %d", exitcode); > } > >+VG_DETERMINE_INTERFACE_VERSION(SK_(pre_clo_init), 0) >+ >+ > /*--------------------------------------------------------------------*/ > /*--- end lk_main.c ---*/ > /*--------------------------------------------------------------------*/ >diff -ruN valgrind-2.1.0/lackey/tests/.cvsignore valgrind/lackey/tests/.cvsignore >--- valgrind-2.1.0/lackey/tests/.cvsignore 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/lackey/tests/.cvsignore 2002-10-04 06:35:47.000000000 -0500 >@@ -0,0 +1,2 @@ >+Makefile.in >+Makefile >diff -ruN valgrind-2.1.0/lackey/tests/CVS/Entries valgrind/lackey/tests/CVS/Entries >--- valgrind-2.1.0/lackey/tests/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/lackey/tests/CVS/Entries 2004-02-11 22:51:46.384760688 -0600 >@@ -0,0 +1,6 @@ >+/.cvsignore/1.1/Fri Oct 4 11:35:47 2002// >+/Makefile.am/1.3/Thu Jun 12 14:12:58 2003// >+/filter_stderr/1.2/Tue Apr 22 21:41:38 2003// >+/true.stderr.exp/1.1/Fri Oct 4 11:35:47 2002// >+/true.vgtest/1.1/Fri Oct 4 11:35:47 2002// >+D >diff -ruN valgrind-2.1.0/lackey/tests/CVS/Repository valgrind/lackey/tests/CVS/Repository >--- valgrind-2.1.0/lackey/tests/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/lackey/tests/CVS/Repository 2004-02-11 22:51:46.380761296 -0600 >@@ -0,0 +1 @@ >+valgrind/lackey/tests >diff -ruN valgrind-2.1.0/lackey/tests/CVS/Root valgrind/lackey/tests/CVS/Root >--- valgrind-2.1.0/lackey/tests/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/lackey/tests/CVS/Root 2004-02-11 22:51:46.380761296 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/lackey/tests/Makefile.in valgrind/lackey/tests/Makefile.in >--- valgrind-2.1.0/lackey/tests/Makefile.in 2003-12-14 09:50:17.000000000 -0600 >+++ valgrind/lackey/tests/Makefile.in 2004-02-11 22:52:33.520594952 -0600 >@@ -1,8 +1,8 @@ >-# Makefile.in generated by automake 1.7.6 from Makefile.am. >+# Makefile.in generated by automake 1.8.2 from Makefile.am. > # @configure_input@ > >-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 >-# Free Software Foundation, Inc. >+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, >+# 2003, 2004 Free Software Foundation, Inc. > # This Makefile.in is free software; the Free Software Foundation > # gives unlimited permission to copy and/or distribute it, > # with or without modifications, as long as this notice is preserved. >@@ -21,7 +21,6 @@ > pkglibdir = $(libdir)/@PACKAGE@ > pkgincludedir = $(includedir)/@PACKAGE@ > top_builddir = ../.. >- > am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd > INSTALL = @INSTALL@ > install_sh_DATA = $(install_sh) -c -m 644 >@@ -36,6 +35,19 @@ > PRE_UNINSTALL = : > POST_UNINSTALL = : > host_triplet = @host@ >+subdir = lackey/tests >+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in >+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >+am__aclocal_m4_deps = $(top_srcdir)/configure.in >+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ >+ $(ACLOCAL_M4) >+mkinstalldirs = $(mkdir_p) >+CONFIG_HEADER = $(top_builddir)/config.h >+CONFIG_CLEAN_FILES = >+SCRIPTS = $(noinst_SCRIPTS) >+SOURCES = >+DIST_SOURCES = >+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) > ACLOCAL = @ACLOCAL@ > AMDEP_FALSE = @AMDEP_FALSE@ > AMDEP_TRUE = @AMDEP_TRUE@ >@@ -92,6 +104,7 @@ > SHELL = @SHELL@ > STRIP = @STRIP@ > VERSION = @VERSION@ >+VG_PLATFORM = @VG_PLATFORM@ > ac_ct_CC = @ac_ct_CC@ > ac_ct_CXX = @ac_ct_CXX@ > ac_ct_RANLIB = @ac_ct_RANLIB@ >@@ -123,6 +136,7 @@ > libexecdir = @libexecdir@ > localstatedir = @localstatedir@ > mandir = @mandir@ >+mkdir_p = @mkdir_p@ > oldincludedir = @oldincludedir@ > prefix = @prefix@ > program_transform_name = @program_transform_name@ >@@ -131,27 +145,41 @@ > sysconfdir = @sysconfdir@ > target_alias = @target_alias@ > noinst_SCRIPTS = filter_stderr >- > EXTRA_DIST = $(noinst_SCRIPTS) \ > true.stderr.exp true.vgtest > >-subdir = lackey/tests >-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs >-CONFIG_HEADER = $(top_builddir)/config.h >-CONFIG_CLEAN_FILES = >-SCRIPTS = $(noinst_SCRIPTS) >- >-DIST_SOURCES = >-DIST_COMMON = Makefile.am Makefile.in > all: all-am > > .SUFFIXES: >-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) >+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) >+ @for dep in $?; do \ >+ case '$(am__configure_deps)' in \ >+ *$$dep*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ >+ && exit 0; \ >+ exit 1;; \ >+ esac; \ >+ done; \ >+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lackey/tests/Makefile'; \ > cd $(top_srcdir) && \ > $(AUTOMAKE) --gnu lackey/tests/Makefile >-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status >- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) >+.PRECIOUS: Makefile >+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status >+ @case '$?' in \ >+ *config.status*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ >+ *) \ >+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ >+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ >+ esac; >+ >+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+ >+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh > uninstall-info-am: > tags: TAGS > TAGS: >@@ -159,10 +187,6 @@ > ctags: CTAGS > CTAGS: > >-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) >- >-top_distdir = ../.. >-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) > > distdir: $(DISTFILES) > @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ >@@ -176,7 +200,7 @@ > dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ > if test "$$dir" != "$$file" && test "$$dir" != "."; then \ > dir="/$$dir"; \ >- $(mkinstalldirs) "$(distdir)$$dir"; \ >+ $(mkdir_p) "$(distdir)$$dir"; \ > else \ > dir=''; \ > fi; \ >@@ -194,7 +218,6 @@ > check-am: all-am > check: check-am > all-am: Makefile $(SCRIPTS) >- > installdirs: > install: install-am > install-exec: install-exec-am >@@ -207,7 +230,7 @@ > installcheck: installcheck-am > install-strip: > $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ >- INSTALL_STRIP_FLAG=-s \ >+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ > `test -z '$(STRIP)' || \ > echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install > mostlyclean-generic: >@@ -215,7 +238,7 @@ > clean-generic: > > distclean-generic: >- -rm -f Makefile $(CONFIG_CLEAN_FILES) >+ -rm -f $(CONFIG_CLEAN_FILES) > > maintainer-clean-generic: > @echo "This command is intended for maintainers to use" >@@ -225,13 +248,15 @@ > clean-am: clean-generic mostlyclean-am > > distclean: distclean-am >- >+ -rm -f Makefile > distclean-am: clean-am distclean-generic > > dvi: dvi-am > > dvi-am: > >+html: html-am >+ > info: info-am > > info-am: >@@ -247,7 +272,7 @@ > installcheck-am: > > maintainer-clean: maintainer-clean-am >- >+ -rm -f Makefile > maintainer-clean-am: distclean-am maintainer-clean-generic > > mostlyclean: mostlyclean-am >@@ -265,8 +290,8 @@ > uninstall-am: uninstall-info-am > > .PHONY: all all-am check check-am clean clean-generic distclean \ >- distclean-generic distdir dvi dvi-am info info-am install \ >- install-am install-data install-data-am install-exec \ >+ distclean-generic distdir dvi dvi-am html html-am info info-am \ >+ install install-am install-data install-data-am install-exec \ > install-exec-am install-info install-info-am install-man \ > install-strip installcheck installcheck-am installdirs \ > maintainer-clean maintainer-clean-generic mostlyclean \ >diff -ruN valgrind-2.1.0/linux22.supp valgrind/linux22.supp >--- valgrind-2.1.0/linux22.supp 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/linux22.supp 2003-11-14 11:47:51.000000000 -0600 >@@ -0,0 +1,286 @@ >+ >+##----------------------------------------------------------------------## >+ >+# Errors to suppress by default on a RedHat 6.2 system >+# (glibc 2.1.3, XFree86 3.3.6) >+ >+# Format of this file is: >+# { >+# name_of_suppression >+# tool_name:supp_kind >+# (optional extra info for some suppression types) >+# caller0 name, or /name/of/so/file.so >+# caller1 name, or ditto >+# (optionally: caller2 name) >+# (optionally: caller3 name) >+# } >+# >+# For Memcheck, the supp_kinds are: >+# >+# Param Value1 Value2 Value4 Value8 Value16 >+# Free Addr1 Addr2 Addr4 Addr8 Addr16 >+# Cond (previously known as Value0) >+# >+# and the optional extra info is: >+# if Param: name of system call param >+# if Free: name of free-ing fn) >+ >+##----------------------------------------------------------------------## >+ >+{ >+ socketcall.connect(serv_addr)/__libc_connect/*(Param) >+ Addrcheck,Memcheck:Param >+ socketcall.connect(serv_addr) >+ fun:__libc_connect >+ fun:* >+} >+ >+{ >+ strrchr/_dl_map_object_from_fd/_dl_map_object(Addr4) >+ Addrcheck,Memcheck:Addr4 >+ fun:strrchr >+ fun:_dl_map_object_from_fd >+ fun:_dl_map_object >+} >+ >+{ >+ strrchr/_dl_map_object_from_fd/_dl_map_object(Value1) >+ Memcheck:Value1 >+ fun:strrchr >+ fun:_dl_map_object_from_fd >+ fun:_dl_map_object >+} >+ >+{ >+ llseek(result)/__libc_lseek64/_IO_file_seek(Param) >+ Addrcheck,Memcheck:Param >+ llseek(result) >+ fun:__libc_lseek64 >+ fun:_IO_file_seek >+} >+ >+{ >+ __rawmemchr/_nl_*/*locale(Addr4) >+ Addrcheck,Memcheck:Addr4 >+ fun:__rawmemchr >+ fun:_nl_* >+ fun:*locale >+} >+ >+# new ones for RH62 ls -l >+{ >+ __strchrnul/__nss_database_lookup(Cond) >+ Memcheck:Cond >+ fun:__strchrnul >+ fun:__nss_database_lookup >+} >+{ >+ __strchrnul/__gethostbyname_r(Cond) >+ Memcheck:Cond >+ fun:__strchrnul >+ fun:__gethostbyname_r >+} >+ >+{ >+ strrchr/_dl_map*/_dl_map*(Cond) >+ Memcheck:Cond >+ fun:strrchr >+ fun:_dl_map* >+ fun:_dl_map* >+} >+ >+{ >+ strchr/dl_open_worker/_dl_catch_error(Cond) >+ Memcheck:Cond >+ fun:strchr >+ fun:dl_open_worker >+ fun:_dl_catch_error >+} >+ >+{ >+ __rawmemchr/???/__getgrgid_r(Cond) >+ Memcheck:Cond >+ fun:__rawmemchr >+ fun:* >+ fun:__getgrgid_r >+} >+ >+{ >+ __rawmemchr/_nl_*/*locale*(Cond) >+ Memcheck:Cond >+ fun:__rawmemchr >+ fun:_nl_* >+ fun:*locale* >+} >+ >+{ >+ _dl_relocate_object/dl_open_worker(Value0) >+ Memcheck:Cond >+ fun:_dl_relocate_object >+ fun:dl_open_worker >+} >+ >+##----------------------------------------------------------------------## >+## from a Debian machine running kernel 2.2.19 I believe >+## I guess most of these are the same as above really, but >+## Debian stripped their libc-2.1.3 >+ >+{ >+ libc-2.1.3.so/libc-2.1.3.so/libc-2.1.3.so(Cond) >+ Memcheck:Cond >+ obj:*libc-2.1.3.so >+ obj:*libc-2.1.3.so >+ obj:*libc-2.1.3.so >+} >+ >+{ >+ strchr/libc-2.1.3.so(Cond) >+ Memcheck:Cond >+ fun:*strchr* >+ obj:*libc-2.1.3.so >+} >+ >+{ >+ libc-2.1.3.so/libXt.so(Cond) >+ Memcheck:Cond >+ obj:*libc-2.1.3.so >+ obj:*libXt.so* >+} >+ >+{ >+ socketcall.connect(serv_addr)/__libc_connect/*(Param) >+ Addrcheck,Memcheck:Param >+ socketcall.connect(serv_addr) >+ obj:*libc-2.1.3.so >+ obj:*libX11.so* >+} >+ >+ >+##----------------------------------------------------------------------## >+ >+{ >+ X11-Cond-0 >+ Memcheck:Cond >+ obj:*libXt.so.6.0 >+ obj:*libXt.so.6.0 >+ obj:*libXt.so.6.0 >+} >+{ >+ X11-Cond-1 >+ Memcheck:Cond >+ fun:__rawmemchr >+ obj:*libXt.so.6.0 >+ obj:*libXt.so.6.0 >+} >+ >+ >+# Suppressions for XFree86-3.3.X >+ >+{ >+ X11-Addr4-1 >+ Addrcheck,Memcheck:Addr4 >+ obj:/usr/X11R6/lib/libX11.so.6.1 >+ obj:/usr/X11R6/lib/libX11.so.6.1 >+ obj:/usr/X11R6/lib/libX11.so.6.1 >+} >+ >+{ >+ X11-Addr4-2 >+ Addrcheck,Memcheck:Addr4 >+ obj:/usr/X11R6/lib/libX11.so.6.1 >+ obj:/usr/X11R6/lib/libX11.so.6.1 >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+} >+ >+{ >+ X11-Addr4-3 >+ Addrcheck,Memcheck:Addr4 >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+} >+ >+{ >+ X11-Addr4-4 >+ Addrcheck,Memcheck:Addr4 >+ obj:/usr/X11R6/lib/libX11.so.6.1 >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+} >+ >+{ >+ X11-Addr4-5 >+ Addrcheck,Memcheck:Addr4 >+ fun:__rawmemchr >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+} >+ >+{ >+ X11-Addr4-6 >+ Addrcheck,Memcheck:Addr4 >+ obj:/usr/X11R6/lib/libXmu.so.6.0 >+ obj:/usr/X11R6/lib/libXmu.so.6.0 >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+} >+ >+{ >+ X11-Addr4-7 >+ Addrcheck,Memcheck:Addr4 >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+ obj:/usr/X11R6/lib/libXawXpm_posing_as_Xaw.so.6.1 >+} >+ >+{ >+ X11-Param-1 >+ Addrcheck,Memcheck:Param >+ write(buf) >+ fun:__libc_write >+ obj:/usr/X11R6/lib/libX11.so.6.1 >+ obj:/usr/X11R6/lib/libX11.so.6.1 >+} >+ >+{ >+ X11-Addr4-8 >+ Addrcheck,Memcheck:Addr4 >+ obj:/usr/X11R6/lib/libX11.so.6.1 >+ obj:/usr/X11R6/lib/libXpm.so.4.11 >+ obj:/usr/X11R6/lib/libXpm.so.4.11 >+} >+ >+{ >+ X11-Addr4-8 >+ Addrcheck,Memcheck:Addr4 >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+ obj:/usr/X11R6/lib/libXawXpm_posing_as_Xaw.so.6.1 >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+} >+ >+{ >+ X11-Addr4-9 >+ Addrcheck,Memcheck:Addr4 >+ obj:/usr/X11R6/lib/libXaw.so.6.1 >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+} >+ >+{ >+ X11-Addr4-10 >+ Addrcheck,Memcheck:Addr4 >+ obj:/usr/X11R6/lib/libXaw.so.6.1 >+ obj:/usr/X11R6/lib/libXaw.so.6.1 >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+} >+ >+{ >+ X11-Addr4-11 >+ Addrcheck,Memcheck:Addr4 >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+ obj:/usr/X11R6/lib/libXaw.so.6.1 >+} >+ >+ >+ >+##----------------------------------------------------------------------## >diff -ruN valgrind-2.1.0/linux24.supp valgrind/linux24.supp >--- valgrind-2.1.0/linux24.supp 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/linux24.supp 2003-11-14 11:47:51.000000000 -0600 >@@ -0,0 +1,304 @@ >+ >+##----------------------------------------------------------------------## >+ >+# Errors to suppress by default on a Linux kernel 2.4 system >+# (glibc 2.2.4, XFree86 4.1.0) >+ >+# Format of this file is: >+# { >+# name_of_suppression >+# tool_name:supp_kind >+# (optional extra info for some suppression types) >+# caller0 name, or /name/of/so/file.so >+# caller1 name, or ditto >+# (optionally: caller2 name) >+# (optionally: caller3 name) >+# } >+# >+# For memcheck, the supp_kinds are: >+# >+# Param Value1 Value2 Value4 Value8 Value16 >+# Free Addr1 Addr2 Addr4 Addr8 Addr16 >+# Cond (previously known as Value0) >+# >+# and the optional extra info is: >+# if Param: name of system call param >+# if Free: name of free-ing fn) >+ >+# even more glibc suppressions ? >+{ >+ libc-2.2.4.so/libc-2.2.4.so/libc-2.2.4.so(Cond) >+ memcheck:Cond >+ obj:*libc-2.2.4.so >+ obj:*libc-2.2.4.so >+ obj:*libc-2.2.4.so >+} >+{ >+ libc-2.2.4.so/libc-2.2.4.so/libc-2.2.4.so(Value4) >+ memcheck:Value4 >+ obj:*libc-2.2.4.so >+ obj:*libc-2.2.4.so >+ obj:*libc-2.2.4.so >+} >+ >+##### glibc 2.2.5 stuff perhaps? >+##### suppressions for coolo >+{ >+ strchr/dl_open_worker(Cond) >+ Memcheck:Cond >+ fun:strchr >+ fun:dl_open_worker >+} >+{ >+ __rawmemchr/internal_getgrgid_r(Cond) >+ Memcheck:Cond >+ fun:__rawmemchr >+ fun:internal_getgrgid_r >+} >+{ >+ _IO_vfprintf/__strnlen(Cond) >+ Memcheck:Cond >+ fun:__strnlen >+ fun:_IO_vfprintf >+} >+{ >+ __strchrnul/gethostbyname*(Cond) >+ Memcheck:Cond >+ fun:__strchrnul >+ fun:gethostbyname* >+} >+ >+ >+##---- >+{ >+ strlen/*dl_map_object*(Cond) >+ Memcheck:Cond >+ fun:strlen >+ fun:*dl_map_object* >+} >+ >+{ >+ strlen/*dl_open_worker*(Cond) >+ Memcheck:Cond >+ fun:strlen >+ fun:*dl_open_worker* >+} >+ >+{ >+ *rawmemchr*/*nss*(Cond) >+ Memcheck:Cond >+ fun:*rawmemchr* >+ fun:*nss* >+} >+ >+{ >+ *strchrnul*/*nss*(Cond) >+ Memcheck:Cond >+ fun:*strchrnul* >+ fun:*nss* >+} >+ >+ >+ >+# gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98) >+# on Red Hat 7.2 (x86) miscompiles __mpn_construct_double in >+# __mpn_construct_double (../sysdeps/ieee754/dbl-64/mpn2dbl.c:45) >+# (glibc-2.2.4) to read and write below %esp. Hence the following >+# two: >+{ >+ __mpn_construct_double/*(Addr4) >+ Addrcheck,Memcheck:Addr4 >+ fun:__mpn_construct_double >+ fun:* >+} >+{ >+ __mpn_construct_double/*(Addr8) >+ Addrcheck,Memcheck:Addr8 >+ fun:__mpn_construct_double >+ fun:* >+} >+ >+# More of the same (gcc bug, I'm pretty sure) >+{ >+ __fabs/*(Addr4) >+ Addrcheck,Memcheck:Addr4 >+ fun:__fabs >+ fun:* >+} >+{ >+ __fabs/*(Addr8) >+ Addrcheck,Memcheck:Addr8 >+ fun:__fabs >+ fun:* >+} >+ >+ >+# Not sure what this is about ... but anyway >+{ >+ pthread_sighandler/*(Addr4) >+ Addrcheck,Memcheck:Addr4 >+ fun:pthread_sighandler >+ fun:* >+} >+ >+ >+# More glibc stuff, AFAICS >+ >+{ >+ __strnlen/__argz_stringify/_nl_make_l10nflist(Cond) >+ Memcheck:Cond >+ fun:__strnlen >+ fun:__argz_stringify >+ fun:_nl_make_l10nflist >+} >+ >+#-------------- >+{ >+ _dl_relocate_object/dl_open_worker/_dl_catch_error(Cond) >+ Memcheck:Cond >+ fun:_dl_relocate_object >+ fun:dl_open_worker >+ fun:_dl_catch_error >+} >+{ >+ _dl_relocate_object/libc-2.2.4.so/_dl_catch_error(Cond) >+ Memcheck:Cond >+ fun:_dl_relocate_object >+ obj:*libc-2.2.4.so >+ fun:_dl_catch_error >+} >+ >+{ >+ strrchr/_dl_map_object_from_fd/_dl_map_object(Cond) >+ Memcheck:Cond >+ fun:strrchr >+ fun:_dl_map_object_from_fd >+ fun:_dl_map_object >+} >+ >+#------------------- >+{ >+ socketcall.connect(serv_addr)/__libc_connect/* >+ Addrcheck,Memcheck:Param >+ socketcall.connect(serv_addr) >+ fun:__libc_connect >+ fun:* >+} >+{ >+ socketcall.connect(serv_addr)/libc-2.2.4.so/libc-2.2.4.so >+ Addrcheck,Memcheck:Param >+ socketcall.connect(serv_addr) >+ obj:*libc-2.2.4.so >+ obj:*libc-2.2.4.so >+} >+ >+{ >+ libX11.so.6.2/libX11.so.6.2/libX11.so.6.2(Cond) >+ Memcheck:Cond >+ obj:/usr/X11R6/lib/libX11.so.6.2 >+ obj:/usr/X11R6/lib/libX11.so.6.2 >+ obj:/usr/X11R6/lib/libX11.so.6.2 >+} >+ >+{ >+ libXt.so.6.2/libXt.so.6.2/libXt.so.6.2(Cond) >+ Memcheck:Cond >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+} >+ >+ >+{ >+ libXaw.so.7.0/libXaw.so.7.0/libXaw.so.7.0(Cond) >+ Memcheck:Cond >+ obj:/usr/X11R6/lib/libXaw.so.7.0 >+ obj:/usr/X11R6/lib/libXaw.so.7.0 >+ obj:/usr/X11R6/lib/libXaw.so.7.0 >+} >+ >+{ >+ libXmu.so.6.2/libXmu.so.6.2/libXmu.so.6.2(Cond) >+ Memcheck:Cond >+ obj:/usr/X11R6/lib/libXmu.so.6.2 >+ obj:/usr/X11R6/lib/libXmu.so.6.2 >+ obj:/usr/X11R6/lib/libXmu.so.6.2 >+} >+ >+{ >+ libXt.so.6.0/libXt.so.6.0/libXaw.so.7.0(Cond) >+ Memcheck:Cond >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+ obj:/usr/X11R6/lib/libXaw.so.7.0 >+} >+ >+{ >+ libXaw.so.7.0/libXaw.so.7.0/libXt.so.6.0(Value4) >+ Memcheck:Value4 >+ obj:/usr/X11R6/lib/libXaw.so.7.0 >+ obj:/usr/X11R6/lib/libXaw.so.7.0 >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+} >+ >+{ >+ libX11.so.6.2/libX11.so.6.2/libXaw.so.7.0(Cond) >+ Memcheck:Cond >+ obj:/usr/X11R6/lib/libX11.so.6.2 >+ obj:/usr/X11R6/lib/libX11.so.6.2 >+ obj:/usr/X11R6/lib/libXaw.so.7.0 >+} >+ >+#---------------------- >+{ >+ write(buf)/__libc_write/libX11.so.6.2/libX11.so.6.2(Param) >+ Addrcheck,Memcheck:Param >+ write(buf) >+ fun:__libc_write >+ obj:/usr/X11R6/lib/libX11.so.6.2 >+ obj:/usr/X11R6/lib/libX11.so.6.2 >+} >+{ >+ write(buf)/libc-2.2.4.so/libX11.so.6.2/libX11.so.6.2(Param) >+ Addrcheck,Memcheck:Param >+ write(buf) >+ obj:*libc-2.2.4.so >+ obj:/usr/X11R6/lib/libX11.so.6.2 >+ obj:/usr/X11R6/lib/libX11.so.6.2 >+} >+ >+#{ >+# llseek(result)/__libc_lseek64/_IO_file_seek(Param) >+# Addrcheck,Memcheck:Param >+# llseek(result) >+# fun:__libc_lseek64 >+# fun:_IO_file_seek >+#} >+ >+{ >+ writev(vector[...])/__writev/libX11.so.6.2/libX11.so.6.2 >+ Addrcheck,Memcheck:Param >+ writev(vector[...]) >+ fun:__writev >+ obj:/usr/X11R6/lib/libX11.so.6.2 >+ obj:/usr/X11R6/lib/libX11.so.6.2 >+} >+ >+#---------------- >+{ >+ __rawmemchr/libXt.so.6.0/libXt.so.6.0 >+ Memcheck:Cond >+ fun:__rawmemchr >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+} >+{ >+ libc-2.2.4.so/libXt.so.6.0/libXt.so.6.0 >+ Memcheck:Cond >+ obj:*libc-2.2.4.so >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+ obj:/usr/X11R6/lib/libXt.so.6.0 >+} >+ >+##----------------------------------------------------------------------## >+ >diff -ruN valgrind-2.1.0/make-uninstall-docs valgrind/make-uninstall-docs >--- valgrind-2.1.0/make-uninstall-docs 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/make-uninstall-docs 2003-11-14 11:47:51.000000000 -0600 >@@ -0,0 +1,21 @@ >+#!/bin/sh >+ >+# small tool to help documentation writers. >+# Copy docs out of an installation tree (`pwd`/Inst) back to the build tree >+# since it is a lot easier to edit them in the installation tree. >+# Use with care! >+ >+cp Inst/share/doc/valgrind/coregrind_core.html coregrind/docs >+cp Inst/share/doc/valgrind/coregrind_intro.html coregrind/docs >+cp Inst/share/doc/valgrind/coregrind_tools.html coregrind/docs >+cp Inst/share/doc/valgrind/manual.html docs >+cp Inst/share/doc/valgrind/ac_main.html addrcheck/docs >+cp Inst/share/doc/valgrind/mc_main.html memcheck/docs >+cp Inst/share/doc/valgrind/mc_techdocs.html memcheck/docs >+cp Inst/share/doc/valgrind/cg_main.html cachegrind/docs >+cp Inst/share/doc/valgrind/cg_techdocs.html cachegrind/docs >+cp Inst/share/doc/valgrind/cc_main.html corecheck/docs >+cp Inst/share/doc/valgrind/hg_main.html helgrind/docs >+cp Inst/share/doc/valgrind/lk_main.html lackey/docs >+cp Inst/share/doc/valgrind/nl_main.html none/docs >+ >diff -ruN valgrind-2.1.0/memcheck/.cvsignore valgrind/memcheck/.cvsignore >--- valgrind-2.1.0/memcheck/.cvsignore 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/memcheck/.cvsignore 2002-09-23 06:36:34.000000000 -0500 >@@ -0,0 +1,2 @@ >+Makefile.in >+Makefile >diff -ruN valgrind-2.1.0/memcheck/CVS/Entries valgrind/memcheck/CVS/Entries >--- valgrind-2.1.0/memcheck/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/memcheck/CVS/Entries 2004-02-11 22:51:47.148644560 -0600 >@@ -0,0 +1,17 @@ >+/.cvsignore/1.1/Mon Sep 23 11:36:34 2002// >+/Makefile.am/1.47/Tue Dec 16 02:05:14 2003// >+/mac_leakcheck.c/1.13/Sun Jan 4 16:43:22 2004// >+/mac_malloc_wrappers.c/1.10/Wed Jan 21 15:08:04 2004// >+/mac_needs.c/1.22/Sun Jan 4 23:30:55 2004// >+/mac_replace_strmem.c/1.12/Sun Jan 4 16:43:22 2004// >+/mac_shared.h/1.17/Wed Jan 21 15:08:04 2004// >+/mc_clientreqs.c/1.18/Sun Jan 4 16:43:22 2004// >+/mc_constants.h/1.4/Sun Jan 4 16:43:22 2004// >+/mc_errcontext.c/1.22/Sun Jan 4 16:43:22 2004// >+/mc_from_ucode.c/1.15/Sun Jan 4 16:43:22 2004// >+/mc_helpers.S/1.8/Sun Jan 4 16:43:22 2004// >+/mc_include.h/1.18/Sun Jan 4 16:43:22 2004// >+/mc_main.c/1.46/Sun Jan 4 23:30:55 2004// >+/mc_translate.c/1.36/Wed Feb 11 23:33:28 2004// >+/memcheck.h/1.18/Wed Jan 21 15:08:04 2004// >+D >diff -ruN valgrind-2.1.0/memcheck/CVS/Entries.Log valgrind/memcheck/CVS/Entries.Log >--- valgrind-2.1.0/memcheck/CVS/Entries.Log 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/memcheck/CVS/Entries.Log 2004-02-11 22:51:47.514588928 -0600 >@@ -0,0 +1,2 @@ >+A D/docs//// >+A D/tests//// >diff -ruN valgrind-2.1.0/memcheck/CVS/Repository valgrind/memcheck/CVS/Repository >--- valgrind-2.1.0/memcheck/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/memcheck/CVS/Repository 2004-02-11 22:51:46.384760688 -0600 >@@ -0,0 +1 @@ >+valgrind/memcheck >diff -ruN valgrind-2.1.0/memcheck/CVS/Root valgrind/memcheck/CVS/Root >--- valgrind-2.1.0/memcheck/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/memcheck/CVS/Root 2004-02-11 22:51:46.384760688 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/memcheck/Makefile.am valgrind/memcheck/Makefile.am >--- valgrind-2.1.0/memcheck/Makefile.am 2003-07-22 04:12:32.000000000 -0500 >+++ valgrind/memcheck/Makefile.am 2003-12-15 20:05:14.000000000 -0600 >@@ -4,19 +4,25 @@ > all_includes = -I$(top_srcdir)/include > > AM_CPPFLAGS = $(all_includes) -DVG_LIBDIR="\"$(libdir)"\" >-AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer \ >+AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O2 -fomit-frame-pointer \ > @PREFERRED_STACK_BOUNDARY@ -g > AM_CCASFLAGS = $(all_includes) > > valdir = $(libdir)/valgrind >+inplacedir = $(top_srcdir)/.in_place > >-val_PROGRAMS = vgskin_memcheck.so >+val_PROGRAMS = vgskin_memcheck.so vgpreload_memcheck.so >+ >+vgpreload_memcheck_so_SOURCES = \ >+ mac_replace_strmem.c >+vgpreload_memcheck_so_LDADD = $(top_srcdir)/coregrind/vg_replace_malloc.o >+vgpreload_memcheck_so_DEPENDENCIES = $(top_srcdir)/coregrind/vg_replace_malloc.o >+vgpreload_memcheck_so_LDFLAGS = -shared -Wl,-z,interpose,-z,initfirst > > vgskin_memcheck_so_SOURCES = \ > mac_leakcheck.c \ > mac_malloc_wrappers.c \ > mac_needs.c \ >- mac_replace_strmem.c \ > mc_main.c \ > mc_clientreqs.c \ > mc_errcontext.c \ >@@ -24,7 +30,6 @@ > mc_translate.c \ > mc_helpers.S > vgskin_memcheck_so_LDFLAGS = -shared >-vgskin_memcheck_so_LDADD = ../coregrind/vg_replace_malloc.o > > mcincludedir = $(includedir)/valgrind > >@@ -38,3 +43,7 @@ > > mac_replace_strmem.o: CFLAGS += -fno-omit-frame-pointer > >+all-local: >+ mkdir -p $(inplacedir) >+ -rm -f $(addprefix $(inplacedir)/,$(val_PROGRAMS)) >+ ln -f -s $(addprefix $(top_srcdir)/$(subdir)/,$(val_PROGRAMS)) $(inplacedir) >diff -ruN valgrind-2.1.0/memcheck/Makefile.in valgrind/memcheck/Makefile.in >--- valgrind-2.1.0/memcheck/Makefile.in 2003-12-14 09:50:18.000000000 -0600 >+++ valgrind/memcheck/Makefile.in 2004-02-11 22:52:33.786554520 -0600 >@@ -1,8 +1,8 @@ >-# Makefile.in generated by automake 1.7.6 from Makefile.am. >+# Makefile.in generated by automake 1.8.2 from Makefile.am. > # @configure_input@ > >-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 >-# Free Software Foundation, Inc. >+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, >+# 2003, 2004 Free Software Foundation, Inc. > # This Makefile.in is free software; the Free Software Foundation > # gives unlimited permission to copy and/or distribute it, > # with or without modifications, as long as this notice is preserved. >@@ -14,6 +14,9 @@ > > @SET_MAKE@ > >+ >+SOURCES = $(vgpreload_memcheck_so_SOURCES) $(vgskin_memcheck_so_SOURCES) >+ > srcdir = @srcdir@ > top_srcdir = @top_srcdir@ > VPATH = @srcdir@ >@@ -21,7 +24,6 @@ > pkglibdir = $(libdir)/@PACKAGE@ > pkgincludedir = $(includedir)/@PACKAGE@ > top_builddir = .. >- > am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd > INSTALL = @INSTALL@ > install_sh_DATA = $(install_sh) -c -m 644 >@@ -36,6 +38,62 @@ > PRE_UNINSTALL = : > POST_UNINSTALL = : > host_triplet = @host@ >+val_PROGRAMS = vgskin_memcheck.so$(EXEEXT) \ >+ vgpreload_memcheck.so$(EXEEXT) >+subdir = memcheck >+DIST_COMMON = $(mcinclude_HEADERS) $(noinst_HEADERS) \ >+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in >+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >+am__aclocal_m4_deps = $(top_srcdir)/configure.in >+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ >+ $(ACLOCAL_M4) >+mkinstalldirs = $(mkdir_p) >+CONFIG_HEADER = $(top_builddir)/config.h >+CONFIG_CLEAN_FILES = >+am__installdirs = $(DESTDIR)$(valdir) $(DESTDIR)$(mcincludedir) >+valPROGRAMS_INSTALL = $(INSTALL_PROGRAM) >+PROGRAMS = $(val_PROGRAMS) >+am_vgpreload_memcheck_so_OBJECTS = mac_replace_strmem.$(OBJEXT) >+vgpreload_memcheck_so_OBJECTS = $(am_vgpreload_memcheck_so_OBJECTS) >+am_vgskin_memcheck_so_OBJECTS = mac_leakcheck.$(OBJEXT) \ >+ mac_malloc_wrappers.$(OBJEXT) mac_needs.$(OBJEXT) \ >+ mc_main.$(OBJEXT) mc_clientreqs.$(OBJEXT) \ >+ mc_errcontext.$(OBJEXT) mc_from_ucode.$(OBJEXT) \ >+ mc_translate.$(OBJEXT) mc_helpers.$(OBJEXT) >+vgskin_memcheck_so_OBJECTS = $(am_vgskin_memcheck_so_OBJECTS) >+vgskin_memcheck_so_LDADD = $(LDADD) >+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) >+depcomp = $(SHELL) $(top_srcdir)/depcomp >+am__depfiles_maybe = depfiles >+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/mac_leakcheck.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/mac_malloc_wrappers.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/mac_needs.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/mac_replace_strmem.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/mc_clientreqs.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/mc_errcontext.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/mc_from_ucode.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/mc_main.Po ./$(DEPDIR)/mc_translate.Po >+CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS) >+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ >+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) >+CCLD = $(CC) >+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ >+SOURCES = $(vgpreload_memcheck_so_SOURCES) \ >+ $(vgskin_memcheck_so_SOURCES) >+DIST_SOURCES = $(vgpreload_memcheck_so_SOURCES) \ >+ $(vgskin_memcheck_so_SOURCES) >+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ >+ html-recursive info-recursive install-data-recursive \ >+ install-exec-recursive install-info-recursive \ >+ install-recursive installcheck-recursive installdirs-recursive \ >+ pdf-recursive ps-recursive uninstall-info-recursive \ >+ uninstall-recursive >+mcincludeHEADERS_INSTALL = $(INSTALL_HEADER) >+HEADERS = $(mcinclude_HEADERS) $(noinst_HEADERS) >+ETAGS = etags >+CTAGS = ctags >+DIST_SUBDIRS = $(SUBDIRS) >+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) > ACLOCAL = @ACLOCAL@ > AMDEP_FALSE = @AMDEP_FALSE@ > AMDEP_TRUE = @AMDEP_TRUE@ >@@ -92,6 +150,7 @@ > SHELL = @SHELL@ > STRIP = @STRIP@ > VERSION = @VERSION@ >+VG_PLATFORM = @VG_PLATFORM@ > ac_ct_CC = @ac_ct_CC@ > ac_ct_CXX = @ac_ct_CXX@ > ac_ct_RANLIB = @ac_ct_RANLIB@ >@@ -123,6 +182,7 @@ > libexecdir = @libexecdir@ > localstatedir = @localstatedir@ > mandir = @mandir@ >+mkdir_p = @mkdir_p@ > oldincludedir = @oldincludedir@ > prefix = @prefix@ > program_transform_name = @program_transform_name@ >@@ -130,26 +190,25 @@ > sharedstatedir = @sharedstatedir@ > sysconfdir = @sysconfdir@ > target_alias = @target_alias@ >- > SUBDIRS = . tests docs >- > all_includes = -I$(top_srcdir)/include >- > AM_CPPFLAGS = $(all_includes) -DVG_LIBDIR="\"$(libdir)"\" >-AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer \ >+AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O2 -fomit-frame-pointer \ > @PREFERRED_STACK_BOUNDARY@ -g > > AM_CCASFLAGS = $(all_includes) >- > valdir = $(libdir)/valgrind >- >-val_PROGRAMS = vgskin_memcheck.so >- >+inplacedir = $(top_srcdir)/.in_place >+vgpreload_memcheck_so_SOURCES = \ >+ mac_replace_strmem.c >+ >+vgpreload_memcheck_so_LDADD = $(top_srcdir)/coregrind/vg_replace_malloc.o >+vgpreload_memcheck_so_DEPENDENCIES = $(top_srcdir)/coregrind/vg_replace_malloc.o >+vgpreload_memcheck_so_LDFLAGS = -shared -Wl,-z,interpose,-z,initfirst > vgskin_memcheck_so_SOURCES = \ > mac_leakcheck.c \ > mac_malloc_wrappers.c \ > mac_needs.c \ >- mac_replace_strmem.c \ > mc_main.c \ > mc_clientreqs.c \ > mc_errcontext.c \ >@@ -158,79 +217,51 @@ > mc_helpers.S > > vgskin_memcheck_so_LDFLAGS = -shared >-vgskin_memcheck_so_LDADD = ../coregrind/vg_replace_malloc.o >- > mcincludedir = $(includedir)/valgrind >- > mcinclude_HEADERS = \ > memcheck.h > >- > noinst_HEADERS = \ > mac_shared.h \ > mc_constants.h \ > mc_include.h > >-subdir = memcheck >-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs >-CONFIG_HEADER = $(top_builddir)/config.h >-CONFIG_CLEAN_FILES = >-val_PROGRAMS = vgskin_memcheck.so$(EXEEXT) >-PROGRAMS = $(val_PROGRAMS) >- >-am_vgskin_memcheck_so_OBJECTS = mac_leakcheck.$(OBJEXT) \ >- mac_malloc_wrappers.$(OBJEXT) mac_needs.$(OBJEXT) \ >- mac_replace_strmem.$(OBJEXT) mc_main.$(OBJEXT) \ >- mc_clientreqs.$(OBJEXT) mc_errcontext.$(OBJEXT) \ >- mc_from_ucode.$(OBJEXT) mc_translate.$(OBJEXT) \ >- mc_helpers.$(OBJEXT) >-vgskin_memcheck_so_OBJECTS = $(am_vgskin_memcheck_so_OBJECTS) >-vgskin_memcheck_so_DEPENDENCIES = ../coregrind/vg_replace_malloc.o >- >-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) >-depcomp = $(SHELL) $(top_srcdir)/depcomp >-am__depfiles_maybe = depfiles >-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/mac_leakcheck.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/mac_malloc_wrappers.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/mac_needs.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/mac_replace_strmem.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/mc_clientreqs.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/mc_errcontext.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/mc_from_ucode.Po ./$(DEPDIR)/mc_main.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/mc_translate.Po >-CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS) >-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ >- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) >-CCLD = $(CC) >-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ >-DIST_SOURCES = $(vgskin_memcheck_so_SOURCES) >-HEADERS = $(mcinclude_HEADERS) $(noinst_HEADERS) >- >- >-RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ >- ps-recursive install-info-recursive uninstall-info-recursive \ >- all-recursive install-data-recursive install-exec-recursive \ >- installdirs-recursive install-recursive uninstall-recursive \ >- check-recursive installcheck-recursive >-DIST_COMMON = $(mcinclude_HEADERS) $(noinst_HEADERS) Makefile.am \ >- Makefile.in >-DIST_SUBDIRS = $(SUBDIRS) >-SOURCES = $(vgskin_memcheck_so_SOURCES) >- > all: all-recursive > > .SUFFIXES: > .SUFFIXES: .S .c .o .obj >-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) >+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) >+ @for dep in $?; do \ >+ case '$(am__configure_deps)' in \ >+ *$$dep*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ >+ && exit 0; \ >+ exit 1;; \ >+ esac; \ >+ done; \ >+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu memcheck/Makefile'; \ > cd $(top_srcdir) && \ > $(AUTOMAKE) --gnu memcheck/Makefile >-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status >- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) >-valPROGRAMS_INSTALL = $(INSTALL_PROGRAM) >+.PRECIOUS: Makefile >+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status >+ @case '$?' in \ >+ *config.status*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ >+ *) \ >+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ >+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ >+ esac; >+ >+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+ >+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh > install-valPROGRAMS: $(val_PROGRAMS) > @$(NORMAL_INSTALL) >- $(mkinstalldirs) $(DESTDIR)$(valdir) >+ $(mkdir_p) $(DESTDIR)$(valdir) > @list='$(val_PROGRAMS)'; for p in $$list; do \ > p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ > if test -f $$p \ >@@ -251,12 +282,15 @@ > > clean-valPROGRAMS: > -test -z "$(val_PROGRAMS)" || rm -f $(val_PROGRAMS) >+vgpreload_memcheck.so$(EXEEXT): $(vgpreload_memcheck_so_OBJECTS) $(vgpreload_memcheck_so_DEPENDENCIES) >+ @rm -f vgpreload_memcheck.so$(EXEEXT) >+ $(LINK) $(vgpreload_memcheck_so_LDFLAGS) $(vgpreload_memcheck_so_OBJECTS) $(vgpreload_memcheck_so_LDADD) $(LIBS) > vgskin_memcheck.so$(EXEEXT): $(vgskin_memcheck_so_OBJECTS) $(vgskin_memcheck_so_DEPENDENCIES) > @rm -f vgskin_memcheck.so$(EXEEXT) > $(LINK) $(vgskin_memcheck_so_LDFLAGS) $(vgskin_memcheck_so_OBJECTS) $(vgskin_memcheck_so_LDADD) $(LIBS) > > mostlyclean-compile: >- -rm -f *.$(OBJEXT) core *.core >+ -rm -f *.$(OBJEXT) > > distclean-compile: > -rm -f *.tab.c >@@ -271,41 +305,31 @@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mc_main.Po@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mc_translate.Po@am__quote@ > >-distclean-depend: >- -rm -rf ./$(DEPDIR) >- > .S.o: >- $(CCASCOMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< >+ $(CCASCOMPILE) -c $< > > .S.obj: >- $(CCASCOMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` >+ $(CCASCOMPILE) -c `$(CYGPATH_W) '$<'` > > .c.o: >-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ >-@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ >-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ >-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ >-@am__fastdepCC_TRUE@ fi >+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ >+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi > @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >-@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< >+@am__fastdepCC_FALSE@ $(COMPILE) -c $< > > .c.obj: >-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ >-@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ >-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ >-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ >-@am__fastdepCC_TRUE@ fi >+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ >+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi > @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >-@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` >+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` > uninstall-info-am: >-mcincludeHEADERS_INSTALL = $(INSTALL_HEADER) > install-mcincludeHEADERS: $(mcinclude_HEADERS) > @$(NORMAL_INSTALL) >- $(mkinstalldirs) $(DESTDIR)$(mcincludedir) >+ $(mkdir_p) $(DESTDIR)$(mcincludedir) > @list='$(mcinclude_HEADERS)'; for p in $$list; do \ > if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ > f="`echo $$p | sed -e 's|^.*/||'`"; \ >@@ -380,14 +404,6 @@ > test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ > done > >-ETAGS = etags >-ETAGSFLAGS = >- >-CTAGS = ctags >-CTAGSFLAGS = >- >-tags: TAGS >- > ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) > list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ > unique=`for i in $$list; do \ >@@ -396,6 +412,7 @@ > $(AWK) ' { files[$$0] = 1; } \ > END { for (i in files) print i; }'`; \ > mkid -fID $$unique >+tags: TAGS > > TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ > $(TAGS_FILES) $(LISP) >@@ -421,7 +438,6 @@ > test -z "$(ETAGS_ARGS)$$tags$$unique" \ > || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ > $$tags $$unique >- > ctags: CTAGS > CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ > $(TAGS_FILES) $(LISP) >@@ -444,10 +460,6 @@ > > distclean-tags: > -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags >-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) >- >-top_distdir = .. >-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) > > distdir: $(DISTFILES) > @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ >@@ -461,7 +473,7 @@ > dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ > if test "$$dir" != "$$file" && test "$$dir" != "."; then \ > dir="/$$dir"; \ >- $(mkinstalldirs) "$(distdir)$$dir"; \ >+ $(mkdir_p) "$(distdir)$$dir"; \ > else \ > dir=''; \ > fi; \ >@@ -478,24 +490,23 @@ > done > list='$(SUBDIRS)'; for subdir in $$list; do \ > if test "$$subdir" = .; then :; else \ >- test -d $(distdir)/$$subdir \ >- || mkdir $(distdir)/$$subdir \ >+ test -d "$(distdir)/$$subdir" \ >+ || mkdir "$(distdir)/$$subdir" \ > || exit 1; \ > (cd $$subdir && \ > $(MAKE) $(AM_MAKEFLAGS) \ >- top_distdir="$(top_distdir)" \ >- distdir=../$(distdir)/$$subdir \ >+ top_distdir="../$(top_distdir)" \ >+ distdir="../$(distdir)/$$subdir" \ > distdir) \ > || exit 1; \ > fi; \ > done > check-am: all-am > check: check-recursive >-all-am: Makefile $(PROGRAMS) $(HEADERS) >+all-am: Makefile $(PROGRAMS) $(HEADERS) all-local > installdirs: installdirs-recursive > installdirs-am: >- $(mkinstalldirs) $(DESTDIR)$(valdir) $(DESTDIR)$(mcincludedir) >- >+ $(mkdir_p) $(DESTDIR)$(valdir) $(DESTDIR)$(mcincludedir) > install: install-recursive > install-exec: install-exec-recursive > install-data: install-data-recursive >@@ -507,7 +518,7 @@ > installcheck: installcheck-recursive > install-strip: > $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ >- INSTALL_STRIP_FLAG=-s \ >+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ > `test -z '$(STRIP)' || \ > echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install > mostlyclean-generic: >@@ -515,7 +526,7 @@ > clean-generic: > > distclean-generic: >- -rm -f Makefile $(CONFIG_CLEAN_FILES) >+ -rm -f $(CONFIG_CLEAN_FILES) > > maintainer-clean-generic: > @echo "This command is intended for maintainers to use" >@@ -525,14 +536,17 @@ > clean-am: clean-generic clean-valPROGRAMS mostlyclean-am > > distclean: distclean-recursive >- >-distclean-am: clean-am distclean-compile distclean-depend \ >- distclean-generic distclean-tags >+ -rm -rf ./$(DEPDIR) >+ -rm -f Makefile >+distclean-am: clean-am distclean-compile distclean-generic \ >+ distclean-tags > > dvi: dvi-recursive > > dvi-am: > >+html: html-recursive >+ > info: info-recursive > > info-am: >@@ -548,7 +562,8 @@ > installcheck-am: > > maintainer-clean: maintainer-clean-recursive >- >+ -rm -rf ./$(DEPDIR) >+ -rm -f Makefile > maintainer-clean-am: distclean-am maintainer-clean-generic > > mostlyclean: mostlyclean-recursive >@@ -568,26 +583,28 @@ > > uninstall-info: uninstall-info-recursive > >-.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ >- clean-generic clean-recursive clean-valPROGRAMS ctags \ >- ctags-recursive distclean distclean-compile distclean-depend \ >+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am all-local check \ >+ check-am clean clean-generic clean-recursive clean-valPROGRAMS \ >+ ctags ctags-recursive distclean distclean-compile \ > distclean-generic distclean-recursive distclean-tags distdir \ >- dvi dvi-am dvi-recursive info info-am info-recursive install \ >- install-am install-data install-data-am install-data-recursive \ >- install-exec install-exec-am install-exec-recursive \ >- install-info install-info-am install-info-recursive install-man \ >- install-mcincludeHEADERS install-recursive install-strip \ >- install-valPROGRAMS installcheck installcheck-am installdirs \ >- installdirs-am installdirs-recursive maintainer-clean \ >- maintainer-clean-generic maintainer-clean-recursive mostlyclean \ >- mostlyclean-compile mostlyclean-generic mostlyclean-recursive \ >- pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \ >- tags-recursive uninstall uninstall-am uninstall-info-am \ >- uninstall-info-recursive uninstall-mcincludeHEADERS \ >- uninstall-recursive uninstall-valPROGRAMS >+ dvi dvi-am html html-am info info-am install install-am \ >+ install-data install-data-am install-exec install-exec-am \ >+ install-info install-info-am install-man \ >+ install-mcincludeHEADERS install-strip install-valPROGRAMS \ >+ installcheck installcheck-am installdirs installdirs-am \ >+ maintainer-clean maintainer-clean-generic \ >+ maintainer-clean-recursive mostlyclean mostlyclean-compile \ >+ mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \ >+ tags tags-recursive uninstall uninstall-am uninstall-info-am \ >+ uninstall-mcincludeHEADERS uninstall-valPROGRAMS > > > mac_replace_strmem.o: CFLAGS += -fno-omit-frame-pointer >+ >+all-local: >+ mkdir -p $(inplacedir) >+ -rm -f $(addprefix $(inplacedir)/,$(val_PROGRAMS)) >+ ln -f -s $(addprefix $(top_srcdir)/$(subdir)/,$(val_PROGRAMS)) $(inplacedir) > # Tell versions [3.59,3.63) of GNU make to not export all variables. > # Otherwise a system limit (for SysV at least) may be exceeded. > .NOEXPORT: >diff -ruN valgrind-2.1.0/memcheck/docs/.cvsignore valgrind/memcheck/docs/.cvsignore >--- valgrind-2.1.0/memcheck/docs/.cvsignore 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/memcheck/docs/.cvsignore 2002-09-23 06:36:35.000000000 -0500 >@@ -0,0 +1,2 @@ >+Makefile.in >+Makefile >diff -ruN valgrind-2.1.0/memcheck/docs/CVS/Entries valgrind/memcheck/docs/CVS/Entries >--- valgrind-2.1.0/memcheck/docs/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/memcheck/docs/CVS/Entries 2004-02-11 22:51:47.513589080 -0600 >@@ -0,0 +1,5 @@ >+/.cvsignore/1.1/Mon Sep 23 11:36:35 2002// >+/Makefile.am/1.2/Wed Nov 13 21:24:56 2002// >+/mc_main.html/1.10/Fri Nov 14 17:47:54 2003// >+/mc_techdocs.html/1.9/Sun Jan 4 16:43:23 2004// >+D >diff -ruN valgrind-2.1.0/memcheck/docs/CVS/Repository valgrind/memcheck/docs/CVS/Repository >--- valgrind-2.1.0/memcheck/docs/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/memcheck/docs/CVS/Repository 2004-02-11 22:51:47.148644560 -0600 >@@ -0,0 +1 @@ >+valgrind/memcheck/docs >diff -ruN valgrind-2.1.0/memcheck/docs/CVS/Root valgrind/memcheck/docs/CVS/Root >--- valgrind-2.1.0/memcheck/docs/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/memcheck/docs/CVS/Root 2004-02-11 22:51:47.148644560 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/memcheck/docs/Makefile.in valgrind/memcheck/docs/Makefile.in >--- valgrind-2.1.0/memcheck/docs/Makefile.in 2003-12-14 09:50:18.000000000 -0600 >+++ valgrind/memcheck/docs/Makefile.in 2004-02-11 22:52:33.932532328 -0600 >@@ -1,8 +1,8 @@ >-# Makefile.in generated by automake 1.7.6 from Makefile.am. >+# Makefile.in generated by automake 1.8.2 from Makefile.am. > # @configure_input@ > >-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 >-# Free Software Foundation, Inc. >+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, >+# 2003, 2004 Free Software Foundation, Inc. > # This Makefile.in is free software; the Free Software Foundation > # gives unlimited permission to copy and/or distribute it, > # with or without modifications, as long as this notice is preserved. >@@ -21,7 +21,6 @@ > pkglibdir = $(libdir)/@PACKAGE@ > pkgincludedir = $(includedir)/@PACKAGE@ > top_builddir = ../.. >- > am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd > INSTALL = @INSTALL@ > install_sh_DATA = $(install_sh) -c -m 644 >@@ -36,6 +35,21 @@ > PRE_UNINSTALL = : > POST_UNINSTALL = : > host_triplet = @host@ >+subdir = memcheck/docs >+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in >+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >+am__aclocal_m4_deps = $(top_srcdir)/configure.in >+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ >+ $(ACLOCAL_M4) >+mkinstalldirs = $(mkdir_p) >+CONFIG_HEADER = $(top_builddir)/config.h >+CONFIG_CLEAN_FILES = >+SOURCES = >+DIST_SOURCES = >+am__installdirs = $(DESTDIR)$(docdir) >+docDATA_INSTALL = $(INSTALL_DATA) >+DATA = $(doc_DATA) >+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) > ACLOCAL = @ACLOCAL@ > AMDEP_FALSE = @AMDEP_FALSE@ > AMDEP_TRUE = @AMDEP_TRUE@ >@@ -92,6 +106,7 @@ > SHELL = @SHELL@ > STRIP = @STRIP@ > VERSION = @VERSION@ >+VG_PLATFORM = @VG_PLATFORM@ > ac_ct_CC = @ac_ct_CC@ > ac_ct_CXX = @ac_ct_CXX@ > ac_ct_RANLIB = @ac_ct_RANLIB@ >@@ -123,6 +138,7 @@ > libexecdir = @libexecdir@ > localstatedir = @localstatedir@ > mandir = @mandir@ >+mkdir_p = @mkdir_p@ > oldincludedir = @oldincludedir@ > prefix = @prefix@ > program_transform_name = @program_transform_name@ >@@ -131,32 +147,44 @@ > sysconfdir = @sysconfdir@ > target_alias = @target_alias@ > docdir = $(datadir)/doc/valgrind >- > doc_DATA = mc_main.html mc_techdocs.html >- > EXTRA_DIST = $(doc_DATA) >-subdir = memcheck/docs >-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs >-CONFIG_HEADER = $(top_builddir)/config.h >-CONFIG_CLEAN_FILES = >-DIST_SOURCES = >-DATA = $(doc_DATA) >- >-DIST_COMMON = Makefile.am Makefile.in > all: all-am > > .SUFFIXES: >-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) >+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) >+ @for dep in $?; do \ >+ case '$(am__configure_deps)' in \ >+ *$$dep*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ >+ && exit 0; \ >+ exit 1;; \ >+ esac; \ >+ done; \ >+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu memcheck/docs/Makefile'; \ > cd $(top_srcdir) && \ > $(AUTOMAKE) --gnu memcheck/docs/Makefile >-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status >- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) >+.PRECIOUS: Makefile >+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status >+ @case '$?' in \ >+ *config.status*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ >+ *) \ >+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ >+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ >+ esac; >+ >+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+ >+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh > uninstall-info-am: >-docDATA_INSTALL = $(INSTALL_DATA) > install-docDATA: $(doc_DATA) > @$(NORMAL_INSTALL) >- $(mkinstalldirs) $(DESTDIR)$(docdir) >+ $(mkdir_p) $(DESTDIR)$(docdir) > @list='$(doc_DATA)'; for p in $$list; do \ > if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ > f="`echo $$p | sed -e 's|^.*/||'`"; \ >@@ -177,10 +205,6 @@ > ctags: CTAGS > CTAGS: > >-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) >- >-top_distdir = ../.. >-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) > > distdir: $(DISTFILES) > @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ >@@ -194,7 +218,7 @@ > dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ > if test "$$dir" != "$$file" && test "$$dir" != "."; then \ > dir="/$$dir"; \ >- $(mkinstalldirs) "$(distdir)$$dir"; \ >+ $(mkdir_p) "$(distdir)$$dir"; \ > else \ > dir=''; \ > fi; \ >@@ -212,9 +236,8 @@ > check-am: all-am > check: check-am > all-am: Makefile $(DATA) >- > installdirs: >- $(mkinstalldirs) $(DESTDIR)$(docdir) >+ $(mkdir_p) $(DESTDIR)$(docdir) > install: install-am > install-exec: install-exec-am > install-data: install-data-am >@@ -226,7 +249,7 @@ > installcheck: installcheck-am > install-strip: > $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ >- INSTALL_STRIP_FLAG=-s \ >+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ > `test -z '$(STRIP)' || \ > echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install > mostlyclean-generic: >@@ -234,7 +257,7 @@ > clean-generic: > > distclean-generic: >- -rm -f Makefile $(CONFIG_CLEAN_FILES) >+ -rm -f $(CONFIG_CLEAN_FILES) > > maintainer-clean-generic: > @echo "This command is intended for maintainers to use" >@@ -244,13 +267,15 @@ > clean-am: clean-generic mostlyclean-am > > distclean: distclean-am >- >+ -rm -f Makefile > distclean-am: clean-am distclean-generic > > dvi: dvi-am > > dvi-am: > >+html: html-am >+ > info: info-am > > info-am: >@@ -266,7 +291,7 @@ > installcheck-am: > > maintainer-clean: maintainer-clean-am >- >+ -rm -f Makefile > maintainer-clean-am: distclean-am maintainer-clean-generic > > mostlyclean: mostlyclean-am >@@ -284,13 +309,14 @@ > uninstall-am: uninstall-docDATA uninstall-info-am > > .PHONY: all all-am check check-am clean clean-generic distclean \ >- distclean-generic distdir dvi dvi-am info info-am install \ >- install-am install-data install-data-am install-docDATA \ >- install-exec install-exec-am install-info install-info-am \ >- install-man install-strip installcheck installcheck-am \ >- installdirs maintainer-clean maintainer-clean-generic \ >- mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ >- uninstall-am uninstall-docDATA uninstall-info-am >+ distclean-generic distdir dvi dvi-am html html-am info info-am \ >+ install install-am install-data install-data-am \ >+ install-docDATA install-exec install-exec-am install-info \ >+ install-info-am install-man install-strip installcheck \ >+ installcheck-am installdirs maintainer-clean \ >+ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ >+ pdf-am ps ps-am uninstall uninstall-am uninstall-docDATA \ >+ uninstall-info-am > > # Tell versions [3.59,3.63) of GNU make to not export all variables. > # Otherwise a system limit (for SysV at least) may be exceeded. >diff -ruN valgrind-2.1.0/memcheck/docs/mc_techdocs.html valgrind/memcheck/docs/mc_techdocs.html >--- valgrind-2.1.0/memcheck/docs/mc_techdocs.html 2003-11-30 11:41:45.000000000 -0600 >+++ valgrind/memcheck/docs/mc_techdocs.html 2004-01-04 10:43:23.000000000 -0600 >@@ -34,7 +34,7 @@ > <p> > <a href="mailto:jseward@acm.org">jseward@acm.org</a><br> > <a href="http://valgrind.kde.org">http://valgrind.kde.org</a><br> >-Copyright © 2000-2003 Julian Seward >+Copyright © 2000-2004 Julian Seward > <p> > Valgrind is licensed under the GNU General Public License, > version 2<br> >diff -ruN valgrind-2.1.0/memcheck/mac_leakcheck.c valgrind/memcheck/mac_leakcheck.c >--- valgrind-2.1.0/memcheck/mac_leakcheck.c 2003-12-02 04:17:44.000000000 -0600 >+++ valgrind/memcheck/mac_leakcheck.c 2004-01-04 10:43:22.000000000 -0600 >@@ -9,7 +9,7 @@ > detecting memory errors, and AddrCheck, a lightweight Valgrind tool > for detecting memory errors. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -311,10 +311,7 @@ > where the .bss segment has been put. If you can, drop me a > line. > */ >- if (VG_(within_stack)(a)) return; >- if (VG_(within_m_state_static_OR_threads)(a)) return; >- if (a == (Addr)(&lc_min_mallocd_addr)) return; >- if (a == (Addr)(&lc_max_mallocd_addr)) return; >+ if (!VG_(is_client_addr)(a)) return; > > /* OK, let's get on and do something Useful for a change. */ > >diff -ruN valgrind-2.1.0/memcheck/mac_malloc_wrappers.c valgrind/memcheck/mac_malloc_wrappers.c >--- valgrind-2.1.0/memcheck/mac_malloc_wrappers.c 2003-11-14 11:47:53.000000000 -0600 >+++ valgrind/memcheck/mac_malloc_wrappers.c 2004-01-21 09:08:04.000000000 -0600 >@@ -9,7 +9,7 @@ > detecting memory errors, and AddrCheck, a lightweight Valgrind tool > for detecting memory errors. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -44,7 +44,7 @@ > /* We want a 16B redzone on heap blocks for Addrcheck and Memcheck */ > UInt VG_(vg_malloc_redzone_szB) = 16; > >-/* Function pointers for the two skins to track interesting events. */ >+/* Function pointers for the two tools to track interesting events. */ > void (*MAC_(new_mem_heap)) ( Addr a, UInt len, Bool is_inited ) = NULL; > void (*MAC_(ban_mem_heap)) ( Addr a, UInt len ) = NULL; > void (*MAC_(die_mem_heap)) ( Addr a, UInt len ) = NULL; >diff -ruN valgrind-2.1.0/memcheck/mac_needs.c valgrind/memcheck/mac_needs.c >--- valgrind-2.1.0/memcheck/mac_needs.c 2003-11-14 11:47:53.000000000 -0600 >+++ valgrind/memcheck/mac_needs.c 2004-01-04 17:30:55.000000000 -0600 >@@ -9,7 +9,7 @@ > detecting memory errors, and AddrCheck, a lightweight Valgrind tool > for detecting memory errors. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -732,19 +732,19 @@ > 81 fpu_read aligned 4 > 82 fpu_read aligned 8 > 83 fpu_read 2 >- 84 fpu_read 10/28/108 >+ 84 fpu_read 10/28/108/512 > > M 85 fpu_write > M 86 fpu_write aligned 4 > M 87 fpu_write aligned 8 > M 88 fpu_write 2 >-M 89 fpu_write 10/28/108 >+M 89 fpu_write 10/28/108/512 > > 90 fpu_access > 91 fpu_access aligned 4 > 92 fpu_access aligned 8 > 93 fpu_access 2 >- 94 fpu_access 10/28/108 >+ 94 fpu_access 10/28/108/512 > > 100 fpu_access_check_SLOWLY > 101 fpu_access_check_SLOWLY(byte loop) >diff -ruN valgrind-2.1.0/memcheck/mac_replace_strmem.c valgrind/memcheck/mac_replace_strmem.c >--- valgrind-2.1.0/memcheck/mac_replace_strmem.c 2003-11-14 11:47:53.000000000 -0600 >+++ valgrind/memcheck/mac_replace_strmem.c 2004-01-04 10:43:22.000000000 -0600 >@@ -9,7 +9,7 @@ > This file is part of MemCheck, a heavyweight Valgrind tool for > detecting memory errors. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -31,8 +31,26 @@ > */ > > #include "mc_include.h" >+#include "memcheck.h" > #include "valgrind.h" > >+static Addr record_overlap_error; >+ >+static int init_done; >+ >+/* Startup hook - called as init section */ >+static void init(void) __attribute__((constructor)); >+static void init(void) >+{ >+ if (init_done) >+ return; >+ >+ VALGRIND_MAGIC_SEQUENCE(record_overlap_error, 0, >+ _VG_USERREQ__MEMCHECK_GET_RECORD_OVERLAP, >+ 0, 0, 0, 0); >+ init_done = 1; >+} >+ > /* --------------------------------------------------------------------- > The normal versions of these functions are hyper-optimised, which fools > Memcheck and cause spurious value warnings. So we replace them with >@@ -80,7 +98,8 @@ > OverlapExtra extra = { > .src = (Addr)src, .dst = (Addr)dst, .len = -1, > }; >- VALGRIND_NON_SIMD_CALL2( MAC_(record_overlap_error), s, &extra ); >+ init(); >+ VALGRIND_NON_SIMD_CALL2( record_overlap_error, s, &extra ); > } > > static __inline__ >@@ -90,7 +109,8 @@ > OverlapExtra extra = { > .src = (Addr)src, .dst = (Addr)dst, .len = n, > }; >- VALGRIND_NON_SIMD_CALL2( MAC_(record_overlap_error), s, &extra ); >+ init(); >+ VALGRIND_NON_SIMD_CALL2( record_overlap_error, s, &extra ); > } > > char* strrchr ( const char* s, int c ) >@@ -156,6 +176,13 @@ > return dst_orig; > } > >+unsigned int strnlen ( const char* str, unsigned int n ) >+{ >+ UInt i = 0; >+ while (i < n && str[i] != 0) i++; >+ return i; >+} >+ > unsigned int strlen ( const char* str ) > { > UInt i = 0; >@@ -300,6 +327,30 @@ > return 0; > } > >+ >+/* Copy SRC to DEST, returning the address of the terminating '\0' in >+ DEST. (minor variant of strcpy) */ >+ >+char* stpcpy ( char* dst, const char* src ) >+{ >+ const Char* src_orig = src; >+ Char* dst_orig = dst; >+ >+ while (*src) *dst++ = *src++; >+ *dst = 0; >+ >+ /* This checks for overlap after copying, unavoidable without >+ pre-counting length... should be ok */ >+ if (is_overlap(dst_orig, >+ src_orig, >+ (Addr)dst-(Addr)dst_orig+1, >+ (Addr)src-(Addr)src_orig+1)) >+ complain2("stpcpy", dst_orig, src_orig); >+ >+ return dst; >+} >+ >+ > /*--------------------------------------------------------------------*/ > /*--- end mac_replace_strmem.c ---*/ > /*--------------------------------------------------------------------*/ >diff -ruN valgrind-2.1.0/memcheck/mac_shared.h valgrind/memcheck/mac_shared.h >--- valgrind-2.1.0/memcheck/mac_shared.h 2003-11-14 11:47:53.000000000 -0600 >+++ valgrind/memcheck/mac_shared.h 2004-01-21 09:08:04.000000000 -0600 >@@ -9,7 +9,7 @@ > detecting memory errors, and AddrCheck, a lightweight Valgrind tool > for detecting memory errors. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -154,7 +154,7 @@ > MAC_Chunk; > > /*------------------------------------------------------------*/ >-/*--- Profiling of skins and memory events ---*/ >+/*--- Profiling of tools and memory events ---*/ > /*------------------------------------------------------------*/ > > typedef >@@ -163,7 +163,7 @@ > VgpSetMem, > VgpESPAdj > } >- VgpSkinCC; >+ VgpToolCC; > > /* Define to collect detailed performance info. */ > /* #define MAC_PROFILE_MEMORY */ >@@ -270,7 +270,7 @@ > /* For tracking malloc'd blocks */ > extern VgHashTable MAC_(malloc_list); > >-/* Function pointers for the two skins to track interesting events. */ >+/* Function pointers for the two tools to track interesting events. */ > extern void (*MAC_(new_mem_heap)) ( Addr a, UInt len, Bool is_inited ); > extern void (*MAC_(ban_mem_heap)) ( Addr a, UInt len ); > extern void (*MAC_(die_mem_heap)) ( Addr a, UInt len ); >diff -ruN valgrind-2.1.0/memcheck/mc_clientreqs.c valgrind/memcheck/mc_clientreqs.c >--- valgrind-2.1.0/memcheck/mc_clientreqs.c 2003-11-14 11:47:53.000000000 -0600 >+++ valgrind/memcheck/mc_clientreqs.c 2004-01-04 10:43:22.000000000 -0600 >@@ -9,7 +9,7 @@ > This file is part of MemCheck, a heavyweight Valgrind tool for > detecting memory errors. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -232,6 +232,10 @@ > ( tid, arg[1], arg[2], arg[3], True /* set them */ ); > break; > >+ case _VG_USERREQ__MEMCHECK_GET_RECORD_OVERLAP: >+ *ret = (Addr)MAC_(record_overlap_error); >+ break; >+ > default: > if (MAC_(handle_common_client_requests)(tid, arg, ret )) { > return True; >diff -ruN valgrind-2.1.0/memcheck/mc_constants.h valgrind/memcheck/mc_constants.h >--- valgrind-2.1.0/memcheck/mc_constants.h 2003-11-14 11:47:53.000000000 -0600 >+++ valgrind/memcheck/mc_constants.h 2004-01-04 10:43:22.000000000 -0600 >@@ -7,7 +7,7 @@ > This file is part of MemCheck, a heavyweight Valgrind tool for > detecting memory errors. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >diff -ruN valgrind-2.1.0/memcheck/mc_errcontext.c valgrind/memcheck/mc_errcontext.c >--- valgrind-2.1.0/memcheck/mc_errcontext.c 2003-11-14 11:47:53.000000000 -0600 >+++ valgrind/memcheck/mc_errcontext.c 2004-01-04 10:43:22.000000000 -0600 >@@ -8,7 +8,7 @@ > This file is part of MemCheck, a heavyweight Valgrind tool for > detecting memory errors. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >diff -ruN valgrind-2.1.0/memcheck/mc_from_ucode.c valgrind/memcheck/mc_from_ucode.c >--- valgrind-2.1.0/memcheck/mc_from_ucode.c 2003-11-14 11:47:53.000000000 -0600 >+++ valgrind/memcheck/mc_from_ucode.c 2004-01-04 10:43:22.000000000 -0600 >@@ -8,7 +8,7 @@ > This file is part of MemCheck, a heavyweight Valgrind tool for > detecting memory errors. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -166,6 +166,8 @@ > > static void synth_TESTV ( Int sz, Int tag, Int val ) > { >+ Int tgt; /* jump target */ >+ > /* Important note. Note that that the calls to > MC_(helper_value_check[0124]_fail) must be compact helpers due to > the codegen scheme used below. Since there are a shortage of >@@ -173,6 +175,8 @@ > actually used, we assert against it. */ > sk_assert(sz == 0 || sz == 2 || sz == 4); > >+ VG_(init_target)(&tgt); >+ > sk_assert(tag == ArchReg || tag == RealReg); > if (tag == ArchReg) { > switch (sz) { >@@ -222,9 +226,12 @@ > VG_(skin_panic)("synth_TESTV(RealReg)"); > } > } >- VG_(emit_jcondshort_delta) ( False, CondZ, 3 ); >+ >+ /* predict taken because we assume failures are rare */ >+ VG_(emit_jcondshort_target) ( False, CondZ, &tgt, JP_TAKEN ); >+ > VG_(synth_call) ( >- True, /* needed to guarantee that this insn is indeed 3 bytes long */ >+ False, > ( sz==4 > ? VG_(helper_offset)((Addr) & MC_(helper_value_check4_fail)) > : ( sz==2 >@@ -234,6 +241,7 @@ > : VG_(helper_offset)((Addr) & MC_(helper_value_check0_fail))))), > False, FlagsEmpty, FlagsOSZACP /* helpers don't preserve flags */ > ); >+ VG_(target_forward)(&tgt); > } > > >@@ -246,16 +254,16 @@ > R_EBP, reg ); > break; > case 2: >- VG_(emit_movzwl_offregmem_reg) ( VG_(shadow_reg_offset)(arch), >+ VG_(emit_movzwl_offregmem_reg) ( False, VG_(shadow_reg_offset)(arch), > R_EBP, reg ); > VG_(emit_nonshiftopv_lit_reg) ( False, 4, OR, 0xFFFF0000, reg ); > break; > case 1: > if (arch < 4) { >- VG_(emit_movzbl_offregmem_reg) ( VG_(shadow_reg_offset)(arch), >+ VG_(emit_movzbl_offregmem_reg) ( False, VG_(shadow_reg_offset)(arch), > R_EBP, reg ); > } else { >- VG_(emit_movzbl_offregmem_reg) ( VG_(shadow_reg_offset)(arch-4)+1, >+ VG_(emit_movzbl_offregmem_reg) ( False, VG_(shadow_reg_offset)(arch-4)+1, > R_EBP, reg ); > } > VG_(emit_nonshiftopv_lit_reg) ( False, 4, OR, 0xFFFFFF00, reg ); >diff -ruN valgrind-2.1.0/memcheck/mc_helpers.S valgrind/memcheck/mc_helpers.S >--- valgrind-2.1.0/memcheck/mc_helpers.S 2003-11-14 11:47:54.000000000 -0600 >+++ valgrind/memcheck/mc_helpers.S 2004-01-04 10:43:22.000000000 -0600 >@@ -8,7 +8,7 @@ > This file is part of MemCheck, a heavyweight Valgrind tool for > detecting memory errors. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >diff -ruN valgrind-2.1.0/memcheck/mc_include.h valgrind/memcheck/mc_include.h >--- valgrind-2.1.0/memcheck/mc_include.h 2003-11-14 11:47:54.000000000 -0600 >+++ valgrind/memcheck/mc_include.h 2004-01-04 10:43:22.000000000 -0600 >@@ -8,7 +8,7 @@ > This file is part of MemCheck, a heavyweight Valgrind tool for > detecting memory errors. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >diff -ruN valgrind-2.1.0/memcheck/mc_main.c valgrind/memcheck/mc_main.c >--- valgrind-2.1.0/memcheck/mc_main.c 2003-11-20 10:20:55.000000000 -0600 >+++ valgrind/memcheck/mc_main.c 2004-01-04 17:30:55.000000000 -0600 >@@ -9,7 +9,7 @@ > This file is part of MemCheck, a heavyweight Valgrind tool for > detecting memory errors. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -34,8 +34,6 @@ > #include "memcheck.h" /* for client requests */ > //#include "vg_profile.c" > >-VG_DETERMINE_INTERFACE_VERSION >- > /* Define to debug the mem audit system. */ > /* #define VG_DEBUG_MEMORY */ > >@@ -118,7 +116,6 @@ > static SecMap* primary_map[ /*65536*/ 262144 ]; > static SecMap distinguished_secondary_map; > >- > static void init_shadow_memory ( void ) > { > Int i; >@@ -157,7 +154,7 @@ > although this isn't important, so the following assert is > spurious. */ > sk_assert(0 == (sizeof(SecMap) % VKI_BYTES_PER_PAGE)); >- map = VG_(get_memory_from_mmap)( sizeof(SecMap), caller ); >+ map = (SecMap *)VG_(shadow_alloc)(sizeof(SecMap)); > > for (i = 0; i < 8192; i++) > map->abits[i] = VGM_BYTE_INVALID; /* Invalid address */ >@@ -1193,7 +1190,7 @@ > } > > if (size == 16 /*SSE*/ >- || size == 10 || size == 28 || size == 108) { >+ || size == 10 || size == 28 || size == 108 || size == 512) { > PROF_EVENT(84); > mc_fpu_read_check_SLOWLY ( addr, size ); > return; >@@ -1276,7 +1273,7 @@ > } > > if (size == 16 /*SSE*/ >- || size == 10 || size == 28 || size == 108) { >+ || size == 10 || size == 28 || size == 108 || size == 512) { > PROF_EVENT(89); > mc_fpu_write_check_SLOWLY ( addr, size ); > return; >@@ -1471,23 +1468,10 @@ > Sanity check machinery (permanently engaged). > ------------------------------------------------------------------ */ > >-/* Check that nobody has spuriously claimed that the first or last 16 >- pages (64 KB) of address space have become accessible. Failure of >- the following do not per se indicate an internal consistency >- problem, but they are so likely to that we really want to know >- about it if so. */ >- > Bool SK_(cheap_sanity_check) ( void ) > { >- if (IS_DISTINGUISHED_SM(primary_map[0]) >- /* kludge: kernel drops a page up at top of address range for >- magic "optimized syscalls", so we can no longer check the >- highest page */ >- /* && IS_DISTINGUISHED_SM(primary_map[65535]) */ >- ) >- return True; >- else >- return False; >+ /* nothing useful we can rapidly check */ >+ return True; > } > > Bool SK_(expensive_sanity_check) ( void ) >@@ -1658,7 +1642,7 @@ > VG_(details_version) (NULL); > VG_(details_description) ("a memory error detector"); > VG_(details_copyright_author)( >- "Copyright (C) 2002-2003, and GNU GPL'd, by Julian Seward."); >+ "Copyright (C) 2002-2004, and GNU GPL'd, by Julian Seward."); > VG_(details_bug_reports_to) (VG_BUGS_TO); > VG_(details_avg_translation_sizeB) ( 228 ); > >@@ -1671,6 +1655,7 @@ > VG_(needs_extended_UCode) (); > VG_(needs_syscall_wrapper) (); > VG_(needs_sanity_checks) (); >+ VG_(needs_shadow_memory) (); > > MAC_( new_mem_heap) = & mc_new_mem_heap; > MAC_( ban_mem_heap) = & MC_(make_noaccess); >@@ -1678,45 +1663,45 @@ > MAC_( die_mem_heap) = & MC_(make_noaccess); > MAC_(check_noaccess) = & MC_(check_noaccess); > >- VG_(track_new_mem_startup) ( & mc_new_mem_startup ); >- VG_(track_new_mem_stack_signal) ( & MC_(make_writable) ); >- VG_(track_new_mem_brk) ( & MC_(make_writable) ); >- VG_(track_new_mem_mmap) ( & mc_set_perms ); >+ VG_(init_new_mem_startup) ( & mc_new_mem_startup ); >+ VG_(init_new_mem_stack_signal) ( & MC_(make_writable) ); >+ VG_(init_new_mem_brk) ( & MC_(make_writable) ); >+ VG_(init_new_mem_mmap) ( & mc_set_perms ); > >- VG_(track_copy_mem_remap) ( & mc_copy_address_range_state ); >- VG_(track_change_mem_mprotect) ( & mc_set_perms ); >+ VG_(init_copy_mem_remap) ( & mc_copy_address_range_state ); >+ VG_(init_change_mem_mprotect) ( & mc_set_perms ); > >- VG_(track_die_mem_stack_signal) ( & MC_(make_noaccess) ); >- VG_(track_die_mem_brk) ( & MC_(make_noaccess) ); >- VG_(track_die_mem_munmap) ( & MC_(make_noaccess) ); >- >- VG_(track_new_mem_stack_4) ( & MAC_(new_mem_stack_4) ); >- VG_(track_new_mem_stack_8) ( & MAC_(new_mem_stack_8) ); >- VG_(track_new_mem_stack_12) ( & MAC_(new_mem_stack_12) ); >- VG_(track_new_mem_stack_16) ( & MAC_(new_mem_stack_16) ); >- VG_(track_new_mem_stack_32) ( & MAC_(new_mem_stack_32) ); >- VG_(track_new_mem_stack) ( & MAC_(new_mem_stack) ); >- >- VG_(track_die_mem_stack_4) ( & MAC_(die_mem_stack_4) ); >- VG_(track_die_mem_stack_8) ( & MAC_(die_mem_stack_8) ); >- VG_(track_die_mem_stack_12) ( & MAC_(die_mem_stack_12) ); >- VG_(track_die_mem_stack_16) ( & MAC_(die_mem_stack_16) ); >- VG_(track_die_mem_stack_32) ( & MAC_(die_mem_stack_32) ); >- VG_(track_die_mem_stack) ( & MAC_(die_mem_stack) ); >+ VG_(init_die_mem_stack_signal) ( & MC_(make_noaccess) ); >+ VG_(init_die_mem_brk) ( & MC_(make_noaccess) ); >+ VG_(init_die_mem_munmap) ( & MC_(make_noaccess) ); >+ >+ VG_(init_new_mem_stack_4) ( & MAC_(new_mem_stack_4) ); >+ VG_(init_new_mem_stack_8) ( & MAC_(new_mem_stack_8) ); >+ VG_(init_new_mem_stack_12) ( & MAC_(new_mem_stack_12) ); >+ VG_(init_new_mem_stack_16) ( & MAC_(new_mem_stack_16) ); >+ VG_(init_new_mem_stack_32) ( & MAC_(new_mem_stack_32) ); >+ VG_(init_new_mem_stack) ( & MAC_(new_mem_stack) ); >+ >+ VG_(init_die_mem_stack_4) ( & MAC_(die_mem_stack_4) ); >+ VG_(init_die_mem_stack_8) ( & MAC_(die_mem_stack_8) ); >+ VG_(init_die_mem_stack_12) ( & MAC_(die_mem_stack_12) ); >+ VG_(init_die_mem_stack_16) ( & MAC_(die_mem_stack_16) ); >+ VG_(init_die_mem_stack_32) ( & MAC_(die_mem_stack_32) ); >+ VG_(init_die_mem_stack) ( & MAC_(die_mem_stack) ); > >- VG_(track_ban_mem_stack) ( & MC_(make_noaccess) ); >+ VG_(init_ban_mem_stack) ( & MC_(make_noaccess) ); > >- VG_(track_pre_mem_read) ( & mc_check_is_readable ); >- VG_(track_pre_mem_read_asciiz) ( & mc_check_is_readable_asciiz ); >- VG_(track_pre_mem_write) ( & mc_check_is_writable ); >- VG_(track_post_mem_write) ( & MC_(make_readable) ); >- >- VG_(track_post_regs_write_init) ( & mc_post_regs_write_init ); >- VG_(track_post_reg_write_syscall_return) ( & mc_post_reg_write ); >- VG_(track_post_reg_write_deliver_signal) ( & mc_post_reg_write ); >- VG_(track_post_reg_write_pthread_return) ( & mc_post_reg_write ); >- VG_(track_post_reg_write_clientreq_return) ( & mc_post_reg_write ); >- VG_(track_post_reg_write_clientcall_return) ( & mc_post_reg_write_clientcall ); >+ VG_(init_pre_mem_read) ( & mc_check_is_readable ); >+ VG_(init_pre_mem_read_asciiz) ( & mc_check_is_readable_asciiz ); >+ VG_(init_pre_mem_write) ( & mc_check_is_writable ); >+ VG_(init_post_mem_write) ( & MC_(make_readable) ); >+ >+ VG_(init_post_regs_write_init) ( & mc_post_regs_write_init ); >+ VG_(init_post_reg_write_syscall_return) ( & mc_post_reg_write ); >+ VG_(init_post_reg_write_deliver_signal) ( & mc_post_reg_write ); >+ VG_(init_post_reg_write_pthread_return) ( & mc_post_reg_write ); >+ VG_(init_post_reg_write_clientreq_return) ( & mc_post_reg_write ); >+ VG_(init_post_reg_write_clientcall_return) ( & mc_post_reg_write_clientcall ); > > /* Three compact slots taken up by stack memory helpers */ > VG_(register_compact_helper)((Addr) & MC_(helper_value_check4_fail)); >@@ -1760,6 +1745,8 @@ > } > } > >+VG_DETERMINE_INTERFACE_VERSION(SK_(pre_clo_init), 9./8) >+ > /*--------------------------------------------------------------------*/ > /*--- end mc_main.c ---*/ > /*--------------------------------------------------------------------*/ >diff -ruN valgrind-2.1.0/memcheck/mc_translate.c valgrind/memcheck/mc_translate.c >--- valgrind-2.1.0/memcheck/mc_translate.c 2003-11-14 11:47:54.000000000 -0600 >+++ valgrind/memcheck/mc_translate.c 2004-02-11 17:33:28.000000000 -0600 >@@ -1,4 +1,4 @@ >-/* -*- c-basic-offset: 3 -*- */ >+ > /*--------------------------------------------------------------------*/ > /*--- Instrument UCode to perform memory checking operations. ---*/ > /*--- mc_translate.c ---*/ >@@ -8,7 +8,7 @@ > This file is part of MemCheck, a heavyweight Valgrind tool for > detecting memory errors. > >- Copyright (C) 2000-2003 Julian Seward >+ Copyright (C) 2000-2004 Julian Seward > jseward@acm.org > > This program is free software; you can redistribute it and/or >@@ -718,9 +718,9 @@ > Noticed by Kevin Ryde <user42@zip.com.au> > */ > /* sk_assert(u_in->flags_w != FlagsEmpty); */ >- qs = getOperandShadow(cb, u_in->size, u_in->tag1, u_in->val1); >+ qs = getOperandShadow(cb, 1, u_in->tag1, u_in->val1); > /* We can safely modify qs; cast it to 0-size. */ >- create_PCast(cb, u_in->size, 0, qs); >+ create_PCast(cb, 1, 0, qs); > qd = SHADOW(u_in->val2); > create_PCast(cb, u_in->size, 0, qd); > /* qs is cast-to-0(shift count#), and qd is cast-to-0(value#). */ >@@ -1076,14 +1076,17 @@ > } > > /* SSE ins referencing scalar integer registers */ >- case SSE3g_RegWr: >+ case SSE2g_RegWr: >+ case SSE2g1_RegWr: >+ case SSE2e1_RegRd: >+ case SSE3g_RegWr: > case SSE3e_RegRd: > case SSE3e_RegWr: > case SSE3g1_RegWr: > case SSE3e1_RegRd: > sk_assert(u_in->tag3 == TempReg); > >- if (u_in->opcode == SSE3e1_RegRd) { >+ if (u_in->opcode == SSE2e1_RegRd || u_in->opcode == SSE3e1_RegRd) { > sk_assert(u_in->size == 2); > } else { > sk_assert(u_in->size == 4); >@@ -1108,16 +1111,18 @@ > case SSE3a_MemWr: > case SSE2a_MemWr: > case SSE2a_MemRd: >- case SSE3a1_MemRd: { >+ case SSE3a1_MemRd: >+ case SSE2a1_MemRd: { > Bool is_load; > Int t_size; > >- sk_assert(u_in->size == 4 >- || u_in->size == 8 || u_in->size == 16); >+ sk_assert(u_in->size == 4 || u_in->size == 8 >+ || u_in->size == 16 || u_in->size == 512); > > t_size = INVALID_TEMPREG; > is_load = u_in->opcode==SSE2a_MemRd > || u_in->opcode==SSE3a_MemRd >+ || u_in->opcode==SSE2a1_MemRd > || u_in->opcode==SSE3a1_MemRd; > > sk_assert(u_in->tag3 == TempReg); >@@ -1491,7 +1496,7 @@ > case Tag_ImproveAND1_TQ: > sz = 1; goto do_ImproveAND; > do_ImproveAND: >- /* Implements Q = T OR Q. So if Q is entirely defined, >+ /* Implements Q = T AND Q. So if Q is entirely defined, > ie all 0s, we get MOV T, Q. */ > if (def[u->val2] <= 4) { > sk_assert(def[u->val2] == sz); >diff -ruN valgrind-2.1.0/memcheck/memcheck.h valgrind/memcheck/memcheck.h >--- valgrind-2.1.0/memcheck/memcheck.h 2003-11-14 11:47:54.000000000 -0600 >+++ valgrind/memcheck/memcheck.h 2004-01-21 09:08:04.000000000 -0600 >@@ -12,7 +12,7 @@ > This file is part of MemCheck, a heavyweight Valgrind tool for > detecting memory errors. > >- Copyright (C) 2002-2003 Julian Seward. All rights reserved. >+ Copyright (C) 2000-2004 Julian Seward. All rights reserved. > > Redistribution and use in source and binary forms, with or without > modification, are permitted provided that the following conditions >@@ -82,14 +82,17 @@ > VG_USERREQ__COUNT_LEAKS, > > /* These two have been moved into core, because they are useful for >- any skin that tracks heap blocks. Hence the suffix. But they're >+ any tool that tracks heap blocks. Hence the suffix. But they're > still here for backwards compatibility, although Valgrind will > abort with an explanatory message if you use them. */ > VG_USERREQ__MALLOCLIKE_BLOCK__OLD_DO_NOT_USE, > VG_USERREQ__FREELIKE_BLOCK__OLD_DO_NOT_USE, > > VG_USERREQ__GET_VBITS, >- VG_USERREQ__SET_VBITS >+ VG_USERREQ__SET_VBITS, >+ >+ /* This is just for memcheck's internal use - don't use it */ >+ _VG_USERREQ__MEMCHECK_GET_RECORD_OVERLAP = VG_USERREQ_SKIN_BASE('M','C')+256, > } Vg_MemCheckClientRequest; > > >diff -ruN valgrind-2.1.0/memcheck/tests/.cvsignore valgrind/memcheck/tests/.cvsignore >--- valgrind-2.1.0/memcheck/tests/.cvsignore 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/memcheck/tests/.cvsignore 2004-01-03 09:22:09.000000000 -0600 >@@ -0,0 +1,58 @@ >+Makefile.in >+Makefile >+badaddrvalue >+badfree >+badjump >+badloop >+buflen_check >+clientperm >+clientstackperm >+custom_alloc >+dir >+doublefree >+error_counts >+errs1 >+exitprog >+filter_leak_check_size >+filter_stderr >+fprw >+fwrite >+inits >+inline >+malloc1 >+malloc2 >+malloc3 >+manuel1 >+manuel2 >+manuel3 >+memalign_test >+memcmptest >+mismatches >+mmaptest >+nanoleak >+new_override >+null_socket >+overlap >+pushfpopf >+realloc1 >+realloc2 >+sigaltstack >+signal2 >+supp1 >+supp2 >+suppfree >+trivialleak >+tronical >+weirdioctl >+*.stdout.diff >+*.stderr.diff >+*.stdout.out >+*.stderr.out >+badrw >+brk >+metadata >+new_nothrow >+realloc3 >+threadederrno >+writev >+zeropage >diff -ruN valgrind-2.1.0/memcheck/tests/CVS/Entries valgrind/memcheck/tests/CVS/Entries >--- valgrind-2.1.0/memcheck/tests/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/memcheck/tests/CVS/Entries 2004-02-11 22:51:47.805544696 -0600 >@@ -0,0 +1,177 @@ >+/.cvsignore/1.8/Sat Jan 3 15:22:09 2004// >+/Makefile.am/1.30/Tue Dec 2 14:56:04 2003// >+/badaddrvalue.c/1.2/Mon Sep 23 09:36:25 2002// >+/badaddrvalue.stderr.exp/1.8/Thu Nov 13 17:53:43 2003// >+/badaddrvalue.stdout.exp/1.2/Mon Sep 23 09:36:25 2002// >+/badaddrvalue.vgtest/1.3/Sun Jul 6 23:24:18 2003// >+/badfree-2trace.stderr.exp/1.5/Thu Nov 13 17:53:43 2003// >+/badfree-2trace.vgtest/1.3/Sun Jul 6 23:43:01 2003// >+/badfree.c/1.2/Mon Sep 23 09:36:25 2002// >+/badfree.stderr.exp/1.9/Thu Nov 13 17:53:43 2003// >+/badfree.vgtest/1.3/Sun Jul 6 23:43:01 2003// >+/badjump.c/1.2/Mon Sep 23 09:36:25 2002// >+/badjump.stderr.exp/1.7/Tue Dec 16 02:05:15 2003// >+/badjump.vgtest/1.2/Mon Sep 23 09:36:25 2002// >+/badloop.c/1.2/Mon Sep 23 09:36:25 2002// >+/badloop.stderr.exp/1.6/Thu Nov 13 17:35:04 2003// >+/badloop.vgtest/1.3/Sun Jul 6 23:43:01 2003// >+/badrw.c/1.2/Wed Jan 7 08:47:03 2004// >+/badrw.stderr.exp/1.4/Wed Jan 7 08:47:03 2004// >+/badrw.vgtest/1.1/Fri Sep 5 23:29:33 2003// >+/brk.c/1.1/Thu Sep 4 20:57:51 2003// >+/brk.stderr.exp/1.1/Thu Sep 4 20:57:51 2003// >+/brk.vgtest/1.1/Thu Sep 4 20:57:51 2003// >+/buflen_check.c/1.2/Mon Sep 23 09:36:25 2002// >+/buflen_check.stderr.exp/1.7/Thu Nov 13 17:53:43 2003// >+/buflen_check.vgtest/1.3/Sun Jul 6 23:43:01 2003// >+/clientperm.c/1.1/Fri Oct 4 14:16:35 2002// >+/clientperm.stderr.exp/1.5/Thu Nov 13 17:35:04 2003// >+/clientperm.stdout.exp/1.1/Fri Oct 4 14:16:35 2002// >+/clientperm.vgtest/1.2/Sun Jul 6 23:43:01 2003// >+/custom_alloc.c/1.2/Sat Jan 3 14:18:02 2004// >+/custom_alloc.stderr.exp/1.4/Thu Nov 13 17:53:43 2003// >+/custom_alloc.vgtest/1.2/Sun Jul 6 23:43:01 2003// >+/doublefree.c/1.2/Mon Sep 23 09:36:25 2002// >+/doublefree.stderr.exp/1.9/Thu Nov 13 17:53:43 2003// >+/doublefree.vgtest/1.3/Mon Jul 7 00:23:23 2003// >+/error_counts.c/1.4/Tue Jul 22 22:03:58 2003// >+/error_counts.stderr.exp/1.1/Mon Apr 21 13:24:40 2003// >+/error_counts.stdout.exp/1.1/Mon Apr 21 13:24:40 2003// >+/error_counts.vgtest/1.1/Mon Apr 21 13:24:40 2003// >+/errs1.c/1.2/Mon Sep 23 09:36:25 2002// >+/errs1.stderr.exp/1.5/Thu Nov 13 17:53:43 2003// >+/errs1.vgtest/1.3/Sun Jul 13 22:35:55 2003// >+/exitprog.c/1.3/Mon Jul 7 00:32:44 2003// >+/exitprog.stderr.exp/1.10/Thu Nov 13 17:53:43 2003// >+/exitprog.vgtest/1.3/Mon Jul 7 00:23:23 2003// >+/filter_allocs/1.3/Sat Jan 3 14:18:02 2004// >+/filter_leak_check_size/1.4/Sat Jan 3 14:18:02 2004// >+/filter_pushfpopf/1.2/Mon May 5 16:18:51 2003// >+/filter_stderr/1.9/Sat Jan 3 14:18:02 2004// >+/filter_stderr_backtrace/1.1/Thu Apr 24 00:40:38 2003// >+/filter_tronical/1.2/Mon May 5 16:18:51 2003// >+/fprw.c/1.2/Mon Sep 23 09:36:25 2002// >+/fprw.stderr.exp/1.9/Thu Nov 13 17:53:43 2003// >+/fprw.vgtest/1.4/Tue Dec 16 02:05:15 2003// >+/fwrite.c/1.2/Mon Sep 23 09:36:25 2002// >+/fwrite.stderr.exp/1.9/Mon Dec 15 09:00:21 2003// >+/fwrite.stdout.exp/1.2/Mon Sep 23 09:36:25 2002// >+/fwrite.vgtest/1.3/Mon Jul 7 00:23:23 2003// >+/inits.c/1.2/Mon Sep 23 09:36:25 2002// >+/inits.stderr.exp/1.6/Thu Nov 13 17:35:04 2003// >+/inits.vgtest/1.3/Mon Jul 7 00:23:23 2003// >+/inline.c/1.2/Mon Sep 23 09:36:25 2002// >+/inline.stderr.exp/1.9/Thu Nov 13 17:53:43 2003// >+/inline.stdout.exp/1.2/Mon Sep 23 09:36:25 2002// >+/inline.vgtest/1.3/Mon Jul 7 00:23:23 2003// >+/malloc1.c/1.2/Mon Sep 23 09:36:25 2002// >+/malloc1.stderr.exp/1.9/Thu Nov 13 17:53:43 2003// >+/malloc1.vgtest/1.3/Mon Jul 7 00:23:23 2003// >+/malloc2.c/1.2/Mon Sep 23 09:36:25 2002// >+/malloc2.stderr.exp/1.9/Thu Nov 13 17:53:43 2003// >+/malloc2.vgtest/1.3/Mon Jul 7 00:23:23 2003// >+/malloc3.c/1.1/Tue Apr 15 13:03:20 2003// >+/malloc3.stderr.exp/1.2/Mon Jul 7 00:23:23 2003// >+/malloc3.stdout.exp/1.1/Tue Apr 15 13:03:20 2003// >+/malloc3.vgtest/1.2/Mon Jul 7 00:23:23 2003// >+/manuel1.c/1.2/Mon Sep 23 09:36:25 2002// >+/manuel1.stderr.exp/1.6/Thu Nov 13 17:35:04 2003// >+/manuel1.stdout.exp/1.2/Mon Sep 23 09:36:25 2002// >+/manuel1.vgtest/1.3/Mon Jul 7 00:43:34 2003// >+/manuel2.c/1.3/Sat Jan 3 14:18:02 2004// >+/manuel2.stderr.exp/1.6/Thu Nov 13 17:35:04 2003// >+/manuel2.stdout.exp/1.2/Mon Sep 23 09:36:25 2002// >+/manuel2.vgtest/1.3/Mon Jul 7 00:43:34 2003// >+/manuel3.c/1.3/Sat Jan 3 14:18:02 2004// >+/manuel3.stderr.exp/1.6/Thu Nov 13 17:35:04 2003// >+/manuel3.vgtest/1.3/Mon Jul 7 00:43:34 2003// >+/memalign_test.c/1.2/Mon Sep 23 09:36:25 2002// >+/memalign_test.stderr.exp/1.9/Thu Nov 13 17:53:43 2003// >+/memalign_test.vgtest/1.3/Mon Jul 7 00:43:34 2003// >+/memcmptest.c/1.2/Mon Sep 23 09:36:25 2002// >+/memcmptest.stderr.exp/1.7/Thu Nov 13 17:35:04 2003// >+/memcmptest.stdout.exp/1.2/Mon Sep 23 09:36:25 2002// >+/memcmptest.vgtest/1.3/Mon Jul 7 00:43:34 2003// >+/metadata.c/1.2/Sat Jan 3 14:18:02 2004// >+/metadata.stderr.exp/1.2/Thu Nov 13 17:35:04 2003// >+/metadata.stdout.exp/1.1/Mon Jul 7 00:03:52 2003// >+/metadata.vgtest/1.1/Mon Jul 7 00:03:52 2003// >+/mismatches.cpp/1.2/Mon Sep 23 09:36:25 2002// >+/mismatches.stderr.exp/1.10/Thu Nov 13 17:53:43 2003// >+/mismatches.vgtest/1.5/Tue Sep 30 16:52:47 2003// >+/mmaptest.c/1.2/Mon Sep 23 09:36:25 2002// >+/mmaptest.stderr.exp/1.3/Mon Jul 7 00:43:34 2003// >+/mmaptest.vgtest/1.3/Mon Jul 7 00:43:34 2003// >+/nanoleak.c/1.3/Sat Jan 3 14:18:02 2004// >+/nanoleak.stderr.exp/1.9/Tue Dec 2 10:17:44 2003// >+/nanoleak.supp/1.2/Tue Dec 16 02:05:15 2003// >+/nanoleak.vgtest/1.3/Mon Jul 7 00:43:34 2003// >+/nanoleak_supp.stderr.exp/1.3/Tue Dec 2 10:17:44 2003// >+/nanoleak_supp.vgtest/1.2/Mon Jul 7 23:56:10 2003// >+/new_nothrow.cpp/1.1/Thu Oct 9 15:40:38 2003// >+/new_nothrow.stderr.exp/1.1/Thu Oct 9 15:40:38 2003// >+/new_nothrow.vgtest/1.1/Thu Oct 9 15:40:38 2003// >+/new_override.cpp/1.2/Mon Sep 23 09:36:25 2002// >+/new_override.stderr.exp/1.6/Sun Jun 1 20:04:10 2003// >+/new_override.vgtest/1.3/Wed Feb 26 10:16:02 2003// >+/null_socket.c/1.1/Fri May 2 16:19:10 2003// >+/null_socket.stderr.exp/1.2/Mon Jul 7 23:56:10 2003// >+/null_socket.vgtest/1.2/Mon Jul 7 23:56:10 2003// >+/overlap.c/1.3/Sun Nov 2 17:43:27 2003// >+/overlap.stderr.exp/1.7/Thu Nov 13 17:35:04 2003// >+/overlap.stdout.exp/1.1/Tue Apr 15 13:03:21 2003// >+/overlap.vgtest/1.2/Mon Jul 7 23:56:10 2003// >+/pth_once.stderr.exp/1.1/Thu Oct 30 09:11:03 2003// >+/pth_once.stdout.exp/1.1/Thu Oct 30 09:11:03 2003// >+/pth_once.vgtest/1.1/Thu Oct 30 09:11:03 2003// >+/pushfpopf.stderr.exp/1.7/Thu Nov 13 17:35:04 2003// >+/pushfpopf.stdout.exp/1.2/Mon Sep 23 09:36:25 2002// >+/pushfpopf.vgtest/1.4/Mon Jul 7 23:56:10 2003// >+/pushfpopf_c.c/1.2/Mon Sep 23 09:36:25 2002// >+/pushfpopf_s.s/1.2/Mon Sep 23 09:36:25 2002// >+/realloc1.c/1.3/Mon Jul 7 23:56:10 2003// >+/realloc1.stderr.exp/1.3/Mon Jul 7 23:56:10 2003// >+/realloc1.vgtest/1.3/Mon Jul 7 23:56:10 2003// >+/realloc2.c/1.3/Sat Jan 3 14:18:02 2004// >+/realloc2.stderr.exp/1.3/Mon Jul 7 23:56:10 2003// >+/realloc2.vgtest/1.3/Mon Jul 7 23:56:10 2003// >+/realloc3.c/1.1/Thu Jul 24 17:39:59 2003// >+/realloc3.stderr.exp/1.3/Thu Nov 13 17:53:43 2003// >+/realloc3.vgtest/1.1/Thu Jul 24 17:39:59 2003// >+/sigaltstack.c/1.7/Sat Jan 3 14:18:02 2004// >+/sigaltstack.stderr.exp/1.8/Tue Dec 16 02:05:15 2003// >+/sigaltstack.vgtest/1.4/Mon Jul 7 23:56:10 2003// >+/signal2.c/1.2/Mon Sep 23 09:36:25 2002// >+/signal2.stderr.exp/1.8/Thu Nov 13 17:53:43 2003// >+/signal2.stdout.exp/1.2/Mon Sep 23 09:36:25 2002// >+/signal2.vgtest/1.3/Mon Jul 7 23:56:10 2003// >+/supp.c/1.3/Mon Jul 7 23:56:10 2003// >+/supp.supp/1.5/Mon Oct 7 14:46:07 2002// >+/supp1.stderr.exp/1.3/Mon Jul 7 23:56:10 2003// >+/supp1.vgtest/1.3/Mon Jul 7 23:56:10 2003// >+/supp2.stderr.exp/1.6/Thu Nov 13 17:35:04 2003// >+/supp2.vgtest/1.3/Mon Jul 7 23:56:10 2003// >+/suppfree.c/1.2/Mon Sep 23 09:36:25 2002// >+/suppfree.stderr.exp/1.5/Thu Nov 13 17:53:43 2003// >+/suppfree.vgtest/1.3/Mon Jul 7 23:56:10 2003// >+/threadederrno.c/1.4/Wed Jan 21 17:40:16 2004// >+/threadederrno.stderr.exp/1.2/Tue Dec 16 02:05:15 2003// >+/threadederrno.stdout.exp/1.4/Wed Jan 21 17:40:16 2004// >+/threadederrno.vgtest/1.1/Sun Jul 13 11:13:37 2003// >+/trivialleak.c/1.2/Mon Sep 23 09:36:25 2002// >+/trivialleak.stderr.exp/1.8/Tue Dec 2 10:17:44 2003// >+/trivialleak.vgtest/1.3/Mon Jul 7 23:56:10 2003// >+/tronical.S/1.3/Sun Oct 6 00:08:57 2002// >+/tronical.stderr.exp/1.7/Thu Nov 13 17:35:04 2003// >+/tronical.vgtest/1.4/Mon Jul 7 23:56:10 2003// >+/weirdioctl.c/1.2/Mon Sep 23 09:36:25 2002// >+/weirdioctl.stderr.exp/1.8/Mon Dec 15 09:00:21 2003// >+/weirdioctl.stdout.exp/1.3/Mon Jul 7 23:56:10 2003// >+/weirdioctl.vgtest/1.3/Mon Jul 7 23:56:10 2003// >+/writev.c/1.1/Fri Sep 5 23:02:38 2003// >+/writev.stderr.exp/1.5/Mon Dec 15 09:00:21 2003// >+/writev.vgtest/1.1/Fri Sep 5 23:02:38 2003// >+/zeropage.c/1.2/Sat Jan 3 14:18:02 2004// >+/zeropage.stderr.exp/1.2/Tue Dec 16 02:05:15 2003// >+/zeropage.vgtest/1.1/Tue Dec 2 14:56:04 2003// >+D >diff -ruN valgrind-2.1.0/memcheck/tests/CVS/Repository valgrind/memcheck/tests/CVS/Repository >--- valgrind-2.1.0/memcheck/tests/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/memcheck/tests/CVS/Repository 2004-02-11 22:51:47.514588928 -0600 >@@ -0,0 +1 @@ >+valgrind/memcheck/tests >diff -ruN valgrind-2.1.0/memcheck/tests/CVS/Root valgrind/memcheck/tests/CVS/Root >--- valgrind-2.1.0/memcheck/tests/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/memcheck/tests/CVS/Root 2004-02-11 22:51:47.513589080 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/memcheck/tests/Makefile.in valgrind/memcheck/tests/Makefile.in >--- valgrind-2.1.0/memcheck/tests/Makefile.in 2003-12-14 09:50:20.000000000 -0600 >+++ valgrind/memcheck/tests/Makefile.in 2004-02-11 22:52:34.602430488 -0600 >@@ -1,8 +1,8 @@ >-# Makefile.in generated by automake 1.7.6 from Makefile.am. >+# Makefile.in generated by automake 1.8.2 from Makefile.am. > # @configure_input@ > >-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 >-# Free Software Foundation, Inc. >+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, >+# 2003, 2004 Free Software Foundation, Inc. > # This Makefile.in is free software; the Free Software Foundation > # gives unlimited permission to copy and/or distribute it, > # with or without modifications, as long as this notice is preserved. >@@ -14,6 +14,8 @@ > > @SET_MAKE@ > >+SOURCES = $(badaddrvalue_SOURCES) $(badfree_SOURCES) $(badjump_SOURCES) $(badloop_SOURCES) $(badrw_SOURCES) $(brk_SOURCES) $(buflen_check_SOURCES) $(clientperm_SOURCES) $(custom_alloc_SOURCES) $(doublefree_SOURCES) $(error_counts_SOURCES) $(errs1_SOURCES) $(exitprog_SOURCES) $(fprw_SOURCES) $(fwrite_SOURCES) $(inits_SOURCES) $(inline_SOURCES) $(malloc1_SOURCES) $(malloc2_SOURCES) $(malloc3_SOURCES) $(manuel1_SOURCES) $(manuel2_SOURCES) $(manuel3_SOURCES) $(memalign_test_SOURCES) $(memcmptest_SOURCES) $(metadata_SOURCES) $(mismatches_SOURCES) $(mmaptest_SOURCES) $(nanoleak_SOURCES) $(new_nothrow_SOURCES) $(new_override_SOURCES) $(null_socket_SOURCES) $(overlap_SOURCES) $(pushfpopf_SOURCES) $(realloc1_SOURCES) $(realloc2_SOURCES) $(realloc3_SOURCES) $(sigaltstack_SOURCES) $(signal2_SOURCES) $(supp1_SOURCES) $(supp2_SOURCES) $(suppfree_SOURCES) $(threadederrno_SOURCES) $(trivialleak_SOURCES) $(tronical_SOURCES) $(weirdioctl_SOURCES) $(writev_SOURCES) $(zeropage_SOURCES) >+ > srcdir = @srcdir@ > top_srcdir = @top_srcdir@ > VPATH = @srcdir@ >@@ -21,7 +23,6 @@ > pkglibdir = $(libdir)/@PACKAGE@ > pkgincludedir = $(includedir)/@PACKAGE@ > top_builddir = ../.. >- > am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd > INSTALL = @INSTALL@ > install_sh_DATA = $(install_sh) -c -m 644 >@@ -36,6 +37,257 @@ > PRE_UNINSTALL = : > POST_UNINSTALL = : > host_triplet = @host@ >+check_PROGRAMS = badaddrvalue$(EXEEXT) badfree$(EXEEXT) \ >+ badjump$(EXEEXT) badloop$(EXEEXT) badrw$(EXEEXT) brk$(EXEEXT) \ >+ buflen_check$(EXEEXT) clientperm$(EXEEXT) \ >+ custom_alloc$(EXEEXT) doublefree$(EXEEXT) \ >+ error_counts$(EXEEXT) errs1$(EXEEXT) exitprog$(EXEEXT) \ >+ fprw$(EXEEXT) fwrite$(EXEEXT) inits$(EXEEXT) inline$(EXEEXT) \ >+ malloc1$(EXEEXT) malloc2$(EXEEXT) malloc3$(EXEEXT) \ >+ manuel1$(EXEEXT) manuel2$(EXEEXT) manuel3$(EXEEXT) \ >+ memalign_test$(EXEEXT) memcmptest$(EXEEXT) mmaptest$(EXEEXT) \ >+ nanoleak$(EXEEXT) new_nothrow$(EXEEXT) null_socket$(EXEEXT) \ >+ overlap$(EXEEXT) pushfpopf$(EXEEXT) realloc1$(EXEEXT) \ >+ realloc2$(EXEEXT) realloc3$(EXEEXT) sigaltstack$(EXEEXT) \ >+ signal2$(EXEEXT) supp1$(EXEEXT) supp2$(EXEEXT) \ >+ suppfree$(EXEEXT) trivialleak$(EXEEXT) tronical$(EXEEXT) \ >+ weirdioctl$(EXEEXT) mismatches$(EXEEXT) new_override$(EXEEXT) \ >+ metadata$(EXEEXT) threadederrno$(EXEEXT) writev$(EXEEXT) \ >+ zeropage$(EXEEXT) >+subdir = memcheck/tests >+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in >+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >+am__aclocal_m4_deps = $(top_srcdir)/configure.in >+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ >+ $(ACLOCAL_M4) >+mkinstalldirs = $(mkdir_p) >+CONFIG_HEADER = $(top_builddir)/config.h >+CONFIG_CLEAN_FILES = >+am_badaddrvalue_OBJECTS = badaddrvalue.$(OBJEXT) >+badaddrvalue_OBJECTS = $(am_badaddrvalue_OBJECTS) >+badaddrvalue_LDADD = $(LDADD) >+am_badfree_OBJECTS = badfree.$(OBJEXT) >+badfree_OBJECTS = $(am_badfree_OBJECTS) >+badfree_LDADD = $(LDADD) >+am_badjump_OBJECTS = badjump.$(OBJEXT) >+badjump_OBJECTS = $(am_badjump_OBJECTS) >+badjump_LDADD = $(LDADD) >+am_badloop_OBJECTS = badloop.$(OBJEXT) >+badloop_OBJECTS = $(am_badloop_OBJECTS) >+badloop_LDADD = $(LDADD) >+am_badrw_OBJECTS = badrw.$(OBJEXT) >+badrw_OBJECTS = $(am_badrw_OBJECTS) >+badrw_LDADD = $(LDADD) >+am_brk_OBJECTS = brk.$(OBJEXT) >+brk_OBJECTS = $(am_brk_OBJECTS) >+brk_LDADD = $(LDADD) >+am_buflen_check_OBJECTS = buflen_check.$(OBJEXT) >+buflen_check_OBJECTS = $(am_buflen_check_OBJECTS) >+buflen_check_LDADD = $(LDADD) >+am_clientperm_OBJECTS = clientperm.$(OBJEXT) >+clientperm_OBJECTS = $(am_clientperm_OBJECTS) >+clientperm_LDADD = $(LDADD) >+am_custom_alloc_OBJECTS = custom_alloc.$(OBJEXT) >+custom_alloc_OBJECTS = $(am_custom_alloc_OBJECTS) >+custom_alloc_LDADD = $(LDADD) >+am_doublefree_OBJECTS = doublefree.$(OBJEXT) >+doublefree_OBJECTS = $(am_doublefree_OBJECTS) >+doublefree_LDADD = $(LDADD) >+am_error_counts_OBJECTS = error_counts.$(OBJEXT) >+error_counts_OBJECTS = $(am_error_counts_OBJECTS) >+error_counts_LDADD = $(LDADD) >+am_errs1_OBJECTS = errs1.$(OBJEXT) >+errs1_OBJECTS = $(am_errs1_OBJECTS) >+errs1_LDADD = $(LDADD) >+am_exitprog_OBJECTS = exitprog.$(OBJEXT) >+exitprog_OBJECTS = $(am_exitprog_OBJECTS) >+exitprog_LDADD = $(LDADD) >+am_fprw_OBJECTS = fprw.$(OBJEXT) >+fprw_OBJECTS = $(am_fprw_OBJECTS) >+fprw_LDADD = $(LDADD) >+am_fwrite_OBJECTS = fwrite.$(OBJEXT) >+fwrite_OBJECTS = $(am_fwrite_OBJECTS) >+fwrite_LDADD = $(LDADD) >+am_inits_OBJECTS = inits.$(OBJEXT) >+inits_OBJECTS = $(am_inits_OBJECTS) >+inits_LDADD = $(LDADD) >+am_inline_OBJECTS = inline.$(OBJEXT) >+inline_OBJECTS = $(am_inline_OBJECTS) >+inline_LDADD = $(LDADD) >+am_malloc1_OBJECTS = malloc1.$(OBJEXT) >+malloc1_OBJECTS = $(am_malloc1_OBJECTS) >+malloc1_LDADD = $(LDADD) >+am_malloc2_OBJECTS = malloc2.$(OBJEXT) >+malloc2_OBJECTS = $(am_malloc2_OBJECTS) >+malloc2_LDADD = $(LDADD) >+am_malloc3_OBJECTS = malloc3.$(OBJEXT) >+malloc3_OBJECTS = $(am_malloc3_OBJECTS) >+malloc3_LDADD = $(LDADD) >+am_manuel1_OBJECTS = manuel1.$(OBJEXT) >+manuel1_OBJECTS = $(am_manuel1_OBJECTS) >+manuel1_LDADD = $(LDADD) >+am_manuel2_OBJECTS = manuel2.$(OBJEXT) >+manuel2_OBJECTS = $(am_manuel2_OBJECTS) >+manuel2_LDADD = $(LDADD) >+am_manuel3_OBJECTS = manuel3.$(OBJEXT) >+manuel3_OBJECTS = $(am_manuel3_OBJECTS) >+manuel3_LDADD = $(LDADD) >+am_memalign_test_OBJECTS = memalign_test.$(OBJEXT) >+memalign_test_OBJECTS = $(am_memalign_test_OBJECTS) >+memalign_test_LDADD = $(LDADD) >+am_memcmptest_OBJECTS = memcmptest.$(OBJEXT) >+memcmptest_OBJECTS = $(am_memcmptest_OBJECTS) >+memcmptest_LDADD = $(LDADD) >+am_metadata_OBJECTS = metadata.$(OBJEXT) >+metadata_OBJECTS = $(am_metadata_OBJECTS) >+metadata_LDADD = $(LDADD) >+am_mismatches_OBJECTS = mismatches.$(OBJEXT) >+mismatches_OBJECTS = $(am_mismatches_OBJECTS) >+mismatches_LDADD = $(LDADD) >+am_mmaptest_OBJECTS = mmaptest.$(OBJEXT) >+mmaptest_OBJECTS = $(am_mmaptest_OBJECTS) >+mmaptest_LDADD = $(LDADD) >+am_nanoleak_OBJECTS = nanoleak.$(OBJEXT) >+nanoleak_OBJECTS = $(am_nanoleak_OBJECTS) >+nanoleak_LDADD = $(LDADD) >+am_new_nothrow_OBJECTS = new_nothrow.$(OBJEXT) >+new_nothrow_OBJECTS = $(am_new_nothrow_OBJECTS) >+new_nothrow_LDADD = $(LDADD) >+am_new_override_OBJECTS = new_override.$(OBJEXT) >+new_override_OBJECTS = $(am_new_override_OBJECTS) >+new_override_LDADD = $(LDADD) >+am_null_socket_OBJECTS = null_socket.$(OBJEXT) >+null_socket_OBJECTS = $(am_null_socket_OBJECTS) >+null_socket_LDADD = $(LDADD) >+am_overlap_OBJECTS = overlap.$(OBJEXT) >+overlap_OBJECTS = $(am_overlap_OBJECTS) >+overlap_LDADD = $(LDADD) >+am_pushfpopf_OBJECTS = pushfpopf_c.$(OBJEXT) pushfpopf_s.$(OBJEXT) >+pushfpopf_OBJECTS = $(am_pushfpopf_OBJECTS) >+pushfpopf_LDADD = $(LDADD) >+am_realloc1_OBJECTS = realloc1.$(OBJEXT) >+realloc1_OBJECTS = $(am_realloc1_OBJECTS) >+realloc1_LDADD = $(LDADD) >+am_realloc2_OBJECTS = realloc2.$(OBJEXT) >+realloc2_OBJECTS = $(am_realloc2_OBJECTS) >+realloc2_LDADD = $(LDADD) >+am_realloc3_OBJECTS = realloc3.$(OBJEXT) >+realloc3_OBJECTS = $(am_realloc3_OBJECTS) >+realloc3_LDADD = $(LDADD) >+am_sigaltstack_OBJECTS = sigaltstack.$(OBJEXT) >+sigaltstack_OBJECTS = $(am_sigaltstack_OBJECTS) >+sigaltstack_LDADD = $(LDADD) >+am_signal2_OBJECTS = signal2.$(OBJEXT) >+signal2_OBJECTS = $(am_signal2_OBJECTS) >+signal2_LDADD = $(LDADD) >+am_supp1_OBJECTS = supp.$(OBJEXT) >+supp1_OBJECTS = $(am_supp1_OBJECTS) >+supp1_LDADD = $(LDADD) >+am_supp2_OBJECTS = supp.$(OBJEXT) >+supp2_OBJECTS = $(am_supp2_OBJECTS) >+supp2_LDADD = $(LDADD) >+am_suppfree_OBJECTS = suppfree.$(OBJEXT) >+suppfree_OBJECTS = $(am_suppfree_OBJECTS) >+suppfree_LDADD = $(LDADD) >+am_threadederrno_OBJECTS = threadederrno.$(OBJEXT) >+threadederrno_OBJECTS = $(am_threadederrno_OBJECTS) >+threadederrno_DEPENDENCIES = >+am_trivialleak_OBJECTS = trivialleak.$(OBJEXT) >+trivialleak_OBJECTS = $(am_trivialleak_OBJECTS) >+trivialleak_LDADD = $(LDADD) >+am_tronical_OBJECTS = tronical.$(OBJEXT) >+tronical_OBJECTS = $(am_tronical_OBJECTS) >+tronical_LDADD = $(LDADD) >+am_weirdioctl_OBJECTS = weirdioctl.$(OBJEXT) >+weirdioctl_OBJECTS = $(am_weirdioctl_OBJECTS) >+weirdioctl_LDADD = $(LDADD) >+am_writev_OBJECTS = writev.$(OBJEXT) >+writev_OBJECTS = $(am_writev_OBJECTS) >+writev_LDADD = $(LDADD) >+am_zeropage_OBJECTS = zeropage.$(OBJEXT) >+zeropage_OBJECTS = $(am_zeropage_OBJECTS) >+zeropage_LDADD = $(LDADD) >+SCRIPTS = $(noinst_SCRIPTS) >+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) >+depcomp = $(SHELL) $(top_srcdir)/depcomp >+am__depfiles_maybe = depfiles >+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/badaddrvalue.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/badfree.Po ./$(DEPDIR)/badjump.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/badloop.Po ./$(DEPDIR)/badrw.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/brk.Po ./$(DEPDIR)/buflen_check.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/clientperm.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/custom_alloc.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/doublefree.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/error_counts.Po ./$(DEPDIR)/errs1.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/exitprog.Po ./$(DEPDIR)/fprw.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/fwrite.Po ./$(DEPDIR)/inits.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/inline.Po ./$(DEPDIR)/malloc1.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/malloc2.Po ./$(DEPDIR)/malloc3.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/manuel1.Po ./$(DEPDIR)/manuel2.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/manuel3.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/memalign_test.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/memcmptest.Po ./$(DEPDIR)/metadata.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/mismatches.Po ./$(DEPDIR)/mmaptest.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/nanoleak.Po ./$(DEPDIR)/new_nothrow.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/new_override.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/null_socket.Po ./$(DEPDIR)/overlap.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/pushfpopf_c.Po ./$(DEPDIR)/realloc1.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/realloc2.Po ./$(DEPDIR)/realloc3.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/sigaltstack.Po ./$(DEPDIR)/signal2.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/supp.Po ./$(DEPDIR)/suppfree.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/threadederrno.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/trivialleak.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/weirdioctl.Po ./$(DEPDIR)/writev.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/zeropage.Po >+CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS) >+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ >+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) >+CCLD = $(CC) >+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ >+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ >+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) >+CXXLD = $(CXX) >+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ >+ -o $@ >+SOURCES = $(badaddrvalue_SOURCES) $(badfree_SOURCES) \ >+ $(badjump_SOURCES) $(badloop_SOURCES) $(badrw_SOURCES) \ >+ $(brk_SOURCES) $(buflen_check_SOURCES) $(clientperm_SOURCES) \ >+ $(custom_alloc_SOURCES) $(doublefree_SOURCES) \ >+ $(error_counts_SOURCES) $(errs1_SOURCES) $(exitprog_SOURCES) \ >+ $(fprw_SOURCES) $(fwrite_SOURCES) $(inits_SOURCES) \ >+ $(inline_SOURCES) $(malloc1_SOURCES) $(malloc2_SOURCES) \ >+ $(malloc3_SOURCES) $(manuel1_SOURCES) $(manuel2_SOURCES) \ >+ $(manuel3_SOURCES) $(memalign_test_SOURCES) \ >+ $(memcmptest_SOURCES) $(metadata_SOURCES) \ >+ $(mismatches_SOURCES) $(mmaptest_SOURCES) $(nanoleak_SOURCES) \ >+ $(new_nothrow_SOURCES) $(new_override_SOURCES) \ >+ $(null_socket_SOURCES) $(overlap_SOURCES) $(pushfpopf_SOURCES) \ >+ $(realloc1_SOURCES) $(realloc2_SOURCES) $(realloc3_SOURCES) \ >+ $(sigaltstack_SOURCES) $(signal2_SOURCES) $(supp1_SOURCES) \ >+ $(supp2_SOURCES) $(suppfree_SOURCES) $(threadederrno_SOURCES) \ >+ $(trivialleak_SOURCES) $(tronical_SOURCES) \ >+ $(weirdioctl_SOURCES) $(writev_SOURCES) $(zeropage_SOURCES) >+DIST_SOURCES = $(badaddrvalue_SOURCES) $(badfree_SOURCES) \ >+ $(badjump_SOURCES) $(badloop_SOURCES) $(badrw_SOURCES) \ >+ $(brk_SOURCES) $(buflen_check_SOURCES) $(clientperm_SOURCES) \ >+ $(custom_alloc_SOURCES) $(doublefree_SOURCES) \ >+ $(error_counts_SOURCES) $(errs1_SOURCES) $(exitprog_SOURCES) \ >+ $(fprw_SOURCES) $(fwrite_SOURCES) $(inits_SOURCES) \ >+ $(inline_SOURCES) $(malloc1_SOURCES) $(malloc2_SOURCES) \ >+ $(malloc3_SOURCES) $(manuel1_SOURCES) $(manuel2_SOURCES) \ >+ $(manuel3_SOURCES) $(memalign_test_SOURCES) \ >+ $(memcmptest_SOURCES) $(metadata_SOURCES) \ >+ $(mismatches_SOURCES) $(mmaptest_SOURCES) $(nanoleak_SOURCES) \ >+ $(new_nothrow_SOURCES) $(new_override_SOURCES) \ >+ $(null_socket_SOURCES) $(overlap_SOURCES) $(pushfpopf_SOURCES) \ >+ $(realloc1_SOURCES) $(realloc2_SOURCES) $(realloc3_SOURCES) \ >+ $(sigaltstack_SOURCES) $(signal2_SOURCES) $(supp1_SOURCES) \ >+ $(supp2_SOURCES) $(suppfree_SOURCES) $(threadederrno_SOURCES) \ >+ $(trivialleak_SOURCES) $(tronical_SOURCES) \ >+ $(weirdioctl_SOURCES) $(writev_SOURCES) $(zeropage_SOURCES) >+ETAGS = etags >+CTAGS = ctags >+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) > ACLOCAL = @ACLOCAL@ > AMDEP_FALSE = @AMDEP_FALSE@ > AMDEP_TRUE = @AMDEP_TRUE@ >@@ -92,6 +344,7 @@ > SHELL = @SHELL@ > STRIP = @STRIP@ > VERSION = @VERSION@ >+VG_PLATFORM = @VG_PLATFORM@ > ac_ct_CC = @ac_ct_CC@ > ac_ct_CXX = @ac_ct_CXX@ > ac_ct_RANLIB = @ac_ct_RANLIB@ >@@ -123,6 +376,7 @@ > libexecdir = @libexecdir@ > localstatedir = @localstatedir@ > mandir = @mandir@ >+mkdir_p = @mkdir_p@ > oldincludedir = @oldincludedir@ > prefix = @prefix@ > program_transform_name = @program_transform_name@ >@@ -130,12 +384,10 @@ > sharedstatedir = @sharedstatedir@ > sysconfdir = @sysconfdir@ > target_alias = @target_alias@ >- > noinst_SCRIPTS = filter_allocs filter_leak_check_size \ > filter_stderr filter_stderr_backtrace filter_pushfpopf \ > filter_tronical > >- > EXTRA_DIST = $(noinst_SCRIPTS) \ > badaddrvalue.stderr.exp \ > badaddrvalue.stdout.exp badaddrvalue.vgtest \ >@@ -194,19 +446,6 @@ > writev.stderr.exp writev.vgtest \ > zeropage.stderr.exp zeropage.vgtest > >- >-check_PROGRAMS = \ >- badaddrvalue badfree badjump badloop badrw brk buflen_check \ >- clientperm custom_alloc \ >- doublefree error_counts errs1 exitprog fprw fwrite inits inline \ >- malloc1 malloc2 malloc3 manuel1 manuel2 manuel3 \ >- memalign_test memcmptest mmaptest nanoleak new_nothrow null_socket \ >- overlap pushfpopf \ >- realloc1 realloc2 realloc3 sigaltstack signal2 supp1 supp2 suppfree \ >- trivialleak tronical weirdioctl \ >- mismatches new_override metadata threadederrno writev zeropage >- >- > AM_CPPFLAGS = -I$(top_srcdir)/include > AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -g > AM_CXXFLAGS = $(AM_CFLAGS) >@@ -263,339 +502,39 @@ > mismatches_SOURCES = mismatches.cpp > new_nothrow_SOURCES = new_nothrow.cpp > new_override_SOURCES = new_override.cpp >-subdir = memcheck/tests >-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs >-CONFIG_HEADER = $(top_builddir)/config.h >-CONFIG_CLEAN_FILES = >-check_PROGRAMS = badaddrvalue$(EXEEXT) badfree$(EXEEXT) badjump$(EXEEXT) \ >- badloop$(EXEEXT) badrw$(EXEEXT) brk$(EXEEXT) \ >- buflen_check$(EXEEXT) clientperm$(EXEEXT) custom_alloc$(EXEEXT) \ >- doublefree$(EXEEXT) error_counts$(EXEEXT) errs1$(EXEEXT) \ >- exitprog$(EXEEXT) fprw$(EXEEXT) fwrite$(EXEEXT) inits$(EXEEXT) \ >- inline$(EXEEXT) malloc1$(EXEEXT) malloc2$(EXEEXT) \ >- malloc3$(EXEEXT) manuel1$(EXEEXT) manuel2$(EXEEXT) \ >- manuel3$(EXEEXT) memalign_test$(EXEEXT) memcmptest$(EXEEXT) \ >- mmaptest$(EXEEXT) nanoleak$(EXEEXT) new_nothrow$(EXEEXT) \ >- null_socket$(EXEEXT) overlap$(EXEEXT) pushfpopf$(EXEEXT) \ >- realloc1$(EXEEXT) realloc2$(EXEEXT) realloc3$(EXEEXT) \ >- sigaltstack$(EXEEXT) signal2$(EXEEXT) supp1$(EXEEXT) \ >- supp2$(EXEEXT) suppfree$(EXEEXT) trivialleak$(EXEEXT) \ >- tronical$(EXEEXT) weirdioctl$(EXEEXT) mismatches$(EXEEXT) \ >- new_override$(EXEEXT) metadata$(EXEEXT) threadederrno$(EXEEXT) \ >- writev$(EXEEXT) zeropage$(EXEEXT) >-am_badaddrvalue_OBJECTS = badaddrvalue.$(OBJEXT) >-badaddrvalue_OBJECTS = $(am_badaddrvalue_OBJECTS) >-badaddrvalue_LDADD = $(LDADD) >-badaddrvalue_DEPENDENCIES = >-badaddrvalue_LDFLAGS = >-am_badfree_OBJECTS = badfree.$(OBJEXT) >-badfree_OBJECTS = $(am_badfree_OBJECTS) >-badfree_LDADD = $(LDADD) >-badfree_DEPENDENCIES = >-badfree_LDFLAGS = >-am_badjump_OBJECTS = badjump.$(OBJEXT) >-badjump_OBJECTS = $(am_badjump_OBJECTS) >-badjump_LDADD = $(LDADD) >-badjump_DEPENDENCIES = >-badjump_LDFLAGS = >-am_badloop_OBJECTS = badloop.$(OBJEXT) >-badloop_OBJECTS = $(am_badloop_OBJECTS) >-badloop_LDADD = $(LDADD) >-badloop_DEPENDENCIES = >-badloop_LDFLAGS = >-am_badrw_OBJECTS = badrw.$(OBJEXT) >-badrw_OBJECTS = $(am_badrw_OBJECTS) >-badrw_LDADD = $(LDADD) >-badrw_DEPENDENCIES = >-badrw_LDFLAGS = >-am_brk_OBJECTS = brk.$(OBJEXT) >-brk_OBJECTS = $(am_brk_OBJECTS) >-brk_LDADD = $(LDADD) >-brk_DEPENDENCIES = >-brk_LDFLAGS = >-am_buflen_check_OBJECTS = buflen_check.$(OBJEXT) >-buflen_check_OBJECTS = $(am_buflen_check_OBJECTS) >-buflen_check_LDADD = $(LDADD) >-buflen_check_DEPENDENCIES = >-buflen_check_LDFLAGS = >-am_clientperm_OBJECTS = clientperm.$(OBJEXT) >-clientperm_OBJECTS = $(am_clientperm_OBJECTS) >-clientperm_LDADD = $(LDADD) >-clientperm_DEPENDENCIES = >-clientperm_LDFLAGS = >-am_custom_alloc_OBJECTS = custom_alloc.$(OBJEXT) >-custom_alloc_OBJECTS = $(am_custom_alloc_OBJECTS) >-custom_alloc_LDADD = $(LDADD) >-custom_alloc_DEPENDENCIES = >-custom_alloc_LDFLAGS = >-am_doublefree_OBJECTS = doublefree.$(OBJEXT) >-doublefree_OBJECTS = $(am_doublefree_OBJECTS) >-doublefree_LDADD = $(LDADD) >-doublefree_DEPENDENCIES = >-doublefree_LDFLAGS = >-am_error_counts_OBJECTS = error_counts.$(OBJEXT) >-error_counts_OBJECTS = $(am_error_counts_OBJECTS) >-error_counts_LDADD = $(LDADD) >-error_counts_DEPENDENCIES = >-error_counts_LDFLAGS = >-am_errs1_OBJECTS = errs1.$(OBJEXT) >-errs1_OBJECTS = $(am_errs1_OBJECTS) >-errs1_LDADD = $(LDADD) >-errs1_DEPENDENCIES = >-errs1_LDFLAGS = >-am_exitprog_OBJECTS = exitprog.$(OBJEXT) >-exitprog_OBJECTS = $(am_exitprog_OBJECTS) >-exitprog_LDADD = $(LDADD) >-exitprog_DEPENDENCIES = >-exitprog_LDFLAGS = >-am_fprw_OBJECTS = fprw.$(OBJEXT) >-fprw_OBJECTS = $(am_fprw_OBJECTS) >-fprw_LDADD = $(LDADD) >-fprw_DEPENDENCIES = >-fprw_LDFLAGS = >-am_fwrite_OBJECTS = fwrite.$(OBJEXT) >-fwrite_OBJECTS = $(am_fwrite_OBJECTS) >-fwrite_LDADD = $(LDADD) >-fwrite_DEPENDENCIES = >-fwrite_LDFLAGS = >-am_inits_OBJECTS = inits.$(OBJEXT) >-inits_OBJECTS = $(am_inits_OBJECTS) >-inits_LDADD = $(LDADD) >-inits_DEPENDENCIES = >-inits_LDFLAGS = >-am_inline_OBJECTS = inline.$(OBJEXT) >-inline_OBJECTS = $(am_inline_OBJECTS) >-inline_LDADD = $(LDADD) >-inline_DEPENDENCIES = >-inline_LDFLAGS = >-am_malloc1_OBJECTS = malloc1.$(OBJEXT) >-malloc1_OBJECTS = $(am_malloc1_OBJECTS) >-malloc1_LDADD = $(LDADD) >-malloc1_DEPENDENCIES = >-malloc1_LDFLAGS = >-am_malloc2_OBJECTS = malloc2.$(OBJEXT) >-malloc2_OBJECTS = $(am_malloc2_OBJECTS) >-malloc2_LDADD = $(LDADD) >-malloc2_DEPENDENCIES = >-malloc2_LDFLAGS = >-am_malloc3_OBJECTS = malloc3.$(OBJEXT) >-malloc3_OBJECTS = $(am_malloc3_OBJECTS) >-malloc3_LDADD = $(LDADD) >-malloc3_DEPENDENCIES = >-malloc3_LDFLAGS = >-am_manuel1_OBJECTS = manuel1.$(OBJEXT) >-manuel1_OBJECTS = $(am_manuel1_OBJECTS) >-manuel1_LDADD = $(LDADD) >-manuel1_DEPENDENCIES = >-manuel1_LDFLAGS = >-am_manuel2_OBJECTS = manuel2.$(OBJEXT) >-manuel2_OBJECTS = $(am_manuel2_OBJECTS) >-manuel2_LDADD = $(LDADD) >-manuel2_DEPENDENCIES = >-manuel2_LDFLAGS = >-am_manuel3_OBJECTS = manuel3.$(OBJEXT) >-manuel3_OBJECTS = $(am_manuel3_OBJECTS) >-manuel3_LDADD = $(LDADD) >-manuel3_DEPENDENCIES = >-manuel3_LDFLAGS = >-am_memalign_test_OBJECTS = memalign_test.$(OBJEXT) >-memalign_test_OBJECTS = $(am_memalign_test_OBJECTS) >-memalign_test_LDADD = $(LDADD) >-memalign_test_DEPENDENCIES = >-memalign_test_LDFLAGS = >-am_memcmptest_OBJECTS = memcmptest.$(OBJEXT) >-memcmptest_OBJECTS = $(am_memcmptest_OBJECTS) >-memcmptest_LDADD = $(LDADD) >-memcmptest_DEPENDENCIES = >-memcmptest_LDFLAGS = >-am_metadata_OBJECTS = metadata.$(OBJEXT) >-metadata_OBJECTS = $(am_metadata_OBJECTS) >-metadata_LDADD = $(LDADD) >-metadata_DEPENDENCIES = >-metadata_LDFLAGS = >-am_mismatches_OBJECTS = mismatches.$(OBJEXT) >-mismatches_OBJECTS = $(am_mismatches_OBJECTS) >-mismatches_LDADD = $(LDADD) >-mismatches_DEPENDENCIES = >-mismatches_LDFLAGS = >-am_mmaptest_OBJECTS = mmaptest.$(OBJEXT) >-mmaptest_OBJECTS = $(am_mmaptest_OBJECTS) >-mmaptest_LDADD = $(LDADD) >-mmaptest_DEPENDENCIES = >-mmaptest_LDFLAGS = >-am_nanoleak_OBJECTS = nanoleak.$(OBJEXT) >-nanoleak_OBJECTS = $(am_nanoleak_OBJECTS) >-nanoleak_LDADD = $(LDADD) >-nanoleak_DEPENDENCIES = >-nanoleak_LDFLAGS = >-am_new_nothrow_OBJECTS = new_nothrow.$(OBJEXT) >-new_nothrow_OBJECTS = $(am_new_nothrow_OBJECTS) >-new_nothrow_LDADD = $(LDADD) >-new_nothrow_DEPENDENCIES = >-new_nothrow_LDFLAGS = >-am_new_override_OBJECTS = new_override.$(OBJEXT) >-new_override_OBJECTS = $(am_new_override_OBJECTS) >-new_override_LDADD = $(LDADD) >-new_override_DEPENDENCIES = >-new_override_LDFLAGS = >-am_null_socket_OBJECTS = null_socket.$(OBJEXT) >-null_socket_OBJECTS = $(am_null_socket_OBJECTS) >-null_socket_LDADD = $(LDADD) >-null_socket_DEPENDENCIES = >-null_socket_LDFLAGS = >-am_overlap_OBJECTS = overlap.$(OBJEXT) >-overlap_OBJECTS = $(am_overlap_OBJECTS) >-overlap_LDADD = $(LDADD) >-overlap_DEPENDENCIES = >-overlap_LDFLAGS = >-am_pushfpopf_OBJECTS = pushfpopf_c.$(OBJEXT) pushfpopf_s.$(OBJEXT) >-pushfpopf_OBJECTS = $(am_pushfpopf_OBJECTS) >-pushfpopf_LDADD = $(LDADD) >-pushfpopf_DEPENDENCIES = >-pushfpopf_LDFLAGS = >-am_realloc1_OBJECTS = realloc1.$(OBJEXT) >-realloc1_OBJECTS = $(am_realloc1_OBJECTS) >-realloc1_LDADD = $(LDADD) >-realloc1_DEPENDENCIES = >-realloc1_LDFLAGS = >-am_realloc2_OBJECTS = realloc2.$(OBJEXT) >-realloc2_OBJECTS = $(am_realloc2_OBJECTS) >-realloc2_LDADD = $(LDADD) >-realloc2_DEPENDENCIES = >-realloc2_LDFLAGS = >-am_realloc3_OBJECTS = realloc3.$(OBJEXT) >-realloc3_OBJECTS = $(am_realloc3_OBJECTS) >-realloc3_LDADD = $(LDADD) >-realloc3_DEPENDENCIES = >-realloc3_LDFLAGS = >-am_sigaltstack_OBJECTS = sigaltstack.$(OBJEXT) >-sigaltstack_OBJECTS = $(am_sigaltstack_OBJECTS) >-sigaltstack_LDADD = $(LDADD) >-sigaltstack_DEPENDENCIES = >-sigaltstack_LDFLAGS = >-am_signal2_OBJECTS = signal2.$(OBJEXT) >-signal2_OBJECTS = $(am_signal2_OBJECTS) >-signal2_LDADD = $(LDADD) >-signal2_DEPENDENCIES = >-signal2_LDFLAGS = >-am_supp1_OBJECTS = supp.$(OBJEXT) >-supp1_OBJECTS = $(am_supp1_OBJECTS) >-supp1_LDADD = $(LDADD) >-supp1_DEPENDENCIES = >-supp1_LDFLAGS = >-am_supp2_OBJECTS = supp.$(OBJEXT) >-supp2_OBJECTS = $(am_supp2_OBJECTS) >-supp2_LDADD = $(LDADD) >-supp2_DEPENDENCIES = >-supp2_LDFLAGS = >-am_suppfree_OBJECTS = suppfree.$(OBJEXT) >-suppfree_OBJECTS = $(am_suppfree_OBJECTS) >-suppfree_LDADD = $(LDADD) >-suppfree_DEPENDENCIES = >-suppfree_LDFLAGS = >-am_threadederrno_OBJECTS = threadederrno.$(OBJEXT) >-threadederrno_OBJECTS = $(am_threadederrno_OBJECTS) >-threadederrno_DEPENDENCIES = >-threadederrno_LDFLAGS = >-am_trivialleak_OBJECTS = trivialleak.$(OBJEXT) >-trivialleak_OBJECTS = $(am_trivialleak_OBJECTS) >-trivialleak_LDADD = $(LDADD) >-trivialleak_DEPENDENCIES = >-trivialleak_LDFLAGS = >-am_tronical_OBJECTS = tronical.$(OBJEXT) >-tronical_OBJECTS = $(am_tronical_OBJECTS) >-tronical_LDADD = $(LDADD) >-tronical_DEPENDENCIES = >-tronical_LDFLAGS = >-am_weirdioctl_OBJECTS = weirdioctl.$(OBJEXT) >-weirdioctl_OBJECTS = $(am_weirdioctl_OBJECTS) >-weirdioctl_LDADD = $(LDADD) >-weirdioctl_DEPENDENCIES = >-weirdioctl_LDFLAGS = >-am_writev_OBJECTS = writev.$(OBJEXT) >-writev_OBJECTS = $(am_writev_OBJECTS) >-writev_LDADD = $(LDADD) >-writev_DEPENDENCIES = >-writev_LDFLAGS = >-am_zeropage_OBJECTS = zeropage.$(OBJEXT) >-zeropage_OBJECTS = $(am_zeropage_OBJECTS) >-zeropage_LDADD = $(LDADD) >-zeropage_DEPENDENCIES = >-zeropage_LDFLAGS = >-SCRIPTS = $(noinst_SCRIPTS) >- >- >-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) >-depcomp = $(SHELL) $(top_srcdir)/depcomp >-am__depfiles_maybe = depfiles >-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/badaddrvalue.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/badfree.Po ./$(DEPDIR)/badjump.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/badloop.Po ./$(DEPDIR)/badrw.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/brk.Po ./$(DEPDIR)/buflen_check.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/clientperm.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/custom_alloc.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/doublefree.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/error_counts.Po ./$(DEPDIR)/errs1.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/exitprog.Po ./$(DEPDIR)/fprw.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/fwrite.Po ./$(DEPDIR)/inits.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/inline.Po ./$(DEPDIR)/malloc1.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/malloc2.Po ./$(DEPDIR)/malloc3.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/manuel1.Po ./$(DEPDIR)/manuel2.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/manuel3.Po ./$(DEPDIR)/memalign_test.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/memcmptest.Po ./$(DEPDIR)/metadata.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/mismatches.Po ./$(DEPDIR)/mmaptest.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/nanoleak.Po ./$(DEPDIR)/new_nothrow.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/new_override.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/null_socket.Po ./$(DEPDIR)/overlap.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/pushfpopf_c.Po ./$(DEPDIR)/realloc1.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/realloc2.Po ./$(DEPDIR)/realloc3.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/sigaltstack.Po ./$(DEPDIR)/signal2.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/supp.Po ./$(DEPDIR)/suppfree.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/threadederrno.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/trivialleak.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/weirdioctl.Po ./$(DEPDIR)/writev.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/zeropage.Po >-CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS) >-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ >- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) >-CCLD = $(CC) >-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ >-CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ >- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) >-CXXLD = $(CXX) >-CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ >- -o $@ >-DIST_SOURCES = $(badaddrvalue_SOURCES) $(badfree_SOURCES) \ >- $(badjump_SOURCES) $(badloop_SOURCES) $(badrw_SOURCES) \ >- $(brk_SOURCES) $(buflen_check_SOURCES) $(clientperm_SOURCES) \ >- $(custom_alloc_SOURCES) $(doublefree_SOURCES) \ >- $(error_counts_SOURCES) $(errs1_SOURCES) $(exitprog_SOURCES) \ >- $(fprw_SOURCES) $(fwrite_SOURCES) $(inits_SOURCES) \ >- $(inline_SOURCES) $(malloc1_SOURCES) $(malloc2_SOURCES) \ >- $(malloc3_SOURCES) $(manuel1_SOURCES) $(manuel2_SOURCES) \ >- $(manuel3_SOURCES) $(memalign_test_SOURCES) \ >- $(memcmptest_SOURCES) $(metadata_SOURCES) $(mismatches_SOURCES) \ >- $(mmaptest_SOURCES) $(nanoleak_SOURCES) $(new_nothrow_SOURCES) \ >- $(new_override_SOURCES) $(null_socket_SOURCES) \ >- $(overlap_SOURCES) $(pushfpopf_SOURCES) $(realloc1_SOURCES) \ >- $(realloc2_SOURCES) $(realloc3_SOURCES) $(sigaltstack_SOURCES) \ >- $(signal2_SOURCES) $(supp1_SOURCES) $(supp2_SOURCES) \ >- $(suppfree_SOURCES) $(threadederrno_SOURCES) \ >- $(trivialleak_SOURCES) $(tronical_SOURCES) \ >- $(weirdioctl_SOURCES) $(writev_SOURCES) $(zeropage_SOURCES) >-DIST_COMMON = Makefile.am Makefile.in >-SOURCES = $(badaddrvalue_SOURCES) $(badfree_SOURCES) $(badjump_SOURCES) $(badloop_SOURCES) $(badrw_SOURCES) $(brk_SOURCES) $(buflen_check_SOURCES) $(clientperm_SOURCES) $(custom_alloc_SOURCES) $(doublefree_SOURCES) $(error_counts_SOURCES) $(errs1_SOURCES) $(exitprog_SOURCES) $(fprw_SOURCES) $(fwrite_SOURCES) $(inits_SOURCES) $(inline_SOURCES) $(malloc1_SOURCES) $(malloc2_SOURCES) $(malloc3_SOURCES) $(manuel1_SOURCES) $(manuel2_SOURCES) $(manuel3_SOURCES) $(memalign_test_SOURCES) $(memcmptest_SOURCES) $(metadata_SOURCES) $(mismatches_SOURCES) $(mmaptest_SOURCES) $(nanoleak_SOURCES) $(new_nothrow_SOURCES) $(new_override_SOURCES) $(null_socket_SOURCES) $(overlap_SOURCES) $(pushfpopf_SOURCES) $(realloc1_SOURCES) $(realloc2_SOURCES) $(realloc3_SOURCES) $(sigaltstack_SOURCES) $(signal2_SOURCES) $(supp1_SOURCES) $(supp2_SOURCES) $(suppfree_SOURCES) $(threadederrno_SOURCES) $(trivialleak_SOURCES) $(tronical_SOURCES) $(weirdioctl_SOURCES) $(writev_SOURCES) $(zeropage_SOURCES) >- > all: all-am > > .SUFFIXES: > .SUFFIXES: .S .c .cpp .o .obj .s >-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) >+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) >+ @for dep in $?; do \ >+ case '$(am__configure_deps)' in \ >+ *$$dep*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ >+ && exit 0; \ >+ exit 1;; \ >+ esac; \ >+ done; \ >+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu memcheck/tests/Makefile'; \ > cd $(top_srcdir) && \ > $(AUTOMAKE) --gnu memcheck/tests/Makefile >-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status >- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) >+.PRECIOUS: Makefile >+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status >+ @case '$?' in \ >+ *config.status*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ >+ *) \ >+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ >+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ >+ esac; >+ >+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+ >+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh > > clean-checkPROGRAMS: > -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) >@@ -745,7 +684,7 @@ > $(LINK) $(zeropage_LDFLAGS) $(zeropage_OBJECTS) $(zeropage_LDADD) $(LIBS) > > mostlyclean-compile: >- -rm -f *.$(OBJEXT) core *.core >+ -rm -f *.$(OBJEXT) > > distclean-compile: > -rm -f *.tab.c >@@ -797,74 +736,51 @@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/writev.Po@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zeropage.Po@am__quote@ > >-distclean-depend: >- -rm -rf ./$(DEPDIR) >- > .S.o: >- $(CCASCOMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< >+ $(CCASCOMPILE) -c $< > > .S.obj: >- $(CCASCOMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` >+ $(CCASCOMPILE) -c `$(CYGPATH_W) '$<'` > > .c.o: >-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ >-@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ >-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ >-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ >-@am__fastdepCC_TRUE@ fi >+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ >+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi > @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >-@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< >+@am__fastdepCC_FALSE@ $(COMPILE) -c $< > > .c.obj: >-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ >-@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ >-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ >-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ >-@am__fastdepCC_TRUE@ fi >+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ >+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi > @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >-@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` >+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` > > .cpp.o: >-@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ >-@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ >-@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ >-@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ >-@am__fastdepCXX_TRUE@ fi >+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ >+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi > @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< >+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< > > .cpp.obj: >-@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ >-@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ >-@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ >-@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ >-@am__fastdepCXX_TRUE@ fi >+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ >+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi > @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` >+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` > > .s.o: >- $(CCASCOMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< >+ $(CCASCOMPILE) -c $< > > .s.obj: >- $(CCASCOMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` >+ $(CCASCOMPILE) -c `$(CYGPATH_W) '$<'` > uninstall-info-am: > >-ETAGS = etags >-ETAGSFLAGS = >- >-CTAGS = ctags >-CTAGSFLAGS = >- >-tags: TAGS >- > ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) > list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ > unique=`for i in $$list; do \ >@@ -873,6 +789,7 @@ > $(AWK) ' { files[$$0] = 1; } \ > END { for (i in files) print i; }'`; \ > mkid -fID $$unique >+tags: TAGS > > TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ > $(TAGS_FILES) $(LISP) >@@ -887,7 +804,6 @@ > test -z "$(ETAGS_ARGS)$$tags$$unique" \ > || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ > $$tags $$unique >- > ctags: CTAGS > CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ > $(TAGS_FILES) $(LISP) >@@ -910,10 +826,6 @@ > > distclean-tags: > -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags >-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) >- >-top_distdir = ../.. >-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) > > distdir: $(DISTFILES) > @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ >@@ -927,7 +839,7 @@ > dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ > if test "$$dir" != "$$file" && test "$$dir" != "."; then \ > dir="/$$dir"; \ >- $(mkinstalldirs) "$(distdir)$$dir"; \ >+ $(mkdir_p) "$(distdir)$$dir"; \ > else \ > dir=''; \ > fi; \ >@@ -946,7 +858,6 @@ > $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) > check: check-am > all-am: Makefile $(SCRIPTS) >- > installdirs: > install: install-am > install-exec: install-exec-am >@@ -959,7 +870,7 @@ > installcheck: installcheck-am > install-strip: > $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ >- INSTALL_STRIP_FLAG=-s \ >+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ > `test -z '$(STRIP)' || \ > echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install > mostlyclean-generic: >@@ -967,7 +878,7 @@ > clean-generic: > > distclean-generic: >- -rm -f Makefile $(CONFIG_CLEAN_FILES) >+ -rm -f $(CONFIG_CLEAN_FILES) > > maintainer-clean-generic: > @echo "This command is intended for maintainers to use" >@@ -977,14 +888,17 @@ > clean-am: clean-checkPROGRAMS clean-generic mostlyclean-am > > distclean: distclean-am >- >-distclean-am: clean-am distclean-compile distclean-depend \ >- distclean-generic distclean-tags >+ -rm -rf ./$(DEPDIR) >+ -rm -f Makefile >+distclean-am: clean-am distclean-compile distclean-generic \ >+ distclean-tags > > dvi: dvi-am > > dvi-am: > >+html: html-am >+ > info: info-am > > info-am: >@@ -1000,7 +914,8 @@ > installcheck-am: > > maintainer-clean: maintainer-clean-am >- >+ -rm -rf ./$(DEPDIR) >+ -rm -f Makefile > maintainer-clean-am: distclean-am maintainer-clean-generic > > mostlyclean: mostlyclean-am >@@ -1017,13 +932,13 @@ > > uninstall-am: uninstall-info-am > >-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-checkPROGRAMS \ >- clean-generic ctags distclean distclean-compile \ >- distclean-depend distclean-generic distclean-tags distdir dvi \ >- dvi-am info info-am install install-am install-data \ >- install-data-am install-exec install-exec-am install-info \ >- install-info-am install-man install-strip installcheck \ >- installcheck-am installdirs maintainer-clean \ >+.PHONY: CTAGS GTAGS all all-am check check-am clean \ >+ clean-checkPROGRAMS clean-generic ctags distclean \ >+ distclean-compile distclean-generic distclean-tags distdir dvi \ >+ dvi-am html html-am info info-am install install-am \ >+ install-data install-data-am install-exec install-exec-am \ >+ install-info install-info-am install-man install-strip \ >+ installcheck installcheck-am installdirs maintainer-clean \ > maintainer-clean-generic mostlyclean mostlyclean-compile \ > mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ > uninstall-am uninstall-info-am >diff -ruN valgrind-2.1.0/memcheck/tests/badjump.stderr.exp valgrind/memcheck/tests/badjump.stderr.exp >--- valgrind-2.1.0/memcheck/tests/badjump.stderr.exp 2003-11-13 11:53:43.000000000 -0600 >+++ valgrind/memcheck/tests/badjump.stderr.exp 2003-12-15 20:05:15.000000000 -0600 >@@ -6,7 +6,7 @@ > Address 0x........ is not stack'd, malloc'd or free'd > > Process terminating with default action of signal 11 (SIGSEGV): dumping core >- Address not mapped to object at address 0x........ >+ Access not within mapped region at address 0x........ > at 0x........: ??? > by 0x........: __libc_start_main (...libc...) > by 0x........: ... >diff -ruN valgrind-2.1.0/memcheck/tests/badrw.c valgrind/memcheck/tests/badrw.c >--- valgrind-2.1.0/memcheck/tests/badrw.c 2003-09-05 18:29:33.000000000 -0500 >+++ valgrind/memcheck/tests/badrw.c 2004-01-07 02:47:03.000000000 -0600 >@@ -4,14 +4,26 @@ > { > void* x = malloc(10); > >- int* x4 = x-4; >- short int* x2 = x-4; >- char* x1 = x-1; >+ int *x4; >+ short *x2; >+ char *x1; >+ int y4; >+ short y2; >+ char y1; >+ >+ x4 = x-4; >+ x2 = x-4; >+ x1 = x-1; > > // Invalid reads and writes of sizes 4, 2, 1 >- int y4 = *x4; *x4 = y4; >- short int y2 = *x2; *x2 = y2; >- char y1 = *x1; *x1 = y1; >+ y4 = *x4; >+ *x4 = y4; >+ >+ y2 = *x2; >+ *x2 = y2; >+ >+ y1 = *x1; >+ *x1 = y1; > > return 0; > } >diff -ruN valgrind-2.1.0/memcheck/tests/badrw.stderr.exp valgrind/memcheck/tests/badrw.stderr.exp >--- valgrind-2.1.0/memcheck/tests/badrw.stderr.exp 2003-11-13 11:53:43.000000000 -0600 >+++ valgrind/memcheck/tests/badrw.stderr.exp 2004-01-07 02:47:03.000000000 -0600 >@@ -1,35 +1,35 @@ > Invalid read of size 4 >- at 0x........: main (badrw.c:12) >+ at 0x........: main (badrw.c:19) > Address 0x........ is 4 bytes before a block of size 10 alloc'd > at 0x........: malloc (vg_replace_malloc.c:...) > by 0x........: main (badrw.c:5) > > Invalid write of size 4 >- at 0x........: main (badrw.c:12) >+ at 0x........: main (badrw.c:20) > Address 0x........ is 4 bytes before a block of size 10 alloc'd > at 0x........: malloc (vg_replace_malloc.c:...) > by 0x........: main (badrw.c:5) > > Invalid read of size 2 >- at 0x........: main (badrw.c:13) >+ at 0x........: main (badrw.c:22) > Address 0x........ is 4 bytes before a block of size 10 alloc'd > at 0x........: malloc (vg_replace_malloc.c:...) > by 0x........: main (badrw.c:5) > > Invalid write of size 2 >- at 0x........: main (badrw.c:13) >+ at 0x........: main (badrw.c:23) > Address 0x........ is 4 bytes before a block of size 10 alloc'd > at 0x........: malloc (vg_replace_malloc.c:...) > by 0x........: main (badrw.c:5) > > Invalid read of size 1 >- at 0x........: main (badrw.c:14) >+ at 0x........: main (badrw.c:25) > Address 0x........ is 1 bytes before a block of size 10 alloc'd > at 0x........: malloc (vg_replace_malloc.c:...) > by 0x........: main (badrw.c:5) > > Invalid write of size 1 >- at 0x........: main (badrw.c:14) >+ at 0x........: main (badrw.c:26) > Address 0x........ is 1 bytes before a block of size 10 alloc'd > at 0x........: malloc (vg_replace_malloc.c:...) > by 0x........: main (badrw.c:5) >diff -ruN valgrind-2.1.0/memcheck/tests/custom_alloc.c valgrind/memcheck/tests/custom_alloc.c >--- valgrind-2.1.0/memcheck/tests/custom_alloc.c 2003-05-20 11:38:24.000000000 -0500 >+++ valgrind/memcheck/tests/custom_alloc.c 2004-01-03 08:18:02.000000000 -0600 >@@ -14,7 +14,7 @@ > void* get_superblock(void) > { > void* p = mmap( 0, SUPERBLOCK_SIZE, PROT_READ|PROT_WRITE|PROT_EXEC, >- MAP_PRIVATE|MAP_ANONYMOUS, -1, 0 ); >+ MAP_PRIVATE|MAP_ANON, -1, 0 ); > > assert(p != ((void*)(-1))); > >diff -ruN valgrind-2.1.0/memcheck/tests/filter_allocs valgrind/memcheck/tests/filter_allocs >--- valgrind-2.1.0/memcheck/tests/filter_allocs 2003-05-05 11:18:51.000000000 -0500 >+++ valgrind/memcheck/tests/filter_allocs 2004-01-03 08:18:02.000000000 -0600 >@@ -1,6 +1,6 @@ > #! /bin/sh > > ./filter_stderr | >-sed "s/malloc\/free: in use at exit: [0-9]\+ bytes in [0-9]\+ blocks./malloc\/free: in use at exit: ... bytes in ... blocks./" | >-sed "s/malloc.free: [0-9]\+ allocs, [0-9]\+ frees, [0-9]\+ bytes allocated./malloc\/free: ... allocs, ... frees, ... bytes allocated./" >+sed "s/malloc\/free: in use at exit: [0-9]* bytes in [0-9]* blocks./malloc\/free: in use at exit: ... bytes in ... blocks./" | >+sed "s/malloc.free: [0-9]* allocs, [0-9]* frees, [0-9]* bytes allocated./malloc\/free: ... allocs, ... frees, ... bytes allocated./" > >diff -ruN valgrind-2.1.0/memcheck/tests/filter_leak_check_size valgrind/memcheck/tests/filter_leak_check_size >--- valgrind-2.1.0/memcheck/tests/filter_leak_check_size 2003-05-05 11:18:51.000000000 -0500 >+++ valgrind/memcheck/tests/filter_leak_check_size 2004-01-03 08:18:02.000000000 -0600 >@@ -1,4 +1,4 @@ > #! /bin/sh > > ./filter_stderr | >-sed "s/checked [0-9]\+ bytes./checked ... bytes./" >+sed "s/checked [0-9]* bytes./checked ... bytes./" >diff -ruN valgrind-2.1.0/memcheck/tests/filter_stderr valgrind/memcheck/tests/filter_stderr >--- valgrind-2.1.0/memcheck/tests/filter_stderr 2003-07-22 04:12:33.000000000 -0500 >+++ valgrind/memcheck/tests/filter_stderr 2004-01-03 08:18:02.000000000 -0600 >@@ -8,7 +8,7 @@ > $dir/../../tests/filter_addresses | > > # Anonymise line numbers in mac_replace_strmem.c >-sed "s/mac_replace_strmem.c:[0-9]\+/mac_replace_strmem.c:.../" | >+sed "s/mac_replace_strmem.c:[0-9]*/mac_replace_strmem.c:.../" | > > $dir/../../tests/filter_test_paths | > >diff -ruN valgrind-2.1.0/memcheck/tests/fprw.vgtest valgrind/memcheck/tests/fprw.vgtest >--- valgrind-2.1.0/memcheck/tests/fprw.vgtest 2003-07-07 18:56:10.000000000 -0500 >+++ valgrind/memcheck/tests/fprw.vgtest 2003-12-15 20:05:15.000000000 -0600 >@@ -1,2 +1,2 @@ >-vgopts: --single-step=yes -q >+vgopts: -q > prog: fprw >diff -ruN valgrind-2.1.0/memcheck/tests/fwrite.stderr.exp valgrind/memcheck/tests/fwrite.stderr.exp >--- valgrind-2.1.0/memcheck/tests/fwrite.stderr.exp 2003-11-13 11:53:43.000000000 -0600 >+++ valgrind/memcheck/tests/fwrite.stderr.exp 2003-12-15 03:00:21.000000000 -0600 >@@ -1,5 +1,5 @@ > Syscall param write(buf) contains uninitialised or unaddressable byte(s) >- at 0x........: __libc_write (...libc...) >+ at 0x........: write (in /...libc...) > by 0x........: __libc_start_main (...libc...) > by 0x........: ... > Address 0x........ is 0 bytes inside a block of size 10 alloc'd >diff -ruN valgrind-2.1.0/memcheck/tests/manuel2.c valgrind/memcheck/tests/manuel2.c >--- valgrind-2.1.0/memcheck/tests/manuel2.c 2002-09-23 04:36:25.000000000 -0500 >+++ valgrind/memcheck/tests/manuel2.c 2004-01-03 08:18:02.000000000 -0600 >@@ -1,5 +1,5 @@ > #include <stdio.h> >-#include <malloc.h> >+#include <stdlib.h> > > int main () > { >diff -ruN valgrind-2.1.0/memcheck/tests/manuel3.c valgrind/memcheck/tests/manuel3.c >--- valgrind-2.1.0/memcheck/tests/manuel3.c 2002-09-23 04:36:25.000000000 -0500 >+++ valgrind/memcheck/tests/manuel3.c 2004-01-03 08:18:02.000000000 -0600 >@@ -1,5 +1,5 @@ > #include <stdio.h> >-#include <malloc.h> >+#include <stdlib.h> > > int gcc_cant_inline_me ( int ); > >diff -ruN valgrind-2.1.0/memcheck/tests/metadata.c valgrind/memcheck/tests/metadata.c >--- valgrind-2.1.0/memcheck/tests/metadata.c 2003-07-06 19:03:52.000000000 -0500 >+++ valgrind/memcheck/tests/metadata.c 2004-01-03 08:18:02.000000000 -0600 >@@ -1,6 +1,6 @@ > > #include <stdio.h> >-#include <malloc.h> >+#include <stdlib.h> > #include "../memcheck.h" > > /* Program demonstrating copying of metadata in memcheck. */ >diff -ruN valgrind-2.1.0/memcheck/tests/nanoleak.c valgrind/memcheck/tests/nanoleak.c >--- valgrind-2.1.0/memcheck/tests/nanoleak.c 2002-09-23 04:36:25.000000000 -0500 >+++ valgrind/memcheck/tests/nanoleak.c 2004-01-03 08:18:02.000000000 -0600 >@@ -1,5 +1,5 @@ > >-#include <malloc.h> >+#include <stdlib.h> > > int main ( void ) > { >diff -ruN valgrind-2.1.0/memcheck/tests/nanoleak.supp valgrind/memcheck/tests/nanoleak.supp >--- valgrind-2.1.0/memcheck/tests/nanoleak.supp 2003-04-15 08:03:21.000000000 -0500 >+++ valgrind/memcheck/tests/nanoleak.supp 2003-12-15 20:05:15.000000000 -0600 >@@ -3,6 +3,5 @@ > Addrcheck,Memcheck:Leak > fun:malloc > fun:main >- fun:__libc_start_main > } > >diff -ruN valgrind-2.1.0/memcheck/tests/realloc2.c valgrind/memcheck/tests/realloc2.c >--- valgrind-2.1.0/memcheck/tests/realloc2.c 2002-09-23 04:36:25.000000000 -0500 >+++ valgrind/memcheck/tests/realloc2.c 2004-01-03 08:18:02.000000000 -0600 >@@ -3,7 +3,7 @@ > realloc time due to bad ordering of the things happening. Now runs > without error. */ > >-#include <malloc.h> >+#include <stdlib.h> > #include <stdio.h> > > int main ( void ) >diff -ruN valgrind-2.1.0/memcheck/tests/sigaltstack.c valgrind/memcheck/tests/sigaltstack.c >--- valgrind-2.1.0/memcheck/tests/sigaltstack.c 2003-11-21 03:22:06.000000000 -0600 >+++ valgrind/memcheck/tests/sigaltstack.c 2004-01-03 08:18:02.000000000 -0600 >@@ -1,7 +1,7 @@ > > > #include <stdio.h> >-#include <malloc.h> >+#include <stdlib.h> > #include <signal.h> > #include <sys/mman.h> > >@@ -15,7 +15,7 @@ > stack_t sigstk; > struct sigaction act; > static const int size = SIGSTKSZ*2; >- char *stk = (char *)mmap(0, size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0); >+ char *stk = (char *)mmap(0, size, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0); > sigstk.ss_sp = stk; > > sigstk.ss_size = size; >@@ -26,6 +26,7 @@ > fprintf(stderr,"setting sigaction\n"); > act.sa_flags=SA_ONSTACK; > act.sa_handler=&sig_handler; >+ sigemptyset(&act.sa_mask); > res = sigaction(SIGUSR1,&act,0); > fprintf(stderr, "res = %d\n", res); > fprintf(stderr, "raising the signal\n"); >diff -ruN valgrind-2.1.0/memcheck/tests/sigaltstack.stderr.exp valgrind/memcheck/tests/sigaltstack.stderr.exp >--- valgrind-2.1.0/memcheck/tests/sigaltstack.stderr.exp 2003-11-13 11:53:43.000000000 -0600 >+++ valgrind/memcheck/tests/sigaltstack.stderr.exp 2003-12-15 20:05:15.000000000 -0600 >@@ -1,8 +1,5 @@ > calling sigaltstack, stack base is 0x........ > setting sigaction >-Syscall param sigaction(act) contains uninitialised or unaddressable byte(s) >- at 0x........: __libc_sigaction (...libc...) >- Address 0x........ is on thread 1's stack > res = 0 > raising the signal > caught signal, local var is on 0x........ >diff -ruN valgrind-2.1.0/memcheck/tests/threadederrno.c valgrind/memcheck/tests/threadederrno.c >--- valgrind-2.1.0/memcheck/tests/threadederrno.c 2003-07-13 06:13:37.000000000 -0500 >+++ valgrind/memcheck/tests/threadederrno.c 2004-01-21 11:40:16.000000000 -0600 >@@ -2,22 +2,20 @@ > #include <pthread.h> > #include <stdio.h> > #include <errno.h> >- >+#include <string.h> > > > void* thr2 ( void* v ) > { > FILE* f = fopen("bogus2", "r"); >- printf("f2 = %p, errno2 = %d\n", f, errno); >- perror("wurble2"); >+ printf("f = %p, errno = %d (%s)\n", f, errno, strerror(errno)); > return NULL; > } > > void* thr3 ( void* v ) > { > FILE* f = fopen("bogus3", "r"); >- printf("f3 = %p, errno3 = %d\n", f, errno); >- perror("wurble3"); >+ printf("f = %p, errno = %d (%s)\n", f, errno, strerror(errno)); > return NULL; > } > >@@ -29,8 +27,7 @@ > pthread_create(&tid2, NULL, &thr2, NULL); > pthread_create(&tid3, NULL, &thr3, NULL); > f = fopen("bogus", "r"); >- printf("f1 = %p, errno1 = %d\n", f, errno); >- perror("wurble1"); >+ printf("f = %p, errno = %d (%s)\n", f, errno, strerror(errno)); > pthread_join(tid2, NULL); > pthread_join(tid3, NULL); > return 0; >diff -ruN valgrind-2.1.0/memcheck/tests/threadederrno.stderr.exp valgrind/memcheck/tests/threadederrno.stderr.exp >--- valgrind-2.1.0/memcheck/tests/threadederrno.stderr.exp 2003-07-13 06:13:37.000000000 -0500 >+++ valgrind/memcheck/tests/threadederrno.stderr.exp 2003-12-15 20:05:15.000000000 -0600 >@@ -1,3 +0,0 @@ >-wurble1: No such file or directory >-wurble2: No such file or directory >-wurble3: No such file or directory >diff -ruN valgrind-2.1.0/memcheck/tests/threadederrno.stdout.exp valgrind/memcheck/tests/threadederrno.stdout.exp >--- valgrind-2.1.0/memcheck/tests/threadederrno.stdout.exp 2003-07-13 06:13:37.000000000 -0500 >+++ valgrind/memcheck/tests/threadederrno.stdout.exp 2004-01-21 11:40:16.000000000 -0600 >@@ -1,3 +1,3 @@ >-f1 = (nil), errno1 = 2 >-f2 = (nil), errno2 = 2 >-f3 = (nil), errno3 = 2 >+f = (nil), errno = 2 (No such file or directory) >+f = (nil), errno = 2 (No such file or directory) >+f = (nil), errno = 2 (No such file or directory) >diff -ruN valgrind-2.1.0/memcheck/tests/weirdioctl.stderr.exp valgrind/memcheck/tests/weirdioctl.stderr.exp >--- valgrind-2.1.0/memcheck/tests/weirdioctl.stderr.exp 2003-11-13 11:53:43.000000000 -0600 >+++ valgrind/memcheck/tests/weirdioctl.stderr.exp 2003-12-15 03:00:21.000000000 -0600 >@@ -1,5 +1,5 @@ > Syscall param ioctl(TCSET{A,AW,AF}) contains uninitialised or unaddressable byte(s) >- at 0x........: __ioctl (in /...libc...) >+ at 0x........: ioctl (in /...libc...) > by 0x........: __libc_start_main (...libc...) > by 0x........: ... > Address 0x........ is on thread 1's stack >diff -ruN valgrind-2.1.0/memcheck/tests/writev.stderr.exp valgrind/memcheck/tests/writev.stderr.exp >--- valgrind-2.1.0/memcheck/tests/writev.stderr.exp 2003-11-13 11:53:43.000000000 -0600 >+++ valgrind/memcheck/tests/writev.stderr.exp 2003-12-15 03:00:21.000000000 -0600 >@@ -1,19 +1,19 @@ > > Test file created. > Syscall param writev(vector[...]) contains uninitialised or unaddressable byte(s) >- at 0x........: __libc_writev (...libc...) >+ at 0x........: writev (in /...libc...) > by 0x........: main (writev.c:56) > Address 0x........ is not stack'd, malloc'd or free'd > Received EFAULT as expected > > Syscall param writev(vector) contains uninitialised or unaddressable byte(s) >- at 0x........: __libc_writev (...libc...) >+ at 0x........: writev (in /...libc...) > by 0x........: main (writev.c:68) > Address 0x........ is not stack'd, malloc'd or free'd > Received EINVAL as expected > > Syscall param readv(vector) contains uninitialised or unaddressable byte(s) >- at 0x........: __libc_readv (...libc...) >+ at 0x........: readv (in /...libc...) > by 0x........: main (writev.c:76) > Address 0x........ is not stack'd, malloc'd or free'd > Received EINVAL as expected >diff -ruN valgrind-2.1.0/memcheck/tests/zeropage.c valgrind/memcheck/tests/zeropage.c >--- valgrind-2.1.0/memcheck/tests/zeropage.c 2003-12-02 08:56:04.000000000 -0600 >+++ valgrind/memcheck/tests/zeropage.c 2004-01-03 08:18:02.000000000 -0600 >@@ -12,25 +12,25 @@ > { > /* mmap(0x0, ... FIXED) should fail */ > int* m = mmap(0x0, 1000000, PROT_READ|PROT_WRITE, >- MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED, -1, 0); >+ MAP_PRIVATE|MAP_ANON|MAP_FIXED, -1, 0); > if (m != (int*)-1) > printf("succeeded?!\n"); > > /* mmap(0x1000, ... FIXED) should fail */ > m = mmap((void*)0x1000, 1000000, PROT_READ|PROT_WRITE, >- MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED, -1, 0); >+ MAP_PRIVATE|MAP_ANON|MAP_FIXED, -1, 0); > if (m != (int*)-1) > printf("succeeded?!\n"); > > /* mmap(0xa000, ... FIXED) should fail */ > m = mmap((void*)0xa000, 1000000, PROT_READ|PROT_WRITE, >- MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED, -1, 0); >+ MAP_PRIVATE|MAP_ANON|MAP_FIXED, -1, 0); > if (m != (int*)-1) > printf("succeeded?!\n"); > > /* mmap(0x10000, ... FIXED) should fail */ > m = mmap((void*)0x10000, 1000000, PROT_READ|PROT_WRITE, >- MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED, -1, 0); >+ MAP_PRIVATE|MAP_ANON|MAP_FIXED, -1, 0); > if (m == (int*)-1) > printf("failed?!\n"); > >diff -ruN valgrind-2.1.0/memcheck/tests/zeropage.stderr.exp valgrind/memcheck/tests/zeropage.stderr.exp >--- valgrind-2.1.0/memcheck/tests/zeropage.stderr.exp 2003-12-02 08:56:04.000000000 -0600 >+++ valgrind/memcheck/tests/zeropage.stderr.exp 2003-12-15 20:05:15.000000000 -0600 >@@ -0,0 +1,3 @@ >+Warning: client syscall mmap2 tried to modify addresses 0x........-0x........ >+Warning: client syscall mmap2 tried to modify addresses 0x........-0x........ >+Warning: client syscall mmap2 tried to modify addresses 0x........-0x........ >diff -ruN valgrind-2.1.0/missing valgrind/missing >--- valgrind-2.1.0/missing 2003-09-23 10:39:40.000000000 -0500 >+++ valgrind/missing 2004-02-04 02:07:51.000000000 -0600 >@@ -1,6 +1,10 @@ > #! /bin/sh > # Common stub for a few missing GNU programs while installing. >-# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. >+ >+scriptversion=2003-09-02.23 >+ >+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 >+# Free Software Foundation, Inc. > # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. > > # This program is free software; you can redistribute it and/or modify >@@ -38,12 +42,23 @@ > configure_ac=configure.in > fi > >+msg="missing on your system" >+ > case "$1" in > --run) > # Try to run requested program, and just exit if it succeeds. > run= > shift > "$@" && exit 0 >+ # Exit code 63 means version mismatch. This often happens >+ # when the user try to use an ancient version of a tool on >+ # a file that requires a minimum version. In this case we >+ # we should proceed has if the program had been absent, or >+ # if --run hadn't been passed. >+ if test $? = 63; then >+ run=: >+ msg="probably too old" >+ fi > ;; > esac > >@@ -74,11 +89,13 @@ > lex create \`lex.yy.c', if possible, from existing .c > makeinfo touch the output file > tar try tar, gnutar, gtar, then tar without non-portable flags >- yacc create \`y.tab.[ch]', if possible, from existing .[ch]" >+ yacc create \`y.tab.[ch]', if possible, from existing .[ch] >+ >+Send bug reports to <bug-automake@gnu.org>." > ;; > > -v|--v|--ve|--ver|--vers|--versi|--versio|--version) >- echo "missing 0.4 - GNU automake" >+ echo "missing $scriptversion (GNU Automake)" > ;; > > -*) >@@ -94,7 +111,7 @@ > fi > > echo 1>&2 "\ >-WARNING: \`$1' is missing on your system. You should only need it if >+WARNING: \`$1' is $msg. You should only need it if > you modified \`acinclude.m4' or \`${configure_ac}'. You might want > to install the \`Automake' and \`Perl' packages. Grab them from > any GNU archive site." >@@ -108,7 +125,7 @@ > fi > > echo 1>&2 "\ >-WARNING: \`$1' is missing on your system. You should only need it if >+WARNING: \`$1' is $msg. You should only need it if > you modified \`${configure_ac}'. You might want to install the > \`Autoconf' and \`GNU m4' packages. Grab them from any GNU > archive site." >@@ -122,7 +139,7 @@ > fi > > echo 1>&2 "\ >-WARNING: \`$1' is missing on your system. You should only need it if >+WARNING: \`$1' is $msg. You should only need it if > you modified \`acconfig.h' or \`${configure_ac}'. You might want > to install the \`Autoconf' and \`GNU m4' packages. Grab them > from any GNU archive site." >@@ -146,7 +163,7 @@ > fi > > echo 1>&2 "\ >-WARNING: \`$1' is missing on your system. You should only need it if >+WARNING: \`$1' is $msg. You should only need it if > you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. > You might want to install the \`Automake' and \`Perl' packages. > Grab them from any GNU archive site." >@@ -162,10 +179,10 @@ > fi > > echo 1>&2 "\ >-WARNING: \`$1' is needed, and you do not seem to have it handy on your >- system. You might have modified some files without having the >+WARNING: \`$1' is needed, but is $msg. >+ You might have modified some files without having the > proper tools for further handling them. >- You can get \`$1Help2man' as part of \`Autoconf' from any GNU >+ You can get \`$1' as part of \`Autoconf' from any GNU > archive site." > > file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` >@@ -185,7 +202,7 @@ > > bison|yacc) > echo 1>&2 "\ >-WARNING: \`$1' is missing on your system. You should only need it if >+WARNING: \`$1' $msg. You should only need it if > you modified a \`.y' file. You may need the \`Bison' package > in order for those modifications to take effect. You can get > \`Bison' from any GNU archive site." >@@ -215,7 +232,7 @@ > > lex|flex) > echo 1>&2 "\ >-WARNING: \`$1' is missing on your system. You should only need it if >+WARNING: \`$1' is $msg. You should only need it if > you modified a \`.l' file. You may need the \`Flex' package > in order for those modifications to take effect. You can get > \`Flex' from any GNU archive site." >@@ -243,7 +260,7 @@ > fi > > echo 1>&2 "\ >-WARNING: \`$1' is missing on your system. You should only need it if >+WARNING: \`$1' is $msg. You should only need it if > you modified a dependency of a manual page. You may need the > \`Help2man' package in order for those modifications to take > effect. You can get \`Help2man' from any GNU archive site." >@@ -268,7 +285,7 @@ > fi > > echo 1>&2 "\ >-WARNING: \`$1' is missing on your system. You should only need it if >+WARNING: \`$1' is $msg. You should only need it if > you modified a \`.texi' or \`.texinfo' file, or any other file > indirectly affecting the aspect of the manual. The spurious > call might also be the consequence of using a buggy \`make' (AIX, >@@ -323,10 +340,10 @@ > > *) > echo 1>&2 "\ >-WARNING: \`$1' is needed, and you do not seem to have it handy on your >- system. You might have modified some files without having the >+WARNING: \`$1' is needed, and is $msg. >+ You might have modified some files without having the > proper tools for further handling them. Check the \`README' file, >- it often tells you about the needed prerequirements for installing >+ it often tells you about the needed prerequisites for installing > this package. You may also peek at any GNU archive site, in case > some other package would contain this missing \`$1' program." > exit 1 >@@ -334,3 +351,10 @@ > esac > > exit 0 >+ >+# Local variables: >+# eval: (add-hook 'write-file-hooks 'time-stamp) >+# time-stamp-start: "scriptversion=" >+# time-stamp-format: "%:y-%02m-%02d.%02H" >+# time-stamp-end: "$" >+# End: >diff -ruN valgrind-2.1.0/mkinstalldirs valgrind/mkinstalldirs >--- valgrind-2.1.0/mkinstalldirs 2003-09-23 10:39:40.000000000 -0500 >+++ valgrind/mkinstalldirs 1969-12-31 18:00:00.000000000 -0600 >@@ -1,111 +0,0 @@ >-#! /bin/sh >-# mkinstalldirs --- make directory hierarchy >-# Author: Noah Friedman <friedman@prep.ai.mit.edu> >-# Created: 1993-05-16 >-# Public domain >- >-errstatus=0 >-dirmode="" >- >-usage="\ >-Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." >- >-# process command line arguments >-while test $# -gt 0 ; do >- case $1 in >- -h | --help | --h*) # -h for help >- echo "$usage" 1>&2 >- exit 0 >- ;; >- -m) # -m PERM arg >- shift >- test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } >- dirmode=$1 >- shift >- ;; >- --) # stop option processing >- shift >- break >- ;; >- -*) # unknown option >- echo "$usage" 1>&2 >- exit 1 >- ;; >- *) # first non-opt arg >- break >- ;; >- esac >-done >- >-for file >-do >- if test -d "$file"; then >- shift >- else >- break >- fi >-done >- >-case $# in >- 0) exit 0 ;; >-esac >- >-case $dirmode in >- '') >- if mkdir -p -- . 2>/dev/null; then >- echo "mkdir -p -- $*" >- exec mkdir -p -- "$@" >- fi >- ;; >- *) >- if mkdir -m "$dirmode" -p -- . 2>/dev/null; then >- echo "mkdir -m $dirmode -p -- $*" >- exec mkdir -m "$dirmode" -p -- "$@" >- fi >- ;; >-esac >- >-for file >-do >- set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` >- shift >- >- pathcomp= >- for d >- do >- pathcomp="$pathcomp$d" >- case $pathcomp in >- -*) pathcomp=./$pathcomp ;; >- esac >- >- if test ! -d "$pathcomp"; then >- echo "mkdir $pathcomp" >- >- mkdir "$pathcomp" || lasterr=$? >- >- if test ! -d "$pathcomp"; then >- errstatus=$lasterr >- else >- if test ! -z "$dirmode"; then >- echo "chmod $dirmode $pathcomp" >- lasterr="" >- chmod "$dirmode" "$pathcomp" || lasterr=$? >- >- if test ! -z "$lasterr"; then >- errstatus=$lasterr >- fi >- fi >- fi >- fi >- >- pathcomp="$pathcomp/" >- done >-done >- >-exit $errstatus >- >-# Local Variables: >-# mode: shell-script >-# sh-indentation: 2 >-# End: >-# mkinstalldirs ends here >diff -ruN valgrind-2.1.0/none/.cvsignore valgrind/none/.cvsignore >--- valgrind-2.1.0/none/.cvsignore 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/.cvsignore 2002-09-23 06:36:38.000000000 -0500 >@@ -0,0 +1,2 @@ >+Makefile.in >+Makefile >diff -ruN valgrind-2.1.0/none/CVS/Entries valgrind/none/CVS/Entries >--- valgrind-2.1.0/none/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/CVS/Entries 2004-02-11 22:51:47.812543632 -0600 >@@ -0,0 +1,4 @@ >+/.cvsignore/1.1/Mon Sep 23 11:36:38 2002// >+/Makefile.am/1.42/Tue Dec 16 02:05:15 2003// >+/nl_main.c/1.18/Sun Jan 4 16:43:23 2004// >+D >diff -ruN valgrind-2.1.0/none/CVS/Entries.Log valgrind/none/CVS/Entries.Log >--- valgrind-2.1.0/none/CVS/Entries.Log 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/CVS/Entries.Log 2004-02-11 22:51:47.821542264 -0600 >@@ -0,0 +1,2 @@ >+A D/docs//// >+A D/tests//// >diff -ruN valgrind-2.1.0/none/CVS/Repository valgrind/none/CVS/Repository >--- valgrind-2.1.0/none/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/CVS/Repository 2004-02-11 22:51:47.806544544 -0600 >@@ -0,0 +1 @@ >+valgrind/none >diff -ruN valgrind-2.1.0/none/CVS/Root valgrind/none/CVS/Root >--- valgrind-2.1.0/none/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/CVS/Root 2004-02-11 22:51:47.806544544 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/none/Makefile.am valgrind/none/Makefile.am >--- valgrind-2.1.0/none/Makefile.am 2003-06-12 09:13:04.000000000 -0500 >+++ valgrind/none/Makefile.am 2003-12-15 20:05:15.000000000 -0600 >@@ -6,9 +6,14 @@ > @PREFERRED_STACK_BOUNDARY@ -g > > valdir = $(libdir)/valgrind >+inplacedir = $(top_srcdir)/.in_place > > val_PROGRAMS = vgskin_none.so > > vgskin_none_so_SOURCES = nl_main.c >-vgskin_none_so_LDFLAGS = -shared >+vgskin_none_so_LDFLAGS = -shared -Wl,-rpath,$(top_srcdir)/coregrind > >+all-local: >+ mkdir -p $(inplacedir) >+ -rm -f $(inplacedir)/$(val_PROGRAMS) >+ ln -f -s $(top_srcdir)/$(subdir)/$(val_PROGRAMS) $(inplacedir)/$(val_PROGRAMS) >diff -ruN valgrind-2.1.0/none/Makefile.in valgrind/none/Makefile.in >--- valgrind-2.1.0/none/Makefile.in 2003-12-14 09:50:20.000000000 -0600 >+++ valgrind/none/Makefile.in 2004-02-11 22:52:34.814398264 -0600 >@@ -1,8 +1,8 @@ >-# Makefile.in generated by automake 1.7.6 from Makefile.am. >+# Makefile.in generated by automake 1.8.2 from Makefile.am. > # @configure_input@ > >-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 >-# Free Software Foundation, Inc. >+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, >+# 2003, 2004 Free Software Foundation, Inc. > # This Makefile.in is free software; the Free Software Foundation > # gives unlimited permission to copy and/or distribute it, > # with or without modifications, as long as this notice is preserved. >@@ -14,6 +14,8 @@ > > @SET_MAKE@ > >+SOURCES = $(vgskin_none_so_SOURCES) >+ > srcdir = @srcdir@ > top_srcdir = @top_srcdir@ > VPATH = @srcdir@ >@@ -21,7 +23,6 @@ > pkglibdir = $(libdir)/@PACKAGE@ > pkgincludedir = $(includedir)/@PACKAGE@ > top_builddir = .. >- > am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd > INSTALL = @INSTALL@ > install_sh_DATA = $(install_sh) -c -m 644 >@@ -36,6 +37,42 @@ > PRE_UNINSTALL = : > POST_UNINSTALL = : > host_triplet = @host@ >+val_PROGRAMS = vgskin_none.so$(EXEEXT) >+subdir = none >+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in >+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >+am__aclocal_m4_deps = $(top_srcdir)/configure.in >+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ >+ $(ACLOCAL_M4) >+mkinstalldirs = $(mkdir_p) >+CONFIG_HEADER = $(top_builddir)/config.h >+CONFIG_CLEAN_FILES = >+am__installdirs = $(DESTDIR)$(valdir) >+valPROGRAMS_INSTALL = $(INSTALL_PROGRAM) >+PROGRAMS = $(val_PROGRAMS) >+am_vgskin_none_so_OBJECTS = nl_main.$(OBJEXT) >+vgskin_none_so_OBJECTS = $(am_vgskin_none_so_OBJECTS) >+vgskin_none_so_LDADD = $(LDADD) >+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) >+depcomp = $(SHELL) $(top_srcdir)/depcomp >+am__depfiles_maybe = depfiles >+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/nl_main.Po >+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ >+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) >+CCLD = $(CC) >+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ >+SOURCES = $(vgskin_none_so_SOURCES) >+DIST_SOURCES = $(vgskin_none_so_SOURCES) >+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ >+ html-recursive info-recursive install-data-recursive \ >+ install-exec-recursive install-info-recursive \ >+ install-recursive installcheck-recursive installdirs-recursive \ >+ pdf-recursive ps-recursive uninstall-info-recursive \ >+ uninstall-recursive >+ETAGS = etags >+CTAGS = ctags >+DIST_SUBDIRS = $(SUBDIRS) >+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) > ACLOCAL = @ACLOCAL@ > AMDEP_FALSE = @AMDEP_FALSE@ > AMDEP_TRUE = @AMDEP_TRUE@ >@@ -92,6 +129,7 @@ > SHELL = @SHELL@ > STRIP = @STRIP@ > VERSION = @VERSION@ >+VG_PLATFORM = @VG_PLATFORM@ > ac_ct_CC = @ac_ct_CC@ > ac_ct_CXX = @ac_ct_CXX@ > ac_ct_RANLIB = @ac_ct_RANLIB@ >@@ -123,6 +161,7 @@ > libexecdir = @libexecdir@ > localstatedir = @localstatedir@ > mandir = @mandir@ >+mkdir_p = @mkdir_p@ > oldincludedir = @oldincludedir@ > prefix = @prefix@ > program_transform_name = @program_transform_name@ >@@ -130,65 +169,51 @@ > sharedstatedir = @sharedstatedir@ > sysconfdir = @sysconfdir@ > target_alias = @target_alias@ >- > SUBDIRS = . docs tests >- > AM_CPPFLAGS = -I$(top_srcdir)/include -DVG_LIBDIR="\"$(libdir)"\" > AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer \ > @PREFERRED_STACK_BOUNDARY@ -g > >- > valdir = $(libdir)/valgrind >- >-val_PROGRAMS = vgskin_none.so >- >+inplacedir = $(top_srcdir)/.in_place > vgskin_none_so_SOURCES = nl_main.c >-vgskin_none_so_LDFLAGS = -shared >-subdir = none >-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs >-CONFIG_HEADER = $(top_builddir)/config.h >-CONFIG_CLEAN_FILES = >-val_PROGRAMS = vgskin_none.so$(EXEEXT) >-PROGRAMS = $(val_PROGRAMS) >- >-am_vgskin_none_so_OBJECTS = nl_main.$(OBJEXT) >-vgskin_none_so_OBJECTS = $(am_vgskin_none_so_OBJECTS) >-vgskin_none_so_LDADD = $(LDADD) >-vgskin_none_so_DEPENDENCIES = >- >-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) >-depcomp = $(SHELL) $(top_srcdir)/depcomp >-am__depfiles_maybe = depfiles >-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/nl_main.Po >-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ >- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) >-CCLD = $(CC) >-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ >-DIST_SOURCES = $(vgskin_none_so_SOURCES) >- >-RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ >- ps-recursive install-info-recursive uninstall-info-recursive \ >- all-recursive install-data-recursive install-exec-recursive \ >- installdirs-recursive install-recursive uninstall-recursive \ >- check-recursive installcheck-recursive >-DIST_COMMON = Makefile.am Makefile.in >-DIST_SUBDIRS = $(SUBDIRS) >-SOURCES = $(vgskin_none_so_SOURCES) >- >+vgskin_none_so_LDFLAGS = -shared -Wl,-rpath,$(top_srcdir)/coregrind > all: all-recursive > > .SUFFIXES: > .SUFFIXES: .c .o .obj >-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) >+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) >+ @for dep in $?; do \ >+ case '$(am__configure_deps)' in \ >+ *$$dep*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ >+ && exit 0; \ >+ exit 1;; \ >+ esac; \ >+ done; \ >+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu none/Makefile'; \ > cd $(top_srcdir) && \ > $(AUTOMAKE) --gnu none/Makefile >-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status >- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) >-valPROGRAMS_INSTALL = $(INSTALL_PROGRAM) >+.PRECIOUS: Makefile >+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status >+ @case '$?' in \ >+ *config.status*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ >+ *) \ >+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ >+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ >+ esac; >+ >+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+ >+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh > install-valPROGRAMS: $(val_PROGRAMS) > @$(NORMAL_INSTALL) >- $(mkinstalldirs) $(DESTDIR)$(valdir) >+ $(mkdir_p) $(DESTDIR)$(valdir) > @list='$(val_PROGRAMS)'; for p in $$list; do \ > p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ > if test -f $$p \ >@@ -214,37 +239,28 @@ > $(LINK) $(vgskin_none_so_LDFLAGS) $(vgskin_none_so_OBJECTS) $(vgskin_none_so_LDADD) $(LIBS) > > mostlyclean-compile: >- -rm -f *.$(OBJEXT) core *.core >+ -rm -f *.$(OBJEXT) > > distclean-compile: > -rm -f *.tab.c > > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nl_main.Po@am__quote@ > >-distclean-depend: >- -rm -rf ./$(DEPDIR) >- > .c.o: >-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ >-@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ >-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ >-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ >-@am__fastdepCC_TRUE@ fi >+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ >+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi > @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >-@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< >+@am__fastdepCC_FALSE@ $(COMPILE) -c $< > > .c.obj: >-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ >-@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ >-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ >-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ >-@am__fastdepCC_TRUE@ fi >+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ >+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi > @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >-@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` >+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` > uninstall-info-am: > > # This directory's subdirectories are mostly independent; you can cd >@@ -306,14 +322,6 @@ > test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ > done > >-ETAGS = etags >-ETAGSFLAGS = >- >-CTAGS = ctags >-CTAGSFLAGS = >- >-tags: TAGS >- > ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) > list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ > unique=`for i in $$list; do \ >@@ -322,6 +330,7 @@ > $(AWK) ' { files[$$0] = 1; } \ > END { for (i in files) print i; }'`; \ > mkid -fID $$unique >+tags: TAGS > > TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ > $(TAGS_FILES) $(LISP) >@@ -347,7 +356,6 @@ > test -z "$(ETAGS_ARGS)$$tags$$unique" \ > || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ > $$tags $$unique >- > ctags: CTAGS > CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ > $(TAGS_FILES) $(LISP) >@@ -370,10 +378,6 @@ > > distclean-tags: > -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags >-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) >- >-top_distdir = .. >-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) > > distdir: $(DISTFILES) > @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ >@@ -387,7 +391,7 @@ > dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ > if test "$$dir" != "$$file" && test "$$dir" != "."; then \ > dir="/$$dir"; \ >- $(mkinstalldirs) "$(distdir)$$dir"; \ >+ $(mkdir_p) "$(distdir)$$dir"; \ > else \ > dir=''; \ > fi; \ >@@ -404,24 +408,23 @@ > done > list='$(SUBDIRS)'; for subdir in $$list; do \ > if test "$$subdir" = .; then :; else \ >- test -d $(distdir)/$$subdir \ >- || mkdir $(distdir)/$$subdir \ >+ test -d "$(distdir)/$$subdir" \ >+ || mkdir "$(distdir)/$$subdir" \ > || exit 1; \ > (cd $$subdir && \ > $(MAKE) $(AM_MAKEFLAGS) \ >- top_distdir="$(top_distdir)" \ >- distdir=../$(distdir)/$$subdir \ >+ top_distdir="../$(top_distdir)" \ >+ distdir="../$(distdir)/$$subdir" \ > distdir) \ > || exit 1; \ > fi; \ > done > check-am: all-am > check: check-recursive >-all-am: Makefile $(PROGRAMS) >+all-am: Makefile $(PROGRAMS) all-local > installdirs: installdirs-recursive > installdirs-am: >- $(mkinstalldirs) $(DESTDIR)$(valdir) >- >+ $(mkdir_p) $(DESTDIR)$(valdir) > install: install-recursive > install-exec: install-exec-recursive > install-data: install-data-recursive >@@ -433,7 +436,7 @@ > installcheck: installcheck-recursive > install-strip: > $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ >- INSTALL_STRIP_FLAG=-s \ >+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ > `test -z '$(STRIP)' || \ > echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install > mostlyclean-generic: >@@ -441,7 +444,7 @@ > clean-generic: > > distclean-generic: >- -rm -f Makefile $(CONFIG_CLEAN_FILES) >+ -rm -f $(CONFIG_CLEAN_FILES) > > maintainer-clean-generic: > @echo "This command is intended for maintainers to use" >@@ -451,14 +454,17 @@ > clean-am: clean-generic clean-valPROGRAMS mostlyclean-am > > distclean: distclean-recursive >- >-distclean-am: clean-am distclean-compile distclean-depend \ >- distclean-generic distclean-tags >+ -rm -rf ./$(DEPDIR) >+ -rm -f Makefile >+distclean-am: clean-am distclean-compile distclean-generic \ >+ distclean-tags > > dvi: dvi-recursive > > dvi-am: > >+html: html-recursive >+ > info: info-recursive > > info-am: >@@ -474,7 +480,8 @@ > installcheck-am: > > maintainer-clean: maintainer-clean-recursive >- >+ -rm -rf ./$(DEPDIR) >+ -rm -f Makefile > maintainer-clean-am: distclean-am maintainer-clean-generic > > mostlyclean: mostlyclean-recursive >@@ -493,24 +500,25 @@ > > uninstall-info: uninstall-info-recursive > >-.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ >- clean-generic clean-recursive clean-valPROGRAMS ctags \ >- ctags-recursive distclean distclean-compile distclean-depend \ >+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am all-local check \ >+ check-am clean clean-generic clean-recursive clean-valPROGRAMS \ >+ ctags ctags-recursive distclean distclean-compile \ > distclean-generic distclean-recursive distclean-tags distdir \ >- dvi dvi-am dvi-recursive info info-am info-recursive install \ >- install-am install-data install-data-am install-data-recursive \ >- install-exec install-exec-am install-exec-recursive \ >- install-info install-info-am install-info-recursive install-man \ >- install-recursive install-strip install-valPROGRAMS \ >- installcheck installcheck-am installdirs installdirs-am \ >- installdirs-recursive maintainer-clean maintainer-clean-generic \ >+ dvi dvi-am html html-am info info-am install install-am \ >+ install-data install-data-am install-exec install-exec-am \ >+ install-info install-info-am install-man install-strip \ >+ install-valPROGRAMS installcheck installcheck-am installdirs \ >+ installdirs-am maintainer-clean maintainer-clean-generic \ > maintainer-clean-recursive mostlyclean mostlyclean-compile \ >- mostlyclean-generic mostlyclean-recursive pdf pdf-am \ >- pdf-recursive ps ps-am ps-recursive tags tags-recursive \ >- uninstall uninstall-am uninstall-info-am \ >- uninstall-info-recursive uninstall-recursive \ >+ mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \ >+ tags tags-recursive uninstall uninstall-am uninstall-info-am \ > uninstall-valPROGRAMS > >+ >+all-local: >+ mkdir -p $(inplacedir) >+ -rm -f $(inplacedir)/$(val_PROGRAMS) >+ ln -f -s $(top_srcdir)/$(subdir)/$(val_PROGRAMS) $(inplacedir)/$(val_PROGRAMS) > # Tell versions [3.59,3.63) of GNU make to not export all variables. > # Otherwise a system limit (for SysV at least) may be exceeded. > .NOEXPORT: >diff -ruN valgrind-2.1.0/none/docs/.cvsignore valgrind/none/docs/.cvsignore >--- valgrind-2.1.0/none/docs/.cvsignore 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/docs/.cvsignore 2002-10-03 04:12:58.000000000 -0500 >@@ -0,0 +1,2 @@ >+Makefile.in >+Makefile >diff -ruN valgrind-2.1.0/none/docs/CVS/Entries valgrind/none/docs/CVS/Entries >--- valgrind-2.1.0/none/docs/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/docs/CVS/Entries 2004-02-11 22:51:47.820542416 -0600 >@@ -0,0 +1,4 @@ >+/.cvsignore/1.1/Thu Oct 3 09:12:58 2002// >+/Makefile.am/1.2/Wed Nov 13 21:24:57 2002// >+/nl_main.html/1.4/Sun Jan 4 16:43:23 2004// >+D >diff -ruN valgrind-2.1.0/none/docs/CVS/Repository valgrind/none/docs/CVS/Repository >--- valgrind-2.1.0/none/docs/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/docs/CVS/Repository 2004-02-11 22:51:47.812543632 -0600 >@@ -0,0 +1 @@ >+valgrind/none/docs >diff -ruN valgrind-2.1.0/none/docs/CVS/Root valgrind/none/docs/CVS/Root >--- valgrind-2.1.0/none/docs/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/docs/CVS/Root 2004-02-11 22:51:47.812543632 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/none/docs/Makefile.in valgrind/none/docs/Makefile.in >--- valgrind-2.1.0/none/docs/Makefile.in 2003-12-14 09:50:20.000000000 -0600 >+++ valgrind/none/docs/Makefile.in 2004-02-11 22:52:34.959376224 -0600 >@@ -1,8 +1,8 @@ >-# Makefile.in generated by automake 1.7.6 from Makefile.am. >+# Makefile.in generated by automake 1.8.2 from Makefile.am. > # @configure_input@ > >-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 >-# Free Software Foundation, Inc. >+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, >+# 2003, 2004 Free Software Foundation, Inc. > # This Makefile.in is free software; the Free Software Foundation > # gives unlimited permission to copy and/or distribute it, > # with or without modifications, as long as this notice is preserved. >@@ -21,7 +21,6 @@ > pkglibdir = $(libdir)/@PACKAGE@ > pkgincludedir = $(includedir)/@PACKAGE@ > top_builddir = ../.. >- > am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd > INSTALL = @INSTALL@ > install_sh_DATA = $(install_sh) -c -m 644 >@@ -36,6 +35,21 @@ > PRE_UNINSTALL = : > POST_UNINSTALL = : > host_triplet = @host@ >+subdir = none/docs >+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in >+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >+am__aclocal_m4_deps = $(top_srcdir)/configure.in >+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ >+ $(ACLOCAL_M4) >+mkinstalldirs = $(mkdir_p) >+CONFIG_HEADER = $(top_builddir)/config.h >+CONFIG_CLEAN_FILES = >+SOURCES = >+DIST_SOURCES = >+am__installdirs = $(DESTDIR)$(docdir) >+docDATA_INSTALL = $(INSTALL_DATA) >+DATA = $(doc_DATA) >+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) > ACLOCAL = @ACLOCAL@ > AMDEP_FALSE = @AMDEP_FALSE@ > AMDEP_TRUE = @AMDEP_TRUE@ >@@ -92,6 +106,7 @@ > SHELL = @SHELL@ > STRIP = @STRIP@ > VERSION = @VERSION@ >+VG_PLATFORM = @VG_PLATFORM@ > ac_ct_CC = @ac_ct_CC@ > ac_ct_CXX = @ac_ct_CXX@ > ac_ct_RANLIB = @ac_ct_RANLIB@ >@@ -123,6 +138,7 @@ > libexecdir = @libexecdir@ > localstatedir = @localstatedir@ > mandir = @mandir@ >+mkdir_p = @mkdir_p@ > oldincludedir = @oldincludedir@ > prefix = @prefix@ > program_transform_name = @program_transform_name@ >@@ -131,32 +147,44 @@ > sysconfdir = @sysconfdir@ > target_alias = @target_alias@ > docdir = $(datadir)/doc/valgrind >- > doc_DATA = nl_main.html >- > EXTRA_DIST = $(doc_DATA) >-subdir = none/docs >-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs >-CONFIG_HEADER = $(top_builddir)/config.h >-CONFIG_CLEAN_FILES = >-DIST_SOURCES = >-DATA = $(doc_DATA) >- >-DIST_COMMON = Makefile.am Makefile.in > all: all-am > > .SUFFIXES: >-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) >+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) >+ @for dep in $?; do \ >+ case '$(am__configure_deps)' in \ >+ *$$dep*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ >+ && exit 0; \ >+ exit 1;; \ >+ esac; \ >+ done; \ >+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu none/docs/Makefile'; \ > cd $(top_srcdir) && \ > $(AUTOMAKE) --gnu none/docs/Makefile >-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status >- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) >+.PRECIOUS: Makefile >+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status >+ @case '$?' in \ >+ *config.status*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ >+ *) \ >+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ >+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ >+ esac; >+ >+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+ >+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh > uninstall-info-am: >-docDATA_INSTALL = $(INSTALL_DATA) > install-docDATA: $(doc_DATA) > @$(NORMAL_INSTALL) >- $(mkinstalldirs) $(DESTDIR)$(docdir) >+ $(mkdir_p) $(DESTDIR)$(docdir) > @list='$(doc_DATA)'; for p in $$list; do \ > if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ > f="`echo $$p | sed -e 's|^.*/||'`"; \ >@@ -177,10 +205,6 @@ > ctags: CTAGS > CTAGS: > >-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) >- >-top_distdir = ../.. >-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) > > distdir: $(DISTFILES) > @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ >@@ -194,7 +218,7 @@ > dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ > if test "$$dir" != "$$file" && test "$$dir" != "."; then \ > dir="/$$dir"; \ >- $(mkinstalldirs) "$(distdir)$$dir"; \ >+ $(mkdir_p) "$(distdir)$$dir"; \ > else \ > dir=''; \ > fi; \ >@@ -212,9 +236,8 @@ > check-am: all-am > check: check-am > all-am: Makefile $(DATA) >- > installdirs: >- $(mkinstalldirs) $(DESTDIR)$(docdir) >+ $(mkdir_p) $(DESTDIR)$(docdir) > install: install-am > install-exec: install-exec-am > install-data: install-data-am >@@ -226,7 +249,7 @@ > installcheck: installcheck-am > install-strip: > $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ >- INSTALL_STRIP_FLAG=-s \ >+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ > `test -z '$(STRIP)' || \ > echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install > mostlyclean-generic: >@@ -234,7 +257,7 @@ > clean-generic: > > distclean-generic: >- -rm -f Makefile $(CONFIG_CLEAN_FILES) >+ -rm -f $(CONFIG_CLEAN_FILES) > > maintainer-clean-generic: > @echo "This command is intended for maintainers to use" >@@ -244,13 +267,15 @@ > clean-am: clean-generic mostlyclean-am > > distclean: distclean-am >- >+ -rm -f Makefile > distclean-am: clean-am distclean-generic > > dvi: dvi-am > > dvi-am: > >+html: html-am >+ > info: info-am > > info-am: >@@ -266,7 +291,7 @@ > installcheck-am: > > maintainer-clean: maintainer-clean-am >- >+ -rm -f Makefile > maintainer-clean-am: distclean-am maintainer-clean-generic > > mostlyclean: mostlyclean-am >@@ -284,13 +309,14 @@ > uninstall-am: uninstall-docDATA uninstall-info-am > > .PHONY: all all-am check check-am clean clean-generic distclean \ >- distclean-generic distdir dvi dvi-am info info-am install \ >- install-am install-data install-data-am install-docDATA \ >- install-exec install-exec-am install-info install-info-am \ >- install-man install-strip installcheck installcheck-am \ >- installdirs maintainer-clean maintainer-clean-generic \ >- mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ >- uninstall-am uninstall-docDATA uninstall-info-am >+ distclean-generic distdir dvi dvi-am html html-am info info-am \ >+ install install-am install-data install-data-am \ >+ install-docDATA install-exec install-exec-am install-info \ >+ install-info-am install-man install-strip installcheck \ >+ installcheck-am installdirs maintainer-clean \ >+ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ >+ pdf-am ps ps-am uninstall uninstall-am uninstall-docDATA \ >+ uninstall-info-am > > # Tell versions [3.59,3.63) of GNU make to not export all variables. > # Otherwise a system limit (for SysV at least) may be exceeded. >diff -ruN valgrind-2.1.0/none/docs/nl_main.html valgrind/none/docs/nl_main.html >--- valgrind-2.1.0/none/docs/nl_main.html 2003-11-14 11:47:54.000000000 -0600 >+++ valgrind/none/docs/nl_main.html 2004-01-04 10:43:23.000000000 -0600 >@@ -31,7 +31,7 @@ > > <center> > <a href="mailto:njn25@cam.ac.uk">njn25@cam.ac.uk</a><br> >-Copyright © 2000-2003 Nicholas Nethercote >+Copyright © 2000-2004 Nicholas Nethercote > <p> > Nulgrind is licensed under the GNU General Public License, > version 2<br> >diff -ruN valgrind-2.1.0/none/nl_main.c valgrind/none/nl_main.c >--- valgrind-2.1.0/none/nl_main.c 2003-11-20 10:20:55.000000000 -0600 >+++ valgrind/none/nl_main.c 2004-01-04 10:43:23.000000000 -0600 >@@ -7,7 +7,7 @@ > This file is part of Nulgrind, the simplest possible Valgrind tool, > which does nothing. > >- Copyright (C) 2002-2003 Nicholas Nethercote >+ Copyright (C) 2002-2004 Nicholas Nethercote > njn25@cam.ac.uk > > This program is free software; you can redistribute it and/or >@@ -30,33 +30,40 @@ > > #include "vg_skin.h" > >-VG_DETERMINE_INTERFACE_VERSION >+//float SK_(shadow_ratio) = 9. / 8.; > >-void SK_(pre_clo_init)(void) >+static void post_clo_init(void) > { >- VG_(details_name) ("Nulgrind"); >- VG_(details_version) (NULL); >- VG_(details_description) ("a binary JIT-compiler"); >- VG_(details_copyright_author)( >- "Copyright (C) 2002-2003, and GNU GPL'd, by Nicholas Nethercote."); >- VG_(details_bug_reports_to) (VG_BUGS_TO); >- >- /* No needs, no core events to track */ > } > >-void SK_(post_clo_init)(void) >+static UCodeBlock* instrument(UCodeBlock* cb, Addr a) > { >+ return cb; > } > >-UCodeBlock* SK_(instrument)(UCodeBlock* cb, Addr a) >+static void fini(Int exitcode) > { >- return cb; > } > >-void SK_(fini)(Int exitcode) >+static void pre_clo_init(void) > { >+ VG_(details_name) ("Nulgrind"); >+ VG_(details_version) (NULL); >+ VG_(details_description) ("a binary JIT-compiler"); >+ VG_(details_copyright_author)( >+ "Copyright (C) 2002-2004, and GNU GPL'd, by Nicholas Nethercote."); >+ VG_(details_bug_reports_to) (VG_BUGS_TO); >+ >+ /* No needs, no core events to track */ >+ >+ /* entrypoints */ >+ VG_(init_post_clo_init)(post_clo_init); >+ VG_(init_instrument)(instrument); >+ VG_(init_fini)(fini); > } > >+VG_DETERMINE_INTERFACE_VERSION(pre_clo_init, 0) >+ > /*--------------------------------------------------------------------*/ > /*--- end nl_main.c ---*/ > /*--------------------------------------------------------------------*/ >diff -ruN valgrind-2.1.0/none/tests/.cvsignore valgrind/none/tests/.cvsignore >--- valgrind-2.1.0/none/tests/.cvsignore 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/.cvsignore 2004-01-03 09:21:55.000000000 -0600 >@@ -0,0 +1,46 @@ >+Makefile.in >+Makefile >+args >+bitfield1 >+bt_everything >+bt_literal >+coolo_sigaction >+coolo_strlen >+cpuid >+dastest >+discard >+floored >+fork >+fpu_lazy_eflags >+fucomip >+gxx304 >+map_unmap >+munmap_exe >+mremap >+pluto >+pth_blockedsig >+rcl_assert >+rcrl >+readline1 >+resolv >+seg_override >+sha1_test >+shortpush >+shorts >+smc1 >+pth_atfork1 >+pth_cancel1 >+pth_cancel2 >+pth_cvsimple >+pth_mutexspeed >+pth_once >+pth_semaphore1 >+pth_simple_mutex >+pth_simple_threads >+pth_specific >+pth_yield >+*.stdout.diff >+*.stderr.diff >+*.stdout.out >+*.stderr.out >+yield >diff -ruN valgrind-2.1.0/none/tests/CVS/Entries valgrind/none/tests/CVS/Entries >--- valgrind-2.1.0/none/tests/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/CVS/Entries 2004-02-11 22:51:48.364459728 -0600 >@@ -0,0 +1,144 @@ >+/.cvsignore/1.8/Sat Jan 3 15:21:55 2004// >+/Makefile.am/1.24/Wed Feb 11 23:33:29 2004// >+/args.c/1.1/Mon Feb 24 22:05:36 2003// >+/args.stderr.exp/1.1/Mon Feb 24 22:05:37 2003// >+/args.stdout.exp/1.1/Mon Feb 24 22:05:37 2003// >+/args.vgtest/1.1/Mon Feb 24 22:05:38 2003// >+/bitfield1.c/1.3/Sat Jan 3 14:24:42 2004// >+/bitfield1.stderr.exp/1.2/Mon Sep 23 09:36:25 2002// >+/bitfield1.vgtest/1.2/Mon Sep 23 09:36:25 2002// >+/bt_everything.c/1.2/Mon Sep 23 09:36:25 2002// >+/bt_everything.stderr.exp/1.2/Mon Sep 23 09:36:25 2002// >+/bt_everything.stdout.exp/1.2/Mon Sep 23 09:36:25 2002// >+/bt_everything.vgtest/1.2/Mon Sep 23 09:36:25 2002// >+/bt_literal.c/1.2/Mon Sep 23 09:36:25 2002// >+/bt_literal.stderr.exp/1.2/Mon Sep 23 09:36:25 2002// >+/bt_literal.stdout.exp/1.2/Mon Sep 23 09:36:25 2002// >+/bt_literal.vgtest/1.2/Mon Sep 23 09:36:25 2002// >+/coolo_sigaction.cpp/1.2/Mon Sep 23 09:36:25 2002// >+/coolo_sigaction.stderr.exp/1.2/Mon Sep 23 09:36:25 2002// >+/coolo_sigaction.stdout.exp/1.2/Mon Sep 23 09:36:25 2002// >+/coolo_sigaction.vgtest/1.2/Mon Sep 23 09:36:25 2002// >+/coolo_strlen.c/1.2/Mon Sep 23 09:36:25 2002// >+/coolo_strlen.stderr.exp/1.2/Mon Sep 23 09:36:25 2002// >+/coolo_strlen.vgtest/1.2/Mon Sep 23 09:36:25 2002// >+/cpuid.stderr.exp/1.2/Mon Sep 23 09:36:25 2002// >+/cpuid.stdout.exp/1.4/Sun Jun 29 10:12:58 2003// >+/cpuid.vgtest/1.3/Sun Jun 29 10:12:58 2003// >+/cpuid_c.c/1.2/Mon Sep 23 09:36:25 2002// >+/cpuid_s.s/1.2/Mon Sep 23 09:36:25 2002// >+/dastest.stderr.exp/1.2/Mon Sep 23 09:36:25 2002// >+/dastest.stdout.exp/1.2/Mon Sep 23 09:36:25 2002// >+/dastest.vgtest/1.2/Mon Sep 23 09:36:25 2002// >+/dastest_c.c/1.2/Mon Sep 23 09:36:25 2002// >+/dastest_s.s/1.2/Mon Sep 23 09:36:25 2002// >+/discard.c/1.3/Thu Nov 13 23:02:16 2003// >+/discard.stderr.exp/1.2/Sun Dec 15 02:51:21 2002// >+/discard.stdout.exp/1.1/Fri Oct 4 14:16:37 2002// >+/discard.vgtest/1.1/Fri Oct 4 14:16:37 2002// >+/exec-sigmask.c/1.1/Fri Jan 16 05:37:46 2004// >+/exec-sigmask.stderr.exp/1.1/Fri Jan 16 02:17:29 2004// >+/exec-sigmask.stdout.exp/1.1/Fri Jan 16 02:19:15 2004// >+/exec-sigmask.vgtest/1.1/Wed Jan 21 01:20:38 2004// >+/filter_cpuid/1.1/Sun Jun 29 10:12:58 2003// >+/filter_none_discards/1.1/Wed Oct 30 15:22:03 2002// >+/filter_stderr/1.3/Mon Sep 23 11:21:55 2002// >+/floored.c/1.2/Mon Sep 23 09:36:25 2002// >+/floored.stderr.exp/1.2/Mon Sep 23 09:36:25 2002// >+/floored.stdout.exp/1.2/Mon Sep 23 09:36:25 2002// >+/floored.vgtest/1.2/Mon Sep 23 09:36:25 2002// >+/fork.c/1.4/Tue Jan 6 21:46:02 2004// >+/fork.stderr.exp/1.4/Tue Jan 6 21:46:02 2004// >+/fork.stdout.exp/1.3/Fri Sep 27 10:38:20 2002// >+/fork.vgtest/1.3/Tue Jan 6 21:46:02 2004// >+/fpu_lazy_eflags.c/1.1/Tue Apr 8 10:04:31 2003// >+/fpu_lazy_eflags.stderr.exp/1.1/Tue Apr 8 10:04:32 2003// >+/fpu_lazy_eflags.stdout.exp/1.1/Tue Apr 8 10:04:32 2003// >+/fpu_lazy_eflags.vgtest/1.1/Tue Apr 8 10:04:32 2003// >+/fucomip.c/1.2/Mon Sep 23 09:36:25 2002// >+/fucomip.stderr.exp/1.2/Mon Sep 23 09:36:25 2002// >+/fucomip.vgtest/1.2/Mon Sep 23 09:36:25 2002// >+/gen_insn_test.pl/1.2/Wed Feb 11 23:33:29 2004// >+/gxx304.cpp/1.2/Mon Sep 23 09:36:25 2002// >+/gxx304.stderr.exp/1.2/Mon Sep 23 09:36:25 2002// >+/gxx304.vgtest/1.2/Mon Sep 23 09:36:25 2002// >+/insn_mmx.def/1.2/Wed Feb 11 23:33:29 2004// >+/insn_mmx.stderr.exp/1.1/Tue Jan 20 09:24:53 2004// >+/insn_mmx.stdout.exp/1.1/Tue Jan 20 09:24:53 2004// >+/insn_mmx.vgtest/1.1/Tue Jan 20 09:24:53 2004// >+/insn_sse.def/1.2/Wed Feb 11 23:33:29 2004// >+/insn_sse.stderr.exp/1.1/Tue Jan 20 09:24:53 2004// >+/insn_sse.stdout.exp/1.1/Tue Jan 20 09:24:53 2004// >+/insn_sse.vgtest/1.1/Tue Jan 20 09:24:53 2004// >+/insn_sse2.def/1.2/Wed Feb 11 23:33:29 2004// >+/insn_sse2.stderr.exp/1.1/Tue Jan 20 09:24:53 2004// >+/insn_sse2.stdout.exp/1.1/Tue Jan 20 09:24:53 2004// >+/insn_sse2.vgtest/1.1/Tue Jan 20 09:24:53 2004// >+/map_unmap.c/1.4/Mon Jan 19 21:47:52 2004// >+/map_unmap.stderr.exp/1.1/Fri Dec 19 21:56:04 2003// >+/map_unmap.stdout.exp/1.1/Fri Dec 19 21:56:04 2003// >+/map_unmap.vgtest/1.1/Fri Dec 19 21:56:04 2003// >+/mremap.c/1.1/Mon Dec 22 08:48:50 2003// >+/mremap.stderr.exp/1.1/Mon Dec 22 08:48:50 2003// >+/mremap.stdout.exp/1.1/Mon Dec 22 08:48:50 2003// >+/mremap.vgtest/1.1/Mon Dec 22 08:48:50 2003// >+/munmap_exe.c/1.3/Sat Jan 3 14:24:42 2004// >+/munmap_exe.stderr.exp/1.2/Mon Sep 23 09:36:25 2002// >+/munmap_exe.vgtest/1.2/Mon Sep 23 09:36:25 2002// >+/pth_blockedsig.c/1.2/Mon Sep 23 09:36:25 2002// >+/pth_blockedsig.stderr.exp/1.2/Mon Sep 23 09:36:25 2002// >+/pth_blockedsig.stdout.exp/1.2/Mon Sep 23 09:36:25 2002// >+/pth_blockedsig.vgtest/1.2/Mon Sep 23 09:36:25 2002// >+/pth_specific.c/1.2/Mon Sep 23 09:36:25 2002// >+/rcl_assert.S/1.2/Mon Sep 23 09:36:25 2002// >+/rcl_assert.stderr.exp/1.2/Mon Sep 23 09:36:25 2002// >+/rcl_assert.vgtest/1.2/Mon Sep 23 09:36:25 2002// >+/rcrl.c/1.2/Mon Sep 23 09:36:25 2002// >+/rcrl.stderr.exp/1.2/Mon Sep 23 09:36:25 2002// >+/rcrl.stdout.exp/1.2/Mon Sep 23 09:36:25 2002// >+/rcrl.vgtest/1.2/Mon Sep 23 09:36:25 2002// >+/readline1.c/1.2/Mon Sep 23 09:36:25 2002// >+/readline1.stderr.exp/1.2/Mon Sep 23 09:36:25 2002// >+/readline1.stdout.exp/1.2/Mon Sep 23 09:36:25 2002// >+/readline1.vgtest/1.2/Mon Sep 23 09:36:25 2002// >+/resolv.c/1.3/Sat Jan 3 14:24:42 2004// >+/resolv.stderr.exp/1.1/Tue Oct 1 11:45:34 2002// >+/resolv.stdout.exp/1.2/Thu Apr 3 00:50:21 2003// >+/resolv.vgtest/1.1/Tue Oct 1 11:45:34 2002// >+/seg_override.c/1.2/Wed Jan 21 01:27:27 2004// >+/seg_override.stderr.exp/1.1/Wed Oct 2 10:36:46 2002// >+/seg_override.stdout.exp/1.1/Wed Oct 2 10:36:46 2002// >+/seg_override.vgtest/1.1/Wed Oct 2 10:36:46 2002// >+/sha1_test.c/1.4/Sat Jan 3 14:24:42 2004// >+/sha1_test.stderr.exp/1.2/Mon Sep 23 09:36:25 2002// >+/sha1_test.vgtest/1.2/Mon Sep 23 09:36:25 2002// >+/shortpush.c/1.2/Mon Sep 23 09:36:25 2002// >+/shortpush.stderr.exp/1.2/Mon Sep 23 09:36:25 2002// >+/shortpush.vgtest/1.2/Mon Sep 23 09:36:25 2002// >+/shorts.c/1.2/Mon Sep 23 09:36:25 2002// >+/shorts.stderr.exp/1.2/Mon Sep 23 09:36:25 2002// >+/shorts.vgtest/1.2/Mon Sep 23 09:36:25 2002// >+/smc1.c/1.3/Tue Dec 16 02:05:15 2003// >+/smc1.stderr.exp/1.2/Mon Sep 23 09:36:25 2002// >+/smc1.stdout.exp/1.3/Tue Dec 16 02:05:15 2003// >+/smc1.vgtest/1.2/Mon Sep 23 09:36:25 2002// >+/syscall-restart1.c/1.1/Fri Jan 16 02:15:23 2004// >+/syscall-restart1.stderr.exp/1.1/Fri Jan 16 02:15:23 2004// >+/syscall-restart1.stdout.exp/1.1/Fri Jan 16 02:15:23 2004// >+/syscall-restart1.vgtest/1.1/Fri Jan 16 02:15:23 2004// >+/syscall-restart2.c/1.1/Fri Jan 16 02:15:23 2004// >+/syscall-restart2.stderr.exp/1.1/Fri Jan 16 02:15:23 2004// >+/syscall-restart2.stdout.exp/1.1/Fri Jan 16 02:15:23 2004// >+/syscall-restart2.vgtest/1.1/Fri Jan 16 02:15:23 2004// >+/tls.c/1.1/Wed Jan 21 01:27:27 2004// >+/tls.stderr.exp/1.1/Wed Jan 21 01:27:27 2004// >+/tls.stdout.exp/1.1/Wed Jan 21 01:27:27 2004// >+/tls.vgtest/1.1/Wed Jan 21 01:27:27 2004// >+/tls2.c/1.1/Wed Jan 21 01:27:27 2004// >+/tls2_so.c/1.1/Wed Jan 21 01:27:27 2004// >+/tls_so.c/1.1/Wed Jan 21 01:27:27 2004// >+/yield.c/1.1/Thu Dec 18 09:08:51 2003// >+/yield.stderr.exp/1.1/Thu Dec 18 09:08:51 2003// >+/yield.stdout.exp/1.1/Thu Dec 18 09:08:51 2003// >+/yield.vgtest/1.1/Thu Dec 18 09:08:51 2003// >+D >diff -ruN valgrind-2.1.0/none/tests/CVS/Repository valgrind/none/tests/CVS/Repository >--- valgrind-2.1.0/none/tests/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/CVS/Repository 2004-02-11 22:51:47.821542264 -0600 >@@ -0,0 +1 @@ >+valgrind/none/tests >diff -ruN valgrind-2.1.0/none/tests/CVS/Root valgrind/none/tests/CVS/Root >--- valgrind-2.1.0/none/tests/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/CVS/Root 2004-02-11 22:51:47.820542416 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/none/tests/Makefile.am valgrind/none/tests/Makefile.am >--- valgrind-2.1.0/none/tests/Makefile.am 2003-06-29 05:12:58.000000000 -0500 >+++ valgrind/none/tests/Makefile.am 2004-02-11 17:33:29.000000000 -0600 >@@ -15,6 +15,8 @@ > dastest.vgtest \ > discard.stderr.exp discard.stdout.exp \ > discard.vgtest \ >+ exec-sigmask.vgtest >+ exec-sigmask.stdout.exp exec-sigmask.stderr.exp \ > floored.stderr.exp floored.stdout.exp \ > floored.vgtest \ > fork.stderr.exp fork.stdout.exp fork.vgtest \ >@@ -22,6 +24,14 @@ > fpu_lazy_eflags.vgtest \ > fucomip.stderr.exp fucomip.vgtest \ > gxx304.stderr.exp gxx304.vgtest \ >+ insn_basic.stderr.exp insn_basic.stdout.exp insn_basic.vgtest \ >+ insn_cmov.stderr.exp insn_cmov.stdout.exp insn_cmov.vgtest \ >+ insn_mmx.stderr.exp insn_mmx.stdout.exp insn_mmx.vgtest \ >+ insn_mmxext.stderr.exp insn_mmxext.stdout.exp insn_mmxext.vgtest \ >+ insn_sse.stderr.exp insn_sse.stdout.exp insn_sse.vgtest \ >+ insn_sse2.stderr.exp insn_sse2.stdout.exp insn_sse2.vgtest \ >+ map_unmap.stdout.exp map_unmap.vgtest \ >+ mremap.stdout.exp mremap.vgtest \ > munmap_exe.stderr.exp munmap_exe.vgtest \ > pth_blockedsig.stderr.exp \ > pth_blockedsig.stdout.exp pth_blockedsig.vgtest \ >@@ -35,17 +45,23 @@ > sha1_test.stderr.exp sha1_test.vgtest \ > shortpush.stderr.exp shortpush.vgtest \ > shorts.stderr.exp shorts.vgtest \ >- smc1.stderr.exp smc1.stdout.exp smc1.vgtest >+ tls.stderr.exp tls.stdout.exp tls.vgtest \ >+ smc1.stderr.exp smc1.stdout.exp smc1.vgtest \ >+ syscall-restart1.vgtest syscall-restart1.stdout.exp syscall-restart1.stderr.exp \ >+ syscall-restart2.vgtest syscall-restart2.stdout.exp syscall-restart2.stderr.exp \ >+ yield.stdout.exp yield.vgtest > > check_PROGRAMS = \ > args bitfield1 bt_everything bt_literal coolo_strlen \ >- cpuid dastest discard floored fork fpu_lazy_eflags \ >- fucomip munmap_exe rcl_assert \ >+ cpuid dastest discard exec-sigmask floored fork fpu_lazy_eflags \ >+ fucomip insn_basic insn_cmov insn_mmx insn_mmxext insn_sse insn_sse2 \ >+ munmap_exe map_unmap mremap rcl_assert \ > rcrl readline1 resolv seg_override sha1_test shortpush shorts smc1 \ >- pth_blockedsig \ >- coolo_sigaction gxx304 >+ tls.so tls2.so tls pth_blockedsig \ >+ syscall-restart1 syscall-restart2 \ >+ coolo_sigaction gxx304 yield > >-AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -g >+AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -g -I$(top_srcdir)/include > AM_CXXFLAGS = $(AM_CFLAGS) > > # generic C ones >@@ -57,11 +73,26 @@ > coolo_strlen_SOURCES = coolo_strlen.c > dastest_SOURCES = dastest_c.c dastest_s.s > discard_SOURCES = discard.c >+exec_sigmask_SOURCES = exec-sigmask.c > fork_SOURCES = fork.c > floored_SOURCES = floored.c > floored_LDADD = -lm > fpu_lazy_eflags_SOURCES = fpu_lazy_eflags.c > fucomip_SOURCES = fucomip.c >+insn_basic_SOURCES = insn_basic.def >+insn_basic_LDADD = -lm >+insn_cmov_SOURCES = insn_cmov.def >+insn_cmov_LDADD = -lm >+insn_mmx_SOURCES = insn_mmx.def >+insn_mmx_LDADD = -lm >+insn_mmxext_SOURCES = insn_mmxext.def >+insn_mmxext_LDADD = -lm >+insn_sse_SOURCES = insn_sse.def >+insn_sse_LDADD = -lm >+insn_sse2_SOURCES = insn_sse2.def >+insn_sse2_LDADD = -lm >+map_unmap_SOURCES = map_unmap.c >+mremap_SOURCES = mremap.c > munmap_exe_SOURCES = munmap_exe.c > rcl_assert_SOURCES = rcl_assert.S > rcrl_SOURCES = rcrl.c >@@ -72,6 +103,22 @@ > sha1_test_SOURCES = sha1_test.c > shortpush_SOURCES = shortpush.c > shorts_SOURCES = shorts.c >+syscall_restart1_SOURCES = syscall-restart1.c >+syscall_restart2_SOURCES = syscall-restart2.c >+tls_SOURCES = tls.c tls2.c >+tls_DEPENDENCIES = tls.so >+tls_LDFLAGS = -Wl,-rpath,$(srcdir) >+tls_LDADD = tls.so -lpthread >+tls_so_SOURCES = tls_so.c >+tls_so_LDADD = tls2.so >+tls_so_DEPENDENCIES = tls2.so >+tls_so_LDFLAGS = -Wl,-rpath,$(srcdir) -shared >+tls2_so_SOURCES = tls2_so.c >+tls2_so_LDFLAGS = -shared >+yield_SOURCES = yield.c >+yield_LDADD = -lpthread >+ >+tls_so.o tls2_so.o: CFLAGS += -fpic > > # pthread C ones > pth_blockedsig_SOURCES = pth_blockedsig.c >@@ -84,3 +131,13 @@ > # must be built with these flags -- bug only occurred with them > fpu_lazy_eflags.o: CFLAGS += -O2 -mcpu=pentiumpro -march=pentiumpro > >+# rebuild instruction tests if test generator changes >+insn_basic.c: gen_insn_test.pl >+insn_cmov.c: gen_insn_test.pl >+insn_mmx.c: gen_insn_test.pl >+insn_mmxext.c: gen_insn_test.pl >+insn_sse.c: gen_insn_test.pl >+insn_sse2.c: gen_insn_test.pl >+ >+.def.c: >+ $(PERL) gen_insn_test.pl < $< > $@ >diff -ruN valgrind-2.1.0/none/tests/Makefile.in valgrind/none/tests/Makefile.in >--- valgrind-2.1.0/none/tests/Makefile.in 2003-12-14 09:50:21.000000000 -0600 >+++ valgrind/none/tests/Makefile.in 2004-02-11 22:52:35.578282136 -0600 >@@ -1,8 +1,8 @@ >-# Makefile.in generated by automake 1.7.6 from Makefile.am. >+# Makefile.in generated by automake 1.8.2 from Makefile.am. > # @configure_input@ > >-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 >-# Free Software Foundation, Inc. >+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, >+# 2003, 2004 Free Software Foundation, Inc. > # This Makefile.in is free software; the Free Software Foundation > # gives unlimited permission to copy and/or distribute it, > # with or without modifications, as long as this notice is preserved. >@@ -14,6 +14,8 @@ > > @SET_MAKE@ > >+SOURCES = $(args_SOURCES) $(bitfield1_SOURCES) $(bt_everything_SOURCES) $(bt_literal_SOURCES) $(coolo_sigaction_SOURCES) $(coolo_strlen_SOURCES) $(cpuid_SOURCES) $(dastest_SOURCES) $(discard_SOURCES) $(exec_sigmask_SOURCES) $(floored_SOURCES) $(fork_SOURCES) $(fpu_lazy_eflags_SOURCES) $(fucomip_SOURCES) $(gxx304_SOURCES) $(insn_basic_SOURCES) $(insn_cmov_SOURCES) $(insn_mmx_SOURCES) $(insn_mmxext_SOURCES) $(insn_sse_SOURCES) $(insn_sse2_SOURCES) $(map_unmap_SOURCES) $(mremap_SOURCES) $(munmap_exe_SOURCES) $(pth_blockedsig_SOURCES) $(rcl_assert_SOURCES) $(rcrl_SOURCES) $(readline1_SOURCES) $(resolv_SOURCES) $(seg_override_SOURCES) $(sha1_test_SOURCES) $(shortpush_SOURCES) $(shorts_SOURCES) $(smc1_SOURCES) $(syscall_restart1_SOURCES) $(syscall_restart2_SOURCES) $(tls_SOURCES) $(tls_so_SOURCES) $(tls2_so_SOURCES) $(yield_SOURCES) >+ > srcdir = @srcdir@ > top_srcdir = @top_srcdir@ > VPATH = @srcdir@ >@@ -21,7 +23,6 @@ > pkglibdir = $(libdir)/@PACKAGE@ > pkgincludedir = $(includedir)/@PACKAGE@ > top_builddir = ../.. >- > am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd > INSTALL = @INSTALL@ > install_sh_DATA = $(install_sh) -c -m 644 >@@ -36,6 +37,220 @@ > PRE_UNINSTALL = : > POST_UNINSTALL = : > host_triplet = @host@ >+check_PROGRAMS = args$(EXEEXT) bitfield1$(EXEEXT) \ >+ bt_everything$(EXEEXT) bt_literal$(EXEEXT) \ >+ coolo_strlen$(EXEEXT) cpuid$(EXEEXT) dastest$(EXEEXT) \ >+ discard$(EXEEXT) exec-sigmask$(EXEEXT) floored$(EXEEXT) \ >+ fork$(EXEEXT) fpu_lazy_eflags$(EXEEXT) fucomip$(EXEEXT) \ >+ insn_basic$(EXEEXT) insn_cmov$(EXEEXT) insn_mmx$(EXEEXT) \ >+ insn_mmxext$(EXEEXT) insn_sse$(EXEEXT) insn_sse2$(EXEEXT) \ >+ munmap_exe$(EXEEXT) map_unmap$(EXEEXT) mremap$(EXEEXT) \ >+ rcl_assert$(EXEEXT) rcrl$(EXEEXT) readline1$(EXEEXT) \ >+ resolv$(EXEEXT) seg_override$(EXEEXT) sha1_test$(EXEEXT) \ >+ shortpush$(EXEEXT) shorts$(EXEEXT) smc1$(EXEEXT) \ >+ tls.so$(EXEEXT) tls2.so$(EXEEXT) tls$(EXEEXT) \ >+ pth_blockedsig$(EXEEXT) syscall-restart1$(EXEEXT) \ >+ syscall-restart2$(EXEEXT) coolo_sigaction$(EXEEXT) \ >+ gxx304$(EXEEXT) yield$(EXEEXT) >+subdir = none/tests >+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in >+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >+am__aclocal_m4_deps = $(top_srcdir)/configure.in >+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ >+ $(ACLOCAL_M4) >+mkinstalldirs = $(mkdir_p) >+CONFIG_HEADER = $(top_builddir)/config.h >+CONFIG_CLEAN_FILES = >+am_args_OBJECTS = args.$(OBJEXT) >+args_OBJECTS = $(am_args_OBJECTS) >+args_LDADD = $(LDADD) >+am_bitfield1_OBJECTS = bitfield1.$(OBJEXT) >+bitfield1_OBJECTS = $(am_bitfield1_OBJECTS) >+bitfield1_LDADD = $(LDADD) >+am_bt_everything_OBJECTS = bt_everything.$(OBJEXT) >+bt_everything_OBJECTS = $(am_bt_everything_OBJECTS) >+bt_everything_LDADD = $(LDADD) >+am_bt_literal_OBJECTS = bt_literal.$(OBJEXT) >+bt_literal_OBJECTS = $(am_bt_literal_OBJECTS) >+bt_literal_LDADD = $(LDADD) >+am_coolo_sigaction_OBJECTS = coolo_sigaction.$(OBJEXT) >+coolo_sigaction_OBJECTS = $(am_coolo_sigaction_OBJECTS) >+coolo_sigaction_LDADD = $(LDADD) >+am_coolo_strlen_OBJECTS = coolo_strlen.$(OBJEXT) >+coolo_strlen_OBJECTS = $(am_coolo_strlen_OBJECTS) >+coolo_strlen_LDADD = $(LDADD) >+am_cpuid_OBJECTS = cpuid_c.$(OBJEXT) cpuid_s.$(OBJEXT) >+cpuid_OBJECTS = $(am_cpuid_OBJECTS) >+cpuid_LDADD = $(LDADD) >+am_dastest_OBJECTS = dastest_c.$(OBJEXT) dastest_s.$(OBJEXT) >+dastest_OBJECTS = $(am_dastest_OBJECTS) >+dastest_LDADD = $(LDADD) >+am_discard_OBJECTS = discard.$(OBJEXT) >+discard_OBJECTS = $(am_discard_OBJECTS) >+discard_LDADD = $(LDADD) >+am_exec_sigmask_OBJECTS = exec-sigmask.$(OBJEXT) >+exec_sigmask_OBJECTS = $(am_exec_sigmask_OBJECTS) >+exec_sigmask_LDADD = $(LDADD) >+am_floored_OBJECTS = floored.$(OBJEXT) >+floored_OBJECTS = $(am_floored_OBJECTS) >+floored_DEPENDENCIES = >+am_fork_OBJECTS = fork.$(OBJEXT) >+fork_OBJECTS = $(am_fork_OBJECTS) >+fork_LDADD = $(LDADD) >+am_fpu_lazy_eflags_OBJECTS = fpu_lazy_eflags.$(OBJEXT) >+fpu_lazy_eflags_OBJECTS = $(am_fpu_lazy_eflags_OBJECTS) >+fpu_lazy_eflags_LDADD = $(LDADD) >+am_fucomip_OBJECTS = fucomip.$(OBJEXT) >+fucomip_OBJECTS = $(am_fucomip_OBJECTS) >+fucomip_LDADD = $(LDADD) >+am_gxx304_OBJECTS = gxx304.$(OBJEXT) >+gxx304_OBJECTS = $(am_gxx304_OBJECTS) >+gxx304_LDADD = $(LDADD) >+am_insn_basic_OBJECTS = insn_basic.$(OBJEXT) >+insn_basic_OBJECTS = $(am_insn_basic_OBJECTS) >+insn_basic_DEPENDENCIES = >+am_insn_cmov_OBJECTS = insn_cmov.$(OBJEXT) >+insn_cmov_OBJECTS = $(am_insn_cmov_OBJECTS) >+insn_cmov_DEPENDENCIES = >+am_insn_mmx_OBJECTS = insn_mmx.$(OBJEXT) >+insn_mmx_OBJECTS = $(am_insn_mmx_OBJECTS) >+insn_mmx_DEPENDENCIES = >+am_insn_mmxext_OBJECTS = insn_mmxext.$(OBJEXT) >+insn_mmxext_OBJECTS = $(am_insn_mmxext_OBJECTS) >+insn_mmxext_DEPENDENCIES = >+am_insn_sse_OBJECTS = insn_sse.$(OBJEXT) >+insn_sse_OBJECTS = $(am_insn_sse_OBJECTS) >+insn_sse_DEPENDENCIES = >+am_insn_sse2_OBJECTS = insn_sse2.$(OBJEXT) >+insn_sse2_OBJECTS = $(am_insn_sse2_OBJECTS) >+insn_sse2_DEPENDENCIES = >+am_map_unmap_OBJECTS = map_unmap.$(OBJEXT) >+map_unmap_OBJECTS = $(am_map_unmap_OBJECTS) >+map_unmap_LDADD = $(LDADD) >+am_mremap_OBJECTS = mremap.$(OBJEXT) >+mremap_OBJECTS = $(am_mremap_OBJECTS) >+mremap_LDADD = $(LDADD) >+am_munmap_exe_OBJECTS = munmap_exe.$(OBJEXT) >+munmap_exe_OBJECTS = $(am_munmap_exe_OBJECTS) >+munmap_exe_LDADD = $(LDADD) >+am_pth_blockedsig_OBJECTS = pth_blockedsig.$(OBJEXT) >+pth_blockedsig_OBJECTS = $(am_pth_blockedsig_OBJECTS) >+pth_blockedsig_DEPENDENCIES = >+am_rcl_assert_OBJECTS = rcl_assert.$(OBJEXT) >+rcl_assert_OBJECTS = $(am_rcl_assert_OBJECTS) >+rcl_assert_LDADD = $(LDADD) >+am_rcrl_OBJECTS = rcrl.$(OBJEXT) >+rcrl_OBJECTS = $(am_rcrl_OBJECTS) >+rcrl_LDADD = $(LDADD) >+am_readline1_OBJECTS = readline1.$(OBJEXT) >+readline1_OBJECTS = $(am_readline1_OBJECTS) >+readline1_LDADD = $(LDADD) >+am_resolv_OBJECTS = resolv.$(OBJEXT) >+resolv_OBJECTS = $(am_resolv_OBJECTS) >+resolv_LDADD = $(LDADD) >+am_seg_override_OBJECTS = seg_override.$(OBJEXT) >+seg_override_OBJECTS = $(am_seg_override_OBJECTS) >+seg_override_LDADD = $(LDADD) >+am_sha1_test_OBJECTS = sha1_test.$(OBJEXT) >+sha1_test_OBJECTS = $(am_sha1_test_OBJECTS) >+sha1_test_LDADD = $(LDADD) >+am_shortpush_OBJECTS = shortpush.$(OBJEXT) >+shortpush_OBJECTS = $(am_shortpush_OBJECTS) >+shortpush_LDADD = $(LDADD) >+am_shorts_OBJECTS = shorts.$(OBJEXT) >+shorts_OBJECTS = $(am_shorts_OBJECTS) >+shorts_LDADD = $(LDADD) >+am_smc1_OBJECTS = smc1.$(OBJEXT) >+smc1_OBJECTS = $(am_smc1_OBJECTS) >+smc1_LDADD = $(LDADD) >+am_syscall_restart1_OBJECTS = syscall-restart1.$(OBJEXT) >+syscall_restart1_OBJECTS = $(am_syscall_restart1_OBJECTS) >+syscall_restart1_LDADD = $(LDADD) >+am_syscall_restart2_OBJECTS = syscall-restart2.$(OBJEXT) >+syscall_restart2_OBJECTS = $(am_syscall_restart2_OBJECTS) >+syscall_restart2_LDADD = $(LDADD) >+am_tls_OBJECTS = tls.$(OBJEXT) tls2.$(OBJEXT) >+tls_OBJECTS = $(am_tls_OBJECTS) >+am_tls_so_OBJECTS = tls_so.$(OBJEXT) >+tls_so_OBJECTS = $(am_tls_so_OBJECTS) >+am_tls2_so_OBJECTS = tls2_so.$(OBJEXT) >+tls2_so_OBJECTS = $(am_tls2_so_OBJECTS) >+tls2_so_LDADD = $(LDADD) >+am_yield_OBJECTS = yield.$(OBJEXT) >+yield_OBJECTS = $(am_yield_OBJECTS) >+yield_DEPENDENCIES = >+SCRIPTS = $(noinst_SCRIPTS) >+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) >+depcomp = $(SHELL) $(top_srcdir)/depcomp >+am__depfiles_maybe = depfiles >+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/args.Po ./$(DEPDIR)/bitfield1.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/bt_everything.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/bt_literal.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/coolo_sigaction.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/coolo_strlen.Po ./$(DEPDIR)/cpuid_c.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/dastest_c.Po ./$(DEPDIR)/discard.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/exec-sigmask.Po ./$(DEPDIR)/floored.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/fork.Po ./$(DEPDIR)/fpu_lazy_eflags.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/fucomip.Po ./$(DEPDIR)/gxx304.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/insn_basic.Po ./$(DEPDIR)/insn_cmov.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/insn_mmx.Po ./$(DEPDIR)/insn_mmxext.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/insn_sse.Po ./$(DEPDIR)/insn_sse2.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/map_unmap.Po ./$(DEPDIR)/mremap.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/munmap_exe.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/pth_blockedsig.Po ./$(DEPDIR)/rcrl.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/readline1.Po ./$(DEPDIR)/resolv.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/seg_override.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/sha1_test.Po ./$(DEPDIR)/shortpush.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/shorts.Po ./$(DEPDIR)/smc1.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/syscall-restart1.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/syscall-restart2.Po ./$(DEPDIR)/tls.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/tls2.Po ./$(DEPDIR)/tls2_so.Po \ >+@AMDEP_TRUE@ ./$(DEPDIR)/tls_so.Po ./$(DEPDIR)/yield.Po >+CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS) >+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ >+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) >+CCLD = $(CC) >+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ >+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ >+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) >+CXXLD = $(CXX) >+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ >+ -o $@ >+SOURCES = $(args_SOURCES) $(bitfield1_SOURCES) \ >+ $(bt_everything_SOURCES) $(bt_literal_SOURCES) \ >+ $(coolo_sigaction_SOURCES) $(coolo_strlen_SOURCES) \ >+ $(cpuid_SOURCES) $(dastest_SOURCES) $(discard_SOURCES) \ >+ $(exec_sigmask_SOURCES) $(floored_SOURCES) $(fork_SOURCES) \ >+ $(fpu_lazy_eflags_SOURCES) $(fucomip_SOURCES) \ >+ $(gxx304_SOURCES) $(insn_basic_SOURCES) $(insn_cmov_SOURCES) \ >+ $(insn_mmx_SOURCES) $(insn_mmxext_SOURCES) $(insn_sse_SOURCES) \ >+ $(insn_sse2_SOURCES) $(map_unmap_SOURCES) $(mremap_SOURCES) \ >+ $(munmap_exe_SOURCES) $(pth_blockedsig_SOURCES) \ >+ $(rcl_assert_SOURCES) $(rcrl_SOURCES) $(readline1_SOURCES) \ >+ $(resolv_SOURCES) $(seg_override_SOURCES) $(sha1_test_SOURCES) \ >+ $(shortpush_SOURCES) $(shorts_SOURCES) $(smc1_SOURCES) \ >+ $(syscall_restart1_SOURCES) $(syscall_restart2_SOURCES) \ >+ $(tls_SOURCES) $(tls_so_SOURCES) $(tls2_so_SOURCES) \ >+ $(yield_SOURCES) >+DIST_SOURCES = $(args_SOURCES) $(bitfield1_SOURCES) \ >+ $(bt_everything_SOURCES) $(bt_literal_SOURCES) \ >+ $(coolo_sigaction_SOURCES) $(coolo_strlen_SOURCES) \ >+ $(cpuid_SOURCES) $(dastest_SOURCES) $(discard_SOURCES) \ >+ $(exec_sigmask_SOURCES) $(floored_SOURCES) $(fork_SOURCES) \ >+ $(fpu_lazy_eflags_SOURCES) $(fucomip_SOURCES) \ >+ $(gxx304_SOURCES) $(insn_basic_SOURCES) $(insn_cmov_SOURCES) \ >+ $(insn_mmx_SOURCES) $(insn_mmxext_SOURCES) $(insn_sse_SOURCES) \ >+ $(insn_sse2_SOURCES) $(map_unmap_SOURCES) $(mremap_SOURCES) \ >+ $(munmap_exe_SOURCES) $(pth_blockedsig_SOURCES) \ >+ $(rcl_assert_SOURCES) $(rcrl_SOURCES) $(readline1_SOURCES) \ >+ $(resolv_SOURCES) $(seg_override_SOURCES) $(sha1_test_SOURCES) \ >+ $(shortpush_SOURCES) $(shorts_SOURCES) $(smc1_SOURCES) \ >+ $(syscall_restart1_SOURCES) $(syscall_restart2_SOURCES) \ >+ $(tls_SOURCES) $(tls_so_SOURCES) $(tls2_so_SOURCES) \ >+ $(yield_SOURCES) >+ETAGS = etags >+CTAGS = ctags >+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) > ACLOCAL = @ACLOCAL@ > AMDEP_FALSE = @AMDEP_FALSE@ > AMDEP_TRUE = @AMDEP_TRUE@ >@@ -92,6 +307,7 @@ > SHELL = @SHELL@ > STRIP = @STRIP@ > VERSION = @VERSION@ >+VG_PLATFORM = @VG_PLATFORM@ > ac_ct_CC = @ac_ct_CC@ > ac_ct_CXX = @ac_ct_CXX@ > ac_ct_RANLIB = @ac_ct_RANLIB@ >@@ -123,6 +339,7 @@ > libexecdir = @libexecdir@ > localstatedir = @localstatedir@ > mandir = @mandir@ >+mkdir_p = @mkdir_p@ > oldincludedir = @oldincludedir@ > prefix = @prefix@ > program_transform_name = @program_transform_name@ >@@ -131,7 +348,6 @@ > sysconfdir = @sysconfdir@ > target_alias = @target_alias@ > noinst_SCRIPTS = filter_cpuid filter_none_discards filter_stderr >- > EXTRA_DIST = $(noinst_SCRIPTS) \ > args.stderr.exp args.stdout.exp args.vgtest \ > bitfield1.stderr.exp bitfield1.vgtest \ >@@ -147,39 +363,9 @@ > dastest.vgtest \ > discard.stderr.exp discard.stdout.exp \ > discard.vgtest \ >- floored.stderr.exp floored.stdout.exp \ >- floored.vgtest \ >- fork.stderr.exp fork.stdout.exp fork.vgtest \ >- fpu_lazy_eflags.stderr.exp fpu_lazy_eflags.stdout.exp \ >- fpu_lazy_eflags.vgtest \ >- fucomip.stderr.exp fucomip.vgtest \ >- gxx304.stderr.exp gxx304.vgtest \ >- munmap_exe.stderr.exp munmap_exe.vgtest \ >- pth_blockedsig.stderr.exp \ >- pth_blockedsig.stdout.exp pth_blockedsig.vgtest \ >- rcl_assert.stderr.exp rcl_assert.vgtest \ >- rcrl.stderr.exp rcrl.stdout.exp rcrl.vgtest \ >- readline1.stderr.exp readline1.stdout.exp \ >- readline1.vgtest \ >- resolv.stderr.exp resolv.stdout.exp resolv.vgtest \ >- seg_override.stderr.exp \ >- seg_override.stdout.exp seg_override.vgtest \ >- sha1_test.stderr.exp sha1_test.vgtest \ >- shortpush.stderr.exp shortpush.vgtest \ >- shorts.stderr.exp shorts.vgtest \ >- smc1.stderr.exp smc1.stdout.exp smc1.vgtest >- >+ exec-sigmask.vgtest > >-check_PROGRAMS = \ >- args bitfield1 bt_everything bt_literal coolo_strlen \ >- cpuid dastest discard floored fork fpu_lazy_eflags \ >- fucomip munmap_exe rcl_assert \ >- rcrl readline1 resolv seg_override sha1_test shortpush shorts smc1 \ >- pth_blockedsig \ >- coolo_sigaction gxx304 >- >- >-AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -g >+AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -g -I$(top_srcdir)/include > AM_CXXFLAGS = $(AM_CFLAGS) > > # generic C ones >@@ -191,11 +377,26 @@ > coolo_strlen_SOURCES = coolo_strlen.c > dastest_SOURCES = dastest_c.c dastest_s.s > discard_SOURCES = discard.c >+exec_sigmask_SOURCES = exec-sigmask.c > fork_SOURCES = fork.c > floored_SOURCES = floored.c > floored_LDADD = -lm > fpu_lazy_eflags_SOURCES = fpu_lazy_eflags.c > fucomip_SOURCES = fucomip.c >+insn_basic_SOURCES = insn_basic.def >+insn_basic_LDADD = -lm >+insn_cmov_SOURCES = insn_cmov.def >+insn_cmov_LDADD = -lm >+insn_mmx_SOURCES = insn_mmx.def >+insn_mmx_LDADD = -lm >+insn_mmxext_SOURCES = insn_mmxext.def >+insn_mmxext_LDADD = -lm >+insn_sse_SOURCES = insn_sse.def >+insn_sse_LDADD = -lm >+insn_sse2_SOURCES = insn_sse2.def >+insn_sse2_LDADD = -lm >+map_unmap_SOURCES = map_unmap.c >+mremap_SOURCES = mremap.c > munmap_exe_SOURCES = munmap_exe.c > rcl_assert_SOURCES = rcl_assert.S > rcrl_SOURCES = rcrl.c >@@ -206,6 +407,20 @@ > sha1_test_SOURCES = sha1_test.c > shortpush_SOURCES = shortpush.c > shorts_SOURCES = shorts.c >+syscall_restart1_SOURCES = syscall-restart1.c >+syscall_restart2_SOURCES = syscall-restart2.c >+tls_SOURCES = tls.c tls2.c >+tls_DEPENDENCIES = tls.so >+tls_LDFLAGS = -Wl,-rpath,$(srcdir) >+tls_LDADD = tls.so -lpthread >+tls_so_SOURCES = tls_so.c >+tls_so_LDADD = tls2.so >+tls_so_DEPENDENCIES = tls2.so >+tls_so_LDFLAGS = -Wl,-rpath,$(srcdir) -shared >+tls2_so_SOURCES = tls2_so.c >+tls2_so_LDFLAGS = -shared >+yield_SOURCES = yield.c >+yield_LDADD = -lpthread > > # pthread C ones > pth_blockedsig_SOURCES = pth_blockedsig.c >@@ -214,196 +429,39 @@ > # generic C++ ones > coolo_sigaction_SOURCES = coolo_sigaction.cpp > gxx304_SOURCES = gxx304.cpp >-subdir = none/tests >-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs >-CONFIG_HEADER = $(top_builddir)/config.h >-CONFIG_CLEAN_FILES = >-check_PROGRAMS = args$(EXEEXT) bitfield1$(EXEEXT) bt_everything$(EXEEXT) \ >- bt_literal$(EXEEXT) coolo_strlen$(EXEEXT) cpuid$(EXEEXT) \ >- dastest$(EXEEXT) discard$(EXEEXT) floored$(EXEEXT) \ >- fork$(EXEEXT) fpu_lazy_eflags$(EXEEXT) fucomip$(EXEEXT) \ >- munmap_exe$(EXEEXT) rcl_assert$(EXEEXT) rcrl$(EXEEXT) \ >- readline1$(EXEEXT) resolv$(EXEEXT) seg_override$(EXEEXT) \ >- sha1_test$(EXEEXT) shortpush$(EXEEXT) shorts$(EXEEXT) \ >- smc1$(EXEEXT) pth_blockedsig$(EXEEXT) coolo_sigaction$(EXEEXT) \ >- gxx304$(EXEEXT) >-am_args_OBJECTS = args.$(OBJEXT) >-args_OBJECTS = $(am_args_OBJECTS) >-args_LDADD = $(LDADD) >-args_DEPENDENCIES = >-args_LDFLAGS = >-am_bitfield1_OBJECTS = bitfield1.$(OBJEXT) >-bitfield1_OBJECTS = $(am_bitfield1_OBJECTS) >-bitfield1_LDADD = $(LDADD) >-bitfield1_DEPENDENCIES = >-bitfield1_LDFLAGS = >-am_bt_everything_OBJECTS = bt_everything.$(OBJEXT) >-bt_everything_OBJECTS = $(am_bt_everything_OBJECTS) >-bt_everything_LDADD = $(LDADD) >-bt_everything_DEPENDENCIES = >-bt_everything_LDFLAGS = >-am_bt_literal_OBJECTS = bt_literal.$(OBJEXT) >-bt_literal_OBJECTS = $(am_bt_literal_OBJECTS) >-bt_literal_LDADD = $(LDADD) >-bt_literal_DEPENDENCIES = >-bt_literal_LDFLAGS = >-am_coolo_sigaction_OBJECTS = coolo_sigaction.$(OBJEXT) >-coolo_sigaction_OBJECTS = $(am_coolo_sigaction_OBJECTS) >-coolo_sigaction_LDADD = $(LDADD) >-coolo_sigaction_DEPENDENCIES = >-coolo_sigaction_LDFLAGS = >-am_coolo_strlen_OBJECTS = coolo_strlen.$(OBJEXT) >-coolo_strlen_OBJECTS = $(am_coolo_strlen_OBJECTS) >-coolo_strlen_LDADD = $(LDADD) >-coolo_strlen_DEPENDENCIES = >-coolo_strlen_LDFLAGS = >-am_cpuid_OBJECTS = cpuid_c.$(OBJEXT) cpuid_s.$(OBJEXT) >-cpuid_OBJECTS = $(am_cpuid_OBJECTS) >-cpuid_LDADD = $(LDADD) >-cpuid_DEPENDENCIES = >-cpuid_LDFLAGS = >-am_dastest_OBJECTS = dastest_c.$(OBJEXT) dastest_s.$(OBJEXT) >-dastest_OBJECTS = $(am_dastest_OBJECTS) >-dastest_LDADD = $(LDADD) >-dastest_DEPENDENCIES = >-dastest_LDFLAGS = >-am_discard_OBJECTS = discard.$(OBJEXT) >-discard_OBJECTS = $(am_discard_OBJECTS) >-discard_LDADD = $(LDADD) >-discard_DEPENDENCIES = >-discard_LDFLAGS = >-am_floored_OBJECTS = floored.$(OBJEXT) >-floored_OBJECTS = $(am_floored_OBJECTS) >-floored_DEPENDENCIES = >-floored_LDFLAGS = >-am_fork_OBJECTS = fork.$(OBJEXT) >-fork_OBJECTS = $(am_fork_OBJECTS) >-fork_LDADD = $(LDADD) >-fork_DEPENDENCIES = >-fork_LDFLAGS = >-am_fpu_lazy_eflags_OBJECTS = fpu_lazy_eflags.$(OBJEXT) >-fpu_lazy_eflags_OBJECTS = $(am_fpu_lazy_eflags_OBJECTS) >-fpu_lazy_eflags_LDADD = $(LDADD) >-fpu_lazy_eflags_DEPENDENCIES = >-fpu_lazy_eflags_LDFLAGS = >-am_fucomip_OBJECTS = fucomip.$(OBJEXT) >-fucomip_OBJECTS = $(am_fucomip_OBJECTS) >-fucomip_LDADD = $(LDADD) >-fucomip_DEPENDENCIES = >-fucomip_LDFLAGS = >-am_gxx304_OBJECTS = gxx304.$(OBJEXT) >-gxx304_OBJECTS = $(am_gxx304_OBJECTS) >-gxx304_LDADD = $(LDADD) >-gxx304_DEPENDENCIES = >-gxx304_LDFLAGS = >-am_munmap_exe_OBJECTS = munmap_exe.$(OBJEXT) >-munmap_exe_OBJECTS = $(am_munmap_exe_OBJECTS) >-munmap_exe_LDADD = $(LDADD) >-munmap_exe_DEPENDENCIES = >-munmap_exe_LDFLAGS = >-am_pth_blockedsig_OBJECTS = pth_blockedsig.$(OBJEXT) >-pth_blockedsig_OBJECTS = $(am_pth_blockedsig_OBJECTS) >-pth_blockedsig_DEPENDENCIES = >-pth_blockedsig_LDFLAGS = >-am_rcl_assert_OBJECTS = rcl_assert.$(OBJEXT) >-rcl_assert_OBJECTS = $(am_rcl_assert_OBJECTS) >-rcl_assert_LDADD = $(LDADD) >-rcl_assert_DEPENDENCIES = >-rcl_assert_LDFLAGS = >-am_rcrl_OBJECTS = rcrl.$(OBJEXT) >-rcrl_OBJECTS = $(am_rcrl_OBJECTS) >-rcrl_LDADD = $(LDADD) >-rcrl_DEPENDENCIES = >-rcrl_LDFLAGS = >-am_readline1_OBJECTS = readline1.$(OBJEXT) >-readline1_OBJECTS = $(am_readline1_OBJECTS) >-readline1_LDADD = $(LDADD) >-readline1_DEPENDENCIES = >-readline1_LDFLAGS = >-am_resolv_OBJECTS = resolv.$(OBJEXT) >-resolv_OBJECTS = $(am_resolv_OBJECTS) >-resolv_LDADD = $(LDADD) >-resolv_DEPENDENCIES = >-resolv_LDFLAGS = >-am_seg_override_OBJECTS = seg_override.$(OBJEXT) >-seg_override_OBJECTS = $(am_seg_override_OBJECTS) >-seg_override_LDADD = $(LDADD) >-seg_override_DEPENDENCIES = >-seg_override_LDFLAGS = >-am_sha1_test_OBJECTS = sha1_test.$(OBJEXT) >-sha1_test_OBJECTS = $(am_sha1_test_OBJECTS) >-sha1_test_LDADD = $(LDADD) >-sha1_test_DEPENDENCIES = >-sha1_test_LDFLAGS = >-am_shortpush_OBJECTS = shortpush.$(OBJEXT) >-shortpush_OBJECTS = $(am_shortpush_OBJECTS) >-shortpush_LDADD = $(LDADD) >-shortpush_DEPENDENCIES = >-shortpush_LDFLAGS = >-am_shorts_OBJECTS = shorts.$(OBJEXT) >-shorts_OBJECTS = $(am_shorts_OBJECTS) >-shorts_LDADD = $(LDADD) >-shorts_DEPENDENCIES = >-shorts_LDFLAGS = >-am_smc1_OBJECTS = smc1.$(OBJEXT) >-smc1_OBJECTS = $(am_smc1_OBJECTS) >-smc1_LDADD = $(LDADD) >-smc1_DEPENDENCIES = >-smc1_LDFLAGS = >-SCRIPTS = $(noinst_SCRIPTS) >- >- >-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) >-depcomp = $(SHELL) $(top_srcdir)/depcomp >-am__depfiles_maybe = depfiles >-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/args.Po ./$(DEPDIR)/bitfield1.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/bt_everything.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/bt_literal.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/coolo_sigaction.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/coolo_strlen.Po ./$(DEPDIR)/cpuid_c.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/dastest_c.Po ./$(DEPDIR)/discard.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/floored.Po ./$(DEPDIR)/fork.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/fpu_lazy_eflags.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/fucomip.Po ./$(DEPDIR)/gxx304.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/munmap_exe.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/pth_blockedsig.Po ./$(DEPDIR)/rcrl.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/readline1.Po ./$(DEPDIR)/resolv.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/seg_override.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/sha1_test.Po ./$(DEPDIR)/shortpush.Po \ >-@AMDEP_TRUE@ ./$(DEPDIR)/shorts.Po ./$(DEPDIR)/smc1.Po >-CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS) >-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ >- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) >-CCLD = $(CC) >-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ >-CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ >- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) >-CXXLD = $(CXX) >-CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ >- -o $@ >-DIST_SOURCES = $(args_SOURCES) $(bitfield1_SOURCES) \ >- $(bt_everything_SOURCES) $(bt_literal_SOURCES) \ >- $(coolo_sigaction_SOURCES) $(coolo_strlen_SOURCES) \ >- $(cpuid_SOURCES) $(dastest_SOURCES) $(discard_SOURCES) \ >- $(floored_SOURCES) $(fork_SOURCES) $(fpu_lazy_eflags_SOURCES) \ >- $(fucomip_SOURCES) $(gxx304_SOURCES) $(munmap_exe_SOURCES) \ >- $(pth_blockedsig_SOURCES) $(rcl_assert_SOURCES) $(rcrl_SOURCES) \ >- $(readline1_SOURCES) $(resolv_SOURCES) $(seg_override_SOURCES) \ >- $(sha1_test_SOURCES) $(shortpush_SOURCES) $(shorts_SOURCES) \ >- $(smc1_SOURCES) >-DIST_COMMON = Makefile.am Makefile.in >-SOURCES = $(args_SOURCES) $(bitfield1_SOURCES) $(bt_everything_SOURCES) $(bt_literal_SOURCES) $(coolo_sigaction_SOURCES) $(coolo_strlen_SOURCES) $(cpuid_SOURCES) $(dastest_SOURCES) $(discard_SOURCES) $(floored_SOURCES) $(fork_SOURCES) $(fpu_lazy_eflags_SOURCES) $(fucomip_SOURCES) $(gxx304_SOURCES) $(munmap_exe_SOURCES) $(pth_blockedsig_SOURCES) $(rcl_assert_SOURCES) $(rcrl_SOURCES) $(readline1_SOURCES) $(resolv_SOURCES) $(seg_override_SOURCES) $(sha1_test_SOURCES) $(shortpush_SOURCES) $(shorts_SOURCES) $(smc1_SOURCES) >- > all: all-am > > .SUFFIXES: >-.SUFFIXES: .S .c .cpp .o .obj .s >-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) >+.SUFFIXES: .S .c .cpp .def .o .obj .s >+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) >+ @for dep in $?; do \ >+ case '$(am__configure_deps)' in \ >+ *$$dep*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ >+ && exit 0; \ >+ exit 1;; \ >+ esac; \ >+ done; \ >+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu none/tests/Makefile'; \ > cd $(top_srcdir) && \ > $(AUTOMAKE) --gnu none/tests/Makefile >-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status >- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) >+.PRECIOUS: Makefile >+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status >+ @case '$?' in \ >+ *config.status*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ >+ *) \ >+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ >+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ >+ esac; >+ >+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+ >+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh > > clean-checkPROGRAMS: > -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) >@@ -434,6 +492,9 @@ > discard$(EXEEXT): $(discard_OBJECTS) $(discard_DEPENDENCIES) > @rm -f discard$(EXEEXT) > $(LINK) $(discard_LDFLAGS) $(discard_OBJECTS) $(discard_LDADD) $(LIBS) >+exec-sigmask$(EXEEXT): $(exec_sigmask_OBJECTS) $(exec_sigmask_DEPENDENCIES) >+ @rm -f exec-sigmask$(EXEEXT) >+ $(LINK) $(exec_sigmask_LDFLAGS) $(exec_sigmask_OBJECTS) $(exec_sigmask_LDADD) $(LIBS) > floored$(EXEEXT): $(floored_OBJECTS) $(floored_DEPENDENCIES) > @rm -f floored$(EXEEXT) > $(LINK) $(floored_LDFLAGS) $(floored_OBJECTS) $(floored_LDADD) $(LIBS) >@@ -449,6 +510,30 @@ > gxx304$(EXEEXT): $(gxx304_OBJECTS) $(gxx304_DEPENDENCIES) > @rm -f gxx304$(EXEEXT) > $(CXXLINK) $(gxx304_LDFLAGS) $(gxx304_OBJECTS) $(gxx304_LDADD) $(LIBS) >+insn_basic$(EXEEXT): $(insn_basic_OBJECTS) $(insn_basic_DEPENDENCIES) >+ @rm -f insn_basic$(EXEEXT) >+ $(LINK) $(insn_basic_LDFLAGS) $(insn_basic_OBJECTS) $(insn_basic_LDADD) $(LIBS) >+insn_cmov$(EXEEXT): $(insn_cmov_OBJECTS) $(insn_cmov_DEPENDENCIES) >+ @rm -f insn_cmov$(EXEEXT) >+ $(LINK) $(insn_cmov_LDFLAGS) $(insn_cmov_OBJECTS) $(insn_cmov_LDADD) $(LIBS) >+insn_mmx$(EXEEXT): $(insn_mmx_OBJECTS) $(insn_mmx_DEPENDENCIES) >+ @rm -f insn_mmx$(EXEEXT) >+ $(LINK) $(insn_mmx_LDFLAGS) $(insn_mmx_OBJECTS) $(insn_mmx_LDADD) $(LIBS) >+insn_mmxext$(EXEEXT): $(insn_mmxext_OBJECTS) $(insn_mmxext_DEPENDENCIES) >+ @rm -f insn_mmxext$(EXEEXT) >+ $(LINK) $(insn_mmxext_LDFLAGS) $(insn_mmxext_OBJECTS) $(insn_mmxext_LDADD) $(LIBS) >+insn_sse$(EXEEXT): $(insn_sse_OBJECTS) $(insn_sse_DEPENDENCIES) >+ @rm -f insn_sse$(EXEEXT) >+ $(LINK) $(insn_sse_LDFLAGS) $(insn_sse_OBJECTS) $(insn_sse_LDADD) $(LIBS) >+insn_sse2$(EXEEXT): $(insn_sse2_OBJECTS) $(insn_sse2_DEPENDENCIES) >+ @rm -f insn_sse2$(EXEEXT) >+ $(LINK) $(insn_sse2_LDFLAGS) $(insn_sse2_OBJECTS) $(insn_sse2_LDADD) $(LIBS) >+map_unmap$(EXEEXT): $(map_unmap_OBJECTS) $(map_unmap_DEPENDENCIES) >+ @rm -f map_unmap$(EXEEXT) >+ $(LINK) $(map_unmap_LDFLAGS) $(map_unmap_OBJECTS) $(map_unmap_LDADD) $(LIBS) >+mremap$(EXEEXT): $(mremap_OBJECTS) $(mremap_DEPENDENCIES) >+ @rm -f mremap$(EXEEXT) >+ $(LINK) $(mremap_LDFLAGS) $(mremap_OBJECTS) $(mremap_LDADD) $(LIBS) > munmap_exe$(EXEEXT): $(munmap_exe_OBJECTS) $(munmap_exe_DEPENDENCIES) > @rm -f munmap_exe$(EXEEXT) > $(LINK) $(munmap_exe_LDFLAGS) $(munmap_exe_OBJECTS) $(munmap_exe_LDADD) $(LIBS) >@@ -482,9 +567,27 @@ > smc1$(EXEEXT): $(smc1_OBJECTS) $(smc1_DEPENDENCIES) > @rm -f smc1$(EXEEXT) > $(LINK) $(smc1_LDFLAGS) $(smc1_OBJECTS) $(smc1_LDADD) $(LIBS) >+syscall-restart1$(EXEEXT): $(syscall_restart1_OBJECTS) $(syscall_restart1_DEPENDENCIES) >+ @rm -f syscall-restart1$(EXEEXT) >+ $(LINK) $(syscall_restart1_LDFLAGS) $(syscall_restart1_OBJECTS) $(syscall_restart1_LDADD) $(LIBS) >+syscall-restart2$(EXEEXT): $(syscall_restart2_OBJECTS) $(syscall_restart2_DEPENDENCIES) >+ @rm -f syscall-restart2$(EXEEXT) >+ $(LINK) $(syscall_restart2_LDFLAGS) $(syscall_restart2_OBJECTS) $(syscall_restart2_LDADD) $(LIBS) >+tls$(EXEEXT): $(tls_OBJECTS) $(tls_DEPENDENCIES) >+ @rm -f tls$(EXEEXT) >+ $(LINK) $(tls_LDFLAGS) $(tls_OBJECTS) $(tls_LDADD) $(LIBS) >+tls.so$(EXEEXT): $(tls_so_OBJECTS) $(tls_so_DEPENDENCIES) >+ @rm -f tls.so$(EXEEXT) >+ $(LINK) $(tls_so_LDFLAGS) $(tls_so_OBJECTS) $(tls_so_LDADD) $(LIBS) >+tls2.so$(EXEEXT): $(tls2_so_OBJECTS) $(tls2_so_DEPENDENCIES) >+ @rm -f tls2.so$(EXEEXT) >+ $(LINK) $(tls2_so_LDFLAGS) $(tls2_so_OBJECTS) $(tls2_so_LDADD) $(LIBS) >+yield$(EXEEXT): $(yield_OBJECTS) $(yield_DEPENDENCIES) >+ @rm -f yield$(EXEEXT) >+ $(LINK) $(yield_LDFLAGS) $(yield_OBJECTS) $(yield_LDADD) $(LIBS) > > mostlyclean-compile: >- -rm -f *.$(OBJEXT) core *.core >+ -rm -f *.$(OBJEXT) > > distclean-compile: > -rm -f *.tab.c >@@ -498,11 +601,20 @@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpuid_c.Po@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dastest_c.Po@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/discard.Po@am__quote@ >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exec-sigmask.Po@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/floored.Po@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fork.Po@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fpu_lazy_eflags.Po@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fucomip.Po@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gxx304.Po@am__quote@ >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/insn_basic.Po@am__quote@ >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/insn_cmov.Po@am__quote@ >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/insn_mmx.Po@am__quote@ >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/insn_mmxext.Po@am__quote@ >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/insn_sse.Po@am__quote@ >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/insn_sse2.Po@am__quote@ >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/map_unmap.Po@am__quote@ >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mremap.Po@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/munmap_exe.Po@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pth_blockedsig.Po@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rcrl.Po@am__quote@ >@@ -513,75 +625,59 @@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shortpush.Po@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shorts.Po@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smc1.Po@am__quote@ >- >-distclean-depend: >- -rm -rf ./$(DEPDIR) >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/syscall-restart1.Po@am__quote@ >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/syscall-restart2.Po@am__quote@ >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls.Po@am__quote@ >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls2.Po@am__quote@ >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls2_so.Po@am__quote@ >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_so.Po@am__quote@ >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/yield.Po@am__quote@ > > .S.o: >- $(CCASCOMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< >+ $(CCASCOMPILE) -c $< > > .S.obj: >- $(CCASCOMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` >+ $(CCASCOMPILE) -c `$(CYGPATH_W) '$<'` > > .c.o: >-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ >-@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ >-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ >-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ >-@am__fastdepCC_TRUE@ fi >+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ >+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi > @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >-@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< >+@am__fastdepCC_FALSE@ $(COMPILE) -c $< > > .c.obj: >-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ >-@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ >-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ >-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ >-@am__fastdepCC_TRUE@ fi >+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ >+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi > @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >-@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` >+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` > > .cpp.o: >-@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ >-@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ >-@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ >-@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ >-@am__fastdepCXX_TRUE@ fi >+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ >+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi > @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< >+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< > > .cpp.obj: >-@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ >-@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ >-@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ >-@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ >-@am__fastdepCXX_TRUE@ fi >+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ >+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi > @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` >+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` > > .s.o: >- $(CCASCOMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< >+ $(CCASCOMPILE) -c $< > > .s.obj: >- $(CCASCOMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` >+ $(CCASCOMPILE) -c `$(CYGPATH_W) '$<'` > uninstall-info-am: > >-ETAGS = etags >-ETAGSFLAGS = >- >-CTAGS = ctags >-CTAGSFLAGS = >- >-tags: TAGS >- > ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) > list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ > unique=`for i in $$list; do \ >@@ -590,6 +686,7 @@ > $(AWK) ' { files[$$0] = 1; } \ > END { for (i in files) print i; }'`; \ > mkid -fID $$unique >+tags: TAGS > > TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ > $(TAGS_FILES) $(LISP) >@@ -604,7 +701,6 @@ > test -z "$(ETAGS_ARGS)$$tags$$unique" \ > || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ > $$tags $$unique >- > ctags: CTAGS > CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ > $(TAGS_FILES) $(LISP) >@@ -627,10 +723,6 @@ > > distclean-tags: > -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags >-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) >- >-top_distdir = ../.. >-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) > > distdir: $(DISTFILES) > @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ >@@ -644,7 +736,7 @@ > dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ > if test "$$dir" != "$$file" && test "$$dir" != "."; then \ > dir="/$$dir"; \ >- $(mkinstalldirs) "$(distdir)$$dir"; \ >+ $(mkdir_p) "$(distdir)$$dir"; \ > else \ > dir=''; \ > fi; \ >@@ -663,7 +755,6 @@ > $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) > check: check-am > all-am: Makefile $(SCRIPTS) >- > installdirs: > install: install-am > install-exec: install-exec-am >@@ -676,7 +767,7 @@ > installcheck: installcheck-am > install-strip: > $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ >- INSTALL_STRIP_FLAG=-s \ >+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ > `test -z '$(STRIP)' || \ > echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install > mostlyclean-generic: >@@ -684,7 +775,7 @@ > clean-generic: > > distclean-generic: >- -rm -f Makefile $(CONFIG_CLEAN_FILES) >+ -rm -f $(CONFIG_CLEAN_FILES) > > maintainer-clean-generic: > @echo "This command is intended for maintainers to use" >@@ -694,14 +785,17 @@ > clean-am: clean-checkPROGRAMS clean-generic mostlyclean-am > > distclean: distclean-am >- >-distclean-am: clean-am distclean-compile distclean-depend \ >- distclean-generic distclean-tags >+ -rm -rf ./$(DEPDIR) >+ -rm -f Makefile >+distclean-am: clean-am distclean-compile distclean-generic \ >+ distclean-tags > > dvi: dvi-am > > dvi-am: > >+html: html-am >+ > info: info-am > > info-am: >@@ -717,7 +811,8 @@ > installcheck-am: > > maintainer-clean: maintainer-clean-am >- >+ -rm -rf ./$(DEPDIR) >+ -rm -f Makefile > maintainer-clean-am: distclean-am maintainer-clean-generic > > mostlyclean: mostlyclean-am >@@ -734,20 +829,67 @@ > > uninstall-am: uninstall-info-am > >-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-checkPROGRAMS \ >- clean-generic ctags distclean distclean-compile \ >- distclean-depend distclean-generic distclean-tags distdir dvi \ >- dvi-am info info-am install install-am install-data \ >- install-data-am install-exec install-exec-am install-info \ >- install-info-am install-man install-strip installcheck \ >- installcheck-am installdirs maintainer-clean \ >+.PHONY: CTAGS GTAGS all all-am check check-am clean \ >+ clean-checkPROGRAMS clean-generic ctags distclean \ >+ distclean-compile distclean-generic distclean-tags distdir dvi \ >+ dvi-am html html-am info info-am install install-am \ >+ install-data install-data-am install-exec install-exec-am \ >+ install-info install-info-am install-man install-strip \ >+ installcheck installcheck-am installdirs maintainer-clean \ > maintainer-clean-generic mostlyclean mostlyclean-compile \ > mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ > uninstall-am uninstall-info-am > >+ exec-sigmask.stdout.exp exec-sigmask.stderr.exp \ >+ floored.stderr.exp floored.stdout.exp \ >+ floored.vgtest \ >+ fork.stderr.exp fork.stdout.exp fork.vgtest \ >+ fpu_lazy_eflags.stderr.exp fpu_lazy_eflags.stdout.exp \ >+ fpu_lazy_eflags.vgtest \ >+ fucomip.stderr.exp fucomip.vgtest \ >+ gxx304.stderr.exp gxx304.vgtest \ >+ insn_basic.stderr.exp insn_basic.stdout.exp insn_basic.vgtest \ >+ insn_cmov.stderr.exp insn_cmov.stdout.exp insn_cmov.vgtest \ >+ insn_mmx.stderr.exp insn_mmx.stdout.exp insn_mmx.vgtest \ >+ insn_mmxext.stderr.exp insn_mmxext.stdout.exp insn_mmxext.vgtest \ >+ insn_sse.stderr.exp insn_sse.stdout.exp insn_sse.vgtest \ >+ insn_sse2.stderr.exp insn_sse2.stdout.exp insn_sse2.vgtest \ >+ map_unmap.stdout.exp map_unmap.vgtest \ >+ mremap.stdout.exp mremap.vgtest \ >+ munmap_exe.stderr.exp munmap_exe.vgtest \ >+ pth_blockedsig.stderr.exp \ >+ pth_blockedsig.stdout.exp pth_blockedsig.vgtest \ >+ rcl_assert.stderr.exp rcl_assert.vgtest \ >+ rcrl.stderr.exp rcrl.stdout.exp rcrl.vgtest \ >+ readline1.stderr.exp readline1.stdout.exp \ >+ readline1.vgtest \ >+ resolv.stderr.exp resolv.stdout.exp resolv.vgtest \ >+ seg_override.stderr.exp \ >+ seg_override.stdout.exp seg_override.vgtest \ >+ sha1_test.stderr.exp sha1_test.vgtest \ >+ shortpush.stderr.exp shortpush.vgtest \ >+ shorts.stderr.exp shorts.vgtest \ >+ tls.stderr.exp tls.stdout.exp tls.vgtest \ >+ smc1.stderr.exp smc1.stdout.exp smc1.vgtest \ >+ syscall-restart1.vgtest syscall-restart1.stdout.exp syscall-restart1.stderr.exp \ >+ syscall-restart2.vgtest syscall-restart2.stdout.exp syscall-restart2.stderr.exp \ >+ yield.stdout.exp yield.vgtest >+ >+tls_so.o tls2_so.o: CFLAGS += -fpic > > # must be built with these flags -- bug only occurred with them > fpu_lazy_eflags.o: CFLAGS += -O2 -mcpu=pentiumpro -march=pentiumpro >+ >+# rebuild instruction tests if test generator changes >+insn_basic.c: gen_insn_test.pl >+insn_cmov.c: gen_insn_test.pl >+insn_mmx.c: gen_insn_test.pl >+insn_mmxext.c: gen_insn_test.pl >+insn_sse.c: gen_insn_test.pl >+insn_sse2.c: gen_insn_test.pl >+ >+.def.c: >+ $(PERL) gen_insn_test.pl < $< > $@ > # Tell versions [3.59,3.63) of GNU make to not export all variables. > # Otherwise a system limit (for SysV at least) may be exceeded. > .NOEXPORT: >diff -ruN valgrind-2.1.0/none/tests/bitfield1.c valgrind/none/tests/bitfield1.c >--- valgrind-2.1.0/none/tests/bitfield1.c 2002-09-23 04:36:25.000000000 -0500 >+++ valgrind/none/tests/bitfield1.c 2004-01-03 08:24:42.000000000 -0600 >@@ -1,5 +1,5 @@ > >-#include <malloc.h> >+#include <stdlib.h> > > typedef > struct { >diff -ruN valgrind-2.1.0/none/tests/exec-sigmask.c valgrind/none/tests/exec-sigmask.c >--- valgrind-2.1.0/none/tests/exec-sigmask.c 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/exec-sigmask.c 2004-01-15 23:37:46.000000000 -0600 >@@ -0,0 +1,37 @@ >+#include <unistd.h> >+#include <signal.h> >+#include <errno.h> >+#include <string.h> >+#include <stdio.h> >+ >+int main(int argc, char **argv) >+{ >+ if (argc == 1) { >+ sigset_t all; >+ >+ >+ sigfillset(&all); >+ sigprocmask(SIG_SETMASK, &all, NULL); >+ >+ execl(argv[0], argv[0], "test", NULL); >+ >+ fprintf(stderr, "FAILED: execl failed with %s\n", >+ strerror(errno)); >+ return 1; >+ } else { >+ sigset_t mask; >+ int i; >+ >+ sigprocmask(SIG_SETMASK, NULL, &mask); >+ >+ for(i = 1; i < NSIG; i++) { >+ if (i == SIGKILL || i == SIGSTOP) >+ continue; >+ >+ if (!sigismember(&mask, i)) >+ printf("signal %d missing from mask\n", i); >+ } >+ } >+ >+ return 0; >+} >diff -ruN valgrind-2.1.0/none/tests/exec-sigmask.stderr.exp valgrind/none/tests/exec-sigmask.stderr.exp >--- valgrind-2.1.0/none/tests/exec-sigmask.stderr.exp 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/exec-sigmask.stderr.exp 2004-01-15 20:17:29.000000000 -0600 >@@ -0,0 +1 @@ >+ >diff -ruN valgrind-2.1.0/none/tests/exec-sigmask.vgtest valgrind/none/tests/exec-sigmask.vgtest >--- valgrind-2.1.0/none/tests/exec-sigmask.vgtest 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/exec-sigmask.vgtest 2004-01-20 19:20:38.000000000 -0600 >@@ -0,0 +1 @@ >+prog: exec-sigmask >diff -ruN valgrind-2.1.0/none/tests/fork.c valgrind/none/tests/fork.c >--- valgrind-2.1.0/none/tests/fork.c 2002-09-27 05:38:20.000000000 -0500 >+++ valgrind/none/tests/fork.c 2004-01-06 15:46:02.000000000 -0600 >@@ -1,6 +1,7 @@ > > #include <unistd.h> > #include <sys/types.h> >+#include <sys/wait.h> > #include <stdio.h> > > int main(void) >@@ -16,5 +17,8 @@ > > printf("%s", pid==0 ? "X" : "XX"); > >+ if (pid != 0) >+ waitpid(pid, NULL, 0); >+ > return 0; > } >diff -ruN valgrind-2.1.0/none/tests/fork.stderr.exp valgrind/none/tests/fork.stderr.exp >--- valgrind-2.1.0/none/tests/fork.stderr.exp 2003-10-14 16:11:29.000000000 -0500 >+++ valgrind/none/tests/fork.stderr.exp 2004-01-06 15:46:02.000000000 -0600 >@@ -1,2 +0,0 @@ >- >- >diff -ruN valgrind-2.1.0/none/tests/fork.vgtest valgrind/none/tests/fork.vgtest >--- valgrind-2.1.0/none/tests/fork.vgtest 2002-09-23 04:36:25.000000000 -0500 >+++ valgrind/none/tests/fork.vgtest 2004-01-06 15:46:02.000000000 -0600 >@@ -1 +1,2 @@ > prog: fork >+vgopts: -q >diff -ruN valgrind-2.1.0/none/tests/gen_insn_test.pl valgrind/none/tests/gen_insn_test.pl >--- valgrind-2.1.0/none/tests/gen_insn_test.pl 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/gen_insn_test.pl 2004-02-11 17:33:29.000000000 -0600 >@@ -0,0 +1,667 @@ >+#!/usr/bin/perl >+ >+use strict; >+use warnings; >+ >+our %ArgTypes = ( >+ r8 => "reg8_t", >+ r16 => "reg16_t", >+ r32 => "reg32_t", >+ mm => "mm_reg_t", >+ xmm => "xmm_reg_t", >+ m8 => "reg8_t", >+ m16 => "reg16_t", >+ m32 => "reg32_t", >+ m64 => "mm_reg_t", >+ m128 => "xmm_reg_t", >+ eflags => "reg32_t" >+ ); >+ >+our %SubTypeFormats = ( >+ sb => "%d", >+ ub => "%u", >+ sw => "%d", >+ uw => "%u", >+ sd => "%ld", >+ ud => "%lu", >+ sq => "%lld", >+ uq => "%llu", >+ ps => "%.16g", >+ pd => "%.16g" >+ ); >+ >+our %SubTypeSuffixes = ( >+ sb => "", >+ ub => "U", >+ sw => "", >+ uw => "", >+ sd => "L", >+ ud => "UL", >+ sq => "LL", >+ uq => "ULL", >+ ps => "F", >+ pd => "" >+ ); >+ >+our %RegNums = ( >+ al => 0, ax => 0, eax => 0, >+ bl => 1, bx => 1, ebx => 1, >+ cl => 2, cx => 2, ecx => 2, >+ dl => 3, dx => 3, edx => 3, >+ ah => 4, >+ bh => 5, >+ ch => 6, >+ dh => 7 >+ ); >+ >+our %RegTypes = ( >+ al => "r8", ah => "r8", ax => "r16", eax => "r32", >+ bl => "r8", bh => "r8", bx => "r16", ebx => "r32", >+ cl => "r8", ch => "r8", cx => "r16", ecx => "r32", >+ dl => "r8", dh => "r8", dx => "r16", edx => "r32" >+ ); >+ >+our @IntRegs = ( >+ { r8 => "al", r16 => "ax", r32 => "eax" }, >+ { r8 => "bl", r16 => "bx", r32 => "ebx" }, >+ { r8 => "cl", r16 => "cx", r32 => "ecx" }, >+ { r8 => "dl", r16 => "dx", r32 => "edx" }, >+ { r8 => "ah" }, >+ { r8 => "bh" }, >+ { r8 => "ch" }, >+ { r8 => "dh" } >+ ); >+ >+print <<EOF; >+#include <math.h> >+#include <setjmp.h> >+#include <signal.h> >+#include <stdio.h> >+#include <stdlib.h> >+ >+typedef union { >+ char sb[1]; >+ unsigned char ub[1]; >+} reg8_t; >+ >+typedef union { >+ char sb[2]; >+ unsigned char ub[2]; >+ short sw[1]; >+ unsigned short uw[1]; >+} reg16_t; >+ >+typedef union { >+ char sb[4]; >+ unsigned char ub[4]; >+ short sw[2]; >+ unsigned short uw[2]; >+ long int sd[1]; >+ unsigned long int ud[1]; >+ float ps[1]; >+} reg32_t; >+ >+typedef union { >+ char sb[8]; >+ unsigned char ub[8]; >+ short sw[4]; >+ unsigned short uw[4]; >+ long int sd[2]; >+ unsigned long int ud[2]; >+ long long int sq[1]; >+ unsigned long long int uq[1]; >+ float ps[2]; >+ double pd[1]; >+} mm_reg_t __attribute__ ((aligned (8))); >+ >+typedef union { >+ char sb[16]; >+ unsigned char ub[16]; >+ short sw[8]; >+ unsigned short uw[8]; >+ long int sd[4]; >+ unsigned long int ud[4]; >+ long long int sq[2]; >+ unsigned long long int uq[2]; >+ float ps[4]; >+ double pd[2]; >+} xmm_reg_t __attribute__ ((aligned (16))); >+ >+static sigjmp_buf catchpoint; >+ >+static void handle_sigill(int signum) >+{ >+ siglongjmp(catchpoint, 1); >+} >+ >+static int eq_float(float f1, float f2) >+{ >+ return f1 == f2 || fabsf(f1 - f2) < fabsf(f1) * 1.5 * pow(2,-12); >+} >+ >+static int eq_double(double d1, double d2) >+{ >+ return d1 == d2 || fabs(d1 - d2) < fabs(d1) * 1.5 * pow(2,-12); >+} >+ >+EOF >+ >+my %tests; >+my @tests; >+ >+while (<>) >+{ >+ next if /^#/; >+ >+ my $insn; >+ my $presets; >+ my $args; >+ my $results; >+ >+ if (/^(\S+)\s+(?:(\S+(?:\s+\S+)*)\s+:\s+)?((?:\S+\s+)*)=>\s+(\S+(?:\s+\S+)*)$/) >+ { >+ $insn = $1; >+ $presets = $2 || ""; >+ $args = $3; >+ $results = $4; >+ } >+ else >+ { >+ die "Can't parse test $_"; >+ } >+ >+ $tests{$insn}++; >+ >+ my $test = "${insn}_$tests{$insn}"; >+ >+ push @tests, $test; >+ >+ print qq|static void $test(void)\n|; >+ print qq|\{\n|; >+ >+ my @intregs = @IntRegs; >+ my @mmregs = map { "mm$_" } (0 .. 7); >+ my @xmmregs = map { "xmm$_" } (0 .. 7); >+ >+ my @presets; >+ my $presetc = 0; >+ my $eflagsmask; >+ my $eflagsset; >+ >+ foreach my $preset (split(/\s+/, $presets)) >+ { >+ if ($preset =~ /^([abcd][lh]|[abcd]x|e[abcd]x)\.(sb|ub|sw|uw|sd|ud|sq|uq|ps|pd)\[([^\]]+)\]$/) >+ { >+ my $name = "preset$presetc"; >+ my $type = $RegTypes{$1}; >+ my $regnum = $RegNums{$1}; >+ my $register = $intregs[$regnum]; >+ my $subtype = $2; >+ my @values = split(/,/, $3); >+ >+ die "Register $1 already used" unless defined($register); >+ >+ my $preset = { >+ name => $name, >+ type => $type, >+ subtype => $subtype, >+ register => $register >+ }; >+ >+ delete($intregs[$regnum]); >+ >+ push @presets, $preset; >+ >+ print qq| $ArgTypes{$type} $name = \{|; >+ >+ my $valuec = 0; >+ >+ foreach my $value (@values) >+ { >+ print qq|,| if $valuec > 0; >+ print qq| .$subtype\[$valuec\] = $value$SubTypeSuffixes{$subtype}|; >+ $valuec++; >+ } >+ >+ print qq| \};\n|; >+ >+ $presetc++; >+ } >+ elsif ($preset =~ /^(eflags)\[([^\]]+)\]$/) >+ { >+ my $type = $1; >+ my @values = split(/,/, $2); >+ >+ $values[0] = oct($values[0]) if $values[0] =~ /^0/; >+ $values[1] = oct($values[1]) if $values[1] =~ /^0/; >+ >+ $eflagsmask = sprintf "0x%x", ~$values[0]; >+ $eflagsset = sprintf "0x%x", $values[1]; >+ } >+ else >+ { >+ die "Can't parse preset $preset"; >+ } >+ } >+ >+ my @args; >+ my $argc = 0; >+ >+ foreach my $arg (split(/\s+/, $args)) >+ { >+ my $name = "arg$argc"; >+ >+ if ($arg =~ /^([abcd]l|[abcd]x|e[abcd]x|r8|r16|r32|mm|xmm|m8|m16|m32|m64|m128)\.(sb|ub|sw|uw|sd|ud|sq|uq|ps|pd)\[([^\]]+)\]$/) >+ { >+ my $type = $RegTypes{$1} || $1; >+ my $regnum = $RegNums{$1}; >+ my $register = $intregs[$regnum] if defined($regnum); >+ my $subtype = $2; >+ my @values = split(/,/, $3); >+ >+ die "Register $1 already used" if defined($regnum) && !defined($register); >+ >+ my $arg = { >+ name => $name, >+ type => $type, >+ subtype => $subtype >+ }; >+ >+ if (defined($register)) >+ { >+ $arg->{register} = $register; >+ delete($intregs[$regnum]); >+ } >+ >+ push @args, $arg; >+ >+ print qq| $ArgTypes{$type} $name = \{|; >+ >+ my $valuec = 0; >+ >+ foreach my $value (@values) >+ { >+ print qq|,| if $valuec > 0; >+ print qq| .$subtype\[$valuec\] = $value$SubTypeSuffixes{$subtype}|; >+ $valuec++; >+ } >+ >+ print qq| \};\n|; >+ } >+ elsif ($arg =~ /^(imm8|imm16|imm32)\[([^\]]+)\]$/) >+ { >+ my $type = $1; >+ my $value = $2; >+ >+ my $arg = { >+ type => $type, >+ value => $value >+ }; >+ >+ push @args, $arg; >+ } >+ else >+ { >+ die "Can't parse argument $arg"; >+ } >+ >+ $argc++; >+ } >+ >+ foreach my $arg (@presets, @args) >+ { >+ if ($arg->{type} =~ /^(r8|r16|r32|m8|m16|m32)$/) >+ { >+ while (!exists($arg->{register}) || !defined($arg->{register})) >+ { >+ $arg->{register} = shift @intregs; >+ } >+ >+ $arg->{register} = $arg->{register}->{$arg->{type}}; >+ } >+ elsif ($arg->{type} =~ /^(mm|m64)$/) >+ { >+ $arg->{register} = shift @mmregs; >+ } >+ elsif ($arg->{type} =~ /^(xmm|m128)$/) >+ { >+ $arg->{register} = shift @xmmregs; >+ } >+ } >+ >+ my @results; >+ my $resultc = 0; >+ >+ foreach my $result (split(/\s+/, $results)) >+ { >+ my $name = "result$resultc"; >+ >+ if ($result =~ /^(\d+)\.(sb|ub|sw|uw|sd|ud|sq|uq|ps|pd)\[([^\]]+)\]$/) >+ { >+ my $index = $1; >+ my $type = $args[$index]->{type}; >+ my $subtype = $2; >+ my @values = split(/,/, $3); >+ >+ die "Argument $index not specified" unless exists($args[$index]); >+ >+ my $result = { >+ name => $name, >+ type => $type, >+ subtype => $subtype, >+ arg => $args[$index], >+ register => $args[$index]->{register}, >+ values => [ @values ] >+ }; >+ >+ push @results, $result; >+ >+ print qq| $ArgTypes{$type} $name|; >+ print qq| = arg$index| if $type =~ /^m(8|16|32|64|128)$/; >+ print qq|;\n|; >+ >+ $args[$index]->{result} = $result; >+ } >+ elsif ($result =~ /^([abcd][lh]|[abcd]x|e[abcd]x)\.(sb|ub|sw|uw|sd|ud|sq|uq|ps|pd)\[([^\]]+)\]$/) >+ { >+ my $register = $1; >+ my $type = $RegTypes{$register}; >+ my $subtype = $2; >+ my @values = split(/,/, $3); >+ >+ my $result = { >+ name => $name, >+ type => $type, >+ subtype => $subtype, >+ register => $register, >+ values => [ @values ] >+ }; >+ >+ push @results, $result; >+ >+ print qq| $ArgTypes{$type} $name;\n|; >+ } >+ elsif ($result =~ /^eflags\[([^\]]+)\]$/) >+ { >+ my @values = split(/,/, $1); >+ >+ $values[0] = oct($values[0]) if $values[0] =~ /^0/; >+ $values[1] = oct($values[1]) if $values[1] =~ /^0/; >+ >+ my $result = { >+ name => $name, >+ type => "eflags", >+ subtype => "ud", >+ values => [ map { sprintf "0x%x", $_ } @values ] >+ }; >+ >+ push @results, $result; >+ >+ print qq| $ArgTypes{eflags} $name;\n|; >+ >+ if (!defined($eflagsmask) && !defined($eflagsset)) >+ { >+ $eflagsmask = sprintf "0x%x", ~$values[0]; >+ $eflagsset = sprintf "0x%x", $values[0] & ~$values[1]; >+ } >+ } >+ else >+ { >+ die "Can't parse result $result"; >+ } >+ >+ $resultc++; >+ } >+ >+ print qq| char state\[108\];\n|; >+ print qq|\n|; >+ print qq| if (sigsetjmp(catchpoint, 1) == 0)\n|; >+ print qq| \{\n|; >+ print qq| asm\(\n|; >+ print qq| \"fsave %\[state\]\\n\"\n|; >+ >+ foreach my $arg (@presets, @args) >+ { >+ if ($arg->{type} eq "r8") >+ { >+ print qq| \"movb %\[$arg->{name}\], %%$arg->{register}\\n\"\n|; >+ } >+ elsif ($arg->{type} eq "r16") >+ { >+ print qq| \"movw %\[$arg->{name}\], %%$arg->{register}\\n\"\n|; >+ } >+ elsif ($arg->{type} eq "r32") >+ { >+ print qq| \"movl %\[$arg->{name}\], %%$arg->{register}\\n\"\n|; >+ } >+ elsif ($arg->{type} eq "mm") >+ { >+ print qq| \"movq %\[$arg->{name}\], %%$arg->{register}\\n\"\n|; >+ } >+ elsif ($arg->{type} eq "xmm") >+ { >+ print qq| \"movlps 0%\[$arg->{name}\], %%$arg->{register}\\n\"\n|; >+ print qq| \"movhps 8%\[$arg->{name}\], %%$arg->{register}\\n\"\n|; >+ } >+ } >+ >+ if (defined($eflagsmask) || defined($eflagsset)) >+ { >+ print qq| \"pushfl\\n\"\n|; >+ print qq| \"andl \$$eflagsmask, (%%esp)\\n\"\n| if defined($eflagsmask); >+ print qq| \"orl \$$eflagsset, (%%esp)\\n\"\n| if defined($eflagsset); >+ print qq| \"popfl\\n\"\n|; >+ } >+ >+ print qq| \"$insn|; >+ >+ my $prefix = " "; >+ >+ foreach my $arg (@args) >+ { >+ next if $arg->{type} eq "eflags"; >+ >+ if ($arg->{type} =~ /^(r8|r16|r32|mm|xmm)$/) >+ { >+ print qq|$prefix%%$arg->{register}|; >+ } >+ elsif ($arg->{type} =~ /^(m(8|16|32|64|128))$/) >+ { >+ if (exists($arg->{result})) >+ { >+ print qq|$prefix%\[$arg->{result}->{name}\]|; >+ } >+ else >+ { >+ print qq|$prefix%\[$arg->{name}\]|; >+ } >+ } >+ elsif ($arg->{type} =~ /^imm(8|16|32)$/) >+ { >+ print qq|$prefix\$$arg->{value}|; >+ } >+ >+ $prefix = ", "; >+ } >+ >+ print qq|\\n\"\n|; >+ >+ foreach my $result (@results) >+ { >+ if ($result->{type} eq "r8") >+ { >+ print qq| \"movb %%$result->{register}, %\[$result->{name}\]\\n\"\n|; >+ } >+ elsif ($result->{type} eq "r16") >+ { >+ print qq| \"movw %%$result->{register}, %\[$result->{name}\]\\n\"\n|; >+ } >+ elsif ($result->{type} eq "r32") >+ { >+ print qq| \"movl %%$result->{register}, %\[$result->{name}\]\\n\"\n|; >+ } >+ elsif ($result->{type} eq "mm") >+ { >+ print qq| \"movq %%$result->{register}, %\[$result->{name}\]\\n\"\n|; >+ } >+ elsif ($result->{type} eq "xmm") >+ { >+ print qq| \"movlps %%$result->{register}, 0%\[$result->{name}\]\\n\"\n|; >+ print qq| \"movhps %%$result->{register}, 8%\[$result->{name}\]\\n\"\n|; >+ } >+ elsif ($result->{type} eq "eflags") >+ { >+ print qq| \"pushfl\\n\"\n|; >+ print qq| \"popl %\[$result->{name}\]\\n\"\n|; >+ } >+ } >+ >+ print qq| \"frstor %\[state\]\\n\"\n|; >+ >+ print qq| :|; >+ >+ $prefix = " "; >+ >+ foreach my $result (@results) >+ { >+ if ($result->{type} =~ /^(m(8|16|32|64|128)|eflags)$/) >+ { >+ print qq|$prefix\[$result->{name}\] \"=m\" \($result->{name}\)|; >+ $prefix = ", "; >+ } >+ } >+ >+ print qq|\n|; >+ >+ $prefix = " : "; >+ >+ foreach my $arg (@presets, @args) >+ { >+ if (defined($arg->{name})) >+ { >+ print qq|$prefix\[$arg->{name}\] \"m\" \($arg->{name}\)|; >+ $prefix = ", "; >+ } >+ } >+ >+ foreach my $result (@results) >+ { >+ if ($result->{type} =~ /^(r(8|16|32)|mm|xmm)$/) >+ { >+ print qq|$prefix\[$result->{name}\] \"m\" \($result->{name}\)|; >+ $prefix = ", "; >+ } >+ } >+ >+ print qq|$prefix\[state\] \"m\" \(state[0]\)\n|; >+ >+ $prefix = " : "; >+ >+ foreach my $arg (@presets, @args) >+ { >+ if ($arg->{register}) >+ { >+ print qq|$prefix\"$arg->{register}\"|; >+ $prefix = ", "; >+ } >+ } >+ >+ print qq|\n|; >+ >+ print qq| \);\n|; >+ print qq|\n|; >+ >+ print qq| if \(|; >+ >+ $prefix = ""; >+ >+ foreach my $result (@results) >+ { >+ my $type = $result->{type}; >+ my $subtype = $result->{subtype}; >+ my $suffix = $SubTypeSuffixes{$subtype}; >+ my @values = @{$result->{values}}; >+ >+ if ($type eq "eflags") >+ { >+ print qq|${prefix}\($result->{name}.ud[0] & $values[0]UL\) == $values[1]UL|; >+ } >+ else >+ { >+ foreach my $value (0 .. $#values) >+ { >+ if ($subtype eq "ps") >+ { >+ print qq|${prefix}eq_float($result->{name}.$subtype\[$value\], $values[$value]$suffix)|; >+ } >+ elsif ($subtype eq "pd") >+ { >+ print qq|${prefix}eq_double($result->{name}.$subtype\[$value\], $values[$value]$suffix)|; >+ } >+ else >+ { >+ print qq|${prefix}$result->{name}.$subtype\[$value\] == $values[$value]$suffix|; >+ } >+ >+ $prefix = " && "; >+ } >+ } >+ >+ $prefix = " &&\n "; >+ } >+ >+ print qq| \)\n|; >+ print qq| \{\n|; >+ print qq| printf("$test ... ok\\n");\n|; >+ print qq| \}\n|; >+ print qq| else\n|; >+ print qq| \{\n|; >+ print qq| printf("$test ... not ok\\n");\n|; >+ >+ foreach my $result (@results) >+ { >+ my $type = $result->{type}; >+ my $subtype = $result->{subtype}; >+ my $suffix = $SubTypeSuffixes{$subtype}; >+ my @values = @{$result->{values}}; >+ >+ if ($type eq "eflags") >+ { >+ print qq| printf(" eflags & 0x%lx = 0x%lx (expected 0x%lx)\\n", $values[0]UL, $result->{name}.ud\[0\] & $values[0]UL, $values[1]UL);\n|; >+ } >+ else >+ { >+ foreach my $value (0 .. $#values) >+ { >+ print qq| printf(" $result->{name}.$subtype\[$value\] = $SubTypeFormats{$subtype} (expected $SubTypeFormats{$subtype})\\n", $result->{name}.$subtype\[$value\], $values[$value]$suffix);\n|; >+ } >+ } >+ } >+ >+ print qq| \}\n|; >+ print qq| \}\n|; >+ print qq| else\n|; >+ print qq| \{\n|; >+ print qq| printf("$test ... failed\\n");\n|; >+ print qq| \}\n|; >+ print qq|\n|; >+ print qq| return;\n|; >+ print qq|\}\n|; >+ print qq|\n|; >+} >+ >+print qq|int main(int argc, char **argv)\n|; >+print qq|\{\n|; >+print qq| signal(SIGILL, handle_sigill);\n|; >+print qq|\n|; >+ >+foreach my $test (@tests) >+{ >+ print qq| $test();\n|; >+} >+ >+print qq|\n|; >+print qq| exit(0);\n|; >+print qq|\}\n|; >+ >+exit 0; >diff -ruN valgrind-2.1.0/none/tests/insn_mmx.def valgrind/none/tests/insn_mmx.def >--- valgrind-2.1.0/none/tests/insn_mmx.def 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/insn_mmx.def 2004-02-11 17:33:29.000000000 -0600 >@@ -0,0 +1,103 @@ >+movd r32.sd[1234] mm.sd[1111,2222] => 1.sd[1234,0] >+movd m32.sd[1234] mm.sd[1111,2222] => 1.sd[1234,0] >+movd mm.sd[1234,2222] r32.sd[1111] => 1.sd[1234] >+movd mm.sd[1234,2222] m32.sd[1111] => 1.sd[1234] >+movq mm.uq[0x012345678abcdef] mm.uq[0x1212121234343434] => 1.uq[0x012345678abcdef] >+movq m64.uq[0x012345678abcdef] mm.uq[0x1212121234343434] => 1.uq[0x012345678abcdef] >+movq mm.uq[0x012345678abcdef] m64.uq[0x1212121234343434] => 1.uq[0x012345678abcdef] >+packssdw mm.sd[12345,123456] mm.sd[-12345,-123456] => 1.sw[-12345,-32768,12345,32767] >+packssdw m64.sd[12345,123456] mm.sd[-12345,-123456] => 1.sw[-12345,-32768,12345,32767] >+packsswb mm.sw[123,-123,1234,-1234] mm.sw[21,-21,321,-321] => 1.sb[21,-21,127,-128,123,-123,127,-128] >+packsswb m64.sw[123,-123,1234,-1234] mm.sw[21,-21,321,-321] => 1.sb[21,-21,127,-128,123,-123,127,-128] >+packuswb mm.sw[123,-123,1234,-1234] mm.sw[21,-21,321,-321] => 1.ub[21,0,255,0,123,0,255,0] >+packuswb m64.sw[123,-123,1234,-1234] mm.sw[21,-21,321,-321] => 1.ub[21,0,255,0,123,0,255,0] >+paddb mm.sb[12,34,56,78,21,43,65,87] mm.sb[8,7,6,5,4,3,2,1] => 1.sb[20,41,62,83,25,46,67,88] >+paddb m64.sb[12,34,56,78,21,43,65,87] mm.sb[8,7,6,5,4,3,2,1] => 1.sb[20,41,62,83,25,46,67,88] >+paddd mm.sd[12345678,87654321] mm.sd[8765,4321] => 1.sd[12354443,87658642] >+paddd m64.sd[12345678,87654321] mm.sd[8765,4321] => 1.sd[12354443,87658642] >+paddsb mm.sb[25,-25,50,-50,100,-100,125,-125] mm.sb[40,-40,30,-30,20,-20,10,-10] => 1.sb[65,-65,80,-80,120,-120,127,-128] >+paddsb m64.sb[25,-25,50,-50,100,-100,125,-125] mm.sb[40,-40,30,-30,20,-20,10,-10] => 1.sb[65,-65,80,-80,120,-120,127,-128] >+paddsw mm.sw[12345,-12345,32145,-32145] mm.sw[32145,-32145,-12345,12345] => 1.sw[32767,-32768,19800,-19800] >+paddsw m64.sw[12345,-12345,32145,-32145] mm.sw[32145,-32145,-12345,12345] => 1.sw[32767,-32768,19800,-19800] >+paddusb mm.ub[25,50,75,100,125,150,175,200] mm.ub[10,20,30,40,50,60,70,80] => 1.ub[35,70,105,140,175,210,245,255] >+paddusb m64.ub[25,50,75,100,125,150,175,200] mm.ub[10,20,30,40,50,60,70,80] => 1.ub[35,70,105,140,175,210,245,255] >+paddusw mm.uw[22222,33333,44444,55555] mm.uw[6666,7777,8888,9999] => 1.uw[28888,41110,53332,65535] >+paddusw m64.uw[22222,33333,44444,55555] mm.uw[6666,7777,8888,9999] => 1.uw[28888,41110,53332,65535] >+paddw mm.sw[1234,5678,4321,8765] mm.sw[87,65,43,21] => 1.sw[1321,5743,4364,8786] >+paddw m64.sw[1234,5678,4321,8765] mm.sw[87,65,43,21] => 1.sw[1321,5743,4364,8786] >+pand mm.uq[0xfdb97531eca86420] mm.uq[0x0123456789abcdef] => 1.uq[0x0121452188a84420] >+pand m64.uq[0xfdb97531eca86420] mm.uq[0x0123456789abcdef] => 1.uq[0x0121452188a84420] >+pandn mm.uq[0xfdb97531eca86420] mm.uq[0x0123456789abcdef] => 1.uq[0xfc98301064002000] >+pandn m64.uq[0xfdb97531eca86420] mm.uq[0x0123456789abcdef] => 1.uq[0xfc98301064002000] >+pcmpeqb mm.ub[11,22,33,44,55,66,77,88] mm.ub[11,11,33,33,55,55,77,77] => 1.ub[0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00] >+pcmpeqb m64.ub[11,22,33,44,55,66,77,88] mm.ub[11,11,33,33,55,55,77,77] => 1.ub[0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00] >+pcmpeqd mm.ud[11223344,55667788] mm.ud[11223344,11223344] => 1.ud[0xffffffff,0x00000000] >+pcmpeqd m64.ud[11223344,55667788] mm.ud[11223344,11223344] => 1.ud[0xffffffff,0x00000000] >+pcmpeqw mm.uw[1122,3344,5566,7788] mm.uw[1122,1122,5566,5566] => 1.uw[0xffff,0x0000,0xffff,0x0000] >+pcmpeqw m64.uw[1122,3344,5566,7788] mm.uw[1122,1122,5566,5566] => 1.uw[0xffff,0x0000,0xffff,0x0000] >+pcmpgtb mm.sb[-77,-55,-33,-11,11,33,55,77] mm.sb[77,55,33,11,-11,-33,-55,-77] => 1.ub[0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00] >+pcmpgtb m64.sb[-77,-55,-33,-11,11,33,55,77] mm.sb[77,55,33,11,-11,-33,-55,-77] => 1.ub[0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00] >+pcmpgtd mm.sd[-11111111,11111111] mm.sd[11111111,-11111111] => 1.ud[0xffffffff,0x00000000] >+pcmpgtd m64.sd[-11111111,11111111] mm.sd[11111111,-11111111] => 1.ud[0xffffffff,0x00000000] >+pcmpgtw mm.sw[-3333,-1111,1111,3333] mm.sw[3333,1111,-1111,-3333] => 1.uw[0xffff,0xffff,0x0000,0x0000] >+pcmpgtw m64.sw[-3333,-1111,1111,3333] mm.sw[3333,1111,-1111,-3333] => 1.uw[0xffff,0xffff,0x0000,0x0000] >+pmaddwd mm.sw[1234,5678,-4321,-8765] mm.sw[1111,-2222,3333,-4444] => 1.sd[-11245542,24549767] >+pmaddwd m64.sw[1234,5678,-4321,-8765] mm.sw[1111,-2222,3333,-4444] => 1.sd[-11245542,24549767] >+pmulhw mm.sw[1111,2222,-1111,-2222] mm.sw[3333,-4444,3333,-4444] => 1.uw[0x0038,0xff69,0xffc7,0x0096] >+pmulhw m64.sw[1111,2222,-1111,-2222] mm.sw[3333,-4444,3333,-4444] => 1.uw[0x0038,0xff69,0xffc7,0x0096] >+pmullw mm.sw[1111,2222,-1111,-2222] mm.sw[3333,-4444,3333,-4444] => 1.uw[0x80b3,0x5378,0x7f4d,0xac88] >+pmullw m64.sw[1111,2222,-1111,-2222] mm.sw[3333,-4444,3333,-4444] => 1.uw[0x80b3,0x5378,0x7f4d,0xac88] >+por mm.uq[0xfdb97531eca86420] mm.uq[0x0123456789abcdef] => 1.uq[0xfdbb7577edabedef] >+por m64.uq[0xfdb97531eca86420] mm.uq[0x0123456789abcdef] => 1.uq[0xfdbb7577edabedef] >+pslld imm8[4] mm.ud[0x01234567,0x89abcdef] => 1.ud[0x12345670,0x9abcdef0] >+pslld mm.uq[4] mm.ud[0x01234567,0x89abcdef] => 1.ud[0x12345670,0x9abcdef0] >+pslld m64.uq[4] mm.ud[0x01234567,0x89abcdef] => 1.ud[0x12345670,0x9abcdef0] >+psllq imm8[4] mm.uq[0x0123456789abcdef] => 1.uq[0x123456789abcdef0] >+psllq mm.uq[4] mm.uq[0x0123456789abcdef] => 1.uq[0x123456789abcdef0] >+psllq m64.uq[4] mm.uq[0x0123456789abcdef] => 1.uq[0x123456789abcdef0] >+psllw imm8[4] mm.uw[0x0123,0x4567,0x89ab,0xcdef] => 1.uw[0x1230,0x5670,0x9ab0,0xdef0] >+psllw mm.uq[4] mm.uw[0x0123,0x4567,0x89ab,0xcdef] => 1.uw[0x1230,0x5670,0x9ab0,0xdef0] >+psllw m64.uq[4] mm.uw[0x0123,0x4567,0x89ab,0xcdef] => 1.uw[0x1230,0x5670,0x9ab0,0xdef0] >+psrad imm8[4] mm.ud[0x01234567,0x89abcdef] => 1.ud[0x00123456,0xf89abcde] >+psrad mm.uq[4] mm.ud[0x01234567,0x89abcdef] => 1.ud[0x00123456,0xf89abcde] >+psrad m64.uq[4] mm.ud[0x01234567,0x89abcdef] => 1.ud[0x00123456,0xf89abcde] >+psraw imm8[4] mm.uw[0x0123,0x4567,0x89ab,0xcdef] => 1.uw[0x0012,0x0456,0xf89a,0xfcde] >+psraw mm.uq[4] mm.uw[0x0123,0x4567,0x89ab,0xcdef] => 1.uw[0x0012,0x0456,0xf89a,0xfcde] >+psraw m64.uq[4] mm.uw[0x0123,0x4567,0x89ab,0xcdef] => 1.uw[0x0012,0x0456,0xf89a,0xfcde] >+psrld imm8[4] mm.ud[0x01234567,0x89abcdef] => 1.ud[0x00123456,0x089abcde] >+psrld mm.uq[4] mm.ud[0x01234567,0x89abcdef] => 1.ud[0x00123456,0x089abcde] >+psrld m64.uq[4] mm.ud[0x01234567,0x89abcdef] => 1.ud[0x00123456,0x089abcde] >+psrlq imm8[4] mm.uq[0x0123456789abcdef] => 1.uq[0x00123456789abcde] >+psrlq mm.uq[4] mm.uq[0x0123456789abcdef] => 1.uq[0x00123456789abcde] >+psrlq m64.uq[4] mm.uq[0x0123456789abcdef] => 1.uq[0x00123456789abcde] >+psrlw imm8[4] mm.uw[0x0123,0x4567,0x89ab,0xcdef] => 1.uw[0x0012,0x0456,0x089a,0x0cde] >+psrlw mm.uq[4] mm.uw[0x0123,0x4567,0x89ab,0xcdef] => 1.uw[0x0012,0x0456,0x089a,0x0cde] >+psrlw m64.uq[4] mm.uw[0x0123,0x4567,0x89ab,0xcdef] => 1.uw[0x0012,0x0456,0x089a,0x0cde] >+psubb mm.sb[8,7,6,5,4,3,2,1] mm.sb[12,34,56,78,21,43,65,87] => 1.sb[4,27,50,73,17,40,63,86] >+psubb m64.sb[8,7,6,5,4,3,2,1] mm.sb[12,34,56,78,21,43,65,87] => 1.sb[4,27,50,73,17,40,63,86] >+psubd mm.sd[8765,4321] mm.sd[12345678,87654321] => 1.sd[12336913,87650000] >+psubd m64.sd[8765,4321] mm.sd[12345678,87654321] => 1.sd[12336913,87650000] >+psubsb mm.sb[-50,50,-40,40,-30,30,-20,20] mm.sb[25,-25,50,-50,100,-100,125,-125] => 1.sb[75,-75,90,-90,127,-128,127,-128] >+psubsb m64.sb[-50,50,-40,40,-30,30,-20,20] mm.sb[25,-25,50,-50,100,-100,125,-125] => 1.sb[75,-75,90,-90,127,-128,127,-128] >+psubsw mm.sw[-32145,32145,12345,-12345] mm.sw[12345,-12345,32145,-32145] => 1.sw[32767,-32768,19800,-19800] >+psubsw m64.sw[-32145,32145,12345,-12345] mm.sw[12345,-12345,32145,-32145] => 1.sw[32767,-32768,19800,-19800] >+psubusb mm.ub[11,22,33,44,55,66,77,88] mm.ub[88,77,66,55,44,33,22,11] => 1.ub[77,55,33,11,0,0,0,0] >+psubusb m64.ub[11,22,33,44,55,66,77,88] mm.ub[88,77,66,55,44,33,22,11] => 1.ub[77,55,33,11,0,0,0,0] >+psubusw mm.uw[1122,3344,5566,7788] mm.uw[8877,6655,4433,2211] => 1.uw[7755,3311,0,0] >+psubusw m64.uw[1122,3344,5566,7788] mm.uw[8877,6655,4433,2211] => 1.uw[7755,3311,0,0] >+psubw mm.sw[87,65,43,21] mm.sw[1234,5678,4321,8765] => 1.sw[1147,5613,4278,8744] >+psubw m64.sw[87,65,43,21] mm.sw[1234,5678,4321,8765] => 1.sw[1147,5613,4278,8744] >+punpckhbw mm.ub[12,34,56,78,21,43,65,87] mm.ub[11,22,33,44,55,66,77,88] => 1.ub[55,21,66,43,77,65,88,87] >+punpckhbw m64.ub[12,34,56,78,21,43,65,87] mm.ub[11,22,33,44,55,66,77,88] => 1.ub[55,21,66,43,77,65,88,87] >+punpckhdq mm.ud[12345678,21436587] mm.ud[11223344,55667788] => 1.ud[55667788,21436587] >+punpckhdq m64.ud[12345678,21436587] mm.ud[11223344,55667788] => 1.ud[55667788,21436587] >+punpckhwd mm.uw[1234,5678,2143,6587] mm.uw[1122,3344,5566,7788] => 1.uw[5566,2143,7788,6587] >+punpckhwd m64.uw[1234,5678,2143,6587] mm.uw[1122,3344,5566,7788] => 1.uw[5566,2143,7788,6587] >+punpcklbw mm.ub[12,34,56,78,21,43,65,87] mm.ub[11,22,33,44,55,66,77,88] => 1.ub[11,12,22,34,33,56,44,78] >+punpcklbw m64.ub[12,34,56,78,21,43,65,87] mm.ub[11,22,33,44,55,66,77,88] => 1.ub[11,12,22,34,33,56,44,78] >+punpckldq mm.ud[12345678,21436587] mm.ud[11223344,55667788] => 1.ud[11223344,12345678] >+punpckldq m64.ud[12345678,21436587] mm.ud[11223344,55667788] => 1.ud[11223344,12345678] >+punpcklwd mm.uw[1234,5678,2143,6587] mm.uw[1122,3344,5566,7788] => 1.uw[1122,1234,3344,5678] >+punpcklwd m64.uw[1234,5678,2143,6587] mm.uw[1122,3344,5566,7788] => 1.uw[1122,1234,3344,5678] >+pxor mm.uq[0xfdb97531eca86420] mm.uq[0x0123456789abcdef] => 1.uq[0xfc9a30566503a9cf] >+pxor m64.uq[0xfdb97531eca86420] mm.uq[0x0123456789abcdef] => 1.uq[0xfc9a30566503a9cf] >diff -ruN valgrind-2.1.0/none/tests/insn_mmx.stderr.exp valgrind/none/tests/insn_mmx.stderr.exp >--- valgrind-2.1.0/none/tests/insn_mmx.stderr.exp 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/insn_mmx.stderr.exp 2004-01-20 03:24:53.000000000 -0600 >@@ -0,0 +1,2 @@ >+ >+ >diff -ruN valgrind-2.1.0/none/tests/insn_mmx.stdout.exp valgrind/none/tests/insn_mmx.stdout.exp >--- valgrind-2.1.0/none/tests/insn_mmx.stdout.exp 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/insn_mmx.stdout.exp 2004-01-20 03:24:53.000000000 -0600 >@@ -0,0 +1,103 @@ >+movd_1 ... ok >+movd_2 ... ok >+movd_3 ... ok >+movd_4 ... ok >+movq_1 ... ok >+movq_2 ... ok >+movq_3 ... ok >+packssdw_1 ... ok >+packssdw_2 ... ok >+packsswb_1 ... ok >+packsswb_2 ... ok >+packuswb_1 ... ok >+packuswb_2 ... ok >+paddb_1 ... ok >+paddb_2 ... ok >+paddd_1 ... ok >+paddd_2 ... ok >+paddsb_1 ... ok >+paddsb_2 ... ok >+paddsw_1 ... ok >+paddsw_2 ... ok >+paddusb_1 ... ok >+paddusb_2 ... ok >+paddusw_1 ... ok >+paddusw_2 ... ok >+paddw_1 ... ok >+paddw_2 ... ok >+pand_1 ... ok >+pand_2 ... ok >+pandn_1 ... ok >+pandn_2 ... ok >+pcmpeqb_1 ... ok >+pcmpeqb_2 ... ok >+pcmpeqd_1 ... ok >+pcmpeqd_2 ... ok >+pcmpeqw_1 ... ok >+pcmpeqw_2 ... ok >+pcmpgtb_1 ... ok >+pcmpgtb_2 ... ok >+pcmpgtd_1 ... ok >+pcmpgtd_2 ... ok >+pcmpgtw_1 ... ok >+pcmpgtw_2 ... ok >+pmaddwd_1 ... ok >+pmaddwd_2 ... ok >+pmulhw_1 ... ok >+pmulhw_2 ... ok >+pmullw_1 ... ok >+pmullw_2 ... ok >+por_1 ... ok >+por_2 ... ok >+pslld_1 ... ok >+pslld_2 ... ok >+pslld_3 ... ok >+psllq_1 ... ok >+psllq_2 ... ok >+psllq_3 ... ok >+psllw_1 ... ok >+psllw_2 ... ok >+psllw_3 ... ok >+psrad_1 ... ok >+psrad_2 ... ok >+psrad_3 ... ok >+psraw_1 ... ok >+psraw_2 ... ok >+psraw_3 ... ok >+psrld_1 ... ok >+psrld_2 ... ok >+psrld_3 ... ok >+psrlq_1 ... ok >+psrlq_2 ... ok >+psrlq_3 ... ok >+psrlw_1 ... ok >+psrlw_2 ... ok >+psrlw_3 ... ok >+psubb_1 ... ok >+psubb_2 ... ok >+psubd_1 ... ok >+psubd_2 ... ok >+psubsb_1 ... ok >+psubsb_2 ... ok >+psubsw_1 ... ok >+psubsw_2 ... ok >+psubusb_1 ... ok >+psubusb_2 ... ok >+psubusw_1 ... ok >+psubusw_2 ... ok >+psubw_1 ... ok >+psubw_2 ... ok >+punpckhbw_1 ... ok >+punpckhbw_2 ... ok >+punpckhdq_1 ... ok >+punpckhdq_2 ... ok >+punpckhwd_1 ... ok >+punpckhwd_2 ... ok >+punpcklbw_1 ... ok >+punpcklbw_2 ... ok >+punpckldq_1 ... ok >+punpckldq_2 ... ok >+punpcklwd_1 ... ok >+punpcklwd_2 ... ok >+pxor_1 ... ok >+pxor_2 ... ok >diff -ruN valgrind-2.1.0/none/tests/insn_mmx.vgtest valgrind/none/tests/insn_mmx.vgtest >--- valgrind-2.1.0/none/tests/insn_mmx.vgtest 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/insn_mmx.vgtest 2004-01-20 03:24:53.000000000 -0600 >@@ -0,0 +1,2 @@ >+prog: insn_mmx >+cpu_test: mmx >diff -ruN valgrind-2.1.0/none/tests/insn_sse.def valgrind/none/tests/insn_sse.def >--- valgrind-2.1.0/none/tests/insn_sse.def 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/insn_sse.def 2004-02-11 17:33:29.000000000 -0600 >@@ -0,0 +1,141 @@ >+addps xmm.ps[12.34,56.78,43.21,87.65] xmm.ps[44.44,33.33,22.22,11.11] => 1.ps[56.78,90.11,65.43,98.76] >+addps m128.ps[12.34,56.78,43.21,87.65] xmm.ps[44.44,33.33,22.22,11.11] => 1.ps[56.78,90.11,65.43,98.76] >+addss xmm.ps[12.34,56.78,43.21,87.65] xmm.ps[44.44,33.33,22.22,11.11] => 1.ps[56.78,33.33,22.22,11.11] >+addss m128.ps[12.34,56.78,43.21,87.65] xmm.ps[44.44,33.33,22.22,11.11] => 1.ps[56.78,33.33,22.22,11.11] >+andnps xmm.uq[0xfdb97531eca86420,0x0123456789abcdef] xmm.uq[0x0123456789abcdef,0xfdb97531eca86420] => 1.uq[0xfc98301064002000,0x00020046010389cf] >+andnps m128.uq[0xfdb97531eca86420,0x0123456789abcdef] xmm.uq[0x0123456789abcdef,0xfdb97531eca86420] => 1.uq[0xfc98301064002000,0x00020046010389cf] >+andps xmm.uq[0xfdb97531eca86420,0x0123456789abcdef] xmm.uq[0x0123456789abcdef,0xfdb97531eca86420] => 1.uq[0x0121452188a84420,0x0121452188a84420] >+andps m128.uq[0xfdb97531eca86420,0x0123456789abcdef] xmm.uq[0x0123456789abcdef,0xfdb97531eca86420] => 1.uq[0x0121452188a84420,0x0121452188a84420] >+cmpeqps xmm.ps[234.5678,234.5678,234.5678,234.5678] xmm.ps[234.5678,234.5679,234.5678,234.5679] => 1.ud[0xffffffff,0x00000000,0xffffffff,0x00000000] >+cmpeqps m128.ps[234.5678,234.5678,234.5678,234.5678] xmm.ps[234.5678,234.5679,234.5678,234.5679] => 1.ud[0xffffffff,0x00000000,0xffffffff,0x00000000] >+cmpeqss xmm.ps[1234.5678,0.0,0.0,0.0] xmm.ps[1234.5678,0.0,0.0,0.0] => 1.ud[0xffffffff,0,0,0] >+cmpeqss m128.ps[1234.5678,0.0,0.0,0.0] xmm.ps[1234.5679,0.0,0.0,0.0] => 1.ud[0x00000000,0,0,0] >+cmpleps xmm.ps[234.5678,234.5678,234.5678,234.5678] xmm.ps[234.5678,234.5679,234.5678,234.5679] => 1.ud[0xffffffff,0x00000000,0xffffffff,0x00000000] >+cmpleps m128.ps[234.5678,234.5678,234.5678,234.5678] xmm.ps[234.5678,234.5679,234.5678,234.5679] => 1.ud[0xffffffff,0x00000000,0xffffffff,0x00000000] >+cmpless xmm.ps[1234.5678,0.0,0.0,0.0] xmm.ps[1234.5678,0.0,0.0,0.0] => 1.ud[0xffffffff,0,0,0] >+cmpless m128.ps[1234.5678,0.0,0.0,0.0] xmm.ps[1234.5679,0.0,0.0,0.0] => 1.ud[0x00000000,0,0,0] >+cmpltps xmm.ps[234.5678,234.5678,234.5678,234.5678] xmm.ps[234.5677,234.5679,234.5677,234.5679] => 1.ud[0xffffffff,0x00000000,0xffffffff,0x00000000] >+cmpltps m128.ps[234.5678,234.5678,234.5678,234.5678] xmm.ps[234.5677,234.5679,234.5677,234.5679] => 1.ud[0xffffffff,0x00000000,0xffffffff,0x00000000] >+cmpltss xmm.ps[1234.5678,0.0,0.0,0.0] xmm.ps[1234.5676,0.0,0.0,0.0] => 1.ud[0xffffffff,0,0,0] >+cmpltss m128.ps[1234.5678,0.0,0.0,0.0] xmm.ps[1234.5679,0.0,0.0,0.0] => 1.ud[0x00000000,0,0,0] >+cmpneqps xmm.ps[234.5678,234.5678,234.5678,234.5678] xmm.ps[234.5679,234.5678,234.5679,234.5678] => 1.ud[0xffffffff,0x00000000,0xffffffff,0x00000000] >+cmpneqps m128.ps[234.5678,234.5678,234.5678,234.5678] xmm.ps[234.5679,234.5678,234.5679,234.5678] => 1.ud[0xffffffff,0x00000000,0xffffffff,0x00000000] >+cmpneqss xmm.ps[1234.5678,0.0,0.0,0.0] xmm.ps[1234.5679,0.0,0.0,0.0] => 1.ud[0xffffffff,0,0,0] >+cmpneqss m128.ps[1234.5678,0.0,0.0,0.0] xmm.ps[1234.5678,0.0,0.0,0.0] => 1.ud[0x00000000,0,0,0] >+cmpnleps xmm.ps[234.5678,234.5678,234.5678,234.5678] xmm.ps[234.5679,234.5678,234.5679,234.5678] => 1.ud[0xffffffff,0x00000000,0xffffffff,0x00000000] >+cmpnleps m128.ps[234.5678,234.5678,234.5678,234.5678] xmm.ps[234.5679,234.5678,234.5679,234.5678] => 1.ud[0xffffffff,0x00000000,0xffffffff,0x00000000] >+cmpnless xmm.ps[1234.5678,0.0,0.0,0.0] xmm.ps[1234.5679,0.0,0.0,0.0] => 1.ud[0xffffffff,0,0,0] >+cmpnless m128.ps[1234.5678,0.0,0.0,0.0] xmm.ps[1234.5678,0.0,0.0,0.0] => 1.ud[0x00000000,0,0,0] >+cmpnltps xmm.ps[234.5678,234.5678,234.5678,234.5678] xmm.ps[234.5679,234.5677,234.5679,234.5677] => 1.ud[0xffffffff,0x00000000,0xffffffff,0x00000000] >+cmpnltps m128.ps[234.5678,234.5678,234.5678,234.5678] xmm.ps[234.5679,234.5677,234.5679,234.5677] => 1.ud[0xffffffff,0x00000000,0xffffffff,0x00000000] >+cmpnltss xmm.ps[1234.5678,0.0,0.0,0.0] xmm.ps[1234.5679,0.0,0.0,0.0] => 1.ud[0xffffffff,0,0,0] >+cmpnltss m128.ps[1234.5678,0.0,0.0,0.0] xmm.ps[1234.5676,0.0,0.0,0.0] => 1.ud[0x00000000,0,0,0] >+comiss xmm.ps[234.5678,0.0] xmm.ps[234.5679,0.0] => eflags[0x8d5,0x000] >+comiss m32.ps[234.5678] xmm.ps[234.5679,0.0] => eflags[0x8d5,0x000] >+comiss xmm.ps[234.5678,0.0] xmm.ps[234.5677,0.0] => eflags[0x8d5,0x001] >+comiss m32.ps[234.5678] xmm.ps[234.5677,0.0] => eflags[0x8d5,0x001] >+comiss xmm.ps[234.5678,0.0] xmm.ps[234.5678,0.0] => eflags[0x8d5,0x040] >+comiss m32.ps[234.5678] xmm.ps[234.5678,0.0] => eflags[0x8d5,0x040] >+cvtpi2ps mm.sd[1234,5678] xmm.ps[1.1,2.2,3.3,4.4] => 1.ps[1234.0,5678.0,3.3,4.4] >+cvtpi2ps m64.sd[1234,5678] xmm.ps[1.1,2.2,3.3,4.4] => 1.ps[1234.0,5678.0,3.3,4.4] >+cvtps2pi xmm.ps[12.34,56.78,1.11,2.22] mm.sd[1,2] => 1.sd[12,57] >+cvtps2pi m128.ps[12.34,56.78,1.11,2.22] mm.sd[1,2] => 1.sd[12,57] >+cvtsi2ss r32.sd[12] xmm.ps[1.11,2.22,3.33,4.44] => 1.ps[12.0,2.22,3.33,4.44] >+cvtsi2ss m32.sd[12] xmm.ps[1.11,2.22,3.33,4.44] => 1.ps[12.0,2.22,3.33,4.44] >+cvtss2si xmm.ps[12.34,56.78,43.21,87.65] r32.sd[99] => 1.sd[12] >+cvtss2si m128.ps[56.78,12.34,87.65,43.21] r32.sd[99] => 1.sd[57] >+cvttps2pi xmm.ps[12.34,56.78,1.11,2.22] mm.sd[1,2] => 1.sd[12,56] >+cvttps2pi m128.ps[12.34,56.78,1.11,2.22] mm.sd[1,2] => 1.sd[12,56] >+cvttss2si xmm.ps[12.34,56.78,43.21,87.65] r32.sd[99] => 1.sd[12] >+cvttss2si m128.ps[56.78,12.34,87.65,43.21] r32.sd[99] => 1.sd[56] >+divps xmm.ps[2.0,3.0,4.0,5.0] xmm.ps[24.68,3.69,48.48,55.55] => 1.ps[12.34,1.23,12.12,11.11] >+divps m128.ps[2.0,3.0,4.0,5.0] xmm.ps[24.68,3.69,48.48,55.55] => 1.ps[12.34,1.23,12.12,11.11] >+divss xmm.ps[2.0,3.0,4.0,5.0] xmm.ps[24.68,3.69,48.48,55.55] => 1.ps[12.34,3.69,48.48,55.55] >+divss m128.ps[2.0,3.0,4.0,5.0] xmm.ps[24.68,3.69,48.48,55.55] => 1.ps[12.34,3.69,48.48,55.55] >+maxps xmm.ps[2.22,4.44,6.66,8.88] xmm.ps[7.77,5.55,3.33,1.11] => 1.ps[7.77,5.55,6.66,8.88] >+maxps m128.ps[2.22,4.44,6.66,8.88] xmm.ps[7.77,5.55,3.33,1.11] => 1.ps[7.77,5.55,6.66,8.88] >+maxss xmm.ps[2.22,4.44,6.66,8.88] xmm.ps[7.77,5.55,3.33,1.11] => 1.ps[7.77,5.55,3.33,1.11] >+maxss m128.ps[8.88,6.66,4.44,2.22] xmm.ps[1.11,3.33,5.55,7.77] => 1.ps[8.88,3.33,5.55,7.77] >+minps xmm.ps[2.22,4.44,6.66,8.88] xmm.ps[7.77,5.55,3.33,1.11] => 1.ps[2.22,4.44,3.33,1.11] >+minps m128.ps[2.22,4.44,6.66,8.88] xmm.ps[7.77,5.55,3.33,1.11] => 1.ps[2.22,4.44,3.33,1.11] >+minss xmm.ps[2.22,4.44,6.66,8.88] xmm.ps[7.77,5.55,3.33,1.11] => 1.ps[2.22,5.55,3.33,1.11] >+minss m128.ps[8.88,6.66,4.44,2.22] xmm.ps[1.11,3.33,5.55,7.77] => 1.ps[1.11,3.33,5.55,7.77] >+movaps xmm.ps[12.34,56.78,43.21,87.65] xmm.ps[11.11,22.22,33.33,44.44] => 1.ps[12.34,56.78,43.21,87.65] >+movaps m128.ps[12.34,56.78,43.21,87.65] xmm.ps[11.11,22.22,33.33,44.44] => 1.ps[12.34,56.78,43.21,87.65] >+movhlps xmm.ps[12.34,56.78,43.21,87.65] xmm.ps[11.11,22.22,33.33,44.44] => 1.ps[43.21,87.65,33.33,44.44] >+movhps m64.ps[12.34,56.78] xmm.ps[11.11,22.22,33.33,44.44] => 1.ps[11.11,22.22,12.34,56.78] >+movhps xmm.ps[12.34,56.78,43.21,87.65] m64.ps[11.11,22.22] => 1.ps[43.21,87.65] >+movlhps xmm.ps[12.34,56.78,43.21,87.65] xmm.ps[11.11,22.22,33.33,44.44] => 1.ps[11.11,22.22,12.34,56.78] >+movlps m64.ps[12.34,56.78] xmm.ps[11.11,22.22,33.33,44.44] => 1.ps[12.34,56.78,33.33,44.44] >+movlps xmm.ps[12.34,56.78,43.21,87.65] m64.ps[11.11,22.22] => 1.ps[12.34,56.78] >+movmskps xmm.ps[12.34,-56.78,43.21,-87.65] r32.sd[0] => 1.sd[10] >+movntps xmm.ps[12.34,56.78,43.21,87.65] m128.ps[11.11,22.22,33.33,44.44] => 1.ps[12.34,56.78,43.21,87.65] >+movntq mm.uq[0x0123456789abcdef] m64.uq[0x1212121234343434] => 1.uq[0x0123456789abcdef] >+movss xmm.ps[12.34,56.78,43.21,87.65] xmm.ps[11.11,22.22,33.33,44.44] => 1.ps[12.34,22.22,33.33,44.44] >+movss m32.ps[12.34] xmm.ps[11.11,22.22,33.33,44.44] => 1.ps[12.34,0.0,0.0,0.0] >+movss xmm.ps[12.34,56.78,43.21,87.65] m32.ps[11.11] => 1.ps[12.34] >+movups xmm.ps[12.34,56.78,43.21,87.65] xmm.ps[11.11,22.22,33.33,44.44] => 1.ps[12.34,56.78,43.21,87.65] >+movups m128.ps[12.34,56.78,43.21,87.65] xmm.ps[11.11,22.22,33.33,44.44] => 1.ps[12.34,56.78,43.21,87.65] >+mulps xmm.ps[12.34,56.78,43.21,87.65] xmm.ps[5.0,4.0,3.0,2.0] => 1.ps[61.70,227.12,129.63,175.30] >+mulps m128.ps[12.34,56.78,43.21,87.65] xmm.ps[5.0,4.0,3.0,2.0] => 1.ps[61.70,227.12,129.63,175.30] >+mulss xmm.ps[12.34,56.78,43.21,87.65] xmm.ps[5.0,4.0,3.0,2.0] => 1.ps[61.70,4.0,3.0,2.0] >+mulss m128.ps[12.34,56.78,43.21,87.65] xmm.ps[5.0,4.0,3.0,2.0] => 1.ps[61.70,4.0,3.0,2.0] >+orps xmm.uq[0xfdb97531eca86420,0x0123456789abcdef] xmm.uq[0x0123456789abcdef,0xfdb97531eca86420] => 1.uq[0xfdbb7577edabedef,0xfdbb7577edabedef] >+orps m128.uq[0xfdb97531eca86420,0x0123456789abcdef] xmm.uq[0x0123456789abcdef,0xfdb97531eca86420] => 1.uq[0xfdbb7577edabedef,0xfdbb7577edabedef] >+pavgb mm.ub[11,22,33,44,55,66,77,88] mm.ub[15,25,35,45,55,65,75,85] => 1.ub[13,24,34,45,55,66,76,87] >+pavgb m64.ub[11,22,33,44,55,66,77,88] mm.ub[15,25,35,45,55,65,75,85] => 1.ub[13,24,34,45,55,66,76,87] >+pavgw mm.uw[1122,3344,5566,7788] mm.uw[1525,3545,5565,7585] => 1.uw[1324,3445,5566,7687] >+pavgw m64.uw[1122,3344,5566,7788] mm.uw[1525,3545,5565,7585] => 1.uw[1324,3445,5566,7687] >+pextrw imm8[0] mm.uw[1234,5678,4321,8765] r32.ud[0xffffffff] => 2.ud[1234] >+pextrw imm8[1] mm.uw[1234,5678,4321,8765] r32.ud[0xffffffff] => 2.ud[5678] >+pextrw imm8[2] mm.uw[1234,5678,4321,8765] r32.ud[0xffffffff] => 2.ud[4321] >+pextrw imm8[3] mm.uw[1234,5678,4321,8765] r32.ud[0xffffffff] => 2.ud[8765] >+pinsrw imm8[0] r32.ud[0xffffffff] mm.uw[1234,5678,4321,8765] => 2.uw[65535,5678,4321,8765] >+pinsrw imm8[1] r32.ud[0xffffffff] mm.uw[1234,5678,4321,8765] => 2.uw[1234,65535,4321,8765] >+pinsrw imm8[2] r32.ud[0xffffffff] mm.uw[1234,5678,4321,8765] => 2.uw[1234,5678,65535,8765] >+pinsrw imm8[3] r32.ud[0xffffffff] mm.uw[1234,5678,4321,8765] => 2.uw[1234,5678,4321,65535] >+pmaxsw mm.sw[-1,2,-3,4] mm.sw[2,-3,4,-5] => 1.sw[2,2,4,4] >+pmaxsw m64.sw[-1,2,-3,4] mm.sw[2,-3,4,-5] => 1.sw[2,2,4,4] >+pmaxub mm.ub[1,2,3,4,5,6,7,8] mm.ub[8,7,6,5,4,3,2,1] => 1.ub[8,7,6,5,5,6,7,8] >+pmaxub m64.ub[1,2,3,4,5,6,7,8] mm.ub[8,7,6,5,4,3,2,1] => 1.ub[8,7,6,5,5,6,7,8] >+pminsw mm.sw[-1,2,-3,4] mm.sw[2,-3,4,-5] => 1.sw[-1,-3,-3,-5] >+pminsw m64.sw[-1,2,-3,4] mm.sw[2,-3,4,-5] => 1.sw[-1,-3,-3,-5] >+pminub mm.ub[1,2,3,4,5,6,7,8] mm.ub[8,7,6,5,4,3,2,1] => 1.ub[1,2,3,4,4,3,2,1] >+pminub m64.ub[1,2,3,4,5,6,7,8] mm.ub[8,7,6,5,4,3,2,1] => 1.ub[1,2,3,4,4,3,2,1] >+pmovmskb mm.uq[0x8000000080008088] r32.ud[0] => 1.ud[0x8b] >+pmulhuw mm.uw[1111,2222,3333,4444] mm.uw[5555,6666,7777,8888] => 1.uw[0x005e,0x00e2,0x018b,0x025a] >+pmulhuw m64.uw[1111,2222,3333,4444] mm.uw[5555,6666,7777,8888] => 1.uw[0x005e,0x00e2,0x018b,0x025a] >+psadbw mm.ub[1,2,3,4,5,6,7,8] mm.ub[8,7,6,5,4,3,2,1] => 1.sw[32,0,0,0] >+psadbw m64.ub[1,2,3,4,5,6,7,8] mm.ub[8,7,6,5,4,3,2,1] => 1.sw[32,0,0,0] >+pshufw imm8[0x1b] mm.sw[11,22,33,44] mm.sw[0,0,0,0] => 2.sw[44,33,22,11] >+pshufw imm8[0x1b] m64.sw[11,22,33,44] mm.sw[0,0,0,0] => 2.sw[44,33,22,11] >+rcpps xmm.ps[2.0,4.0,0.5,0.25] xmm.ps[1.11,2.22,3.33,4.44] => 1.ps[0.5,0.25,2.0,4.0] >+rcpps m128.ps[2.0,4.0,0.5,0.25] xmm.ps[1.11,2.22,3.33,4.44] => 1.ps[0.5,0.25,2.0,4.0] >+rcpss xmm.ps[2.0,4.0,0.5,0.25] xmm.ps[1.11,2.22,3.33,4.44] => 1.ps[0.5,2.22,3.33,4.44] >+rcpss m128.ps[2.0,4.0,0.5,0.25] xmm.ps[1.11,2.22,3.33,4.44] => 1.ps[0.5,2.22,3.33,4.44] >+rsqrtps xmm.ps[4.0,16.0,25.0,64.0] xmm.ps[1.11,2.22,3.33,4.44] => 1.ps[0.499878,0.249939,0.199982,0.124969] >+rsqrtps m128.ps[4.0,16.0,25.0,64.0] xmm.ps[1.11,2.22,3.33,4.44] => 1.ps[0.499878,0.249939,0.199982,0.124969] >+rsqrtss xmm.ps[16.0,5.55,6.66,7.77] xmm.ps[1.11,2.22,3.33,4.44] => 1.ps[0.249939,2.22,3.33,4.44] >+rsqrtss m128.ps[16.0,5.55,6.66,7.77] xmm.ps[1.11,2.22,3.33,4.44] => 1.ps[0.249939,2.22,3.33,4.44] >+shufps imm8[0xe4] xmm.ps[12.34,56.78,43.21,87.65] xmm.ps[12.34,56.78,43.21,87.65] => 2.ps[12.34,56.78,43.21,87.65] >+shufps imm8[0xb1] m128.ps[12.34,56.78,43.21,87.65] xmm.ps[12.34,56.78,43.21,87.65] => 2.ps[56.78,12.34,87.65,43.21] >+sqrtps xmm.ps[16.0,25.0,36.0,49.0] xmm.ps[1.11,2.22,3.33,4.44] => 1.ps[4.0,5.0,6.0,7.0] >+sqrtps m128.ps[16.0,25.0,36.0,49.0] xmm.ps[1.11,2.22,3.33,4.44] => 1.ps[4.0,5.0,6.0,7.0] >+sqrtss xmm.ps[16.0,5.55,6.66,7.77] xmm.ps[1.11,2.22,3.33,4.44] => 1.ps[4.0,2.22,3.33,4.44] >+sqrtss m128.ps[16.0,5.55,6.66,7.77] xmm.ps[1.11,2.22,3.33,4.44] => 1.ps[4.0,2.22,3.33,4.44] >+subps xmm.ps[12.34,56.77,43.21,87.65] xmm.ps[44.0,33.0,22.0,11.0] => 1.ps[31.66,-23.77,-21.21,-76.65] >+subps m128.ps[12.34,56.77,43.21,87.65] xmm.ps[44.0,33.0,22.0,11.0] => 1.ps[31.66,-23.77,-21.21,-76.65] >+subss xmm.ps[12.34,56.77,43.21,87.65] xmm.ps[44.0,33.0,22.0,11.0] => 1.ps[31.66,33.0,22.0,11.0] >+subss m128.ps[12.34,56.77,43.21,87.65] xmm.ps[44.0,33.0,22.0,11.0] => 1.ps[31.66,33.0,22.0,11.0] >+ucomiss xmm.ps[234.5678,0.0] xmm.ps[234.5679,0.0] => eflags[0x8d5,0x000] >+ucomiss m32.ps[234.5678] xmm.ps[234.5679,0.0] => eflags[0x8d5,0x000] >+ucomiss xmm.ps[234.5678,0.0] xmm.ps[234.5677,0.0] => eflags[0x8d5,0x001] >+ucomiss m32.ps[234.5678] xmm.ps[234.5677,0.0] => eflags[0x8d5,0x001] >+ucomiss xmm.ps[234.5678,0.0] xmm.ps[234.5678,0.0] => eflags[0x8d5,0x040] >+ucomiss m32.ps[234.5678] xmm.ps[234.5678,0.0] => eflags[0x8d5,0x040] >+unpckhps xmm.ps[12.34,56.78,43.21,87.65] xmm.ps[11.22,33.44,55.66,77.88] => 1.ps[55.66,43.21,77.88,87.65] >+unpckhps m128.ps[12.34,56.78,43.21,87.65] xmm.ps[11.22,33.44,55.66,77.88] => 1.ps[55.66,43.21,77.88,87.65] >+unpcklps xmm.ps[12.34,56.78,43.21,87.65] xmm.ps[11.22,33.44,55.66,77.88] => 1.ps[11.22,12.34,33.44,56.78] >+unpcklps m128.ps[12.34,56.78,43.21,87.65] xmm.ps[11.22,33.44,55.66,77.88] => 1.ps[11.22,12.34,33.44,56.78] >+xorps xmm.uq[0xfdb97531eca86420,0x0123456789abcdef] xmm.uq[0x0123456789abcdef,0xfdb97531eca86420] => 1.uq[0xfc9a30566503a9cf,0xfc9a30566503a9cf] >+xorps m128.uq[0xfdb97531eca86420,0x0123456789abcdef] xmm.uq[0x0123456789abcdef,0xfdb97531eca86420] => 1.uq[0xfc9a30566503a9cf,0xfc9a30566503a9cf] >diff -ruN valgrind-2.1.0/none/tests/insn_sse.stderr.exp valgrind/none/tests/insn_sse.stderr.exp >--- valgrind-2.1.0/none/tests/insn_sse.stderr.exp 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/insn_sse.stderr.exp 2004-01-20 03:24:53.000000000 -0600 >@@ -0,0 +1,2 @@ >+ >+ >diff -ruN valgrind-2.1.0/none/tests/insn_sse.stdout.exp valgrind/none/tests/insn_sse.stdout.exp >--- valgrind-2.1.0/none/tests/insn_sse.stdout.exp 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/insn_sse.stdout.exp 2004-01-20 03:24:53.000000000 -0600 >@@ -0,0 +1,141 @@ >+addps_1 ... ok >+addps_2 ... ok >+addss_1 ... ok >+addss_2 ... ok >+andnps_1 ... ok >+andnps_2 ... ok >+andps_1 ... ok >+andps_2 ... ok >+cmpeqps_1 ... ok >+cmpeqps_2 ... ok >+cmpeqss_1 ... ok >+cmpeqss_2 ... ok >+cmpleps_1 ... ok >+cmpleps_2 ... ok >+cmpless_1 ... ok >+cmpless_2 ... ok >+cmpltps_1 ... ok >+cmpltps_2 ... ok >+cmpltss_1 ... ok >+cmpltss_2 ... ok >+cmpneqps_1 ... ok >+cmpneqps_2 ... ok >+cmpneqss_1 ... ok >+cmpneqss_2 ... ok >+cmpnleps_1 ... ok >+cmpnleps_2 ... ok >+cmpnless_1 ... ok >+cmpnless_2 ... ok >+cmpnltps_1 ... ok >+cmpnltps_2 ... ok >+cmpnltss_1 ... ok >+cmpnltss_2 ... ok >+comiss_1 ... ok >+comiss_2 ... ok >+comiss_3 ... ok >+comiss_4 ... ok >+comiss_5 ... ok >+comiss_6 ... ok >+cvtpi2ps_1 ... ok >+cvtpi2ps_2 ... ok >+cvtps2pi_1 ... ok >+cvtps2pi_2 ... ok >+cvtsi2ss_1 ... ok >+cvtsi2ss_2 ... ok >+cvtss2si_1 ... ok >+cvtss2si_2 ... ok >+cvttps2pi_1 ... ok >+cvttps2pi_2 ... ok >+cvttss2si_1 ... ok >+cvttss2si_2 ... ok >+divps_1 ... ok >+divps_2 ... ok >+divss_1 ... ok >+divss_2 ... ok >+maxps_1 ... ok >+maxps_2 ... ok >+maxss_1 ... ok >+maxss_2 ... ok >+minps_1 ... ok >+minps_2 ... ok >+minss_1 ... ok >+minss_2 ... ok >+movaps_1 ... ok >+movaps_2 ... ok >+movhlps_1 ... ok >+movhps_1 ... ok >+movhps_2 ... ok >+movlhps_1 ... ok >+movlps_1 ... ok >+movlps_2 ... ok >+movmskps_1 ... ok >+movntps_1 ... ok >+movntq_1 ... ok >+movss_1 ... ok >+movss_2 ... ok >+movss_3 ... ok >+movups_1 ... ok >+movups_2 ... ok >+mulps_1 ... ok >+mulps_2 ... ok >+mulss_1 ... ok >+mulss_2 ... ok >+orps_1 ... ok >+orps_2 ... ok >+pavgb_1 ... ok >+pavgb_2 ... ok >+pavgw_1 ... ok >+pavgw_2 ... ok >+pextrw_1 ... ok >+pextrw_2 ... ok >+pextrw_3 ... ok >+pextrw_4 ... ok >+pinsrw_1 ... ok >+pinsrw_2 ... ok >+pinsrw_3 ... ok >+pinsrw_4 ... ok >+pmaxsw_1 ... ok >+pmaxsw_2 ... ok >+pmaxub_1 ... ok >+pmaxub_2 ... ok >+pminsw_1 ... ok >+pminsw_2 ... ok >+pminub_1 ... ok >+pminub_2 ... ok >+pmovmskb_1 ... ok >+pmulhuw_1 ... ok >+pmulhuw_2 ... ok >+psadbw_1 ... ok >+psadbw_2 ... ok >+pshufw_1 ... ok >+pshufw_2 ... ok >+rcpps_1 ... ok >+rcpps_2 ... ok >+rcpss_1 ... ok >+rcpss_2 ... ok >+rsqrtps_1 ... ok >+rsqrtps_2 ... ok >+rsqrtss_1 ... ok >+rsqrtss_2 ... ok >+shufps_1 ... ok >+shufps_2 ... ok >+sqrtps_1 ... ok >+sqrtps_2 ... ok >+sqrtss_1 ... ok >+sqrtss_2 ... ok >+subps_1 ... ok >+subps_2 ... ok >+subss_1 ... ok >+subss_2 ... ok >+ucomiss_1 ... ok >+ucomiss_2 ... ok >+ucomiss_3 ... ok >+ucomiss_4 ... ok >+ucomiss_5 ... ok >+ucomiss_6 ... ok >+unpckhps_1 ... ok >+unpckhps_2 ... ok >+unpcklps_1 ... ok >+unpcklps_2 ... ok >+xorps_1 ... ok >+xorps_2 ... ok >diff -ruN valgrind-2.1.0/none/tests/insn_sse.vgtest valgrind/none/tests/insn_sse.vgtest >--- valgrind-2.1.0/none/tests/insn_sse.vgtest 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/insn_sse.vgtest 2004-01-20 03:24:53.000000000 -0600 >@@ -0,0 +1,2 @@ >+prog: insn_sse >+cpu_test: sse >diff -ruN valgrind-2.1.0/none/tests/insn_sse2.def valgrind/none/tests/insn_sse2.def >--- valgrind-2.1.0/none/tests/insn_sse2.def 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/insn_sse2.def 2004-02-11 17:33:29.000000000 -0600 >@@ -0,0 +1,292 @@ >+addpd xmm.pd[1234.5678,8765.4321] xmm.pd[2222.2222,1111.1111] => 1.pd[3456.79,9876.5432] >+addpd m128.pd[1234.5678,8765.4321] xmm.pd[2222.2222,1111.1111] => 1.pd[3456.79,9876.5432] >+addsd xmm.pd[1234.5678,8765.4321] xmm.pd[2222.2222,1111.1111] => 1.pd[3456.79,1111.1111] >+addsd m128.pd[1234.5678,8765.4321] xmm.pd[2222.2222,1111.1111] => 1.pd[3456.79,1111.1111] >+andpd xmm.uq[0xfdb97531eca86420,0x0123456789abcdef] xmm.uq[0x0123456789abcdef,0xfdb97531eca86420] => 1.uq[0x0121452188a84420,0x0121452188a84420] >+andpd m128.uq[0xfdb97531eca86420,0x0123456789abcdef] xmm.uq[0x0123456789abcdef,0xfdb97531eca86420] => 1.uq[0x0121452188a84420,0x0121452188a84420] >+andnpd xmm.uq[0xfdb97531eca86420,0x0123456789abcdef] xmm.uq[0x0123456789abcdef,0xfdb97531eca86420] => 1.uq[0xfc98301064002000,0x00020046010389cf] >+andnpd m128.uq[0xfdb97531eca86420,0x0123456789abcdef] xmm.uq[0x0123456789abcdef,0xfdb97531eca86420] => 1.uq[0xfc98301064002000,0x00020046010389cf] >+cmpeqpd xmm.pd[1234.5678,1234.5678] xmm.pd[1234.5678,1234.5679] => 1.uq[0xffffffffffffffff,0x0000000000000000] >+cmpeqpd m128.pd[1234.5678,1234.5678] xmm.pd[1234.5678,1234.5679] => 1.uq[0xffffffffffffffff,0x0000000000000000] >+cmpltpd xmm.pd[1234.5678,1234.5678] xmm.pd[1234.5677,1234.5679] => 1.uq[0xffffffffffffffff,0x0000000000000000] >+cmpltpd m128.pd[1234.5678,1234.5678] xmm.pd[1234.5677,1234.5679] => 1.uq[0xffffffffffffffff,0x0000000000000000] >+cmplepd xmm.pd[1234.5678,1234.5678] xmm.pd[1234.5678,1234.5679] => 1.uq[0xffffffffffffffff,0x0000000000000000] >+cmplepd m128.pd[1234.5678,1234.5678] xmm.pd[1234.5678,1234.5679] => 1.uq[0xffffffffffffffff,0x0000000000000000] >+cmpneqpd xmm.pd[1234.5678,1234.5678] xmm.pd[1234.5679,1234.5678] => 1.uq[0xffffffffffffffff,0x0000000000000000] >+cmpneqpd m128.pd[1234.5678,1234.5678] xmm.pd[1234.5679,1234.5678] => 1.uq[0xffffffffffffffff,0x0000000000000000] >+cmpnltpd xmm.pd[1234.5678,1234.5678] xmm.pd[1234.5679,1234.5677] => 1.uq[0xffffffffffffffff,0x0000000000000000] >+cmpnltpd m128.pd[1234.5678,1234.5678] xmm.pd[1234.5679,1234.5677] => 1.uq[0xffffffffffffffff,0x0000000000000000] >+cmpnlepd xmm.pd[1234.5678,1234.5678] xmm.pd[1234.5679,1234.5678] => 1.uq[0xffffffffffffffff,0x0000000000000000] >+cmpnlepd m128.pd[1234.5678,1234.5678] xmm.pd[1234.5679,1234.5678] => 1.uq[0xffffffffffffffff,0x0000000000000000] >+cmpeqsd xmm.pd[1234.5678,0.0] xmm.pd[1234.5678,0.0] => 1.uq[0xffffffffffffffff,0] >+cmpeqsd m128.pd[1234.5678,0.0] xmm.pd[1234.5679,0.0] => 1.uq[0x0000000000000000,0] >+cmpltsd xmm.pd[1234.5678,0.0] xmm.pd[1234.5677,0.0] => 1.uq[0xffffffffffffffff,0] >+cmpltsd m128.pd[1234.5678,0.0] xmm.pd[1234.5679,0.0] => 1.uq[0x0000000000000000,0] >+cmplesd xmm.pd[1234.5678,0.0] xmm.pd[1234.5678,0.0] => 1.uq[0xffffffffffffffff,0] >+cmplesd m128.pd[1234.5678,0.0] xmm.pd[1234.5679,0.0] => 1.uq[0x0000000000000000,0] >+cmpneqsd xmm.pd[1234.5678,0.0] xmm.pd[1234.5679,0.0] => 1.uq[0xffffffffffffffff,0] >+cmpneqsd m128.pd[1234.5678,0.0] xmm.pd[1234.5678,0.0] => 1.uq[0x0000000000000000,0] >+cmpnltsd xmm.pd[1234.5678,0.0] xmm.pd[1234.5679,0.0] => 1.uq[0xffffffffffffffff,0] >+cmpnltsd m128.pd[1234.5678,0.0] xmm.pd[1234.5677,0.0] => 1.uq[0x0000000000000000,0] >+cmpnlesd xmm.pd[1234.5678,0.0] xmm.pd[1234.5679,0.0] => 1.uq[0xffffffffffffffff,0] >+cmpnlesd m128.pd[1234.5678,0.0] xmm.pd[1234.5678,0.0] => 1.uq[0x0000000000000000,0] >+comisd xmm.pd[1234.5678,0.0] xmm.pd[1234.5679,0.0] => eflags[0x8d5,0x000] >+comisd xmm.pd[1234.5678,0.0] xmm.pd[1234.5677,0.0] => eflags[0x8d5,0x001] >+comisd xmm.pd[1234.5678,0.0] xmm.pd[1234.5678,0.0] => eflags[0x8d5,0x040] >+comisd m64.pd[1234.5678] xmm.pd[1234.5679,0.0] => eflags[0x8d5,0x000] >+comisd m64.pd[1234.5678] xmm.pd[1234.5677,0.0] => eflags[0x8d5,0x001] >+comisd m64.pd[1234.5678] xmm.pd[1234.5678,0.0] => eflags[0x8d5,0x040] >+cvtdq2pd xmm.sd[1234,5678,0,0] xmm.pd[0.0,0.0] => 1.pd[1234.0,5678.0] >+cvtdq2pd m128.sd[1234,5678,0,0] xmm.pd[0.0,0.0] => 1.pd[1234.0,5678.0] >+cvtdq2ps xmm.sd[1234,5678,-1234,-5678] xmm.ps[0.0,0.0,0.0,0.0] => 1.ps[1234.0,5678.0,-1234.0,-5678.0] >+cvtdq2ps m128.sd[1234,5678,-1234,-5678] xmm.ps[0.0,0.0,0.0,0.0] => 1.ps[1234.0,5678.0,-1234.0,-5678.0] >+cvtpd2dq xmm.pd[12.34,56.78] xmm.sd[1,2,3,4] => 1.sd[12,57,0,0] >+cvtpd2dq m128.pd[12.34,56.78] xmm.sd[1,2,3,4] => 1.sd[12,57,0,0] >+cvtpd2pi xmm.pd[12.34,56.78] mm.sd[1,2] => 1.sd[12,57] >+cvtpd2pi m128.pd[12.34,56.78] mm.sd[1,2] => 1.sd[12,57] >+cvtpd2ps xmm.pd[12.34,56.78] xmm.ps[1.1,2.2,3.3,4.4] => 1.ps[12.34,56.78,0.0,0.0] >+cvtpd2ps m128.pd[12.34,56.78] xmm.ps[1.1,2.2,3.3,4.4] => 1.ps[12.34,56.78,0.0,0.0] >+cvtpi2pd mm.sd[1234,5678] xmm.pd[1.1,2.2] => 1.pd[1234.0,5678.0] >+cvtpi2pd m64.sd[1234,5678] xmm.pd[1.1,2.2] => 1.pd[1234.0,5678.0] >+cvtps2dq xmm.ps[12.34,56.78,43.21,87.65] xmm.sd[1,2,3,4] => 1.sd[12,57,43,88] >+cvtps2dq m128.ps[12.34,56.78,43.21,87.65] xmm.sd[1,2,3,4] => 1.sd[12,57,43,88] >+cvtps2pd xmm.ps[12.34,56.78,1.1,2.2] xmm.pd[3.3,4.4] => 1.pd[12.34,56.78] >+cvtps2pd m128.ps[12.34,56.78,1.1,2.2] xmm.pd[3.3,4.4] => 1.pd[12.34,56.78] >+cvtsd2si xmm.pd[12.34,56.78] r32.sd[99] => 1.sd[12] >+cvtsd2si m128.pd[56.78,12.34] r32.sd[99] => 1.sd[57] >+cvtsd2ss xmm.pd[12.34,56.78] xmm.ps[1.11,2.22,3.33,4.44] => 1.ps[12.34,2.22,3.33,4.44] >+cvtsd2ss m128.pd[12.34,56.78] xmm.ps[1.11,2.22,3.33,4.44] => 1.ps[12.34,2.22,3.33,4.44] >+cvtsi2sd r32.sd[12] xmm.pd[1.11,2.22] => 1.pd[12.0,2.22] >+cvtsi2sd m32.sd[12] xmm.pd[1.11,2.22] => 1.pd[12.0,2.22] >+cvtss2sd xmm.ps[12.34,3.33,4.44,5.55] xmm.pd[1.11,2.22] => 1.pd[12.34,2.22] >+cvtss2sd m128.ps[12.34,3.33,4.44,5.55] xmm.pd[1.11,2.22] => 1.pd[12.34,2.22] >+cvttpd2pi xmm.pd[12.34,56.78] mm.sd[1,2] => 1.sd[12,56] >+cvttpd2pi m128.pd[12.34,56.78] mm.sd[1,2] => 1.sd[12,56] >+cvttpd2dq xmm.pd[12.34,56.78] xmm.sd[1,2,3,4] => 1.sd[12,56,0,0] >+cvttpd2dq m128.pd[12.34,56.78] xmm.sd[1,2,3,4] => 1.sd[12,56,0,0] >+cvttps2dq xmm.ps[12.34,56.78,43.21,87.65] xmm.sd[1,2,3,4] => 1.sd[12,56,43,87] >+cvttps2dq m128.ps[12.34,56.78,43.21,87.65] xmm.sd[1,2,3,4] => 1.sd[12,56,43,87] >+cvttsd2si xmm.pd[12.34,56.78] r32.sd[99] => 1.sd[12] >+cvttsd2si m128.pd[56.78,12.34] r32.sd[99] => 1.sd[56] >+divpd xmm.pd[2.0,3.0] xmm.pd[24.68,3.69] => 1.pd[12.34,1.23] >+divpd m128.pd[2.0,3.0] xmm.pd[24.68,3.69] => 1.pd[12.34,1.23] >+divsd xmm.pd[2.0,3.0] xmm.pd[24.68,3.69] => 1.pd[12.34,3.69] >+divsd m128.pd[2.0,3.0] xmm.pd[24.68,3.69] => 1.pd[12.34,3.69] >+maxpd xmm.pd[22.222,44.444] xmm.pd[55.555,33.333] => 1.pd[55.555,44.444] >+maxpd m128.pd[22.222,44.444] xmm.pd[55.555,33.333] => 1.pd[55.555,44.444] >+maxsd xmm.pd[22.222,44.444] xmm.pd[55.555,33.333] => 1.pd[55.555,33.333] >+maxsd m128.pd[44.444,22.222] xmm.pd[33.333,55.555] => 1.pd[44.444,55.555] >+minpd xmm.pd[22.222,44.444] xmm.pd[55.555,33.333] => 1.pd[22.222,33.333] >+minpd m128.pd[22.222,44.444] xmm.pd[55.555,33.333] => 1.pd[22.222,33.333] >+minsd xmm.pd[22.222,44.444] xmm.pd[55.555,33.333] => 1.pd[22.222,33.333] >+minsd m128.pd[44.444,22.222] xmm.pd[33.333,55.555] => 1.pd[33.333,55.555] >+movapd xmm.pd[1234.5678,8765.4321] xmm.pd[1111.1111,2222.2222] => 1.pd[1234.5678,8765.4321] >+movapd m128.pd[1234.5678,8765.4321] xmm.pd[1111.1111,2222.2222] => 1.pd[1234.5678,8765.4321] >+movd r32.sd[1234] xmm.sd[1111,2222,3333,4444] => 1.sd[1234,0,0,0] >+movd m32.sd[1234] xmm.sd[1111,2222,3333,4444] => 1.sd[1234,0,0,0] >+movd xmm.sd[1234,2222,3333,4444] r32.sd[1111] => 1.sd[1234] >+movd xmm.sd[1234,2222,3333,4444] m32.sd[1111] => 1.sd[1234] >+movdqa xmm.uq[0x012345678abcdef,0xfedcba9876543210] xmm.uq[0x1212121234343434,0x5656565678787878] => 1.uq[0x012345678abcdef,0xfedcba9876543210] >+movdqa m128.uq[0x012345678abcdef,0xfedcba9876543210] xmm.uq[0x1212121234343434,0x5656565678787878] => 1.uq[0x012345678abcdef,0xfedcba9876543210] >+movdqa xmm.uq[0x012345678abcdef,0xfedcba9876543210] m128.uq[0x1212121234343434,0x5656565678787878] => 1.uq[0x012345678abcdef,0xfedcba9876543210] >+movdqu xmm.uq[0x012345678abcdef,0xfedcba9876543210] xmm.uq[0x1212121234343434,0x5656565678787878] => 1.uq[0x012345678abcdef,0xfedcba9876543210] >+movdqu m128.uq[0x012345678abcdef,0xfedcba9876543210] xmm.uq[0x1212121234343434,0x5656565678787878] => 1.uq[0x012345678abcdef,0xfedcba9876543210] >+movdqu xmm.uq[0x012345678abcdef,0xfedcba9876543210] m128.uq[0x1212121234343434,0x5656565678787878] => 1.uq[0x012345678abcdef,0xfedcba9876543210] >+movdq2q xmm.uq[0x012345678abcdef,0xfedcba9876543210] mm.uq[0x1212121234343434] => 1.uq[0x012345678abcdef] >+movhpd m64.pd[1234.5678] xmm.pd[1111.1111,2222.2222] => 1.pd[1111.1111,1234.5678] >+movhpd xmm.pd[1234.5678,8765.4321] m64.pd[1111.1111] => 1.pd[8765.4321] >+movlpd m64.pd[1234.5678] xmm.pd[1111.1111,2222.2222] => 1.pd[1234.5678,2222.2222] >+movlpd xmm.pd[1234.5678,8765.4321] m64.pd[1111.1111] => 1.pd[1234.5678] >+movmskpd xmm.pd[1234.5678,-1234.5678] r32.sd[0] => 1.sd[2] >+movntdq xmm.uq[0x012345678abcdef,0xfedcba9876543210] m128.uq[0x1212121234343434,0x5656565678787878] => 1.uq[0x012345678abcdef,0xfedcba9876543210] >+movnti r32.sd[12345678] m32.sd[11111111] => 1.sd[12345678] >+movntpd xmm.pd[1234.5678,8765.4321] m128.pd[1111.1111,2222.2222] => 1.pd[1234.5678,8765.4321] >+movq2dq mm.uq[0x012345678abcdef] xmm.uq[0x1212121234343434,0x5656565678787878] => 1.uq[0x012345678abcdef,0] >+movsd xmm.pd[1234.5678,8765.4321] xmm.pd[1111.1111,2222.2222] => 1.pd[1234.5678,2222.2222] >+movsd m64.pd[1234.5678] xmm.pd[1111.1111,2222.2222] => 1.pd[1234.5678,0.0] >+movsd xmm.pd[1234.5678,8765.4321] m64.pd[1111.1111] => 1.pd[1234.5678] >+movupd xmm.pd[1234.5678,8765.4321] xmm.pd[1111.1111,2222.2222] => 1.pd[1234.5678,8765.4321] >+movupd m128.pd[1234.5678,8765.4321] xmm.pd[1111.1111,2222.2222] => 1.pd[1234.5678,8765.4321] >+mulpd xmm.pd[1234.5678,8765.4321] xmm.pd[3.0,2.0] => 1.pd[3703.7034,17530.8642] >+mulpd m128.pd[1234.5678,8765.4321] xmm.pd[3.0,2.0] => 1.pd[3703.7034,17530.8642] >+mulsd xmm.pd[1234.5678,8765.4321] xmm.pd[3.0,2.0] => 1.pd[3703.7034,2.0] >+mulsd m128.pd[1234.5678,8765.4321] xmm.pd[3.0,2.0] => 1.pd[3703.7034,2.0] >+orpd xmm.uq[0xfdb97531eca86420,0x0123456789abcdef] xmm.uq[0x0123456789abcdef,0xfdb97531eca86420] => 1.uq[0xfdbb7577edabedef,0xfdbb7577edabedef] >+orpd m128.uq[0xfdb97531eca86420,0x0123456789abcdef] xmm.uq[0x0123456789abcdef,0xfdb97531eca86420] => 1.uq[0xfdbb7577edabedef,0xfdbb7577edabedef] >+packssdw xmm.sd[12345,-12345,123456,-123456] xmm.sd[4321,-4321,54321,-54321] => 1.sw[4321,-4321,32767,-32768,12345,-12345,32767,-32768] >+packssdw m128.sd[12345,-12345,123456,-123456] xmm.sd[4321,-4321,54321,-54321] => 1.sw[4321,-4321,32767,-32768,12345,-12345,32767,-32768] >+packsswb xmm.sw[123,-123,1234,-1234,123,-123,1234,-1234] xmm.sw[21,-21,321,-321,21,-21,321,-321] => 1.sb[21,-21,127,-128,21,-21,127,-128,123,-123,127,-128,123,-123,127,-128] >+packsswb m128.sw[123,-123,1234,-1234,123,-123,1234,-1234] xmm.sw[21,-21,321,-321,21,-21,321,-321] => 1.sb[21,-21,127,-128,21,-21,127,-128,123,-123,127,-128,123,-123,127,-128] >+packuswb xmm.sw[123,-123,1234,-1234,123,-123,1234,-1234] xmm.sw[21,-21,321,-321,21,-21,321,-321] => 1.ub[21,0,255,0,21,0,255,0,123,0,255,0,123,0,255,0] >+packuswb m128.sw[123,-123,1234,-1234,123,-123,1234,-1234] xmm.sw[21,-21,321,-321,21,-21,321,-321] => 1.ub[21,0,255,0,21,0,255,0,123,0,255,0,123,0,255,0] >+paddb xmm.sb[12,34,56,78,21,43,65,87,12,34,56,78,21,43,65,87] xmm.sb[8,7,6,5,4,3,2,1,8,7,6,5,4,3,2,1] => 1.sb[20,41,62,83,25,46,67,88,20,41,62,83,25,46,67,88] >+paddb m128.sb[12,34,56,78,21,43,65,87,12,34,56,78,21,43,65,87] xmm.sb[8,7,6,5,4,3,2,1,8,7,6,5,4,3,2,1] => 1.sb[20,41,62,83,25,46,67,88,20,41,62,83,25,46,67,88] >+paddd xmm.sd[12345678,87654321,12345678,87654321] xmm.sd[8765,4321,8765,4321] => 1.sd[12354443,87658642,12354443,87658642] >+paddd m128.sd[12345678,87654321,12345678,87654321] xmm.sd[8765,4321,8765,4321] => 1.sd[12354443,87658642,12354443,87658642] >+paddq mm.sq[11111111] mm.sq[22222222] => 1.sq[33333333] >+paddq m64.sq[11111111] mm.sq[22222222] => 1.sq[33333333] >+paddq xmm.sq[11111111,22222222] xmm.sq[22222222,33333333] => 1.sq[33333333,55555555] >+paddq m128.sq[11111111,22222222] xmm.sq[22222222,33333333] => 1.sq[33333333,55555555] >+paddsb xmm.sb[25,-25,50,-50,100,-100,125,-125,25,-25,50,-50,100,-100,125,-125] xmm.sb[40,-40,30,-30,20,-20,10,-10,40,-40,30,-30,20,-20,10,-10] => 1.sb[65,-65,80,-80,120,-120,127,-128,65,-65,80,-80,120,-120,127,-128] >+paddsb m128.sb[25,-25,50,-50,100,-100,125,-125,25,-25,50,-50,100,-100,125,-125] xmm.sb[40,-40,30,-30,20,-20,10,-10,40,-40,30,-30,20,-20,10,-10] => 1.sb[65,-65,80,-80,120,-120,127,-128,65,-65,80,-80,120,-120,127,-128] >+paddsw xmm.sw[12345,-12345,32145,-32145,12345,-12345,32145,-32145] xmm.sw[32145,-32145,-12345,12345,32145,-32145,-12345,12345] => 1.sw[32767,-32768,19800,-19800,32767,-32768,19800,-19800] >+paddsw m128.sw[12345,-12345,32145,-32145,12345,-12345,32145,-32145] xmm.sw[32145,-32145,-12345,12345,32145,-32145,-12345,12345] => 1.sw[32767,-32768,19800,-19800,32767,-32768,19800,-19800] >+paddusb xmm.ub[25,50,75,100,125,150,175,200,25,50,75,100,125,150,175,200] xmm.ub[10,20,30,40,50,60,70,80,10,20,30,40,50,60,70,80] => 1.ub[35,70,105,140,175,210,245,255,35,70,105,140,175,210,245,255] >+paddusb m128.ub[25,50,75,100,125,150,175,200,25,50,75,100,125,150,175,200] xmm.ub[10,20,30,40,50,60,70,80,10,20,30,40,50,60,70,80] => 1.ub[35,70,105,140,175,210,245,255,35,70,105,140,175,210,245,255] >+paddusw xmm.uw[22222,33333,44444,55555,22222,33333,44444,55555] xmm.uw[6666,7777,8888,9999,6666,7777,8888,9999] => 1.uw[28888,41110,53332,65535,28888,41110,53332,65535] >+paddusw m128.uw[22222,33333,44444,55555,22222,33333,44444,55555] xmm.uw[6666,7777,8888,9999,6666,7777,8888,9999] => 1.uw[28888,41110,53332,65535,28888,41110,53332,65535] >+paddw xmm.sw[1234,5678,4321,8765,1234,5678,4321,8765] xmm.sw[87,65,43,21,87,65,43,21] => 1.sw[1321,5743,4364,8786,1321,5743,4364,8786] >+paddw m128.sw[1234,5678,4321,8765,1234,5678,4321,8765] xmm.sw[87,65,43,21,87,65,43,21] => 1.sw[1321,5743,4364,8786,1321,5743,4364,8786] >+pand xmm.uq[0xfdb97531eca86420,0x0123456789abcdef] xmm.uq[0x0123456789abcdef,0xfdb97531eca86420] => 1.uq[0x0121452188a84420,0x0121452188a84420] >+pand m128.uq[0xfdb97531eca86420,0x0123456789abcdef] xmm.uq[0x0123456789abcdef,0xfdb97531eca86420] => 1.uq[0x0121452188a84420,0x0121452188a84420] >+pandn xmm.uq[0xfdb97531eca86420,0x0123456789abcdef] xmm.uq[0x0123456789abcdef,0xfdb97531eca86420] => 1.uq[0xfc98301064002000,0x00020046010389cf] >+pandn m128.uq[0xfdb97531eca86420,0x0123456789abcdef] xmm.uq[0x0123456789abcdef,0xfdb97531eca86420] => 1.uq[0xfc98301064002000,0x00020046010389cf] >+pavgb xmm.ub[11,22,33,44,55,66,77,88,11,22,33,44,55,66,77,88] xmm.ub[15,25,35,45,55,65,75,85,15,25,35,45,55,65,75,85] => 1.ub[13,24,34,45,55,66,76,87,13,24,34,45,55,66,76,87] >+pavgb m128.ub[11,22,33,44,55,66,77,88,11,22,33,44,55,66,77,88] xmm.ub[15,25,35,45,55,65,75,85,15,25,35,45,55,65,75,85] => 1.ub[13,24,34,45,55,66,76,87,13,24,34,45,55,66,76,87] >+pavgw xmm.uw[1122,3344,5566,7788,1122,3344,5566,7788] xmm.uw[1525,3545,5565,7585,1525,3545,5565,7585] => 1.uw[1324,3445,5566,7687,1324,3445,5566,7687] >+pavgw m128.uw[1122,3344,5566,7788,1122,3344,5566,7788] xmm.uw[1525,3545,5565,7585,1525,3545,5565,7585] => 1.uw[1324,3445,5566,7687,1324,3445,5566,7687] >+pcmpeqb xmm.ub[11,22,33,44,55,66,77,88,11,22,33,44,55,66,77,88] xmm.ub[11,11,33,33,55,55,77,77,11,11,33,33,55,55,77,77] => 1.ub[0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00] >+pcmpeqb m128.ub[11,22,33,44,55,66,77,88,11,22,33,44,55,66,77,88] xmm.ub[11,11,33,33,55,55,77,77,11,11,33,33,55,55,77,77] => 1.ub[0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00] >+pcmpeqd xmm.ud[11223344,55667788,11223344,55667788] xmm.ud[11223344,11223344,11223344,11223344] => 1.ud[0xffffffff,0x00000000,0xffffffff,0x00000000] >+pcmpeqd m128.ud[11223344,55667788,11223344,55667788] xmm.ud[11223344,11223344,11223344,11223344] => 1.ud[0xffffffff,0x00000000,0xffffffff,0x00000000] >+pcmpeqw xmm.uw[1122,3344,5566,7788,1122,3344,5566,7788] xmm.uw[1122,1122,5566,5566,1122,1122,5566,5566] => 1.uw[0xffff,0x0000,0xffff,0x0000,0xffff,0x0000,0xffff,0x0000] >+pcmpeqw m128.uw[1122,3344,5566,7788,1122,3344,5566,7788] xmm.uw[1122,1122,5566,5566,1122,1122,5566,5566] => 1.uw[0xffff,0x0000,0xffff,0x0000,0xffff,0x0000,0xffff,0x0000] >+pcmpgtb xmm.sb[-77,-55,-33,-11,11,33,55,77,-77,-55,-33,-11,11,33,55,77] xmm.sb[77,55,33,11,-11,-33,-55,-77,77,55,33,11,-11,-33,-55,-77] => 1.ub[0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00] >+pcmpgtb m128.sb[-77,-55,-33,-11,11,33,55,77,-77,-55,-33,-11,11,33,55,77] xmm.sb[77,55,33,11,-11,-33,-55,-77,77,55,33,11,-11,-33,-55,-77] => 1.ub[0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00] >+pcmpgtd xmm.sd[-11111111,11111111,-11111111,11111111] xmm.sd[11111111,-11111111,11111111,-11111111] => 1.ud[0xffffffff,0x00000000,0xffffffff,0x00000000] >+pcmpgtd m128.sd[-11111111,11111111,-11111111,11111111] xmm.sd[11111111,-11111111,11111111,-11111111] => 1.ud[0xffffffff,0x00000000,0xffffffff,0x00000000] >+pcmpgtw xmm.sw[-3333,-1111,1111,3333,-3333,-1111,1111,3333] xmm.sw[3333,1111,-1111,-3333,3333,1111,-1111,-3333] => 1.uw[0xffff,0xffff,0x0000,0x0000,0xffff,0xffff,0x0000,0x0000] >+pcmpgtw m128.sw[-3333,-1111,1111,3333,-3333,-1111,1111,3333] xmm.sw[3333,1111,-1111,-3333,3333,1111,-1111,-3333] => 1.uw[0xffff,0xffff,0x0000,0x0000,0xffff,0xffff,0x0000,0x0000] >+pextrw imm8[0] xmm.uw[1234,5678,4321,8765,1111,2222,3333,4444] r32.ud[0xffffffff] => 2.ud[1234] >+pextrw imm8[1] xmm.uw[1234,5678,4321,8765,1111,2222,3333,4444] r32.ud[0xffffffff] => 2.ud[5678] >+pextrw imm8[2] xmm.uw[1234,5678,4321,8765,1111,2222,3333,4444] r32.ud[0xffffffff] => 2.ud[4321] >+pextrw imm8[3] xmm.uw[1234,5678,4321,8765,1111,2222,3333,4444] r32.ud[0xffffffff] => 2.ud[8765] >+pextrw imm8[4] xmm.uw[1234,5678,4321,8765,1111,2222,3333,4444] r32.ud[0xffffffff] => 2.ud[1111] >+pextrw imm8[5] xmm.uw[1234,5678,4321,8765,1111,2222,3333,4444] r32.ud[0xffffffff] => 2.ud[2222] >+pextrw imm8[6] xmm.uw[1234,5678,4321,8765,1111,2222,3333,4444] r32.ud[0xffffffff] => 2.ud[3333] >+pextrw imm8[7] xmm.uw[1234,5678,4321,8765,1111,2222,3333,4444] r32.ud[0xffffffff] => 2.ud[4444] >+pinsrw imm8[0] r32.ud[0xffffffff] xmm.uw[1234,5678,4321,8765,1111,2222,3333,4444] => 2.uw[65535,5678,4321,8765,1111,2222,3333,4444] >+pinsrw imm8[1] r32.ud[0xffffffff] xmm.uw[1234,5678,4321,8765,1111,2222,3333,4444] => 2.uw[1234,65535,4321,8765,1111,2222,3333,4444] >+pinsrw imm8[2] r32.ud[0xffffffff] xmm.uw[1234,5678,4321,8765,1111,2222,3333,4444] => 2.uw[1234,5678,65535,8765,1111,2222,3333,4444] >+pinsrw imm8[3] r32.ud[0xffffffff] xmm.uw[1234,5678,4321,8765,1111,2222,3333,4444] => 2.uw[1234,5678,4321,65535,1111,2222,3333,4444] >+pinsrw imm8[4] r32.ud[0xffffffff] xmm.uw[1234,5678,4321,8765,1111,2222,3333,4444] => 2.uw[1234,5678,4321,8765,65535,2222,3333,4444] >+pinsrw imm8[5] r32.ud[0xffffffff] xmm.uw[1234,5678,4321,8765,1111,2222,3333,4444] => 2.uw[1234,5678,4321,8765,1111,65535,3333,4444] >+pinsrw imm8[6] r32.ud[0xffffffff] xmm.uw[1234,5678,4321,8765,1111,2222,3333,4444] => 2.uw[1234,5678,4321,8765,1111,2222,65535,4444] >+pinsrw imm8[7] r32.ud[0xffffffff] xmm.uw[1234,5678,4321,8765,1111,2222,3333,4444] => 2.uw[1234,5678,4321,8765,1111,2222,3333,65535] >+pmaddwd xmm.sw[1234,5678,-4321,-8765,1234,5678,-4321,-8765] xmm.sw[1111,-2222,3333,-4444,1111,-2222,3333,-4444] => 1.sd[-11245542,24549767,-11245542,24549767] >+pmaddwd m128.sw[1234,5678,-4321,-8765,1234,5678,-4321,-8765] xmm.sw[1111,-2222,3333,-4444,1111,-2222,3333,-4444] => 1.sd[-11245542,24549767,-11245542,24549767] >+pmaxsw xmm.sw[-1,2,-3,4,-5,6,-7,8] xmm.sw[2,-3,4,-5,6,-7,8,-9] => 1.sw[2,2,4,4,6,6,8,8] >+pmaxsw m128.sw[-1,2,-3,4,-5,6,-7,8] xmm.sw[2,-3,4,-5,6,-7,8,-9] => 1.sw[2,2,4,4,6,6,8,8] >+pmaxub xmm.ub[10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25] xmm.ub[25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10] => 1.ub[25,24,23,22,21,20,19,18,18,19,20,21,22,23,24,25] >+pmaxub m128.ub[10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25] xmm.ub[25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10] => 1.ub[25,24,23,22,21,20,19,18,18,19,20,21,22,23,24,25] >+pminsw xmm.sw[-1,2,-3,4,-5,6,-7,8] xmm.sw[2,-3,4,-5,6,-7,8,-9] => 1.sw[-1,-3,-3,-5,-5,-7,-7,-9] >+pminsw m128.sw[-1,2,-3,4,-5,6,-7,8] xmm.sw[2,-3,4,-5,6,-7,8,-9] => 1.sw[-1,-3,-3,-5,-5,-7,-7,-9] >+pminub xmm.ub[10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25] xmm.ub[25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10] => 1.ub[10,11,12,13,14,15,16,17,17,16,15,14,13,12,11,10] >+pminub m128.ub[10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25] xmm.ub[25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10] => 1.ub[10,11,12,13,14,15,16,17,17,16,15,14,13,12,11,10] >+pmovmskb xmm.uq[0x8000000080008088,0x8000000080008088] r32.ud[0] => 1.ud[0x8b8b] >+pmulhuw xmm.uw[1111,2222,3333,4444,5555,6666,7777,8888] xmm.uw[5555,6666,7777,8888,9999,1111,2222,3333] => 1.uw[0x005e,0x00e2,0x018b,0x025a,0x034f,0x0071,0x0107,0x01c4] >+pmulhuw m128.uw[1111,2222,3333,4444,5555,6666,7777,8888] xmm.uw[5555,6666,7777,8888,9999,1111,2222,3333] => 1.uw[0x005e,0x00e2,0x018b,0x025a,0x034f,0x0071,0x0107,0x01c4] >+pmulhw xmm.sw[1111,2222,-1111,-2222,1111,2222,-1111,-2222] xmm.sw[3333,-4444,3333,-4444,3333,-4444,3333,-4444] => 1.uw[0x0038,0xff69,0xffc7,0x0096,0x0038,0xff69,0xffc7,0x0096] >+pmulhw m128.sw[1111,2222,-1111,-2222,1111,2222,-1111,-2222] xmm.sw[3333,-4444,3333,-4444,3333,-4444,3333,-4444] => 1.uw[0x0038,0xff69,0xffc7,0x0096,0x0038,0xff69,0xffc7,0x0096] >+pmullw xmm.sw[1111,2222,-1111,-2222,1111,2222,-1111,-2222] xmm.sw[3333,-4444,3333,-4444,3333,-4444,3333,-4444] => 1.uw[0x80b3,0x5378,0x7f4d,0xac88,0x80b3,0x5378,0x7f4d,0xac88] >+pmullw m128.sw[1111,2222,-1111,-2222,1111,2222,-1111,-2222] xmm.sw[3333,-4444,3333,-4444,3333,-4444,3333,-4444] => 1.uw[0x80b3,0x5378,0x7f4d,0xac88,0x80b3,0x5378,0x7f4d,0xac88] >+pmuludq mm.ud[12345678,0] mm.ud[87654321,0] => 1.uq[1082152022374638] >+pmuludq m64.ud[12345678,0] mm.ud[87654321,0] => 1.uq[1082152022374638] >+pmuludq xmm.ud[12345678,0,87654321,0] xmm.ud[87654321,0,12345678,0] => 1.uq[1082152022374638,1082152022374638] >+pmuludq m128.ud[12345678,0,87654321,0] xmm.ud[87654321,0,12345678,0] => 1.uq[1082152022374638,1082152022374638] >+por xmm.uq[0xfdb97531eca86420,0x0123456789abcdef] xmm.uq[0x0123456789abcdef,0xfdb97531eca86420] => 1.uq[0xfdbb7577edabedef,0xfdbb7577edabedef] >+por m128.uq[0xfdb97531eca86420,0x0123456789abcdef] xmm.uq[0x0123456789abcdef,0xfdb97531eca86420] => 1.uq[0xfdbb7577edabedef,0xfdbb7577edabedef] >+psadbw xmm.ub[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16] xmm.ub[16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1] => 1.sw[64,0,0,0,64,0,0,0] >+psadbw m128.ub[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16] xmm.ub[16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1] => 1.sw[64,0,0,0,64,0,0,0] >+pshufd imm8[0x1b] xmm.sd[1122,3344,5566,7788] xmm.sd[0,0,0,0] => 2.sd[7788,5566,3344,1122] >+pshufd imm8[0x1b] m128.sd[1122,3344,5566,7788] xmm.sd[0,0,0,0] => 2.sd[7788,5566,3344,1122] >+pshufhw imm8[0x1b] xmm.sw[11,22,33,44,55,66,77,88] xmm.sw[0,0,0,0,0,0,0,0] => 2.sw[11,22,33,44,88,77,66,55] >+pshufhw imm8[0x1b] m128.sw[11,22,33,44,55,66,77,88] xmm.sw[0,0,0,0,0,0,0,0] => 2.sw[11,22,33,44,88,77,66,55] >+pshuflw imm8[0x1b] xmm.sw[11,22,33,44,55,66,77,88] xmm.sw[0,0,0,0,0,0,0,0] => 2.sw[44,33,22,11,55,66,77,88] >+pshuflw imm8[0x1b] m128.sw[11,22,33,44,55,66,77,88] xmm.sw[0,0,0,0,0,0,0,0] => 2.sw[44,33,22,11,55,66,77,88] >+pslld imm8[4] xmm.ud[0x01234567,0x89abcdef,0x01234567,0x89abcdef] => 1.ud[0x12345670,0x9abcdef0,0x12345670,0x9abcdef0] >+pslld xmm.uq[4,0] xmm.ud[0x01234567,0x89abcdef,0x01234567,0x89abcdef] => 1.ud[0x12345670,0x9abcdef0,0x12345670,0x9abcdef0] >+pslld m128.uq[4,0] xmm.ud[0x01234567,0x89abcdef,0x01234567,0x89abcdef] => 1.ud[0x12345670,0x9abcdef0,0x12345670,0x9abcdef0] >+pslldq imm8[4] xmm.uq[0x8899aabbccddeeff,0x0011223344556677] => 1.uq[0xccddeeff00000000,0x445566778899aabb] >+pslldq imm8[4] xmm.uq[0x8899aabbccddeeff,0x0011223344556677] => 1.uq[0xccddeeff00000000,0x445566778899aabb] >+psllq imm8[4] xmm.uq[0x0123456789abcdef,0x0123456789abcdef] => 1.uq[0x123456789abcdef0,0x123456789abcdef0] >+psllq xmm.uq[4,0] xmm.uq[0x0123456789abcdef,0x0123456789abcdef] => 1.uq[0x123456789abcdef0,0x123456789abcdef0] >+psllq m128.uq[4,0] xmm.uq[0x0123456789abcdef,0x0123456789abcdef] => 1.uq[0x123456789abcdef0,0x123456789abcdef0] >+psllw imm8[4] xmm.uw[0x0123,0x4567,0x89ab,0xcdef,0x0123,0x4567,0x89ab,0xcdef] => 1.uw[0x1230,0x5670,0x9ab0,0xdef0,0x1230,0x5670,0x9ab0,0xdef0] >+psllw xmm.uq[4,0] xmm.uw[0x0123,0x4567,0x89ab,0xcdef,0x0123,0x4567,0x89ab,0xcdef] => 1.uw[0x1230,0x5670,0x9ab0,0xdef0,0x1230,0x5670,0x9ab0,0xdef0] >+psllw m128.uq[4,0] xmm.uw[0x0123,0x4567,0x89ab,0xcdef,0x0123,0x4567,0x89ab,0xcdef] => 1.uw[0x1230,0x5670,0x9ab0,0xdef0,0x1230,0x5670,0x9ab0,0xdef0] >+psrad imm8[4] xmm.ud[0x01234567,0x89abcdef,0x01234567,0x89abcdef] => 1.ud[0x00123456,0xf89abcde,0x00123456,0xf89abcde] >+psrad xmm.uq[4,0] xmm.ud[0x01234567,0x89abcdef,0x01234567,0x89abcdef] => 1.ud[0x00123456,0xf89abcde,0x00123456,0xf89abcde] >+psrad m128.uq[4,0] xmm.ud[0x01234567,0x89abcdef,0x01234567,0x89abcdef] => 1.ud[0x00123456,0xf89abcde,0x00123456,0xf89abcde] >+psraw imm8[4] xmm.uw[0x0123,0x4567,0x89ab,0xcdef,0x0123,0x4567,0x89ab,0xcdef] => 1.uw[0x0012,0x0456,0xf89a,0xfcde,0x0012,0x0456,0xf89a,0xfcde] >+psraw xmm.uq[4,0] xmm.uw[0x0123,0x4567,0x89ab,0xcdef,0x0123,0x4567,0x89ab,0xcdef] => 1.uw[0x0012,0x0456,0xf89a,0xfcde,0x0012,0x0456,0xf89a,0xfcde] >+psraw m128.uq[4,0] xmm.uw[0x0123,0x4567,0x89ab,0xcdef,0x0123,0x4567,0x89ab,0xcdef] => 1.uw[0x0012,0x0456,0xf89a,0xfcde,0x0012,0x0456,0xf89a,0xfcde] >+psrld imm8[4] xmm.ud[0x01234567,0x89abcdef,0x01234567,0x89abcdef] => 1.ud[0x00123456,0x089abcde,0x00123456,0x089abcde] >+psrld xmm.uq[4,0] xmm.ud[0x01234567,0x89abcdef,0x01234567,0x89abcdef] => 1.ud[0x00123456,0x089abcde,0x00123456,0x089abcde] >+psrld m128.uq[4,0] xmm.ud[0x01234567,0x89abcdef,0x01234567,0x89abcdef] => 1.ud[0x00123456,0x089abcde,0x00123456,0x089abcde] >+psrldq imm8[4] xmm.uq[0x8899aabbccddeeff,0x0011223344556677] => 1.uq[0x445566778899aabb,0x0000000000112233] >+psrldq imm8[4] xmm.uq[0x8899aabbccddeeff,0x0011223344556677] => 1.uq[0x445566778899aabb,0x0000000000112233] >+psrlq imm8[4] xmm.uq[0x0123456789abcdef,0x0123456789abcdef] => 1.uq[0x00123456789abcde,0x00123456789abcde] >+psrlq xmm.uq[4,0] xmm.uq[0x0123456789abcdef,0x0123456789abcdef] => 1.uq[0x00123456789abcde,0x00123456789abcde] >+psrlq m128.uq[4,0] xmm.uq[0x0123456789abcdef,0x0123456789abcdef] => 1.uq[0x00123456789abcde,0x00123456789abcde] >+psrlw imm8[4] xmm.uw[0x0123,0x4567,0x89ab,0xcdef,0x0123,0x4567,0x89ab,0xcdef] => 1.uw[0x0012,0x0456,0x089a,0x0cde,0x0012,0x0456,0x089a,0x0cde] >+psrlw xmm.uq[4,0] xmm.uw[0x0123,0x4567,0x89ab,0xcdef,0x0123,0x4567,0x89ab,0xcdef] => 1.uw[0x0012,0x0456,0x089a,0x0cde,0x0012,0x0456,0x089a,0x0cde] >+psrlw m128.uq[4,0] xmm.uw[0x0123,0x4567,0x89ab,0xcdef,0x0123,0x4567,0x89ab,0xcdef] => 1.uw[0x0012,0x0456,0x089a,0x0cde,0x0012,0x0456,0x089a,0x0cde] >+psubb xmm.sb[8,7,6,5,4,3,2,1,8,7,6,5,4,3,2,1] xmm.sb[12,34,56,78,21,43,65,87,12,34,56,78,21,43,65,87] => 1.sb[4,27,50,73,17,40,63,86,4,27,50,73,17,40,63,86] >+psubb m128.sb[8,7,6,5,4,3,2,1,8,7,6,5,4,3,2,1] xmm.sb[12,34,56,78,21,43,65,87,12,34,56,78,21,43,65,87] => 1.sb[4,27,50,73,17,40,63,86,4,27,50,73,17,40,63,86] >+psubd xmm.sd[8765,4321,8765,4321] xmm.sd[12345678,87654321,12345678,87654321] => 1.sd[12336913,87650000,12336913,87650000] >+psubd m128.sd[8765,4321,8765,4321] xmm.sd[12345678,87654321,12345678,87654321] => 1.sd[12336913,87650000,12336913,87650000] >+psubq mm.sq[11111111] mm.sq[33333333] => 1.sq[22222222] >+psubq m64.sq[11111111] mm.sq[33333333] => 1.sq[22222222] >+psubq xmm.sq[11111111,22222222] xmm.sq[55555555,33333333] => 1.sq[44444444,11111111] >+psubq m128.sq[11111111,22222222] xmm.sq[55555555,33333333] => 1.sq[44444444,11111111] >+psubsb xmm.sb[-50,50,-40,40,-30,30,-20,20,-50,50,-40,40,-30,30,-20,20] xmm.sb[25,-25,50,-50,100,-100,125,-125,25,-25,50,-50,100,-100,125,-125] => 1.sb[75,-75,90,-90,127,-128,127,-128,75,-75,90,-90,127,-128,127,-128] >+psubsb m128.sb[-50,50,-40,40,-30,30,-20,20,-50,50,-40,40,-30,30,-20,20] xmm.sb[25,-25,50,-50,100,-100,125,-125,25,-25,50,-50,100,-100,125,-125] => 1.sb[75,-75,90,-90,127,-128,127,-128,75,-75,90,-90,127,-128,127,-128] >+psubsw xmm.sw[-32145,32145,12345,-12345,-32145,32145,12345,-12345] xmm.sw[12345,-12345,32145,-32145,12345,-12345,32145,-32145] => 1.sw[32767,-32768,19800,-19800,32767,-32768,19800,-19800] >+psubsw m128.sw[-32145,32145,12345,-12345,-32145,32145,12345,-12345] xmm.sw[12345,-12345,32145,-32145,12345,-12345,32145,-32145] => 1.sw[32767,-32768,19800,-19800,32767,-32768,19800,-19800] >+psubusb xmm.ub[11,22,33,44,55,66,77,88,11,22,33,44,55,66,77,88] xmm.ub[88,77,66,55,44,33,22,11,88,77,66,55,44,33,22,11] => 1.ub[77,55,33,11,0,0,0,0,77,55,33,11,0,0,0,0] >+psubusb m128.ub[11,22,33,44,55,66,77,88,11,22,33,44,55,66,77,88] xmm.ub[88,77,66,55,44,33,22,11,88,77,66,55,44,33,22,11] => 1.ub[77,55,33,11,0,0,0,0,77,55,33,11,0,0,0,0] >+psubusw xmm.uw[1122,3344,5566,7788,1122,3344,5566,7788] xmm.uw[8877,6655,4433,2211,8877,6655,4433,2211] => 1.uw[7755,3311,0,0,7755,3311,0,0] >+psubusw m128.uw[1122,3344,5566,7788,1122,3344,5566,7788] xmm.uw[8877,6655,4433,2211,8877,6655,4433,2211] => 1.uw[7755,3311,0,0,7755,3311,0,0] >+psubw xmm.sw[87,65,43,21,87,65,43,21] xmm.sw[1234,5678,4321,8765,1234,5678,4321,8765] => 1.sw[1147,5613,4278,8744,1147,5613,4278,8744] >+psubw m128.sw[87,65,43,21,87,65,43,21] xmm.sw[1234,5678,4321,8765,1234,5678,4321,8765] => 1.sw[1147,5613,4278,8744,1147,5613,4278,8744] >+punpckhbw xmm.ub[12,34,56,78,21,43,65,87,78,56,34,12,87,65,43,21] xmm.ub[11,22,33,44,55,66,77,88,88,77,66,55,44,33,22,11] => 1.ub[88,78,77,56,66,34,55,12,44,87,33,65,22,43,11,21] >+punpckhbw m128.ub[12,34,56,78,21,43,65,87,78,56,34,12,87,65,43,21] xmm.ub[11,22,33,44,55,66,77,88,88,77,66,55,44,33,22,11] => 1.ub[88,78,77,56,66,34,55,12,44,87,33,65,22,43,11,21] >+punpckhdq xmm.ud[12345678,21436587,78563412,87654321] xmm.ud[11223344,55667788,88776655,44332211] => 1.ud[88776655,78563412,44332211,87654321] >+punpckhdq m128.ud[12345678,21436587,78563412,87654321] xmm.ud[11223344,55667788,88776655,44332211] => 1.ud[88776655,78563412,44332211,87654321] >+punpckhqdq xmm.uq[1234567821436587,7856341287654321] xmm.uq[1122334455667788,8877665544332211] => 1.uq[8877665544332211,7856341287654321] >+punpckhqdq m128.uq[1234567821436587,7856341287654321] xmm.uq[1122334455667788,8877665544332211] => 1.uq[8877665544332211,7856341287654321] >+punpckhwd xmm.uw[1234,5678,2143,6587,7856,3412,8765,4321] xmm.uw[1122,3344,5566,7788,8877,6655,4433,2211] => 1.uw[8877,7856,6655,3412,4433,8765,2211,4321] >+punpckhwd m128.uw[1234,5678,2143,6587,7856,3412,8765,4321] xmm.uw[1122,3344,5566,7788,8877,6655,4433,2211] => 1.uw[8877,7856,6655,3412,4433,8765,2211,4321] >+punpcklbw xmm.ub[12,34,56,78,21,43,65,87,78,56,34,12,87,65,43,21] xmm.ub[11,22,33,44,55,66,77,88,88,77,66,55,44,33,22,11] => 1.ub[11,12,22,34,33,56,44,78,55,21,66,43,77,65,88,87] >+punpcklbw m128.ub[12,34,56,78,21,43,65,87,78,56,34,12,87,65,43,21] xmm.ub[11,22,33,44,55,66,77,88,88,77,66,55,44,33,22,11] => 1.ub[11,12,22,34,33,56,44,78,55,21,66,43,77,65,88,87] >+punpckldq xmm.ud[12345678,21436587,78563412,87654321] xmm.ud[11223344,55667788,88776655,44332211] => 1.ud[11223344,12345678,55667788,21436587] >+punpckldq m128.ud[12345678,21436587,78563412,87654321] xmm.ud[11223344,55667788,88776655,44332211] => 1.ud[11223344,12345678,55667788,21436587] >+punpcklqdq xmm.uq[1234567821436587,7856341287654321] xmm.uq[1122334455667788,8877665544332211] => 1.uq[1122334455667788,1234567821436587] >+punpcklqdq m128.uq[1234567821436587,7856341287654321] xmm.uq[1122334455667788,8877665544332211] => 1.uq[1122334455667788,1234567821436587] >+punpcklwd xmm.uw[1234,5678,2143,6587,7856,3412,8765,4321] xmm.uw[1122,3344,5566,7788,8877,6655,4433,2211] => 1.uw[1122,1234,3344,5678,5566,2143,7788,6587] >+punpcklwd m128.uw[1234,5678,2143,6587,7856,3412,8765,4321] xmm.uw[1122,3344,5566,7788,8877,6655,4433,2211] => 1.uw[1122,1234,3344,5678,5566,2143,7788,6587] >+pxor xmm.uq[0xfdb97531eca86420,0x0123456789abcdef] xmm.uq[0x0123456789abcdef,0xfdb97531eca86420] => 1.uq[0xfc9a30566503a9cf,0xfc9a30566503a9cf] >+pxor m128.uq[0xfdb97531eca86420,0x0123456789abcdef] xmm.uq[0x0123456789abcdef,0xfdb97531eca86420] => 1.uq[0xfc9a30566503a9cf,0xfc9a30566503a9cf] >+shufpd imm8[0x0] xmm.pd[1234.5678,8765.4321] xmm.pd[1234.5678,8765.4321] => 2.pd[1234.5678,1234.5678] >+shufpd imm8[0x3] m128.pd[1234.5678,8765.4321] xmm.pd[1234.5678,8765.4321] => 2.pd[8765.4321,8765.4321] >+sqrtpd xmm.pd[36.0,49.0] xmm.pd[1.11,2.22] => 1.pd[6.0,7.0] >+sqrtpd m128.pd[36.0,49.0] xmm.pd[1.11,2.22] => 1.pd[6.0,7.0] >+sqrtsd xmm.pd[36.0,5.55] xmm.pd[1.11,2.22] => 1.pd[6.0,2.22] >+sqrtsd m128.pd[36.0,5.55] xmm.pd[1.11,2.22] => 1.pd[6.0,2.22] >+subpd xmm.pd[1234.5678,8765.4321] xmm.pd[2222.0,1111.0] => 1.pd[987.4322,-7654.4321] >+subpd m128.pd[1234.5678,8765.4321] xmm.pd[2222.0,1111.0] => 1.pd[987.4322,-7654.4321] >+subsd xmm.pd[1234.5678,8765.4321] xmm.pd[2222.0,1111.0] => 1.pd[987.4322,1111.0] >+subsd m128.pd[1234.5678,8765.4321] xmm.pd[2222.0,1111.0] => 1.pd[987.4322,1111.0] >+ucomisd xmm.pd[1234.5678,0.0] xmm.pd[1234.5679,0.0] => eflags[0x8d5,0x000] >+ucomisd xmm.pd[1234.5678,0.0] xmm.pd[1234.5677,0.0] => eflags[0x8d5,0x001] >+ucomisd xmm.pd[1234.5678,0.0] xmm.pd[1234.5678,0.0] => eflags[0x8d5,0x040] >+ucomisd m64.pd[1234.5678] xmm.pd[1234.5679,0.0] => eflags[0x8d5,0x000] >+ucomisd m64.pd[1234.5678] xmm.pd[1234.5677,0.0] => eflags[0x8d5,0x001] >+ucomisd m64.pd[1234.5678] xmm.pd[1234.5678,0.0] => eflags[0x8d5,0x040] >+unpckhpd xmm.pd[1234.5678,8765.4321] xmm.pd[1122.3344,5566.7788] => 1.pd[5566.7788,8765.4321] >+unpckhpd m128.pd[1234.5678,8765.4321] xmm.pd[1122.3344,5566.7788] => 1.pd[5566.7788,8765.4321] >+unpcklpd xmm.pd[1234.5678,8765.4321] xmm.pd[1122.3344,5566.7788] => 1.pd[1122.3344,1234.5678] >+unpcklpd m128.pd[1234.5678,8765.4321] xmm.pd[1122.3344,5566.7788] => 1.pd[1122.3344,1234.5678] >+xorpd xmm.uq[0xfdb97531eca86420,0x0123456789abcdef] xmm.uq[0x0123456789abcdef,0xfdb97531eca86420] => 1.uq[0xfc9a30566503a9cf,0xfc9a30566503a9cf] >+xorpd m128.uq[0xfdb97531eca86420,0x0123456789abcdef] xmm.uq[0x0123456789abcdef,0xfdb97531eca86420] => 1.uq[0xfc9a30566503a9cf,0xfc9a30566503a9cf] >diff -ruN valgrind-2.1.0/none/tests/insn_sse2.stderr.exp valgrind/none/tests/insn_sse2.stderr.exp >--- valgrind-2.1.0/none/tests/insn_sse2.stderr.exp 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/insn_sse2.stderr.exp 2004-01-20 03:24:53.000000000 -0600 >@@ -0,0 +1,2 @@ >+ >+ >diff -ruN valgrind-2.1.0/none/tests/insn_sse2.stdout.exp valgrind/none/tests/insn_sse2.stdout.exp >--- valgrind-2.1.0/none/tests/insn_sse2.stdout.exp 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/insn_sse2.stdout.exp 2004-01-20 03:24:53.000000000 -0600 >@@ -0,0 +1,292 @@ >+addpd_1 ... ok >+addpd_2 ... ok >+addsd_1 ... ok >+addsd_2 ... ok >+andpd_1 ... ok >+andpd_2 ... ok >+andnpd_1 ... ok >+andnpd_2 ... ok >+cmpeqpd_1 ... ok >+cmpeqpd_2 ... ok >+cmpltpd_1 ... ok >+cmpltpd_2 ... ok >+cmplepd_1 ... ok >+cmplepd_2 ... ok >+cmpneqpd_1 ... ok >+cmpneqpd_2 ... ok >+cmpnltpd_1 ... ok >+cmpnltpd_2 ... ok >+cmpnlepd_1 ... ok >+cmpnlepd_2 ... ok >+cmpeqsd_1 ... ok >+cmpeqsd_2 ... ok >+cmpltsd_1 ... ok >+cmpltsd_2 ... ok >+cmplesd_1 ... ok >+cmplesd_2 ... ok >+cmpneqsd_1 ... ok >+cmpneqsd_2 ... ok >+cmpnltsd_1 ... ok >+cmpnltsd_2 ... ok >+cmpnlesd_1 ... ok >+cmpnlesd_2 ... ok >+comisd_1 ... ok >+comisd_2 ... ok >+comisd_3 ... ok >+comisd_4 ... ok >+comisd_5 ... ok >+comisd_6 ... ok >+cvtdq2pd_1 ... ok >+cvtdq2pd_2 ... ok >+cvtdq2ps_1 ... ok >+cvtdq2ps_2 ... ok >+cvtpd2dq_1 ... ok >+cvtpd2dq_2 ... ok >+cvtpd2pi_1 ... ok >+cvtpd2pi_2 ... ok >+cvtpd2ps_1 ... ok >+cvtpd2ps_2 ... ok >+cvtpi2pd_1 ... ok >+cvtpi2pd_2 ... ok >+cvtps2dq_1 ... ok >+cvtps2dq_2 ... ok >+cvtps2pd_1 ... ok >+cvtps2pd_2 ... ok >+cvtsd2si_1 ... ok >+cvtsd2si_2 ... ok >+cvtsd2ss_1 ... ok >+cvtsd2ss_2 ... ok >+cvtsi2sd_1 ... ok >+cvtsi2sd_2 ... ok >+cvtss2sd_1 ... ok >+cvtss2sd_2 ... ok >+cvttpd2pi_1 ... ok >+cvttpd2pi_2 ... ok >+cvttpd2dq_1 ... ok >+cvttpd2dq_2 ... ok >+cvttps2dq_1 ... ok >+cvttps2dq_2 ... ok >+cvttsd2si_1 ... ok >+cvttsd2si_2 ... ok >+divpd_1 ... ok >+divpd_2 ... ok >+divsd_1 ... ok >+divsd_2 ... ok >+maxpd_1 ... ok >+maxpd_2 ... ok >+maxsd_1 ... ok >+maxsd_2 ... ok >+minpd_1 ... ok >+minpd_2 ... ok >+minsd_1 ... ok >+minsd_2 ... ok >+movapd_1 ... ok >+movapd_2 ... ok >+movd_1 ... ok >+movd_2 ... ok >+movd_3 ... ok >+movd_4 ... ok >+movdqa_1 ... ok >+movdqa_2 ... ok >+movdqa_3 ... ok >+movdqu_1 ... ok >+movdqu_2 ... ok >+movdqu_3 ... ok >+movdq2q_1 ... ok >+movhpd_1 ... ok >+movhpd_2 ... ok >+movlpd_1 ... ok >+movlpd_2 ... ok >+movmskpd_1 ... ok >+movntdq_1 ... ok >+movnti_1 ... ok >+movntpd_1 ... ok >+movq2dq_1 ... ok >+movsd_1 ... ok >+movsd_2 ... ok >+movsd_3 ... ok >+movupd_1 ... ok >+movupd_2 ... ok >+mulpd_1 ... ok >+mulpd_2 ... ok >+mulsd_1 ... ok >+mulsd_2 ... ok >+orpd_1 ... ok >+orpd_2 ... ok >+packssdw_1 ... ok >+packssdw_2 ... ok >+packsswb_1 ... ok >+packsswb_2 ... ok >+packuswb_1 ... ok >+packuswb_2 ... ok >+paddb_1 ... ok >+paddb_2 ... ok >+paddd_1 ... ok >+paddd_2 ... ok >+paddq_1 ... ok >+paddq_2 ... ok >+paddq_3 ... ok >+paddq_4 ... ok >+paddsb_1 ... ok >+paddsb_2 ... ok >+paddsw_1 ... ok >+paddsw_2 ... ok >+paddusb_1 ... ok >+paddusb_2 ... ok >+paddusw_1 ... ok >+paddusw_2 ... ok >+paddw_1 ... ok >+paddw_2 ... ok >+pand_1 ... ok >+pand_2 ... ok >+pandn_1 ... ok >+pandn_2 ... ok >+pavgb_1 ... ok >+pavgb_2 ... ok >+pavgw_1 ... ok >+pavgw_2 ... ok >+pcmpeqb_1 ... ok >+pcmpeqb_2 ... ok >+pcmpeqd_1 ... ok >+pcmpeqd_2 ... ok >+pcmpeqw_1 ... ok >+pcmpeqw_2 ... ok >+pcmpgtb_1 ... ok >+pcmpgtb_2 ... ok >+pcmpgtd_1 ... ok >+pcmpgtd_2 ... ok >+pcmpgtw_1 ... ok >+pcmpgtw_2 ... ok >+pextrw_1 ... ok >+pextrw_2 ... ok >+pextrw_3 ... ok >+pextrw_4 ... ok >+pextrw_5 ... ok >+pextrw_6 ... ok >+pextrw_7 ... ok >+pextrw_8 ... ok >+pinsrw_1 ... ok >+pinsrw_2 ... ok >+pinsrw_3 ... ok >+pinsrw_4 ... ok >+pinsrw_5 ... ok >+pinsrw_6 ... ok >+pinsrw_7 ... ok >+pinsrw_8 ... ok >+pmaddwd_1 ... ok >+pmaddwd_2 ... ok >+pmaxsw_1 ... ok >+pmaxsw_2 ... ok >+pmaxub_1 ... ok >+pmaxub_2 ... ok >+pminsw_1 ... ok >+pminsw_2 ... ok >+pminub_1 ... ok >+pminub_2 ... ok >+pmovmskb_1 ... ok >+pmulhuw_1 ... ok >+pmulhuw_2 ... ok >+pmulhw_1 ... ok >+pmulhw_2 ... ok >+pmullw_1 ... ok >+pmullw_2 ... ok >+pmuludq_1 ... ok >+pmuludq_2 ... ok >+pmuludq_3 ... ok >+pmuludq_4 ... ok >+por_1 ... ok >+por_2 ... ok >+psadbw_1 ... ok >+psadbw_2 ... ok >+pshufd_1 ... ok >+pshufd_2 ... ok >+pshufhw_1 ... ok >+pshufhw_2 ... ok >+pshuflw_1 ... ok >+pshuflw_2 ... ok >+pslld_1 ... ok >+pslld_2 ... ok >+pslld_3 ... ok >+pslldq_1 ... ok >+pslldq_2 ... ok >+psllq_1 ... ok >+psllq_2 ... ok >+psllq_3 ... ok >+psllw_1 ... ok >+psllw_2 ... ok >+psllw_3 ... ok >+psrad_1 ... ok >+psrad_2 ... ok >+psrad_3 ... ok >+psraw_1 ... ok >+psraw_2 ... ok >+psraw_3 ... ok >+psrld_1 ... ok >+psrld_2 ... ok >+psrld_3 ... ok >+psrldq_1 ... ok >+psrldq_2 ... ok >+psrlq_1 ... ok >+psrlq_2 ... ok >+psrlq_3 ... ok >+psrlw_1 ... ok >+psrlw_2 ... ok >+psrlw_3 ... ok >+psubb_1 ... ok >+psubb_2 ... ok >+psubd_1 ... ok >+psubd_2 ... ok >+psubq_1 ... ok >+psubq_2 ... ok >+psubq_3 ... ok >+psubq_4 ... ok >+psubsb_1 ... ok >+psubsb_2 ... ok >+psubsw_1 ... ok >+psubsw_2 ... ok >+psubusb_1 ... ok >+psubusb_2 ... ok >+psubusw_1 ... ok >+psubusw_2 ... ok >+psubw_1 ... ok >+psubw_2 ... ok >+punpckhbw_1 ... ok >+punpckhbw_2 ... ok >+punpckhdq_1 ... ok >+punpckhdq_2 ... ok >+punpckhqdq_1 ... ok >+punpckhqdq_2 ... ok >+punpckhwd_1 ... ok >+punpckhwd_2 ... ok >+punpcklbw_1 ... ok >+punpcklbw_2 ... ok >+punpckldq_1 ... ok >+punpckldq_2 ... ok >+punpcklqdq_1 ... ok >+punpcklqdq_2 ... ok >+punpcklwd_1 ... ok >+punpcklwd_2 ... ok >+pxor_1 ... ok >+pxor_2 ... ok >+shufpd_1 ... ok >+shufpd_2 ... ok >+sqrtpd_1 ... ok >+sqrtpd_2 ... ok >+sqrtsd_1 ... ok >+sqrtsd_2 ... ok >+subpd_1 ... ok >+subpd_2 ... ok >+subsd_1 ... ok >+subsd_2 ... ok >+ucomisd_1 ... ok >+ucomisd_2 ... ok >+ucomisd_3 ... ok >+ucomisd_4 ... ok >+ucomisd_5 ... ok >+ucomisd_6 ... ok >+unpckhpd_1 ... ok >+unpckhpd_2 ... ok >+unpcklpd_1 ... ok >+unpcklpd_2 ... ok >+xorpd_1 ... ok >+xorpd_2 ... ok >diff -ruN valgrind-2.1.0/none/tests/insn_sse2.vgtest valgrind/none/tests/insn_sse2.vgtest >--- valgrind-2.1.0/none/tests/insn_sse2.vgtest 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/insn_sse2.vgtest 2004-01-20 03:24:53.000000000 -0600 >@@ -0,0 +1,2 @@ >+prog: insn_sse2 >+cpu_test: sse2 >diff -ruN valgrind-2.1.0/none/tests/map_unmap.c valgrind/none/tests/map_unmap.c >--- valgrind-2.1.0/none/tests/map_unmap.c 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/map_unmap.c 2004-01-19 15:47:52.000000000 -0600 >@@ -0,0 +1,82 @@ >+#include <stdio.h> >+#include <sys/mman.h> >+#include <stdlib.h> >+#include <unistd.h> >+ >+static unsigned int pagesize; >+ >+#define PAGES 1024u >+#define LEN (PAGES*pagesize) >+ >+static void *domap(void) >+{ >+ void *ret = mmap(0, LEN, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0); >+ >+ if (ret == (void *)-1) { >+ perror("mmap"); >+ exit(1); >+ } >+ >+ return ret; >+} >+ >+/* unmap in pieces to exercise munmap more */ >+static void nibblemap(void *p) >+{ >+ int off; >+ int i; >+ >+ off = (random() % LEN) & ~(pagesize-1); >+ >+ for(i = 0; i < PAGES; i++) { >+ /* printf("unmapping off=%d\n", off/pagesize); */ >+ munmap((char *)p + off, pagesize); >+ off += 619*pagesize; >+ off %= LEN; >+ } >+} >+ >+static void prmaps() >+{ >+ char buf[100]; >+ sprintf(buf, "/bin/cat /proc/%d/maps", getpid()); >+ system(buf); >+ exit(1); >+} >+ >+int main() >+{ >+ int i; >+ void *expect1, *expect2; >+ >+ pagesize = getpagesize(); >+ >+ expect1 = domap(); >+ expect2 = domap(); >+ munmap(expect1, LEN); >+ munmap(expect2, LEN); >+ >+ for(i = 0; i < 100; i++) { >+ void *m1, *m2; >+ >+ m1 = domap(); >+ if (m1 != expect1) { >+ printf("FAIL i=%d: m1=%p expect1=%p\n", >+ i, m1, expect1); >+ prmaps(); >+ return 1; >+ } >+ m2 = domap(); >+ if (m2 != expect2) { >+ printf("FAIL i=%d: m2=%p expect2=%p\n", >+ i, m2, expect2); >+ prmaps(); >+ return 1; >+ } >+ nibblemap(m2); >+ munmap(m1, LEN); >+ } >+ >+ printf("PASS\n"); >+ return 0; >+} >diff -ruN valgrind-2.1.0/none/tests/map_unmap.stderr.exp valgrind/none/tests/map_unmap.stderr.exp >--- valgrind-2.1.0/none/tests/map_unmap.stderr.exp 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/map_unmap.stderr.exp 2003-12-19 15:56:04.000000000 -0600 >@@ -0,0 +1,2 @@ >+ >+ >diff -ruN valgrind-2.1.0/none/tests/map_unmap.stdout.exp valgrind/none/tests/map_unmap.stdout.exp >--- valgrind-2.1.0/none/tests/map_unmap.stdout.exp 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/map_unmap.stdout.exp 2003-12-19 15:56:04.000000000 -0600 >@@ -0,0 +1 @@ >+PASS >diff -ruN valgrind-2.1.0/none/tests/map_unmap.vgtest valgrind/none/tests/map_unmap.vgtest >--- valgrind-2.1.0/none/tests/map_unmap.vgtest 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/map_unmap.vgtest 2003-12-19 15:56:04.000000000 -0600 >@@ -0,0 +1 @@ >+prog: map_unmap >diff -ruN valgrind-2.1.0/none/tests/mremap.c valgrind/none/tests/mremap.c >--- valgrind-2.1.0/none/tests/mremap.c 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/mremap.c 2003-12-22 02:48:50.000000000 -0600 >@@ -0,0 +1,98 @@ >+#define _GNU_SOURCE >+#include <sys/mman.h> >+#include <stdio.h> >+#include <stdlib.h> >+ >+static char *mkmap(unsigned sz) >+{ >+ static char *map; >+ static unsigned mapsz; >+ char *p; >+ >+ if (map != NULL) >+ munmap(map, mapsz); >+ >+ p = (char *)mmap(0, sz, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); >+ >+ if (p == (char *)-1) { >+ perror("mmap"); >+ exit(1); >+ } >+ >+ map = p; >+ mapsz = sz; >+ >+ return p; >+} >+ >+ >+int main() >+{ >+ char *np; >+ char *p; >+ >+ p = mkmap(1024*1024); >+ np = mremap(p, 1024*1024, 256*1024, 0); /* shrink, fixed */ >+ if (np == (char *)-1) >+ perror("mremap(shrink, fixed)"); >+ if (np != p) >+ fprintf(stderr, "shrink, nomove: p=%p np=%p: shrink moved?!\n", >+ p, np); >+ if (np != (char *)-1) >+ munmap(np, 256*1024); >+ >+ p = mkmap(1024*1024); >+ np = mremap(p, 1024*1024, 256*1024, MREMAP_MAYMOVE); /* shrink, maymove */ >+ if (np == (char *)-1) >+ perror("mremap(shrink, maymove)"); >+ if (np != p) >+ fprintf(stderr, "shrink, maymove: p=%p np=%p: shrink moved?!\n", >+ p, np); >+ if (np != (char *)-1) >+ munmap(np, 256*1024); >+ >+ p = mkmap(1024*1024); >+ np = mremap(p, 1024*1024, 2048*1024, 0); /* grow, fixed */ >+ if (np == (char *)-1) >+ perror("mremap(grow, fixed)"); >+ if (np != p) >+ fprintf(stderr, "grow, nomove: p=%p np=%p: shrink moved?!\n", >+ p, np); >+ if (np != (char *)-1) >+ munmap(np, 2048*1024); >+ >+ p = mkmap(1024*1024); >+ np = mremap(p, 1024*1024, 2048*1024, MREMAP_MAYMOVE); /* grow, maymove */ >+ if (np == (char *)-1) >+ perror("mremap(grow, maymove)"); >+ if (np != p) >+ fprintf(stderr, "grow, maymove: p=%p np=%p: shrink moved?!\n", >+ p, np); >+ if (np != (char *)-1) >+ munmap(np, 2048*1024); >+ >+ p = mkmap(1024*1024); >+ munmap(p+512*1024, 4096); >+ np = mremap(p, 512*1024, 1024*1024, 0); /* grow, nomove, constrained */ >+ if (np == (char *)-1) >+ perror("mremap(grow, nomove, constrained)"); >+ else if (np == p) >+ fprintf(stderr, "grow, maymove, constrained: p=%p np=%p (managed to grow without moving?!)\n", >+ p, np); >+ if (np != (char *)-1) >+ munmap(np, 1024*1024); >+ >+ p = mkmap(1024*1024); >+ munmap(p+512*1024, 4096); >+ >+ np = mremap(p, 512*1024, 1024*1024, MREMAP_MAYMOVE); /* grow, maymove, constrained */ >+ if (np == (char *)-1) >+ perror("mremap(grow, maymove, constrained)"); >+ if (np == p) >+ fprintf(stderr, "grow, maymove, constrained: p=%p np=%p (managed to grow without moving?!)\n", >+ p, np); >+ if (np != (char *)-1) >+ munmap(np, 1024*1024); >+ >+ return 0; >+} >diff -ruN valgrind-2.1.0/none/tests/mremap.stderr.exp valgrind/none/tests/mremap.stderr.exp >--- valgrind-2.1.0/none/tests/mremap.stderr.exp 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/mremap.stderr.exp 2003-12-22 02:48:50.000000000 -0600 >@@ -0,0 +1,3 @@ >+ >+mremap(grow, nomove, constrained): Cannot allocate memory >+ >diff -ruN valgrind-2.1.0/none/tests/mremap.vgtest valgrind/none/tests/mremap.vgtest >--- valgrind-2.1.0/none/tests/mremap.vgtest 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/mremap.vgtest 2003-12-22 02:48:50.000000000 -0600 >@@ -0,0 +1 @@ >+prog: mremap >diff -ruN valgrind-2.1.0/none/tests/munmap_exe.c valgrind/none/tests/munmap_exe.c >--- valgrind-2.1.0/none/tests/munmap_exe.c 2002-09-23 04:36:25.000000000 -0500 >+++ valgrind/none/tests/munmap_exe.c 2004-01-03 08:24:42.000000000 -0600 >@@ -11,7 +11,7 @@ > { > void* m; > >- m = mmap(NULL, 100, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); >+ m = mmap(NULL, 100, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_ANON, -1, 0); > > if (m == (void*)-1) { > fprintf(stderr, "error mmapping\n"); >diff -ruN valgrind-2.1.0/none/tests/pth_specific.c valgrind/none/tests/pth_specific.c >--- valgrind-2.1.0/none/tests/pth_specific.c 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/pth_specific.c 2002-09-23 04:36:25.000000000 -0500 >@@ -0,0 +1,104 @@ >+/******************************************************** >+ * An example source module to accompany... >+ * >+ * "Using POSIX Threads: Programming with Pthreads" >+ * by Brad nichols, Dick Buttlar, Jackie Farrell >+ * O'Reilly & Associates, Inc. >+ * >+ ******************************************************** >+ * specific.c >+ * >+ */ >+#include <stdlib.h> >+#include <stdio.h> >+#include <unistd.h> >+ >+#include <sys/time.h> >+ >+#include <pthread.h> >+ >+#define NUM_THREADS 3 >+pthread_key_t saved_time_key; >+ >+ >+void free_time(void *arg ) >+{ >+ struct timeval *timev=(struct timeval *)arg; >+ printf("free_time:\n"); >+ free(timev); >+} >+ >+void save_the_time(void) >+{ >+ struct timeval *timev; >+ >+ timev = (struct timeval *)malloc(sizeof(struct timeval)); >+ >+ gettimeofday(timev, NULL); >+ >+ printf("save_the_time: \t\t%ld %ld\n",timev->tv_sec, timev->tv_usec); >+ >+ >+ pthread_setspecific(saved_time_key, (void *)timev); >+ >+} >+ >+void what_time_did_i_save(void) >+{ >+ struct timeval *timev; >+ >+ timev = pthread_getspecific(saved_time_key); >+ >+ printf("what_time_did_i_save: \t%ld %ld\n",timev->tv_sec, timev->tv_usec); >+ >+} >+ >+void *thread_routine(void *arg) >+{ >+ int *my_id=(int *)arg; >+ >+ printf("thread_routine %d\n", *my_id); >+ >+ save_the_time(); >+ >+ what_time_did_i_save(); >+ >+ return(NULL); >+} >+ >+extern int >+main(void) >+{ >+ int i, *id_arg; >+ pthread_t threads[NUM_THREADS]; >+ >+ id_arg = (int *)malloc(NUM_THREADS*sizeof(int)); >+ >+ printf("main : initializing the key\n"); >+ pthread_key_create(&saved_time_key, free_time); >+ >+ printf("main : spawing the threads\n"); >+ for (i = 0; i < NUM_THREADS; i++) { >+ >+ id_arg[i] = i; >+ >+ pthread_create(&(threads[i]), >+ NULL, >+ thread_routine, >+ (void *) &(id_arg[i])); >+ } >+ >+ >+ for (i = 0; i < NUM_THREADS; i++) { >+ pthread_join(threads[i], NULL); >+ printf("main : thread %d has finished. \n", i); >+ } >+ >+ printf("main : goodbye\n"); >+ >+ return 0; >+} >+ >+ >+ >+ >diff -ruN valgrind-2.1.0/none/tests/resolv.c valgrind/none/tests/resolv.c >--- valgrind-2.1.0/none/tests/resolv.c 2003-04-02 18:50:21.000000000 -0600 >+++ valgrind/none/tests/resolv.c 2004-01-03 08:24:42.000000000 -0600 >@@ -1,4 +1,5 @@ > >+#include <netinet/in.h> > #include <resolv.h> > #include <stdio.h> > >diff -ruN valgrind-2.1.0/none/tests/seg_override.c valgrind/none/tests/seg_override.c >--- valgrind-2.1.0/none/tests/seg_override.c 2002-10-02 05:36:46.000000000 -0500 >+++ valgrind/none/tests/seg_override.c 2004-01-20 19:27:27.000000000 -0600 >@@ -110,8 +110,8 @@ > { > asm volatile("movl %2, %%eax\n\t" > "movl %1, %%edx\n\t" >- "movl %0, %%gs\n\t" >- "movl %%eax, %%gs:(%%edx)\t" >+ "movl %0, %%fs\n\t" >+ "movl %%eax, %%fs:(%%edx)\t" > : > : "r" (7 /* LDT(TI), least privilege */ + (ldt_entno << 3)), > "r" (offset), "r" (val) >diff -ruN valgrind-2.1.0/none/tests/sha1_test.c valgrind/none/tests/sha1_test.c >--- valgrind-2.1.0/none/tests/sha1_test.c 2003-04-15 09:58:05.000000000 -0500 >+++ valgrind/none/tests/sha1_test.c 2004-01-03 08:24:42.000000000 -0600 >@@ -42,6 +42,8 @@ > > #define SHA1HANDSOFF > >+#include <config.h> >+ > #include <string.h> > #include <sys/types.h> /* for u_int*_t */ > >@@ -63,7 +65,14 @@ > void SHA1Update(SHA1_CTX* context, const unsigned char* data, u_int32_t len); > void SHA1Final(unsigned char digest[20], SHA1_CTX* context); > /* ================ end of sha1.h ================ */ >+ >+#ifdef HAVE_SYS_ENDIAN_H >+#include <sys/endian.h> >+#endif >+ >+#ifdef HAVE_ENDIAN_H > #include <endian.h> >+#endif > > #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) > >diff -ruN valgrind-2.1.0/none/tests/smc1.c valgrind/none/tests/smc1.c >--- valgrind-2.1.0/none/tests/smc1.c 2002-09-23 04:36:25.000000000 -0500 >+++ valgrind/none/tests/smc1.c 2003-12-15 20:05:15.000000000 -0600 >@@ -30,6 +30,7 @@ > */ > > #include <stdio.h> >+#include "valgrind.h" > > typedef unsigned int Addr; > typedef unsigned char UChar; >@@ -44,7 +45,7 @@ > printf("in p %d\n", n); > } > >-UChar code[100]; >+UChar code[10]; > > /* Make `code' be JMP-32 dest */ > void set_dest ( Addr dest ) >@@ -58,6 +59,9 @@ > code[2] = ((delta >> 8) & 0xFF); > code[3] = ((delta >> 16) & 0xFF); > code[4] = ((delta >> 24) & 0xFF); >+ >+ /* XXX this should be automatic */ >+ VALGRIND_DISCARD_TRANSLATIONS(code, sizeof(code)); > } > > int main ( void ) >diff -ruN valgrind-2.1.0/none/tests/smc1.stdout.exp valgrind/none/tests/smc1.stdout.exp >--- valgrind-2.1.0/none/tests/smc1.stdout.exp 2002-09-23 04:36:25.000000000 -0500 >+++ valgrind/none/tests/smc1.stdout.exp 2003-12-15 20:05:15.000000000 -0600 >@@ -1,10 +1,10 @@ > in p 0 >-in p 1 >+in q 1 > in p 2 >-in p 3 >+in q 3 > in p 4 >-in p 5 >+in q 5 > in p 6 >-in p 7 >+in q 7 > in p 8 >-in p 9 >+in q 9 >diff -ruN valgrind-2.1.0/none/tests/syscall-restart1.c valgrind/none/tests/syscall-restart1.c >--- valgrind-2.1.0/none/tests/syscall-restart1.c 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/syscall-restart1.c 2004-01-15 20:15:23.000000000 -0600 >@@ -0,0 +1,63 @@ >+#include <stdio.h> >+#include <unistd.h> >+#include <signal.h> >+#include <errno.h> >+#include <sys/wait.h> >+#include <string.h> >+ >+/* Make sure that a blocking syscall returns EINTR if hit by a signal, >+ and there's no SA_RESTART */ >+ >+static void handler(int s) >+{ >+} >+ >+int main() >+{ >+ int pid; >+ int fds[2]; >+ >+ if (pipe(fds) == -1) { >+ perror("FAIL: pipe\n"); >+ return 1; >+ } >+ >+ pid = fork(); >+ >+ if (pid == -1) { >+ perror("fork failed"); >+ return 1; >+ } >+ >+ if (pid == 0) { >+ char ch = '?'; >+ int ret; >+ struct sigaction sa; >+ >+ sa.sa_handler = handler; >+ sigfillset(&sa.sa_mask); >+ sa.sa_flags = 0; /* no SA_RESTART */ >+ >+ sigaction(SIGUSR1, &sa, NULL); >+ >+ close(fds[1]); >+ ret = read(fds[0], &ch, 1); >+ >+ if (ret != -1 || errno != EINTR) >+ fprintf(stderr, "FAIL: expected EINTR, not %d/%s/%c\n", >+ ret, strerror(errno), ch); >+ } else { >+ signal(SIGPIPE, SIG_IGN); >+ >+ close(fds[0]); >+ sleep(1); >+ kill(pid, SIGUSR1); >+ sleep(1); >+ if (write(fds[1], "x", 1) != -1 || errno != EPIPE) >+ fprintf(stderr, "FAIL: expected write to fail with EPIPE\n"); >+ >+ waitpid(pid, NULL, 0); >+ } >+ >+ return 0; >+} >diff -ruN valgrind-2.1.0/none/tests/syscall-restart1.stderr.exp valgrind/none/tests/syscall-restart1.stderr.exp >--- valgrind-2.1.0/none/tests/syscall-restart1.stderr.exp 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/syscall-restart1.stderr.exp 2004-01-15 20:15:23.000000000 -0600 >@@ -0,0 +1,3 @@ >+ >+ >+ >diff -ruN valgrind-2.1.0/none/tests/syscall-restart1.vgtest valgrind/none/tests/syscall-restart1.vgtest >--- valgrind-2.1.0/none/tests/syscall-restart1.vgtest 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/syscall-restart1.vgtest 2004-01-15 20:15:23.000000000 -0600 >@@ -0,0 +1 @@ >+prog: syscall-restart1 >diff -ruN valgrind-2.1.0/none/tests/syscall-restart2.c valgrind/none/tests/syscall-restart2.c >--- valgrind-2.1.0/none/tests/syscall-restart2.c 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/syscall-restart2.c 2004-01-15 20:15:23.000000000 -0600 >@@ -0,0 +1,62 @@ >+#include <stdio.h> >+#include <unistd.h> >+#include <signal.h> >+#include <errno.h> >+#include <sys/wait.h> >+#include <string.h> >+ >+/* Make sure that a blocking syscall restarts if hit by a signal, >+ and SA_RESTART is set */ >+ >+static void handler(int s) >+{ >+} >+ >+int main() >+{ >+ int pid; >+ int fds[2]; >+ >+ if (pipe(fds) == -1) { >+ perror("FAIL: pipe\n"); >+ return 1; >+ } >+ >+ pid = fork(); >+ >+ if (pid == -1) { >+ perror("fork failed"); >+ return 1; >+ } >+ >+ if (pid == 0) { >+ char ch = '?'; >+ int ret; >+ struct sigaction sa; >+ >+ sa.sa_handler = handler; >+ sigfillset(&sa.sa_mask); >+ sa.sa_flags = SA_RESTART; >+ >+ sigaction(SIGUSR1, &sa, NULL); >+ >+ close(fds[1]); >+ ret = read(fds[0], &ch, 1); >+ >+ if (ret != 1 || ch != 'x') >+ fprintf(stderr, "FAIL: expected 1 byte, not %d/%s/%c\n", >+ ret, strerror(errno), ch); >+ } else { >+ signal(SIGPIPE, SIG_IGN); >+ >+ close(fds[0]); >+ sleep(1); >+ kill(pid, SIGUSR1); >+ sleep(1); >+ write(fds[1], "x", 1); >+ >+ waitpid(pid, NULL, 0); >+ } >+ >+ return 0; >+} >diff -ruN valgrind-2.1.0/none/tests/syscall-restart2.stderr.exp valgrind/none/tests/syscall-restart2.stderr.exp >--- valgrind-2.1.0/none/tests/syscall-restart2.stderr.exp 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/syscall-restart2.stderr.exp 2004-01-15 20:15:23.000000000 -0600 >@@ -0,0 +1,3 @@ >+ >+ >+ >diff -ruN valgrind-2.1.0/none/tests/syscall-restart2.vgtest valgrind/none/tests/syscall-restart2.vgtest >--- valgrind-2.1.0/none/tests/syscall-restart2.vgtest 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/syscall-restart2.vgtest 2004-01-15 20:15:23.000000000 -0600 >@@ -0,0 +1 @@ >+prog: syscall-restart2 >diff -ruN valgrind-2.1.0/none/tests/tls.c valgrind/none/tests/tls.c >--- valgrind-2.1.0/none/tests/tls.c 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/tls.c 2004-01-20 19:27:27.000000000 -0600 >@@ -0,0 +1,101 @@ >+#include <pthread.h> >+#include <stdio.h> >+#include <unistd.h> >+#include <time.h> >+ >+#define COUNT 10 >+ >+static int race; >+static __thread int local; >+__thread int global; >+extern __thread int static_extern; >+extern __thread int so_extern; >+ >+/* deliberate failure */ >+static int *test_race(void) >+{ >+ return ∽̱ >+} >+ >+static int *test_local(void) >+{ >+ return &local; >+} >+ >+static int *test_global(void) >+{ >+ return &global; >+} >+ >+static int *test_static_extern(void) >+{ >+ return &static_extern; >+} >+ >+static int *test_so_extern(void) >+{ >+ return &so_extern; >+} >+ >+static const struct timespec awhile = { 0, 100000000 }; >+ >+typedef int *(*func_t)(void); >+struct testcase { >+ const char *name; >+ func_t func; >+}; >+ >+static void *tls_ptr(void *p) >+{ >+ struct testcase *test = (struct testcase *)p; >+ int *ip = (*test->func)(); >+ int here = 0; >+ int i; >+ >+ for(i = 0; i < COUNT; i++) { >+ int a = (*ip)++; >+ int b = here++; >+ if (a != b) >+ printf("tls_ptr: case \"%s\" has mismatch: *ip=%d here=%d\n", >+ test->name, a, b); >+ nanosleep(&awhile, 0); >+ } >+ >+ return 0; >+} >+ >+int *test_so_extern(void); >+int *test_so_local(void); >+int *test_so_global(void); >+ >+static const struct testcase tests[] = { >+#define T(t) { #t, test_##t } >+ T(race), >+ T(local), >+ T(global), >+ T(static_extern), >+ T(so_extern), >+ T(so_local), >+ T(so_global), >+#undef T >+}; >+ >+#define NTESTS (sizeof(tests)/sizeof(*tests)) >+ >+int main() >+{ >+ pthread_t threads[NTESTS*2]; >+ int curthread = 0; >+ static >+ int i; >+ >+ for(i = 0; i < NTESTS; i++) { >+ pthread_create(&threads[curthread++], NULL, tls_ptr, (void *)&tests[i]); >+ pthread_create(&threads[curthread++], NULL, tls_ptr, (void *)&tests[i]); >+ } >+ >+ for(i = 0; i < curthread; i++) >+ pthread_join(threads[i], NULL); >+ >+ return 0; >+} >diff -ruN valgrind-2.1.0/none/tests/tls.stderr.exp valgrind/none/tests/tls.stderr.exp >--- valgrind-2.1.0/none/tests/tls.stderr.exp 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/tls.stderr.exp 2004-01-20 19:27:27.000000000 -0600 >@@ -0,0 +1,2 @@ >+ >+ >diff -ruN valgrind-2.1.0/none/tests/tls.stdout.exp valgrind/none/tests/tls.stdout.exp >--- valgrind-2.1.0/none/tests/tls.stdout.exp 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/tls.stdout.exp 2004-01-20 19:27:27.000000000 -0600 >@@ -0,0 +1,19 @@ >+tls_ptr: case "race" has mismatch: *ip=1 here=0 >+tls_ptr: case "race" has mismatch: *ip=2 here=1 >+tls_ptr: case "race" has mismatch: *ip=3 here=1 >+tls_ptr: case "race" has mismatch: *ip=4 here=2 >+tls_ptr: case "race" has mismatch: *ip=5 here=2 >+tls_ptr: case "race" has mismatch: *ip=6 here=3 >+tls_ptr: case "race" has mismatch: *ip=7 here=3 >+tls_ptr: case "race" has mismatch: *ip=8 here=4 >+tls_ptr: case "race" has mismatch: *ip=9 here=4 >+tls_ptr: case "race" has mismatch: *ip=10 here=5 >+tls_ptr: case "race" has mismatch: *ip=11 here=5 >+tls_ptr: case "race" has mismatch: *ip=12 here=6 >+tls_ptr: case "race" has mismatch: *ip=13 here=6 >+tls_ptr: case "race" has mismatch: *ip=14 here=7 >+tls_ptr: case "race" has mismatch: *ip=15 here=7 >+tls_ptr: case "race" has mismatch: *ip=16 here=8 >+tls_ptr: case "race" has mismatch: *ip=17 here=8 >+tls_ptr: case "race" has mismatch: *ip=18 here=9 >+tls_ptr: case "race" has mismatch: *ip=19 here=9 >diff -ruN valgrind-2.1.0/none/tests/tls.vgtest valgrind/none/tests/tls.vgtest >--- valgrind-2.1.0/none/tests/tls.vgtest 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/tls.vgtest 2004-01-20 19:27:27.000000000 -0600 >@@ -0,0 +1 @@ >+prog: tls >diff -ruN valgrind-2.1.0/none/tests/tls2.c valgrind/none/tests/tls2.c >--- valgrind-2.1.0/none/tests/tls2.c 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/tls2.c 2004-01-20 19:27:27.000000000 -0600 >@@ -0,0 +1 @@ >+__thread int static_extern; >diff -ruN valgrind-2.1.0/none/tests/tls2_so.c valgrind/none/tests/tls2_so.c >--- valgrind-2.1.0/none/tests/tls2_so.c 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/tls2_so.c 2004-01-20 19:27:27.000000000 -0600 >@@ -0,0 +1 @@ >+__thread int so_extern; >diff -ruN valgrind-2.1.0/none/tests/tls_so.c valgrind/none/tests/tls_so.c >--- valgrind-2.1.0/none/tests/tls_so.c 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/tls_so.c 2004-01-20 19:27:27.000000000 -0600 >@@ -0,0 +1,20 @@ >+#include <pthread.h> >+ >+extern __thread int so_extern; >+static __thread int so_local; >+extern __thread int global; >+ >+int *test_so_extern(void) >+{ >+ return &so_extern; >+} >+ >+int *test_so_local(void) >+{ >+ return &so_local; >+} >+ >+int *test_so_global(void) >+{ >+ return &global; >+} >diff -ruN valgrind-2.1.0/none/tests/yield.c valgrind/none/tests/yield.c >--- valgrind-2.1.0/none/tests/yield.c 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/yield.c 2003-12-18 03:08:51.000000000 -0600 >@@ -0,0 +1,70 @@ >+#include <pthread.h> >+#include <stdio.h> >+#include <stdlib.h> >+#include <unistd.h> >+ >+static pthread_mutex_t m_go; >+static pthread_cond_t c_go; >+ >+static volatile int alive; >+ >+static int sch_yield; >+static int rep_nop; >+ >+static void *th1(void *v) >+{ >+ pthread_mutex_lock(&m_go); >+ while(!alive) >+ pthread_cond_wait(&c_go, &m_go); >+ pthread_mutex_unlock(&m_go); >+ >+ while(alive) { >+ sch_yield++; >+ sched_yield(); >+ } >+ >+ return 0; >+} >+ >+static void *th2(void *v) >+{ >+ pthread_mutex_lock(&m_go); >+ while(!alive) >+ pthread_cond_wait(&c_go, &m_go); >+ pthread_mutex_unlock(&m_go); >+ >+ while(alive) { >+ rep_nop++; >+ asm volatile ("rep; nop" : : : "memory"); >+ } >+ >+ return 0; >+} >+ >+int main() >+{ >+ pthread_t a, b; >+ >+ pthread_create(&a, NULL, th1, NULL); >+ pthread_create(&b, NULL, th2, NULL); >+ >+ /* make sure both threads start at the same time */ >+ pthread_mutex_lock(&m_go); >+ alive = 1; >+ pthread_cond_signal(&c_go); >+ pthread_mutex_unlock(&m_go); >+ >+ sleep(1); >+ >+ alive = 0; >+ pthread_join(a, NULL); >+ pthread_join(b, NULL); >+ >+ if (abs(sch_yield - rep_nop) < 2) >+ printf("PASS\n"); >+ else >+ printf("FAIL sch_yield=%d rep_nop=%d\n", >+ sch_yield, rep_nop); >+ >+ return 0; >+} >diff -ruN valgrind-2.1.0/none/tests/yield.stderr.exp valgrind/none/tests/yield.stderr.exp >--- valgrind-2.1.0/none/tests/yield.stderr.exp 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/yield.stderr.exp 2003-12-18 03:08:51.000000000 -0600 >@@ -0,0 +1,2 @@ >+ >+ >diff -ruN valgrind-2.1.0/none/tests/yield.stdout.exp valgrind/none/tests/yield.stdout.exp >--- valgrind-2.1.0/none/tests/yield.stdout.exp 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/yield.stdout.exp 2003-12-18 03:08:51.000000000 -0600 >@@ -0,0 +1 @@ >+PASS >diff -ruN valgrind-2.1.0/none/tests/yield.vgtest valgrind/none/tests/yield.vgtest >--- valgrind-2.1.0/none/tests/yield.vgtest 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/none/tests/yield.vgtest 2003-12-18 03:08:51.000000000 -0600 >@@ -0,0 +1 @@ >+prog: yield >diff -ruN valgrind-2.1.0/tests/.cvsignore valgrind/tests/.cvsignore >--- valgrind-2.1.0/tests/.cvsignore 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/tests/.cvsignore 2002-10-04 06:43:11.000000000 -0500 >@@ -0,0 +1,4 @@ >+Makefile.in >+Makefile >+vg_regtest >+true >diff -ruN valgrind-2.1.0/tests/CVS/Entries valgrind/tests/CVS/Entries >--- valgrind-2.1.0/tests/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/tests/CVS/Entries 2004-02-11 22:51:48.412452432 -0600 >@@ -0,0 +1,11 @@ >+/.cvsignore/1.3/Fri Oct 4 11:43:11 2002// >+/Makefile.am/1.35/Mon Jan 19 19:14:18 2004// >+/cputest.c/1.2/Wed Feb 11 23:33:29 2004// >+/filter_addresses/1.3/Sat Jan 3 15:02:59 2004// >+/filter_discards/1.2/Mon Sep 23 09:36:24 2002// >+/filter_numbers/1.1/Fri Oct 31 18:52:18 2003// >+/filter_stderr_basic/1.15/Wed Jan 21 15:08:04 2004// >+/filter_test_paths/1.3/Mon May 5 16:18:51 2003// >+/true.c/1.1/Fri Oct 4 11:35:47 2002// >+/vg_regtest.in/1.18/Mon Jan 19 19:14:18 2004// >+D >diff -ruN valgrind-2.1.0/tests/CVS/Entries.Log valgrind/tests/CVS/Entries.Log >--- valgrind-2.1.0/tests/CVS/Entries.Log 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/tests/CVS/Entries.Log 2004-02-11 22:51:48.418451520 -0600 >@@ -0,0 +1,5 @@ >+A D/cachesim//// >+A D/corecheck//// >+A D/memcheck//// >+A D/none//// >+A D/unused//// >diff -ruN valgrind-2.1.0/tests/CVS/Repository valgrind/tests/CVS/Repository >--- valgrind-2.1.0/tests/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/tests/CVS/Repository 2004-02-11 22:51:48.365459576 -0600 >@@ -0,0 +1 @@ >+valgrind/tests >diff -ruN valgrind-2.1.0/tests/CVS/Root valgrind/tests/CVS/Root >--- valgrind-2.1.0/tests/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/tests/CVS/Root 2004-02-11 22:51:48.365459576 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/tests/Makefile.am valgrind/tests/Makefile.am >--- valgrind-2.1.0/tests/Makefile.am 2003-12-04 10:15:25.000000000 -0600 >+++ valgrind/tests/Makefile.am 2004-01-19 13:14:18.000000000 -0600 >@@ -12,12 +12,13 @@ > EXTRA_DIST = $(noinst_SCRIPTS) > > check_PROGRAMS = \ >- true >+ true \ >+ cputest > > AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -g > AM_CXXFLAGS = $(AM_CFLAGS) > > # generic C ones > true_SOURCES = true.c >- >+cputest_SOURCES = cputest.c > >diff -ruN valgrind-2.1.0/tests/Makefile.in valgrind/tests/Makefile.in >--- valgrind-2.1.0/tests/Makefile.in 2003-12-14 09:50:22.000000000 -0600 >+++ valgrind/tests/Makefile.in 2004-02-11 22:52:35.803247936 -0600 >@@ -1,8 +1,8 @@ >-# Makefile.in generated by automake 1.7.6 from Makefile.am. >+# Makefile.in generated by automake 1.8.2 from Makefile.am. > # @configure_input@ > >-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 >-# Free Software Foundation, Inc. >+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, >+# 2003, 2004 Free Software Foundation, Inc. > # This Makefile.in is free software; the Free Software Foundation > # gives unlimited permission to copy and/or distribute it, > # with or without modifications, as long as this notice is preserved. >@@ -14,6 +14,8 @@ > > @SET_MAKE@ > >+SOURCES = $(cputest_SOURCES) $(true_SOURCES) >+ > srcdir = @srcdir@ > top_srcdir = @top_srcdir@ > VPATH = @srcdir@ >@@ -21,7 +23,6 @@ > pkglibdir = $(libdir)/@PACKAGE@ > pkgincludedir = $(includedir)/@PACKAGE@ > top_builddir = .. >- > am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd > INSTALL = @INSTALL@ > install_sh_DATA = $(install_sh) -c -m 644 >@@ -36,6 +37,44 @@ > PRE_UNINSTALL = : > POST_UNINSTALL = : > host_triplet = @host@ >+check_PROGRAMS = true$(EXEEXT) cputest$(EXEEXT) >+subdir = tests >+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ >+ $(srcdir)/vg_regtest.in >+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >+am__aclocal_m4_deps = $(top_srcdir)/configure.in >+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ >+ $(ACLOCAL_M4) >+mkinstalldirs = $(mkdir_p) >+CONFIG_HEADER = $(top_builddir)/config.h >+CONFIG_CLEAN_FILES = vg_regtest >+am_cputest_OBJECTS = cputest.$(OBJEXT) >+cputest_OBJECTS = $(am_cputest_OBJECTS) >+cputest_LDADD = $(LDADD) >+am_true_OBJECTS = true.$(OBJEXT) >+true_OBJECTS = $(am_true_OBJECTS) >+true_LDADD = $(LDADD) >+SCRIPTS = $(noinst_SCRIPTS) >+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) >+depcomp = $(SHELL) $(top_srcdir)/depcomp >+am__depfiles_maybe = depfiles >+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/cputest.Po ./$(DEPDIR)/true.Po >+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ >+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) >+CCLD = $(CC) >+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ >+SOURCES = $(cputest_SOURCES) $(true_SOURCES) >+DIST_SOURCES = $(cputest_SOURCES) $(true_SOURCES) >+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ >+ html-recursive info-recursive install-data-recursive \ >+ install-exec-recursive install-info-recursive \ >+ install-recursive installcheck-recursive installdirs-recursive \ >+ pdf-recursive ps-recursive uninstall-info-recursive \ >+ uninstall-recursive >+ETAGS = etags >+CTAGS = ctags >+DIST_SUBDIRS = $(SUBDIRS) >+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) > ACLOCAL = @ACLOCAL@ > AMDEP_FALSE = @AMDEP_FALSE@ > AMDEP_TRUE = @AMDEP_TRUE@ >@@ -92,6 +131,7 @@ > SHELL = @SHELL@ > STRIP = @STRIP@ > VERSION = @VERSION@ >+VG_PLATFORM = @VG_PLATFORM@ > ac_ct_CC = @ac_ct_CC@ > ac_ct_CXX = @ac_ct_CXX@ > ac_ct_RANLIB = @ac_ct_RANLIB@ >@@ -123,6 +163,7 @@ > libexecdir = @libexecdir@ > localstatedir = @localstatedir@ > mandir = @mandir@ >+mkdir_p = @mkdir_p@ > oldincludedir = @oldincludedir@ > prefix = @prefix@ > program_transform_name = @program_transform_name@ >@@ -130,9 +171,7 @@ > sharedstatedir = @sharedstatedir@ > sysconfdir = @sysconfdir@ > target_alias = @target_alias@ >- > SUBDIRS = . unused >- > noinst_SCRIPTS = \ > vg_regtest \ > filter_addresses \ >@@ -141,101 +180,82 @@ > filter_stderr_basic \ > filter_test_paths > >- > EXTRA_DIST = $(noinst_SCRIPTS) >- >-check_PROGRAMS = \ >- true >- >- > AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -g > AM_CXXFLAGS = $(AM_CFLAGS) > > # generic C ones > true_SOURCES = true.c >-subdir = tests >-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs >-CONFIG_HEADER = $(top_builddir)/config.h >-CONFIG_CLEAN_FILES = vg_regtest >-check_PROGRAMS = true$(EXEEXT) >-am_true_OBJECTS = true.$(OBJEXT) >-true_OBJECTS = $(am_true_OBJECTS) >-true_LDADD = $(LDADD) >-true_DEPENDENCIES = >-true_LDFLAGS = >-SCRIPTS = $(noinst_SCRIPTS) >- >- >-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) >-depcomp = $(SHELL) $(top_srcdir)/depcomp >-am__depfiles_maybe = depfiles >-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/true.Po >-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ >- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) >-CCLD = $(CC) >-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ >-DIST_SOURCES = $(true_SOURCES) >- >-RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ >- ps-recursive install-info-recursive uninstall-info-recursive \ >- all-recursive install-data-recursive install-exec-recursive \ >- installdirs-recursive install-recursive uninstall-recursive \ >- check-recursive installcheck-recursive >-DIST_COMMON = Makefile.am Makefile.in vg_regtest.in >-DIST_SUBDIRS = $(SUBDIRS) >-SOURCES = $(true_SOURCES) >- >+cputest_SOURCES = cputest.c > all: all-recursive > > .SUFFIXES: > .SUFFIXES: .c .o .obj >-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) >+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) >+ @for dep in $?; do \ >+ case '$(am__configure_deps)' in \ >+ *$$dep*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ >+ && exit 0; \ >+ exit 1;; \ >+ esac; \ >+ done; \ >+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \ > cd $(top_srcdir) && \ > $(AUTOMAKE) --gnu tests/Makefile >-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status >- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) >-vg_regtest: $(top_builddir)/config.status vg_regtest.in >+.PRECIOUS: Makefile >+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status >+ @case '$?' in \ >+ *config.status*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ >+ *) \ >+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ >+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ >+ esac; >+ >+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+ >+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+vg_regtest: $(top_builddir)/config.status $(srcdir)/vg_regtest.in > cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ > > clean-checkPROGRAMS: > -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) >+cputest$(EXEEXT): $(cputest_OBJECTS) $(cputest_DEPENDENCIES) >+ @rm -f cputest$(EXEEXT) >+ $(LINK) $(cputest_LDFLAGS) $(cputest_OBJECTS) $(cputest_LDADD) $(LIBS) > true$(EXEEXT): $(true_OBJECTS) $(true_DEPENDENCIES) > @rm -f true$(EXEEXT) > $(LINK) $(true_LDFLAGS) $(true_OBJECTS) $(true_LDADD) $(LIBS) > > mostlyclean-compile: >- -rm -f *.$(OBJEXT) core *.core >+ -rm -f *.$(OBJEXT) > > distclean-compile: > -rm -f *.tab.c > >+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cputest.Po@am__quote@ > @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/true.Po@am__quote@ > >-distclean-depend: >- -rm -rf ./$(DEPDIR) >- > .c.o: >-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ >-@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ >-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ >-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ >-@am__fastdepCC_TRUE@ fi >+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ >+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi > @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >-@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< >+@am__fastdepCC_FALSE@ $(COMPILE) -c $< > > .c.obj: >-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ >-@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ >-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ >-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ >-@am__fastdepCC_TRUE@ fi >+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ >+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi > @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ > @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ >-@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` >+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` > uninstall-info-am: > > # This directory's subdirectories are mostly independent; you can cd >@@ -297,14 +317,6 @@ > test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ > done > >-ETAGS = etags >-ETAGSFLAGS = >- >-CTAGS = ctags >-CTAGSFLAGS = >- >-tags: TAGS >- > ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) > list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ > unique=`for i in $$list; do \ >@@ -313,6 +325,7 @@ > $(AWK) ' { files[$$0] = 1; } \ > END { for (i in files) print i; }'`; \ > mkid -fID $$unique >+tags: TAGS > > TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ > $(TAGS_FILES) $(LISP) >@@ -338,7 +351,6 @@ > test -z "$(ETAGS_ARGS)$$tags$$unique" \ > || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ > $$tags $$unique >- > ctags: CTAGS > CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ > $(TAGS_FILES) $(LISP) >@@ -361,10 +373,6 @@ > > distclean-tags: > -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags >-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) >- >-top_distdir = .. >-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) > > distdir: $(DISTFILES) > @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ >@@ -378,7 +386,7 @@ > dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ > if test "$$dir" != "$$file" && test "$$dir" != "."; then \ > dir="/$$dir"; \ >- $(mkinstalldirs) "$(distdir)$$dir"; \ >+ $(mkdir_p) "$(distdir)$$dir"; \ > else \ > dir=''; \ > fi; \ >@@ -395,13 +403,13 @@ > done > list='$(SUBDIRS)'; for subdir in $$list; do \ > if test "$$subdir" = .; then :; else \ >- test -d $(distdir)/$$subdir \ >- || mkdir $(distdir)/$$subdir \ >+ test -d "$(distdir)/$$subdir" \ >+ || mkdir "$(distdir)/$$subdir" \ > || exit 1; \ > (cd $$subdir && \ > $(MAKE) $(AM_MAKEFLAGS) \ >- top_distdir="$(top_distdir)" \ >- distdir=../$(distdir)/$$subdir \ >+ top_distdir="../$(top_distdir)" \ >+ distdir="../$(distdir)/$$subdir" \ > distdir) \ > || exit 1; \ > fi; \ >@@ -412,7 +420,6 @@ > all-am: Makefile $(SCRIPTS) > installdirs: installdirs-recursive > installdirs-am: >- > install: install-recursive > install-exec: install-exec-recursive > install-data: install-data-recursive >@@ -424,7 +431,7 @@ > installcheck: installcheck-recursive > install-strip: > $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ >- INSTALL_STRIP_FLAG=-s \ >+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ > `test -z '$(STRIP)' || \ > echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install > mostlyclean-generic: >@@ -432,7 +439,7 @@ > clean-generic: > > distclean-generic: >- -rm -f Makefile $(CONFIG_CLEAN_FILES) >+ -rm -f $(CONFIG_CLEAN_FILES) > > maintainer-clean-generic: > @echo "This command is intended for maintainers to use" >@@ -442,14 +449,17 @@ > clean-am: clean-checkPROGRAMS clean-generic mostlyclean-am > > distclean: distclean-recursive >- >-distclean-am: clean-am distclean-compile distclean-depend \ >- distclean-generic distclean-tags >+ -rm -rf ./$(DEPDIR) >+ -rm -f Makefile >+distclean-am: clean-am distclean-compile distclean-generic \ >+ distclean-tags > > dvi: dvi-recursive > > dvi-am: > >+html: html-recursive >+ > info: info-recursive > > info-am: >@@ -465,7 +475,8 @@ > installcheck-am: > > maintainer-clean: maintainer-clean-recursive >- >+ -rm -rf ./$(DEPDIR) >+ -rm -f Makefile > maintainer-clean-am: distclean-am maintainer-clean-generic > > mostlyclean: mostlyclean-recursive >@@ -484,22 +495,18 @@ > > uninstall-info: uninstall-info-recursive > >-.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ >- clean-checkPROGRAMS clean-generic clean-recursive ctags \ >- ctags-recursive distclean distclean-compile distclean-depend \ >- distclean-generic distclean-recursive distclean-tags distdir \ >- dvi dvi-am dvi-recursive info info-am info-recursive install \ >- install-am install-data install-data-am install-data-recursive \ >- install-exec install-exec-am install-exec-recursive \ >- install-info install-info-am install-info-recursive install-man \ >- install-recursive install-strip installcheck installcheck-am \ >- installdirs installdirs-am installdirs-recursive \ >- maintainer-clean maintainer-clean-generic \ >- maintainer-clean-recursive mostlyclean mostlyclean-compile \ >- mostlyclean-generic mostlyclean-recursive pdf pdf-am \ >- pdf-recursive ps ps-am ps-recursive tags tags-recursive \ >- uninstall uninstall-am uninstall-info-am \ >- uninstall-info-recursive uninstall-recursive >+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ >+ clean clean-checkPROGRAMS clean-generic clean-recursive ctags \ >+ ctags-recursive distclean distclean-compile distclean-generic \ >+ distclean-recursive distclean-tags distdir dvi dvi-am html \ >+ html-am info info-am install install-am install-data \ >+ install-data-am install-exec install-exec-am install-info \ >+ install-info-am install-man install-strip installcheck \ >+ installcheck-am installdirs installdirs-am maintainer-clean \ >+ maintainer-clean-generic maintainer-clean-recursive \ >+ mostlyclean mostlyclean-compile mostlyclean-generic \ >+ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ >+ uninstall uninstall-am uninstall-info-am > > # Tell versions [3.59,3.63) of GNU make to not export all variables. > # Otherwise a system limit (for SysV at least) may be exceeded. >diff -ruN valgrind-2.1.0/tests/cachesim/CVS/Entries valgrind/tests/cachesim/CVS/Entries >--- valgrind-2.1.0/tests/cachesim/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/tests/cachesim/CVS/Entries 2004-02-11 22:51:48.415451976 -0600 >@@ -0,0 +1 @@ >+D >diff -ruN valgrind-2.1.0/tests/cachesim/CVS/Repository valgrind/tests/cachesim/CVS/Repository >--- valgrind-2.1.0/tests/cachesim/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/tests/cachesim/CVS/Repository 2004-02-11 22:51:48.413452280 -0600 >@@ -0,0 +1 @@ >+valgrind/tests/cachesim >diff -ruN valgrind-2.1.0/tests/cachesim/CVS/Root valgrind/tests/cachesim/CVS/Root >--- valgrind-2.1.0/tests/cachesim/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/tests/cachesim/CVS/Root 2004-02-11 22:51:48.413452280 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/tests/corecheck/CVS/Entries valgrind/tests/corecheck/CVS/Entries >--- valgrind-2.1.0/tests/corecheck/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/tests/corecheck/CVS/Entries 2004-02-11 22:51:48.416451824 -0600 >@@ -0,0 +1 @@ >+D >diff -ruN valgrind-2.1.0/tests/corecheck/CVS/Repository valgrind/tests/corecheck/CVS/Repository >--- valgrind-2.1.0/tests/corecheck/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/tests/corecheck/CVS/Repository 2004-02-11 22:51:48.416451824 -0600 >@@ -0,0 +1 @@ >+valgrind/tests/corecheck >diff -ruN valgrind-2.1.0/tests/corecheck/CVS/Root valgrind/tests/corecheck/CVS/Root >--- valgrind-2.1.0/tests/corecheck/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/tests/corecheck/CVS/Root 2004-02-11 22:51:48.415451976 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/tests/cputest.c valgrind/tests/cputest.c >--- valgrind-2.1.0/tests/cputest.c 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/tests/cputest.c 2004-02-11 17:33:29.000000000 -0600 >@@ -0,0 +1,58 @@ >+#include <stdio.h> >+#include <stdlib.h> >+#include <string.h> >+ >+static __inline__ void cpuid(unsigned int n, >+ unsigned int *a, unsigned int *b, >+ unsigned int *c, unsigned int *d) >+{ >+ __asm__ __volatile__ ( >+ "cpuid" >+ : "=a" (*a), "=b" (*b), "=c" (*c), "=d" (*d) /* output */ >+ : "0" (n) /* input */ >+ ); >+} >+ >+int main(int argc, char **argv) >+{ >+ unsigned int level = 0; >+ unsigned int mask = 0; >+ unsigned int a; >+ unsigned int b; >+ unsigned int c; >+ unsigned int d; >+ >+ if ( argc == 2 ) { >+ if ( strcmp( argv[1], "cmov" ) == 0 ) { >+ level = 1; >+ mask = 1 << 15; >+ } else if ( strcmp( argv[1], "mmx" ) == 0 ) { >+ level = 1; >+ mask = 1 << 23; >+ } else if ( strcmp( argv[1], "mmxext" ) == 0 ) { >+ level = 0x80000001; >+ mask = 1 << 22; >+ } else if ( strcmp( argv[1], "sse" ) == 0 ) { >+ level = 1; >+ mask = 1 << 25; >+ } else if ( strcmp( argv[1], "sse2" ) == 0 ) { >+ level = 1; >+ mask = 1 << 26; >+ } >+ } >+ >+ if ( level == 0 || mask == 0 ) { >+ fprintf( stderr, "usage: cputest [cmov|mmx|mmxext|sse|sse2]\n" ); >+ exit( 1 ); >+ } >+ >+ cpuid( level & 0x80000000, &a, &b, &c, &d ); >+ >+ if ( a >= level ) { >+ cpuid( level, &a, &b, &c, &d ); >+ >+ if ( ( d & mask ) != 0 ) exit( 0 ); >+ } >+ >+ exit( 1 ); >+} >diff -ruN valgrind-2.1.0/tests/filter_addresses valgrind/tests/filter_addresses >--- valgrind-2.1.0/tests/filter_addresses 2002-09-23 04:36:24.000000000 -0500 >+++ valgrind/tests/filter_addresses 2004-01-03 09:02:59.000000000 -0600 >@@ -1,4 +1,4 @@ > #! /bin/sh > >-sed "s/0x[0-9A-Fa-f]\+/0x......../g" >+sed "s/0x[0-9A-Fa-f]*/0x......../g" > >diff -ruN valgrind-2.1.0/tests/filter_stderr_basic valgrind/tests/filter_stderr_basic >--- valgrind-2.1.0/tests/filter_stderr_basic 2003-10-31 01:12:21.000000000 -0600 >+++ valgrind/tests/filter_stderr_basic 2004-01-21 09:08:04.000000000 -0600 >@@ -4,24 +4,28 @@ > # startup stuff and pid numbers. > > # Remove ==pid== and --pid-- and ++pid++ and **pid** strings >-sed "s/\(==\|--\|\+\+\|\*\*\)[0-9]\{1,5\}\1 //" | >+sed "s/\(==\|--\|\+\+\|\*\*\)[0-9]\{1,5\}\1 //" | > > # Remove "<name>, a <description> for x86-linux." line and the following >-# copyright notice line. Works for skin and core intro lines. >+# copyright notice line. Works for tool and core intro lines. > sed "/^.*, .* for x86-linux\./ , /./ d" | > > # Remove other introductory lines >-sed "/Estimated CPU clock rate is [0-9]\+ MHz/d" | >+sed "/Estimated CPU clock rate is [0-9]* MHz/d" | > sed "/For more details, rerun with: -v/d" | > > # Anonymise line numbers in vg_replace_malloc.c >-sed "s/vg_replace_malloc.c:[0-9]\+/vg_replace_malloc.c:.../" | >+sed "s/vg_replace_malloc.c:[0-9]*/vg_replace_malloc.c:.../" | > > # Anonymise vg_intercept lines >-sed "s/vg_intercept.c:[0-9]\+/vg_intercept.c:.../" | >+sed "s/vg_intercept.c:[0-9]*/vg_intercept.c:.../" | > > # Anonymise vg_libpthread lines >-sed "s/vg_libpthread.c:[0-9]\+/vg_libpthread.c:.../" | >+sed "s/vg_libpthread.c:[0-9]*/vg_libpthread.c:.../" | >+ >+# Hide suppressed error counts >+sed "s/^\(ERROR SUMMARY[^(]*(suppressed: \)[0-9]*\( from \)[0-9]*)$/\10\20)/" | >+ > > # Reduce some libc incompatibility > sed "s/ __getsockname / getsockname /" | >diff -ruN valgrind-2.1.0/tests/memcheck/CVS/Entries valgrind/tests/memcheck/CVS/Entries >--- valgrind-2.1.0/tests/memcheck/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/tests/memcheck/CVS/Entries 2004-02-11 22:51:48.417451672 -0600 >@@ -0,0 +1 @@ >+D >diff -ruN valgrind-2.1.0/tests/memcheck/CVS/Repository valgrind/tests/memcheck/CVS/Repository >--- valgrind-2.1.0/tests/memcheck/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/tests/memcheck/CVS/Repository 2004-02-11 22:51:48.416451824 -0600 >@@ -0,0 +1 @@ >+valgrind/tests/memcheck >diff -ruN valgrind-2.1.0/tests/memcheck/CVS/Root valgrind/tests/memcheck/CVS/Root >--- valgrind-2.1.0/tests/memcheck/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/tests/memcheck/CVS/Root 2004-02-11 22:51:48.416451824 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/tests/none/CVS/Entries valgrind/tests/none/CVS/Entries >--- valgrind-2.1.0/tests/none/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/tests/none/CVS/Entries 2004-02-11 22:51:48.418451520 -0600 >@@ -0,0 +1 @@ >+D >diff -ruN valgrind-2.1.0/tests/none/CVS/Repository valgrind/tests/none/CVS/Repository >--- valgrind-2.1.0/tests/none/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/tests/none/CVS/Repository 2004-02-11 22:51:48.417451672 -0600 >@@ -0,0 +1 @@ >+valgrind/tests/none >diff -ruN valgrind-2.1.0/tests/none/CVS/Root valgrind/tests/none/CVS/Root >--- valgrind-2.1.0/tests/none/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/tests/none/CVS/Root 2004-02-11 22:51:48.417451672 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/tests/unused/.cvsignore valgrind/tests/unused/.cvsignore >--- valgrind-2.1.0/tests/unused/.cvsignore 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/tests/unused/.cvsignore 2002-10-01 06:50:39.000000000 -0500 >@@ -0,0 +1,2 @@ >+Makefile.in >+Makefile >diff -ruN valgrind-2.1.0/tests/unused/CVS/Entries valgrind/tests/unused/CVS/Entries >--- valgrind-2.1.0/tests/unused/CVS/Entries 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/tests/unused/CVS/Entries 2004-02-11 22:51:48.530434496 -0600 >@@ -0,0 +1,21 @@ >+/.cvsignore/1.1/Tue Oct 1 11:50:39 2002// >+/Makefile.am/1.2/Sat Oct 5 16:19:56 2002// >+/blocked_syscall.c/1.1/Fri Oct 4 14:16:38 2002// >+/oneparam.c/1.2/Mon Sep 23 09:36:25 2002// >+/pth_cancel1.c/1.2/Mon Sep 23 09:36:25 2002// >+/pth_pause.c/1.2/Mon Sep 23 09:36:25 2002// >+/pth_semaphore1.c/1.2/Mon Sep 23 09:36:25 2002// >+/pth_signal1.c/1.2/Mon Sep 23 09:36:25 2002// >+/pth_signal2.c/1.2/Mon Sep 23 09:36:25 2002// >+/pth_signal_gober.c/1.2/Mon Sep 23 09:36:25 2002// >+/pth_sigpending.c/1.2/Mon Sep 23 09:36:25 2002// >+/pth_simple_mutex.c/1.2/Mon Sep 23 09:36:25 2002// >+/pth_simple_threads.c/1.2/Mon Sep 23 09:36:25 2002// >+/pth_threadpool.c/1.3/Fri Jul 4 16:18:15 2003// >+/pth_yield.c/1.2/Mon Sep 23 09:36:25 2002// >+/signal1.c/1.2/Mon Sep 23 09:36:25 2002// >+/signal3.c/1.2/Mon Sep 23 09:36:25 2002// >+/sigwait_all.c/1.2/Mon Sep 23 09:36:25 2002// >+/twoparams.c/1.2/Mon Sep 23 09:36:25 2002// >+/twoparams.s/1.2/Mon Sep 23 09:36:25 2002// >+D >diff -ruN valgrind-2.1.0/tests/unused/CVS/Repository valgrind/tests/unused/CVS/Repository >--- valgrind-2.1.0/tests/unused/CVS/Repository 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/tests/unused/CVS/Repository 2004-02-11 22:51:48.418451520 -0600 >@@ -0,0 +1 @@ >+valgrind/tests/unused >diff -ruN valgrind-2.1.0/tests/unused/CVS/Root valgrind/tests/unused/CVS/Root >--- valgrind-2.1.0/tests/unused/CVS/Root 1969-12-31 18:00:00.000000000 -0600 >+++ valgrind/tests/unused/CVS/Root 2004-02-11 22:51:48.418451520 -0600 >@@ -0,0 +1 @@ >+:pserver:anonymous@anoncvs.kde.org:/home/kde >diff -ruN valgrind-2.1.0/tests/unused/Makefile.in valgrind/tests/unused/Makefile.in >--- valgrind-2.1.0/tests/unused/Makefile.in 2003-12-14 09:50:22.000000000 -0600 >+++ valgrind/tests/unused/Makefile.in 2004-02-11 22:52:35.939227264 -0600 >@@ -1,8 +1,8 @@ >-# Makefile.in generated by automake 1.7.6 from Makefile.am. >+# Makefile.in generated by automake 1.8.2 from Makefile.am. > # @configure_input@ > >-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 >-# Free Software Foundation, Inc. >+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, >+# 2003, 2004 Free Software Foundation, Inc. > # This Makefile.in is free software; the Free Software Foundation > # gives unlimited permission to copy and/or distribute it, > # with or without modifications, as long as this notice is preserved. >@@ -13,7 +13,6 @@ > # PARTICULAR PURPOSE. > > @SET_MAKE@ >- > srcdir = @srcdir@ > top_srcdir = @top_srcdir@ > VPATH = @srcdir@ >@@ -21,7 +20,6 @@ > pkglibdir = $(libdir)/@PACKAGE@ > pkgincludedir = $(includedir)/@PACKAGE@ > top_builddir = ../.. >- > am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd > INSTALL = @INSTALL@ > install_sh_DATA = $(install_sh) -c -m 644 >@@ -36,6 +34,18 @@ > PRE_UNINSTALL = : > POST_UNINSTALL = : > host_triplet = @host@ >+subdir = tests/unused >+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in >+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >+am__aclocal_m4_deps = $(top_srcdir)/configure.in >+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ >+ $(ACLOCAL_M4) >+mkinstalldirs = $(mkdir_p) >+CONFIG_HEADER = $(top_builddir)/config.h >+CONFIG_CLEAN_FILES = >+SOURCES = >+DIST_SOURCES = >+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) > ACLOCAL = @ACLOCAL@ > AMDEP_FALSE = @AMDEP_FALSE@ > AMDEP_TRUE = @AMDEP_TRUE@ >@@ -92,6 +102,7 @@ > SHELL = @SHELL@ > STRIP = @STRIP@ > VERSION = @VERSION@ >+VG_PLATFORM = @VG_PLATFORM@ > ac_ct_CC = @ac_ct_CC@ > ac_ct_CXX = @ac_ct_CXX@ > ac_ct_RANLIB = @ac_ct_RANLIB@ >@@ -123,6 +134,7 @@ > libexecdir = @libexecdir@ > localstatedir = @localstatedir@ > mandir = @mandir@ >+mkdir_p = @mkdir_p@ > oldincludedir = @oldincludedir@ > prefix = @prefix@ > program_transform_name = @program_transform_name@ >@@ -130,7 +142,6 @@ > sharedstatedir = @sharedstatedir@ > sysconfdir = @sysconfdir@ > target_alias = @target_alias@ >- > EXTRA_DIST = \ > oneparam.c \ > pth_signal2.c \ >@@ -151,21 +162,38 @@ > twoparams.s \ > blocked_syscall.c > >-subdir = tests/unused >-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 >-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs >-CONFIG_HEADER = $(top_builddir)/config.h >-CONFIG_CLEAN_FILES = >-DIST_SOURCES = >-DIST_COMMON = Makefile.am Makefile.in > all: all-am > > .SUFFIXES: >-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) >+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) >+ @for dep in $?; do \ >+ case '$(am__configure_deps)' in \ >+ *$$dep*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ >+ && exit 0; \ >+ exit 1;; \ >+ esac; \ >+ done; \ >+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/unused/Makefile'; \ > cd $(top_srcdir) && \ > $(AUTOMAKE) --gnu tests/unused/Makefile >-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status >- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) >+.PRECIOUS: Makefile >+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status >+ @case '$?' in \ >+ *config.status*) \ >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ >+ *) \ >+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ >+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ >+ esac; >+ >+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+ >+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh >+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) >+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh > uninstall-info-am: > tags: TAGS > TAGS: >@@ -173,10 +201,6 @@ > ctags: CTAGS > CTAGS: > >-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) >- >-top_distdir = ../.. >-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) > > distdir: $(DISTFILES) > @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ >@@ -190,7 +214,7 @@ > dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ > if test "$$dir" != "$$file" && test "$$dir" != "."; then \ > dir="/$$dir"; \ >- $(mkinstalldirs) "$(distdir)$$dir"; \ >+ $(mkdir_p) "$(distdir)$$dir"; \ > else \ > dir=''; \ > fi; \ >@@ -208,7 +232,6 @@ > check-am: all-am > check: check-am > all-am: Makefile >- > installdirs: > install: install-am > install-exec: install-exec-am >@@ -221,7 +244,7 @@ > installcheck: installcheck-am > install-strip: > $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ >- INSTALL_STRIP_FLAG=-s \ >+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ > `test -z '$(STRIP)' || \ > echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install > mostlyclean-generic: >@@ -229,7 +252,7 @@ > clean-generic: > > distclean-generic: >- -rm -f Makefile $(CONFIG_CLEAN_FILES) >+ -rm -f $(CONFIG_CLEAN_FILES) > > maintainer-clean-generic: > @echo "This command is intended for maintainers to use" >@@ -239,13 +262,15 @@ > clean-am: clean-generic mostlyclean-am > > distclean: distclean-am >- >+ -rm -f Makefile > distclean-am: clean-am distclean-generic > > dvi: dvi-am > > dvi-am: > >+html: html-am >+ > info: info-am > > info-am: >@@ -261,7 +286,7 @@ > installcheck-am: > > maintainer-clean: maintainer-clean-am >- >+ -rm -f Makefile > maintainer-clean-am: distclean-am maintainer-clean-generic > > mostlyclean: mostlyclean-am >@@ -279,8 +304,8 @@ > uninstall-am: uninstall-info-am > > .PHONY: all all-am check check-am clean clean-generic distclean \ >- distclean-generic distdir dvi dvi-am info info-am install \ >- install-am install-data install-data-am install-exec \ >+ distclean-generic distdir dvi dvi-am html html-am info info-am \ >+ install install-am install-data install-data-am install-exec \ > install-exec-am install-info install-info-am install-man \ > install-strip installcheck installcheck-am installdirs \ > maintainer-clean maintainer-clean-generic mostlyclean \ >diff -ruN valgrind-2.1.0/tests/vg_regtest valgrind/tests/vg_regtest >--- valgrind-2.1.0/tests/vg_regtest 2003-12-14 09:50:55.000000000 -0600 >+++ valgrind/tests/vg_regtest 1969-12-31 18:00:00.000000000 -0600 >@@ -1,360 +0,0 @@ >-#! /usr/bin/perl >-##--------------------------------------------------------------------## >-##--- Valgrind regression testing script vg_regtest ---## >-##--------------------------------------------------------------------## >- >-# This file is part of Valgrind, an extensible x86 protected-mode >-# emulator for monitoring program execution on x86-Unixes. >-# >-# Copyright (C) 2003 Nicholas Nethercote >-# njn25@cam.ac.uk >-# >-# 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. >- >-#---------------------------------------------------------------------------- >-# usage: vg_regtest [options] <dirs | files> >-# >-# Options: >-# --all: run tests in all subdirs >-# --valgrind: valgrind to use. Default is one built from this source tree. >-# >-# The easiest way is to run all tests in valgrind/ with (assuming you installed >-# in $PREFIX): >-# >-# $PREFIX/bin/vg_regtest --all >-# >-# You can specify individual files to test, or whole directories, or both. >-# Directories are traversed recursively, except for ones named, for example, >-# CVS/ or docs/. >-# >-# Each test is defined in a file <test>.vgtest, containing one or more of the >-# following lines, in any order: >-# - prog: <prog to run> (compulsory) >-# - args: <args for prog> (default: none) >-# - vgopts: <Valgrind options> (default: none) >-# - stdout_filter: <filter to run stdout through> (default: none) >-# - stderr_filter: <filter to run stderr through> (default: ./filter_stderr) >-# >-# Note that filters are necessary for stderr results to filter out things that >-# always change, eg. process id numbers. >-# >-# Expected stdout (filtered) is kept in <test>.stdout.exp. It can be missing >-# if it would be empty. Expected stderr (filtered) is kept in >-# <test>.stderr.exp. >-# >-# If results don't match, the output can be found in <test>.std<strm>.out, >-# and the diff between expected and actual in <test>.std<strm>.diff. >-# >-# Notes on adding regression tests for a new tool are in >-# coregrind/docs/coregrind_tools.html. >-#---------------------------------------------------------------------------- >- >-use warnings; >-use strict; >- >-#---------------------------------------------------------------------------- >-# Global vars >-#---------------------------------------------------------------------------- >-my $usage="vg_regtest [--all, --valgrind]\n"; >- >-my $tmp="vg_regtest.tmp.$$"; >- >-# Test variables >-my $vgopts; # valgrind options >-my $prog; # test prog >-my $args; # test prog args >-my $stdout_filter; # filter program to run stdout results file through >-my $stderr_filter; # filter program to run stderr results file through >- >-my @failures; # List of failed tests >- >-my $num_tests_done = 0; >-my %num_failures = (stderr => 0, stdout => 0); >- >-# Default valgrind to use is this build tree's (uninstalled) one >-my $prefix="/home/sewardj/VgHEAD/valgrind/Inst"; >-my $exec_prefix="${prefix}"; >-my $valgrind = "./coregrind/valgrind"; >- >-chomp(my $tests_dir = `pwd`); >- >-# default filter is the one named "filter_stderr" in the test's directory >-my $default_stderr_filter = "filter_stderr"; >- >- >-#---------------------------------------------------------------------------- >-# Process command line, setup >-#---------------------------------------------------------------------------- >- >-# If $prog is a relative path, it prepends $dir to it. Useful for two reasons: >-# >-# 1. Can prepend "." onto programs to avoid trouble with users who don't have >-# "." in their path (by making $dir = ".") >-# 2. Can prepend the current dir to make the command absolute to avoid >-# subsequent trouble when we change directories. >-# >-# Also checks the program exists and is executable. >-sub validate_program ($$$) >-{ >- my ($dir, $prog, $must_be_executable) = @_; >- >- # If absolute path, leave it alone. If relative, make it >- # absolute -- by prepending current dir -- so we can change >- # dirs and still use it. >- $prog = "$dir/$prog" if ($prog !~ /^\//); >- (-f $prog) or die "vg_regtest: `$prog' not found or not a file ($dir)\n"; >- if ($must_be_executable) { >- (-x $prog) or die "vg_regtest: `$prog' not executable ($dir)\n"; >- } >- >- return $prog; >-} >- >-sub process_command_line() >-{ >- my $alldirs = 0; >- my @fs; >- >- for my $arg (@ARGV) { >- if ($arg =~ /^-/) { >- if ($arg =~ /^--all$/) { >- $alldirs = 1; >- } elsif ($arg =~ /^--valgrind=(.*)$/) { >- $valgrind = $1; >- } else { >- die $usage; >- } >- } else { >- push(@fs, $arg); >- } >- } >- $valgrind = validate_program($tests_dir, $valgrind, 0); >- >- if ($alldirs) { >- @fs = (); >- foreach my $f (glob "*") { >- push(@fs, $f) if (-d $f); >- } >- } >- >- (0 != @fs) or die "No test files or directories specified\n"; >- >- return @fs; >-} >- >-#---------------------------------------------------------------------------- >-# Read a .vgtest file >-#---------------------------------------------------------------------------- >-sub read_vgtest_file($) >-{ >- my ($f) = @_; >- >- # Defaults. >- ($vgopts, $prog, $args, $stdout_filter, $stderr_filter) = >- ("", undef, "", undef, undef); >- >- # Every test directory must have a "filter_stderr" >- $stderr_filter = validate_program(".", $default_stderr_filter, 1); >- >- open(INPUTFILE, "< $f") || die "File $f not openable\n"; >- >- while (my $line = <INPUTFILE>) { >- if ($line =~ /^\s*vgopts:\s*(.*)$/) { >- $vgopts = $1; >- } elsif ($line =~ /^\s*prog:\s*(.*)$/) { >- $prog = validate_program(".", $1, 1); >- } elsif ($line =~ /^\s*args:\s*(.*)$/) { >- $args = $1; >- } elsif ($line =~ /^\s*stdout_filter:\s*(.*)$/) { >- $stdout_filter = validate_program(".", $1, 1); >- } elsif ($line =~ /^\s*stderr_filter:\s*(.*)$/) { >- $stderr_filter = validate_program(".", $1, 1); >- } else { >- die "Bad line in $f: $line\n"; >- } >- } >- close(INPUTFILE); >- >- if (!defined $prog) { >- die "no `prog:' line in `$f'\n"; >- } >-} >- >-#---------------------------------------------------------------------------- >-# Do one test >-#---------------------------------------------------------------------------- >-# Since most of the program time is spent in system() calls, need this to >-# propagate a Ctrl-C enabling us to quit. >-sub mysystem($) >-{ >- (system($_[0]) != 2) or exit 1; # 2 is SIGINT >-} >- >-# from a directory name like "/foo/cachesim/tests/" determine the tool name >-sub determine_tool() >-{ >- my $dir = `pwd`; >- $dir =~ /.*\/([^\/]+)\/tests.*/; # foo/tool_name/tests/foo >- return $1; >-} >- >-sub do_one_test($$) >-{ >- my ($dir, $vgtest) = @_; >- $vgtest =~ /^(.*)\.vgtest/; >- my $name = $1; >- my $fullname = "$dir/$name"; >- >- read_vgtest_file($vgtest); >- >- printf("%-16s valgrind $vgopts $prog $args\n", "$name:"); >- >- # Pass the appropriate --tool option for the directory (can be overridden >- # by an "args:" or "args.dev:" line, though). >- # Also, because the default valgrind is coregrind/valgrind which isn't >- # executable, prepend `sh'. >- my $tool=determine_tool(); >- mysystem("sh $valgrind --tool=$tool --in-place=$tests_dir $vgopts $prog $args > $name.stdout.out 2> $name.stderr.out"); >- >- if (defined $stdout_filter) { >- mysystem("$stdout_filter < $name.stdout.out > $tmp"); >- rename($tmp, "$name.stdout.out"); >- } >- >- mysystem("$stderr_filter < $name.stderr.out > $tmp"); >- rename($tmp, "$name.stderr.out"); >- >- # If stdout expected empty, .exp file might be missing so diff with >- # /dev/null >- my $stdout_exp = ( -r "$name.stdout.exp" >- ? "$name.stdout.exp" >- : "/dev/null" ); >- >- my $stderr_exp = "$name.stderr.exp"; >- (-r $stderr_exp) or die "Could not read `$stderr_exp'\n"; >- >- mysystem("diff -C0 $stdout_exp $name.stdout.out > $name.stdout.diff"); >- mysystem("diff -C0 $stderr_exp $name.stderr.out > $name.stderr.diff"); >- >- for my $ext ("stdout", "stderr") { >- if (-s "$name.$ext.diff") { >- print "*** $name failed ($ext) ***\n"; >- push(@failures, sprintf("%-40s ($ext)", "$fullname")); >- $num_failures{$ext}++; >- } else { >- unlink("$name.$ext.out", "$name.$ext.diff"); >- } >- } >- $num_tests_done++; >-} >- >-#---------------------------------------------------------------------------- >-# Test one directory (and any subdirs) >-#---------------------------------------------------------------------------- >-sub test_one_dir($$); # forward declaration >- >-sub test_one_dir($$) >-{ >- my ($dir, $prev_dirs) = @_; >- $dir =~ s/\/$//; # trim a trailing '/' >- >- # ignore dirs into which we should not recurse >- if ($dir =~ /^(BitKeeper|CVS|SCCS|docs|doc)$/) { return; } >- >- chdir($dir) or die "Could not change into $dir\n"; >- >- # Nb: Don't prepend a '/' to the base directory >- my $full_dir = $prev_dirs . ($prev_dirs eq "" ? "" : "/") . $dir; >- my $dashes = "-" x (50 - length $full_dir); >- >- my @fs = glob "*"; >- my @vgtests = grep { $_ =~ /\.vgtest$/ } @fs; >- my $found_tests = (0 != (grep { $_ =~ /\.vgtest$/ } @fs)); >- >- if ($found_tests) { >- print "-- Running tests in $full_dir $dashes\n"; >- } >- foreach my $f (@fs) { >- if (-d $f) { >- test_one_dir($f, $full_dir); >- } elsif ($f =~ /\.vgtest$/) { >- do_one_test($full_dir, $f); >- } >- } >- if ($found_tests) { >- print "-- Finished tests in $full_dir $dashes\n"; >- } >- >- chdir(".."); >-} >- >-#---------------------------------------------------------------------------- >-# Summarise results >-#---------------------------------------------------------------------------- >-sub plural($) >-{ >- return ( $_[0] == 1 ? "" : "s" ); >-} >- >-sub summarise_results >-{ >- my $x = ( $num_tests_done == 1 ? "test" : "tests" ); >- >- printf("\n== %d test%s, %d stderr failure%s, %d stdout failure%s =================\n", >- $num_tests_done, plural($num_tests_done), >- $num_failures{"stderr"}, plural($num_failures{"stderr"}), >- $num_failures{"stdout"}, plural($num_failures{"stdout"})); >- >- foreach my $failure (@failures) { >- print "$failure\n"; >- } >- print "\n"; >-} >- >-#---------------------------------------------------------------------------- >-# main(), sort of >-#---------------------------------------------------------------------------- >- >-# nuke VALGRIND_OPTS >-$ENV{"VALGRIND_OPTS"} = ""; >- >-my @fs = process_command_line(); >-foreach my $f (@fs) { >- if (-d $f) { >- test_one_dir($f, ""); >- } else { >- # Allow the .vgtest suffix to be given or omitted >- if ($f =~ /.vgtest$/ && -r $f) { >- # do nothing >- } elsif (-r "$f.vgtest") { >- $f = "$f.vgtest"; >- } else { >- die "`$f' neither a directory nor a readable test file/name\n" >- } >- my $dir = `dirname $f`; chomp $dir; >- my $file = `basename $f`; chomp $file; >- chdir($dir) or die "Could not change into $dir\n"; >- do_one_test($dir, $file); >- chdir($tests_dir); >- } >-} >-summarise_results(); >- >-##--------------------------------------------------------------------## >-##--- end vg_regtest ---## >-##--------------------------------------------------------------------## >diff -ruN valgrind-2.1.0/tests/vg_regtest.in valgrind/tests/vg_regtest.in >--- valgrind-2.1.0/tests/vg_regtest.in 2003-11-18 18:55:32.000000000 -0600 >+++ valgrind/tests/vg_regtest.in 2004-01-19 13:14:18.000000000 -0600 >@@ -49,6 +49,7 @@ > # - vgopts: <Valgrind options> (default: none) > # - stdout_filter: <filter to run stdout through> (default: none) > # - stderr_filter: <filter to run stderr through> (default: ./filter_stderr) >+# - cpu_test: <cpu feature required for test> (default: none) > # > # Note that filters are necessary for stderr results to filter out things that > # always change, eg. process id numbers. >@@ -80,6 +81,7 @@ > my $args; # test prog args > my $stdout_filter; # filter program to run stdout results file through > my $stderr_filter; # filter program to run stderr results file through >+my $cpu_test; # cpu feature to check for before running test > > my @failures; # List of failed tests > >@@ -165,8 +167,8 @@ > my ($f) = @_; > > # Defaults. >- ($vgopts, $prog, $args, $stdout_filter, $stderr_filter) = >- ("", undef, "", undef, undef); >+ ($vgopts, $prog, $args, $stdout_filter, $stderr_filter, $cpu_test) = >+ ("", undef, "", undef, undef, undef); > > # Every test directory must have a "filter_stderr" > $stderr_filter = validate_program(".", $default_stderr_filter, 1); >@@ -184,6 +186,8 @@ > $stdout_filter = validate_program(".", $1, 1); > } elsif ($line =~ /^\s*stderr_filter:\s*(.*)$/) { > $stderr_filter = validate_program(".", $1, 1); >+ } elsif ($line =~ /^\s*cpu_test:\s*(.*)$/) { >+ $cpu_test = $1; > } else { > die "Bad line in $f: $line\n"; > } >@@ -222,14 +226,16 @@ > > read_vgtest_file($vgtest); > >+ if (defined $cpu_test) { >+ return unless system("../../tests/cputest $cpu_test") == 0; >+ } >+ > printf("%-16s valgrind $vgopts $prog $args\n", "$name:"); > > # Pass the appropriate --tool option for the directory (can be overridden > # by an "args:" or "args.dev:" line, though). >- # Also, because the default valgrind is coregrind/valgrind which isn't >- # executable, prepend `sh'. > my $tool=determine_tool(); >- mysystem("sh $valgrind --tool=$tool --in-place=$tests_dir $vgopts $prog $args > $name.stdout.out 2> $name.stderr.out"); >+ mysystem("VALGRINDLIB=$tests_dir/.in_place $valgrind --tool=$tool $vgopts $prog $args > $name.stdout.out 2> $name.stderr.out"); > > if (defined $stdout_filter) { > mysystem("$stdout_filter < $name.stdout.out > $tmp"); >diff -ruN valgrind-2.1.0/valgrind.spec valgrind/valgrind.spec >--- valgrind-2.1.0/valgrind.spec 2003-12-14 09:50:54.000000000 -0600 >+++ valgrind/valgrind.spec 1969-12-31 18:00:00.000000000 -0600 >@@ -1,51 +0,0 @@ >-Summary: Valgrind Memory Debugger >-Name: valgrind >-Version: 2.1.0 >-Release: 1 >-Copyright: GPL >-Group: Development/Debuggers >-Packager: Jeremy Fitzhardinge <jeremy@goop.org> >-Source: valgrind-2.1.0.tar.bz2 >- >-Buildroot: %{_tmppath}/valgrind >- >-%description >- >-Valgrind is a GPL'd system for debugging and profiling x86-Linux programs. >-With the tools that come with Valgrind, you can automatically detect >-many memory management and threading bugs, avoiding hours of frustrating >-bug-hunting, making your programs more stable. You can also perform >-detailed profiling to help speed up your programs. >- >-The Valgrind distribution includes four tools: two memory error >-detectors, a thread error detector, and a cache profiler. Several other >-tools have been built with Valgrind. >- >-%prep >-%setup -n valgrind-2.1.0 >- >-%build >-./configure --prefix=/usr >-make >- >-%install >-make install prefix=$RPM_BUILD_ROOT/usr >- >-%files >-%defattr(-,root,root) >-/usr/include/valgrind/valgrind.h >-/usr/include/valgrind/memcheck.h >-/usr/include/valgrind/helgrind.h >-/usr/include/valgrind/vg_constants_skin.h >-/usr/include/valgrind/vg_kerneliface.h >-/usr/include/valgrind/vg_skin.h >-/usr/bin/valgrind >-/usr/bin/cg_annotate >-/usr/lib/valgrind/* >-/usr/bin/valgrind-listener >- >-%doc >-/usr/share/doc/valgrind/* >- >-%clean >-[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf ${RPM_BUILD_ROOT} >diff -ruN valgrind-2.1.0/valgrind.spec.in valgrind/valgrind.spec.in >--- valgrind-2.1.0/valgrind.spec.in 2003-12-03 15:44:44.000000000 -0600 >+++ valgrind/valgrind.spec.in 2004-01-24 16:32:56.000000000 -0600 >@@ -29,7 +29,7 @@ > make > > %install >-make install prefix=$RPM_BUILD_ROOT/usr >+make install DESTDIR=$RPM_BUILD_ROOT > > %files > %defattr(-,root,root) >@@ -41,8 +41,10 @@ > /usr/include/valgrind/vg_skin.h > /usr/bin/valgrind > /usr/bin/cg_annotate >+/usr/lib/valgrind > /usr/lib/valgrind/* > /usr/bin/valgrind-listener >+/usr/lib/pkgconfig/valgrind.pc > > %doc > /usr/share/doc/valgrind/*
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 32966
:
25410
|
25450
| 25451 |
25452