+2015-07-24 Pedro Alves <palves@redhat.com>
+
+ * acinclude.m4: Include ptrace.m4.
+ * configure.ac: Call GDB_AC_PTRACE and move ptrace checks ...
+ * ptrace.m4: ... to this new file.
+
2015-07-23 Doug Evans <dje@google.com>
* dwarf2read.c (dwarf2_per_cu_data): Add comment.
dnl For --enable-build-with-cxx and COMPILER.
m4_include(build-with-cxx.m4)
+dnl For GDB_AC_PTRACE.
+m4_include(ptrace.m4)
+
## ----------------------------------------- ##
## ANSIfy the C compiler whenever possible. ##
## From Franc,ois Pinard ##
AM_LANGINFO_CODESET
GDB_AC_COMMON
-# Check the return and argument types of ptrace. No canned test for
-# this, so roll our own.
-gdb_ptrace_headers='
-#include <sys/types.h>
-#if HAVE_SYS_PTRACE_H
-# include <sys/ptrace.h>
-#endif
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-'
-# There is no point in checking if we don't have a prototype.
-AC_CHECK_DECLS(ptrace, [], [
- : ${gdb_cv_func_ptrace_ret='int'}
- : ${gdb_cv_func_ptrace_args='int,int,long,long'}
-], $gdb_ptrace_headers)
-# Check return type. Varargs (used on GNU/Linux) conflict with the
-# empty argument list, so check for that explicitly.
-AC_CACHE_CHECK([return type of ptrace], gdb_cv_func_ptrace_ret,
- AC_TRY_COMPILE($gdb_ptrace_headers,
- [extern long ptrace (enum __ptrace_request, ...);],
- gdb_cv_func_ptrace_ret='long',
- AC_TRY_COMPILE($gdb_ptrace_headers,
- [extern int ptrace ();],
- gdb_cv_func_ptrace_ret='int',
- gdb_cv_func_ptrace_ret='long')))
-AC_DEFINE_UNQUOTED(PTRACE_TYPE_RET, $gdb_cv_func_ptrace_ret,
- [Define as the return type of ptrace.])
-# Check argument types.
-AC_CACHE_CHECK([types of arguments for ptrace], gdb_cv_func_ptrace_args, [
- AC_TRY_COMPILE($gdb_ptrace_headers,
- [extern long ptrace (enum __ptrace_request, ...);],
- [gdb_cv_func_ptrace_args='int,int,long,long'],[
-for gdb_arg1 in 'int' 'long'; do
- for gdb_arg2 in 'pid_t' 'int' 'long'; do
- for gdb_arg3 in 'int *' 'caddr_t' 'int' 'long' 'void *'; do
- for gdb_arg4 in 'int' 'long' 'void *'; do
- AC_TRY_COMPILE($gdb_ptrace_headers, [
-extern $gdb_cv_func_ptrace_ret
- ptrace ($gdb_arg1, $gdb_arg2, $gdb_arg3, $gdb_arg4);
-], [gdb_cv_func_ptrace_args="$gdb_arg1,$gdb_arg2,$gdb_arg3,$gdb_arg4";
- break 4;])
- for gdb_arg5 in 'int *' 'int' 'long'; do
- AC_TRY_COMPILE($gdb_ptrace_headers, [
-extern $gdb_cv_func_ptrace_ret
- ptrace ($gdb_arg1, $gdb_arg2, $gdb_arg3, $gdb_arg4, $gdb_arg5);
-], [
-gdb_cv_func_ptrace_args="$gdb_arg1,$gdb_arg2,$gdb_arg3,$gdb_arg4,$gdb_arg5";
- break 5;])
- done
- done
- done
- done
-done
-# Provide a safe default value.
-: ${gdb_cv_func_ptrace_args='int,int,long,long'}
-])])
-ac_save_IFS=$IFS; IFS=','
-set dummy `echo "$gdb_cv_func_ptrace_args" | sed 's/\*/\*/g'`
-IFS=$ac_save_IFS
-shift
-AC_DEFINE_UNQUOTED(PTRACE_TYPE_ARG3, $[3],
- [Define to the type of arg 3 for ptrace.])
-AC_DEFINE_UNQUOTED(PTRACE_TYPE_ARG4, $[4],
- [Define to the type of arg 4 for ptrace.])
-if test -n "$[5]"; then
- AC_DEFINE_UNQUOTED(PTRACE_TYPE_ARG5, $[5],
- [Define to the type of arg 5 for ptrace.])
-fi
+# Check the return and argument types of ptrace.
+GDB_AC_PTRACE
dnl AC_FUNC_SETPGRP does not work when cross compiling
dnl Instead, assume we will have a prototype for setpgrp if cross compiling.
+2015-07-24 Pedro Alves <palves@redhat.com>
+
+ * acinclude.m4: Include ../ptrace.m4.
+ * configure.ac: Call GDB_AC_PTRACE.
+ * config.in, configure: Regenerate.
+
2015-07-24 Yao Qi <yao.qi@linaro.org>
* linux-low.c (linux_create_inferior): Remove setting to
dnl For --enable-build-with-cxx and COMPILER.
m4_include(../build-with-cxx.m4)
+dnl For GDB_AC_PTRACE.
+m4_include(../ptrace.m4)
+
dnl Check for existence of a type $1 in libthread_db.h
dnl Based on BFD_HAVE_SYS_PROCFS_TYPE in bfd/bfd.m4.
*/
#undef HAVE_DECL_PERROR
+/* Define to 1 if you have the declaration of `ptrace', and to 0 if you don't.
+ */
+#undef HAVE_DECL_PTRACE
+
/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
don't. */
#undef HAVE_DECL_SNPRINTF
/* Define if the target supports PTRACE_GETREGS for register access. */
#undef HAVE_PTRACE_GETREGS
+/* Define to 1 if you have the <ptrace.h> header file. */
+#undef HAVE_PTRACE_H
+
/* Define to 1 if you have the `pwrite' function. */
#undef HAVE_PWRITE
/* Define to 1 if you have the <sys/procfs.h> header file. */
#undef HAVE_SYS_PROCFS_H
+/* Define to 1 if you have the <sys/ptrace.h> header file. */
+#undef HAVE_SYS_PTRACE_H
+
/* Define to 1 if you have the <sys/reg.h> header file. */
#undef HAVE_SYS_REG_H
/* Additional package description */
#undef PKGVERSION
+/* Define to the type of arg 3 for ptrace. */
+#undef PTRACE_TYPE_ARG3
+
+/* Define to the type of arg 4 for ptrace. */
+#undef PTRACE_TYPE_ARG4
+
+/* Define to the type of arg 5 for ptrace. */
+#undef PTRACE_TYPE_ARG5
+
+/* Define as the return type of ptrace. */
+#undef PTRACE_TYPE_RET
+
/* Bug reporting address */
#undef REPORT_BUGS_TO
fi
+# Check the return and argument types of ptrace.
+
+
+for ac_header in sys/ptrace.h ptrace.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+eval as_val=\$$as_ac_Header
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+gdb_ptrace_headers='
+#include <sys/types.h>
+#if HAVE_SYS_PTRACE_H
+# include <sys/ptrace.h>
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+'
+# There is no point in checking if we don't have a prototype.
+ac_fn_c_check_decl "$LINENO" "ptrace" "ac_cv_have_decl_ptrace" "$gdb_ptrace_headers
+"
+if test "x$ac_cv_have_decl_ptrace" = x""yes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_PTRACE $ac_have_decl
+_ACEOF
+if test $ac_have_decl = 1; then :
+
+else
+
+ : ${gdb_cv_func_ptrace_ret='int'}
+ : ${gdb_cv_func_ptrace_args='int,int,long,long'}
+
+fi
+
+# Check return type. Varargs (used on GNU/Linux) conflict with the
+# empty argument list, so check for that explicitly.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of ptrace" >&5
+$as_echo_n "checking return type of ptrace... " >&6; }
+if test "${gdb_cv_func_ptrace_ret+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$gdb_ptrace_headers
+int
+main ()
+{
+extern long ptrace (enum __ptrace_request, ...);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ gdb_cv_func_ptrace_ret='long'
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$gdb_ptrace_headers
+int
+main ()
+{
+extern int ptrace ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ gdb_cv_func_ptrace_ret='int'
+else
+ gdb_cv_func_ptrace_ret='long'
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdb_cv_func_ptrace_ret" >&5
+$as_echo "$gdb_cv_func_ptrace_ret" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define PTRACE_TYPE_RET $gdb_cv_func_ptrace_ret
+_ACEOF
+
+# Check argument types.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking types of arguments for ptrace" >&5
+$as_echo_n "checking types of arguments for ptrace... " >&6; }
+if test "${gdb_cv_func_ptrace_args+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$gdb_ptrace_headers
+int
+main ()
+{
+extern long ptrace (enum __ptrace_request, ...);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ gdb_cv_func_ptrace_args='int,int,long,long'
+else
+
+for gdb_arg1 in 'int' 'long'; do
+ for gdb_arg2 in 'pid_t' 'int' 'long'; do
+ for gdb_arg3 in 'int *' 'caddr_t' 'int' 'long' 'void *'; do
+ for gdb_arg4 in 'int' 'long' 'void *'; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$gdb_ptrace_headers
+int
+main ()
+{
+
+extern $gdb_cv_func_ptrace_ret
+ ptrace ($gdb_arg1, $gdb_arg2, $gdb_arg3, $gdb_arg4);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ gdb_cv_func_ptrace_args="$gdb_arg1,$gdb_arg2,$gdb_arg3,$gdb_arg4";
+ break 4;
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ for gdb_arg5 in 'int *' 'int' 'long'; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$gdb_ptrace_headers
+int
+main ()
+{
+
+extern $gdb_cv_func_ptrace_ret
+ ptrace ($gdb_arg1, $gdb_arg2, $gdb_arg3, $gdb_arg4, $gdb_arg5);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+gdb_cv_func_ptrace_args="$gdb_arg1,$gdb_arg2,$gdb_arg3,$gdb_arg4,$gdb_arg5";
+ break 5;
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+ done
+ done
+ done
+done
+# Provide a safe default value.
+: ${gdb_cv_func_ptrace_args='int,int,long,long'}
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdb_cv_func_ptrace_args" >&5
+$as_echo "$gdb_cv_func_ptrace_args" >&6; }
+ac_save_IFS=$IFS; IFS=','
+set dummy `echo "$gdb_cv_func_ptrace_args" | sed 's/\*/\*/g'`
+IFS=$ac_save_IFS
+shift
+
+cat >>confdefs.h <<_ACEOF
+#define PTRACE_TYPE_ARG3 $3
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PTRACE_TYPE_ARG4 $4
+_ACEOF
+
+if test -n "$5"; then
+
+cat >>confdefs.h <<_ACEOF
+#define PTRACE_TYPE_ARG5 $5
+_ACEOF
+
+fi
+
+
# Check for UST
ustlibs=""
ustinc=""
GDB_AC_COMMON
+# Check the return and argument types of ptrace.
+GDB_AC_PTRACE
+
# Check for UST
ustlibs=""
ustinc=""
--- /dev/null
+dnl Copyright (C) 2012-2015 Free Software Foundation, Inc.
+dnl
+dnl This file is part of GDB.
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+dnl Check the return and argument types of ptrace.
+
+AC_DEFUN([GDB_AC_PTRACE],
+[
+
+AC_CHECK_HEADERS([sys/ptrace.h ptrace.h])
+
+gdb_ptrace_headers='
+#include <sys/types.h>
+#if HAVE_SYS_PTRACE_H
+# include <sys/ptrace.h>
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+'
+# There is no point in checking if we don't have a prototype.
+AC_CHECK_DECLS(ptrace, [], [
+ : ${gdb_cv_func_ptrace_ret='int'}
+ : ${gdb_cv_func_ptrace_args='int,int,long,long'}
+], $gdb_ptrace_headers)
+# Check return type. Varargs (used on GNU/Linux) conflict with the
+# empty argument list, so check for that explicitly.
+AC_CACHE_CHECK([return type of ptrace], gdb_cv_func_ptrace_ret,
+ AC_TRY_COMPILE($gdb_ptrace_headers,
+ [extern long ptrace (enum __ptrace_request, ...);],
+ gdb_cv_func_ptrace_ret='long',
+ AC_TRY_COMPILE($gdb_ptrace_headers,
+ [extern int ptrace ();],
+ gdb_cv_func_ptrace_ret='int',
+ gdb_cv_func_ptrace_ret='long')))
+AC_DEFINE_UNQUOTED(PTRACE_TYPE_RET, $gdb_cv_func_ptrace_ret,
+ [Define as the return type of ptrace.])
+# Check argument types.
+AC_CACHE_CHECK([types of arguments for ptrace], gdb_cv_func_ptrace_args, [
+ AC_TRY_COMPILE($gdb_ptrace_headers,
+ [extern long ptrace (enum __ptrace_request, ...);],
+ [gdb_cv_func_ptrace_args='int,int,long,long'],[
+for gdb_arg1 in 'int' 'long'; do
+ for gdb_arg2 in 'pid_t' 'int' 'long'; do
+ for gdb_arg3 in 'int *' 'caddr_t' 'int' 'long' 'void *'; do
+ for gdb_arg4 in 'int' 'long' 'void *'; do
+ AC_TRY_COMPILE($gdb_ptrace_headers, [
+extern $gdb_cv_func_ptrace_ret
+ ptrace ($gdb_arg1, $gdb_arg2, $gdb_arg3, $gdb_arg4);
+], [gdb_cv_func_ptrace_args="$gdb_arg1,$gdb_arg2,$gdb_arg3,$gdb_arg4";
+ break 4;])
+ for gdb_arg5 in 'int *' 'int' 'long'; do
+ AC_TRY_COMPILE($gdb_ptrace_headers, [
+extern $gdb_cv_func_ptrace_ret
+ ptrace ($gdb_arg1, $gdb_arg2, $gdb_arg3, $gdb_arg4, $gdb_arg5);
+], [
+gdb_cv_func_ptrace_args="$gdb_arg1,$gdb_arg2,$gdb_arg3,$gdb_arg4,$gdb_arg5";
+ break 5;])
+ done
+ done
+ done
+ done
+done
+# Provide a safe default value.
+: ${gdb_cv_func_ptrace_args='int,int,long,long'}
+])])
+ac_save_IFS=$IFS; IFS=','
+set dummy `echo "$gdb_cv_func_ptrace_args" | sed 's/\*/\*/g'`
+IFS=$ac_save_IFS
+shift
+AC_DEFINE_UNQUOTED(PTRACE_TYPE_ARG3, $[3],
+ [Define to the type of arg 3 for ptrace.])
+AC_DEFINE_UNQUOTED(PTRACE_TYPE_ARG4, $[4],
+ [Define to the type of arg 4 for ptrace.])
+if test -n "$[5]"; then
+ AC_DEFINE_UNQUOTED(PTRACE_TYPE_ARG5, $[5],
+ [Define to the type of arg 5 for ptrace.])
+fi
+])