aboutsummaryrefslogtreecommitdiff
path: root/gdb/ptrace.m4
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-04-18 17:42:50 +0100
committerPedro Alves <palves@redhat.com>2016-04-18 17:42:50 +0100
commit9b30624b65697a5f51bb7120c48686ab5506067f (patch)
treed5b7fcf105f1ec874d689b32e6355e83b93a0ea1 /gdb/ptrace.m4
parenta22df60ad216517bbca4b391bec09f9ded06ab7b (diff)
downloadgdb-9b30624b65697a5f51bb7120c48686ab5506067f.zip
gdb-9b30624b65697a5f51bb7120c48686ab5506067f.tar.gz
gdb-9b30624b65697a5f51bb7120c48686ab5506067f.tar.bz2
Fix PR gdb/19250: ptrace prototype is not detected properly in C++ mode
The ptrace args/return types detection doesn't work properly in C++ mode, on non-GNU/Linux hosts. For example, on gcc70 (NetBSD 5.1), where the prototype is: int ptrace(int, __pid_t, void*, int); configure misdetects it as: $ grep PTRACE_TYPE config.h #define PTRACE_TYPE_ARG1 int #define PTRACE_TYPE_ARG3 int * #define PTRACE_TYPE_ARG4 int /* #undef PTRACE_TYPE_ARG5 */ #define PTRACE_TYPE_RET int resulting in: ../../src/gdb/amd64bsd-nat.c: In function 'void amd64bsd_fetch_inferior_registers(target_ops*, regcache*, int)': ../../src/gdb/amd64bsd-nat.c:56: warning: dereferencing type-punned pointer will break strict-aliasing rules ../../src/gdb/amd64bsd-nat.c: In function 'void amd64bsd_store_inferior_registers(target_ops*, regcache*, int)': ../../src/gdb/amd64bsd-nat.c:104: warning: dereferencing type-punned pointer will break strict-aliasing rules ../../src/gdb/amd64bsd-nat.c:110: warning: dereferencing type-punned pointer will break strict-aliasing rules We could address this [1], however despite ptrace.m4's claim: # Needs to be tested in C++ mode, to detect whether we need to cast # the first argument to enum __ptrace_request. it appears that there's actually no need to test in C++ mode. Always running the ptrace tests in C mode works just the same on GNU/Linux. I remember experimenting with several different ways to handle the original issue back then, and maybe that was needed in some other attempt and then I didn't realize it ended up not really necessary. Confirmed that this fixes the NetBSD 5.1 C++ build, and confirmed that C and C++ builds on Fedora 23 are unaffected. [1] - https://sourceware.org/ml/gdb-patches/2016-04/msg00374.html gdb/ChangeLog: 2016-04-18 Pedro Alves <palves@redhat.com> * ptrace.m4 (GDB_AC_PTRACE): Don't run tests in C++ mode. * configure: Regenerate. gdb/gdbserver/ChangeLog: 2016-04-18 Pedro Alves <palves@redhat.com> * configure: Regenerate.
Diffstat (limited to 'gdb/ptrace.m4')
-rw-r--r--gdb/ptrace.m410
1 files changed, 0 insertions, 10 deletions
diff --git a/gdb/ptrace.m4 b/gdb/ptrace.m4
index ca2b7c6..89591d4 100644
--- a/gdb/ptrace.m4
+++ b/gdb/ptrace.m4
@@ -22,12 +22,6 @@ AC_DEFUN([GDB_AC_PTRACE],
AC_CHECK_HEADERS([sys/ptrace.h ptrace.h])
-# Needs to be tested in C++ mode, to detect whether we need to cast
-# the first argument to enum __ptrace_request.
-if test "$enable_build_with_cxx" = "yes"; then
- AC_LANG_PUSH([C++])
-fi
-
gdb_ptrace_headers='
#include <sys/types.h>
#if HAVE_SYS_PTRACE_H
@@ -97,8 +91,4 @@ if test -n "$[5]"; then
AC_DEFINE_UNQUOTED(PTRACE_TYPE_ARG5, $[5],
[Define to the type of arg 5 for ptrace.])
fi
-
-if test "$enable_build_with_cxx" = "yes"; then
- AC_LANG_POP([C++])
-fi
])