|
Mark Wielaard |
c4cbc6 |
commit e40952a7bbfa5ddbd5c4dc00392363a7069d3c15
|
|
Mark Wielaard |
c4cbc6 |
Author: philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9>
|
|
Mark Wielaard |
c4cbc6 |
Date: Thu Jul 25 20:40:17 2013 +0000
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
do not include linux/ptrace.h in vgdb.c
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
Include of linux/ptrace.h was added in revision r11740,
|
|
Mark Wielaard |
c4cbc6 |
to avoid compilation error on s390x (fedora and suse).
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
The compilation error was retrieved thanks to archeological research
|
|
Mark Wielaard |
c4cbc6 |
done by Christian Borntraeger: without this include, the following was given:
|
|
Mark Wielaard |
c4cbc6 |
error: 'PT_ENDREGS' undeclared
|
|
Mark Wielaard |
c4cbc6 |
There was also some errors on ppc64 around the same time:
|
|
Mark Wielaard |
c4cbc6 |
error: 'PTRACE_GETREGS' undeclared
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
Currently, the inclusion of linux/ptrace.h gives a problem on amd64/fedora20:
|
|
Mark Wielaard |
c4cbc6 |
/usr/include/linux/ptrace.h:58:8: error: redefinition of ‘struct ptrace_peeksiginfo_args’
|
|
Mark Wielaard |
c4cbc6 |
/usr/include/sys/ptrace.h:191:8: note: originally defined here
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
According to man ptrace, it is good enough to include sys/ptrace.h
|
|
Mark Wielaard |
c4cbc6 |
(which should avoid the problem on amd64/f20).
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
The linux/ptrace.h is deemed not necessary anymore as:
|
|
Mark Wielaard |
c4cbc6 |
1. Christian has tested on sles11sp2 on s390x.
|
|
Mark Wielaard |
c4cbc6 |
2. since linux/ptrace.h was added in vgdb.c, #ifdef PT_ENDREGS and
|
|
Mark Wielaard |
c4cbc6 |
#ifdef PTRACE_GETREGS were added
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
=> remove the linux/ptrace.h
|
|
Mark Wielaard |
c4cbc6 |
(tested on x86/f12, ppc64/f18, amd64/deb6, sles11sp2/s390x)
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
Thanks to Christian for the investigations
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13471 a5019735-40e9-0310-863c-91ae7b9d1cf9
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
commit f03cccfa732b9890860ba7fb743c5f0938515ab9
|
|
Mark Wielaard |
c4cbc6 |
Author: philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9>
|
|
Mark Wielaard |
c4cbc6 |
Date: Sat Aug 3 20:34:58 2013 +0000
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
Update configure machinery to detect PTRACE_GETREGS
|
|
Mark Wielaard |
c4cbc6 |
Using #ifdef PTRACE_GETREGS gives difficulties as in some
|
|
Mark Wielaard |
c4cbc6 |
platforms (e.g. mips) PTRACE_GETREGS is not defined as a
|
|
Mark Wielaard |
c4cbc6 |
preprocessor symbols unless linux/ptrace.h is included.
|
|
Mark Wielaard |
c4cbc6 |
However, including linux/ptrace.h causes compilation error on some
|
|
Mark Wielaard |
c4cbc6 |
other platforms
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
=> better detect that PTRACE_GETREGS can be used using the
|
|
Mark Wielaard |
c4cbc6 |
configure machinery.
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
This should make vgdb PTRACE_GETREGS working again on
|
|
Mark Wielaard |
c4cbc6 |
various platforms (x86/amd64/mips/...) as PTRACE_GETREGS
|
|
Mark Wielaard |
c4cbc6 |
was disabled on all of these following r13471
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13482 a5019735-40e9-0310-863c-91ae7b9d1cf9
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
diff -ur valgrind-3.8.1.orig/config.h.in valgrind-3.8.1/config.h.in
|
|
Mark Wielaard |
c4cbc6 |
--- valgrind-3.8.1.orig/config.h.in 2013-08-08 13:32:08.086267278 +0200
|
|
Mark Wielaard |
c4cbc6 |
+++ valgrind-3.8.1/config.h.in 2013-08-08 13:49:16.000000000 +0200
|
|
Mark Wielaard |
c4cbc6 |
@@ -207,6 +207,9 @@
|
|
Mark Wielaard |
c4cbc6 |
/* Define to 1 if you have the `pthread_yield' function. */
|
|
Mark Wielaard |
c4cbc6 |
#undef HAVE_PTHREAD_YIELD
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
+/* Define to 1 if you have the `PTRACE_GETREGS' ptrace request. */
|
|
Mark Wielaard |
c4cbc6 |
+#undef HAVE_PTRACE_GETREGS
|
|
Mark Wielaard |
c4cbc6 |
+
|
|
Mark Wielaard |
c4cbc6 |
/* Define to 1 if you have the `readlinkat' function. */
|
|
Mark Wielaard |
c4cbc6 |
#undef HAVE_READLINKAT
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
diff -ur valgrind-3.8.1.orig/configure valgrind-3.8.1/configure
|
|
Mark Wielaard |
c4cbc6 |
--- valgrind-3.8.1.orig/configure 2013-08-08 13:32:08.122267596 +0200
|
|
Mark Wielaard |
c4cbc6 |
+++ valgrind-3.8.1/configure 2013-08-08 13:49:21.697522489 +0200
|
|
Mark Wielaard |
c4cbc6 |
@@ -6731,6 +6731,45 @@
|
|
Mark Wielaard |
c4cbc6 |
# Checking for various library functions and other definitions
|
|
Mark Wielaard |
c4cbc6 |
#----------------------------------------------------------------------------
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
+# Check for PTRACE_GETREGS
|
|
Mark Wielaard |
c4cbc6 |
+
|
|
Mark Wielaard |
c4cbc6 |
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTRACE_GETREGS" >&5
|
|
Mark Wielaard |
c4cbc6 |
+$as_echo_n "checking for PTRACE_GETREGS... " >&6; }
|
|
Mark Wielaard |
c4cbc6 |
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
Mark Wielaard |
c4cbc6 |
+/* end confdefs.h. */
|
|
Mark Wielaard |
c4cbc6 |
+
|
|
Mark Wielaard |
c4cbc6 |
+#include <stddef.h>
|
|
Mark Wielaard |
c4cbc6 |
+#include <sys/ptrace.h>
|
|
Mark Wielaard |
c4cbc6 |
+#include <sys/user.h>
|
|
Mark Wielaard |
c4cbc6 |
+
|
|
Mark Wielaard |
c4cbc6 |
+int
|
|
Mark Wielaard |
c4cbc6 |
+main ()
|
|
Mark Wielaard |
c4cbc6 |
+{
|
|
Mark Wielaard |
c4cbc6 |
+
|
|
Mark Wielaard |
c4cbc6 |
+ void *p;
|
|
Mark Wielaard |
c4cbc6 |
+ long res = ptrace (PTRACE_GETREGS, 0, p, p);
|
|
Mark Wielaard |
c4cbc6 |
+
|
|
Mark Wielaard |
c4cbc6 |
+ ;
|
|
Mark Wielaard |
c4cbc6 |
+ return 0;
|
|
Mark Wielaard |
c4cbc6 |
+}
|
|
Mark Wielaard |
c4cbc6 |
+_ACEOF
|
|
Mark Wielaard |
c4cbc6 |
+if ac_fn_c_try_compile "$LINENO"; then :
|
|
Mark Wielaard |
c4cbc6 |
+
|
|
Mark Wielaard |
c4cbc6 |
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
|
Mark Wielaard |
c4cbc6 |
+$as_echo "yes" >&6; }
|
|
Mark Wielaard |
c4cbc6 |
+
|
|
Mark Wielaard |
c4cbc6 |
+$as_echo "#define HAVE_PTRACE_GETREGS 1" >>confdefs.h
|
|
Mark Wielaard |
c4cbc6 |
+
|
|
Mark Wielaard |
c4cbc6 |
+
|
|
Mark Wielaard |
c4cbc6 |
+else
|
|
Mark Wielaard |
c4cbc6 |
+
|
|
Mark Wielaard |
c4cbc6 |
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
|
Mark Wielaard |
c4cbc6 |
+$as_echo "no" >&6; }
|
|
Mark Wielaard |
c4cbc6 |
+
|
|
Mark Wielaard |
c4cbc6 |
+fi
|
|
Mark Wielaard |
c4cbc6 |
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
|
Mark Wielaard |
c4cbc6 |
+
|
|
Mark Wielaard |
c4cbc6 |
+
|
|
Mark Wielaard |
c4cbc6 |
# Check for CLOCK_MONOTONIC
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CLOCK_MONOTONIC" >&5
|
|
Mark Wielaard |
c4cbc6 |
diff -ur valgrind-3.8.1.orig/configure.in valgrind-3.8.1/configure.in
|
|
Mark Wielaard |
c4cbc6 |
--- valgrind-3.8.1.orig/configure.in 2013-08-08 13:32:08.086267278 +0200
|
|
Mark Wielaard |
c4cbc6 |
+++ valgrind-3.8.1/configure.in 2013-08-08 13:32:29.283455153 +0200
|
|
Mark Wielaard |
c4cbc6 |
@@ -1004,6 +1004,25 @@
|
|
Mark Wielaard |
c4cbc6 |
# Checking for various library functions and other definitions
|
|
Mark Wielaard |
c4cbc6 |
#----------------------------------------------------------------------------
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
+# Check for PTRACE_GETREGS
|
|
Mark Wielaard |
c4cbc6 |
+
|
|
Mark Wielaard |
c4cbc6 |
+AC_MSG_CHECKING([for PTRACE_GETREGS])
|
|
Mark Wielaard |
c4cbc6 |
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
|
Mark Wielaard |
c4cbc6 |
+#include <stddef.h>
|
|
Mark Wielaard |
c4cbc6 |
+#include <sys/ptrace.h>
|
|
Mark Wielaard |
c4cbc6 |
+#include <sys/user.h>
|
|
Mark Wielaard |
c4cbc6 |
+]], [[
|
|
Mark Wielaard |
c4cbc6 |
+ void *p;
|
|
Mark Wielaard |
c4cbc6 |
+ long res = ptrace (PTRACE_GETREGS, 0, p, p);
|
|
Mark Wielaard |
c4cbc6 |
+]])], [
|
|
Mark Wielaard |
c4cbc6 |
+AC_MSG_RESULT([yes])
|
|
Mark Wielaard |
c4cbc6 |
+AC_DEFINE([HAVE_PTRACE_GETREGS], 1,
|
|
Mark Wielaard |
c4cbc6 |
+ [Define to 1 if you have the `PTRACE_GETREGS' ptrace request.])
|
|
Mark Wielaard |
c4cbc6 |
+], [
|
|
Mark Wielaard |
c4cbc6 |
+AC_MSG_RESULT([no])
|
|
Mark Wielaard |
c4cbc6 |
+])
|
|
Mark Wielaard |
c4cbc6 |
+
|
|
Mark Wielaard |
c4cbc6 |
+
|
|
Mark Wielaard |
c4cbc6 |
# Check for CLOCK_MONOTONIC
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
AC_MSG_CHECKING([for CLOCK_MONOTONIC])
|
|
Mark Wielaard |
c4cbc6 |
diff -ur valgrind-3.8.1.orig/coregrind/vgdb.c valgrind-3.8.1/coregrind/vgdb.c
|
|
Mark Wielaard |
c4cbc6 |
--- valgrind-3.8.1.orig/coregrind/vgdb.c 2013-08-08 13:32:08.080267224 +0200
|
|
Mark Wielaard |
c4cbc6 |
+++ valgrind-3.8.1/coregrind/vgdb.c 2013-08-08 13:34:39.247611009 +0200
|
|
Mark Wielaard |
c4cbc6 |
@@ -102,7 +102,6 @@
|
|
Mark Wielaard |
c4cbc6 |
#include <sys/user.h>
|
|
Mark Wielaard |
c4cbc6 |
#if defined(VGO_linux)
|
|
Mark Wielaard |
c4cbc6 |
# include <sys/prctl.h>
|
|
Mark Wielaard |
c4cbc6 |
-# include <linux/ptrace.h>
|
|
Mark Wielaard |
c4cbc6 |
#endif
|
|
Mark Wielaard |
c4cbc6 |
#endif
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
@@ -696,7 +695,7 @@
|
|
Mark Wielaard |
c4cbc6 |
// runtime check not yet done.
|
|
Mark Wielaard |
c4cbc6 |
// 0 : PTRACE_GETREGS runtime check has failed.
|
|
Mark Wielaard |
c4cbc6 |
// 1 : PTRACE_GETREGS defined and runtime check ok.
|
|
Mark Wielaard |
c4cbc6 |
-#ifdef PTRACE_GETREGS
|
|
Mark Wielaard |
c4cbc6 |
+#ifdef HAVE_PTRACE_GETREGS
|
|
Mark Wielaard |
c4cbc6 |
static int has_working_ptrace_getregs = -1;
|
|
Mark Wielaard |
c4cbc6 |
#endif
|
|
Mark Wielaard |
c4cbc6 |
|
|
Mark Wielaard |
c4cbc6 |
@@ -707,7 +706,7 @@
|
|
Mark Wielaard |
c4cbc6 |
Bool getregs (int pid, void *regs, long regs_bsz)
|
|
Mark Wielaard |
c4cbc6 |
{
|
|
Mark Wielaard |
c4cbc6 |
DEBUG(1, "getregs regs_bsz %ld\n", regs_bsz);
|
|
Mark Wielaard |
c4cbc6 |
-# ifdef PTRACE_GETREGS
|
|
Mark Wielaard |
c4cbc6 |
+# ifdef HAVE_PTRACE_GETREGS
|
|
Mark Wielaard |
c4cbc6 |
if (has_working_ptrace_getregs) {
|
|
Mark Wielaard |
c4cbc6 |
// Platforms having GETREGS
|
|
Mark Wielaard |
c4cbc6 |
long res;
|
|
Mark Wielaard |
c4cbc6 |
@@ -778,7 +777,7 @@
|
|
Mark Wielaard |
c4cbc6 |
DEBUG(1, "setregs regs_bsz %ld\n", regs_bsz);
|
|
Mark Wielaard |
c4cbc6 |
// Note : the below is checking for GETREGS, not SETREGS
|
|
Mark Wielaard |
c4cbc6 |
// as if one is defined and working, the other one should also work.
|
|
Mark Wielaard |
c4cbc6 |
-# ifdef PTRACE_GETREGS
|
|
Mark Wielaard |
c4cbc6 |
+# ifdef HAVE_PTRACE_GETREGS
|
|
Mark Wielaard |
c4cbc6 |
if (has_working_ptrace_getregs) {
|
|
Mark Wielaard |
c4cbc6 |
// Platforms having SETREGS
|
|
Mark Wielaard |
c4cbc6 |
long res;
|