Blob Blame History Raw
commit e40952a7bbfa5ddbd5c4dc00392363a7069d3c15
Author: philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date:   Thu Jul 25 20:40:17 2013 +0000

    do not include linux/ptrace.h in vgdb.c
    
    Include of linux/ptrace.h was added in revision r11740,
    to avoid compilation error on s390x (fedora and suse).
    
    The compilation error was retrieved thanks to archeological research
    done by Christian Borntraeger: without this include, the following was given:
      error: 'PT_ENDREGS' undeclared
    There was also some errors on ppc64 around the same time:
      error: 'PTRACE_GETREGS' undeclared
    
    Currently, the inclusion of linux/ptrace.h gives a problem on amd64/fedora20:
    /usr/include/linux/ptrace.h:58:8: error: redefinition of ‘struct ptrace_peeksiginfo_args’
    /usr/include/sys/ptrace.h:191:8: note: originally defined here
    
    According to man ptrace, it is good enough to include sys/ptrace.h
    (which should avoid the problem on amd64/f20).
    
    The linux/ptrace.h is deemed not necessary anymore as:
    1. Christian has tested on sles11sp2 on s390x.
    2. since linux/ptrace.h was added in vgdb.c, #ifdef PT_ENDREGS and
      #ifdef PTRACE_GETREGS were added
    
    => remove the linux/ptrace.h
    (tested on x86/f12, ppc64/f18, amd64/deb6, sles11sp2/s390x)
    
    Thanks to Christian for the investigations
    
    
    
    git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13471 a5019735-40e9-0310-863c-91ae7b9d1cf9

commit f03cccfa732b9890860ba7fb743c5f0938515ab9
Author: philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date:   Sat Aug 3 20:34:58 2013 +0000

    Update configure machinery to detect PTRACE_GETREGS
    Using #ifdef PTRACE_GETREGS gives difficulties as in some
    platforms (e.g. mips) PTRACE_GETREGS is not defined as a
    preprocessor symbols unless linux/ptrace.h is included.
    However, including linux/ptrace.h causes compilation error on some
    other platforms
    
    => better detect that PTRACE_GETREGS can be used using the
    configure machinery.
    
    This should make vgdb PTRACE_GETREGS working again on
    various platforms (x86/amd64/mips/...) as PTRACE_GETREGS
    was disabled on all of these following r13471
    
    
    
    git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13482 a5019735-40e9-0310-863c-91ae7b9d1cf9

diff -ur valgrind-3.8.1.orig/config.h.in valgrind-3.8.1/config.h.in
--- valgrind-3.8.1.orig/config.h.in	2013-08-08 13:32:08.086267278 +0200
+++ valgrind-3.8.1/config.h.in	2013-08-08 13:49:16.000000000 +0200
@@ -207,6 +207,9 @@
 /* Define to 1 if you have the `pthread_yield' function. */
 #undef HAVE_PTHREAD_YIELD
 
+/* Define to 1 if you have the `PTRACE_GETREGS' ptrace request. */
+#undef HAVE_PTRACE_GETREGS
+
 /* Define to 1 if you have the `readlinkat' function. */
 #undef HAVE_READLINKAT
 
diff -ur valgrind-3.8.1.orig/configure valgrind-3.8.1/configure
--- valgrind-3.8.1.orig/configure	2013-08-08 13:32:08.122267596 +0200
+++ valgrind-3.8.1/configure	2013-08-08 13:49:21.697522489 +0200
@@ -6731,6 +6731,45 @@
 # Checking for various library functions and other definitions
 #----------------------------------------------------------------------------
 
+# Check for PTRACE_GETREGS
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTRACE_GETREGS" >&5
+$as_echo_n "checking for PTRACE_GETREGS... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stddef.h>
+#include <sys/ptrace.h>
+#include <sys/user.h>
+
+int
+main ()
+{
+
+  void *p;
+  long res = ptrace (PTRACE_GETREGS, 0, p, p);
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_PTRACE_GETREGS 1" >>confdefs.h
+
+
+else
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
 # Check for CLOCK_MONOTONIC
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CLOCK_MONOTONIC" >&5
diff -ur valgrind-3.8.1.orig/configure.in valgrind-3.8.1/configure.in
--- valgrind-3.8.1.orig/configure.in	2013-08-08 13:32:08.086267278 +0200
+++ valgrind-3.8.1/configure.in	2013-08-08 13:32:29.283455153 +0200
@@ -1004,6 +1004,25 @@
 # Checking for various library functions and other definitions
 #----------------------------------------------------------------------------
 
+# Check for PTRACE_GETREGS
+
+AC_MSG_CHECKING([for PTRACE_GETREGS])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <stddef.h>
+#include <sys/ptrace.h>
+#include <sys/user.h>
+]], [[
+  void *p;
+  long res = ptrace (PTRACE_GETREGS, 0, p, p);
+]])], [
+AC_MSG_RESULT([yes])
+AC_DEFINE([HAVE_PTRACE_GETREGS], 1,
+          [Define to 1 if you have the `PTRACE_GETREGS' ptrace request.])
+], [
+AC_MSG_RESULT([no])
+])
+
+
 # Check for CLOCK_MONOTONIC
 
 AC_MSG_CHECKING([for CLOCK_MONOTONIC])
diff -ur valgrind-3.8.1.orig/coregrind/vgdb.c valgrind-3.8.1/coregrind/vgdb.c
--- valgrind-3.8.1.orig/coregrind/vgdb.c	2013-08-08 13:32:08.080267224 +0200
+++ valgrind-3.8.1/coregrind/vgdb.c	2013-08-08 13:34:39.247611009 +0200
@@ -102,7 +102,6 @@
 #include <sys/user.h>
 #if defined(VGO_linux)
 #  include <sys/prctl.h>
-#  include <linux/ptrace.h>
 #endif
 #endif
 
@@ -696,7 +695,7 @@
 //       runtime check not yet done.
 //   0 : PTRACE_GETREGS runtime check has failed.
 //   1 : PTRACE_GETREGS defined and runtime check ok.
-#ifdef PTRACE_GETREGS
+#ifdef HAVE_PTRACE_GETREGS
 static int has_working_ptrace_getregs = -1;
 #endif
 
@@ -707,7 +706,7 @@
 Bool getregs (int pid, void *regs, long regs_bsz)
 {
    DEBUG(1, "getregs regs_bsz %ld\n", regs_bsz);
-#  ifdef PTRACE_GETREGS
+#  ifdef HAVE_PTRACE_GETREGS
    if (has_working_ptrace_getregs) {
       // Platforms having GETREGS
       long res;
@@ -778,7 +777,7 @@
    DEBUG(1, "setregs regs_bsz %ld\n", regs_bsz);
 // Note : the below is checking for GETREGS, not SETREGS
 // as if one is defined and working, the other one should also work.
-#  ifdef PTRACE_GETREGS
+#  ifdef HAVE_PTRACE_GETREGS
    if (has_working_ptrace_getregs) {
       // Platforms having SETREGS
       long res;