* acinclude.m4 (GDBSERVER_HAVE_THREAD_DB_TYPE): New macro based
authorThiago Jung Bauermann <bauerman@br.ibm.com>
Fri, 13 Apr 2012 19:56:05 +0000 (19:56 +0000)
committerThiago Jung Bauermann <bauerman@br.ibm.com>
Fri, 13 Apr 2012 19:56:05 +0000 (19:56 +0000)
on BFD_HAVE_SYS_PROCFS_TYPE.
* configure.ac: Look for lwpid_t and psaddr_t in libthread_db.h.
* configure: Regenerate.
* config.in: Likewise.

gdb/gdbserver/ChangeLog
gdb/gdbserver/acinclude.m4
gdb/gdbserver/config.in
gdb/gdbserver/configure
gdb/gdbserver/configure.ac

index 0eb9f6cc611357db5a1f3937a2085e8db3bcd971..b252f5d23805df3d9cf81fe12e965047defb73d7 100644 (file)
@@ -1,3 +1,11 @@
+2012-04-13  Thiago Jung Bauermann  <thiago.bauermann@linaro.org>
+
+       * acinclude.m4 (GDBSERVER_HAVE_THREAD_DB_TYPE): New macro based
+       on BFD_HAVE_SYS_PROCFS_TYPE.
+       * configure.ac: Look for lwpid_t and psaddr_t in libthread_db.h.
+       * configure: Regenerate.
+       * config.in: Likewise.
+
 2012-04-13  H.J. Lu  <hongjiu.lu@intel.com>
 
        * Makefile.in (clean): Also remove x32.c x32-linux.c
index 87d0db5f02e67057e47b762abb9d131795ce404a..12eb12bcc70c42d5cf012a734e247ca677baf653 100644 (file)
@@ -7,3 +7,21 @@ sinclude(../../config/override.m4)
 dnl For ACX_PKGVERSION and ACX_BUGURL.
 sinclude(../../config/acx.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.
+
+AC_DEFUN([GDBSERVER_HAVE_THREAD_DB_TYPE],
+[AC_MSG_CHECKING([for $1 in thread_db.h])
+ AC_CACHE_VAL(gdbserver_cv_have_thread_db_type_$1,
+   [AC_TRY_COMPILE([
+#include <thread_db.h>],
+      [$1 avar],
+      gdbserver_cv_have_thread_db_type_$1=yes,
+      gdbserver_cv_have_thread_db_type_$1=no
+   )])
+ if test $gdbserver_cv_have_thread_db_type_$1 = yes; then
+   AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]), 1,
+            [Define if <thread_db.h> has $1.])
+ fi
+ AC_MSG_RESULT($gdbserver_cv_have_thread_db_type_$1)
+])
index 53feb19b5e861a9af1209cfc4ce3788bd3a240b4..8dcf3499852f718b862634fc19f9a44f4492a5c0 100644 (file)
 /* Define to 1 if the system has the type `long long int'. */
 #undef HAVE_LONG_LONG_INT
 
-/* Define if <sys/procfs.h> has lwpid_t. */
+/* Define if <thread_db.h> has lwpid_t. */
 #undef HAVE_LWPID_T
 
 /* Define to 1 if you have the <malloc.h> header file. */
 /* Define to 1 if you have the <proc_service.h> header file. */
 #undef HAVE_PROC_SERVICE_H
 
-/* Define if <sys/procfs.h> has psaddr_t. */
+/* Define if <thread_db.h> has psaddr_t. */
 #undef HAVE_PSADDR_T
 
 /* Define if the target supports PTRACE_GETFPXREGS for extended register
index ebb6698d34ba2d82c731b69d44b47a8fb26c394f..b2980d6cc2ef68edee6cd19b4defce18e272a4ec 100755 (executable)
@@ -5430,6 +5430,80 @@ $as_echo "$bfd_cv_have_sys_procfs_type_elf_fpregset_t" >&6; }
 
 fi
 
+if test "$bfd_cv_have_sys_procfs_type_lwpid_t" != yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lwpid_t in thread_db.h" >&5
+$as_echo_n "checking for lwpid_t in thread_db.h... " >&6; }
+ if test "${gdbserver_cv_have_thread_db_type_lwpid_t+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <thread_db.h>
+int
+main ()
+{
+lwpid_t avar
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gdbserver_cv_have_thread_db_type_lwpid_t=yes
+else
+  gdbserver_cv_have_thread_db_type_lwpid_t=no
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+ if test $gdbserver_cv_have_thread_db_type_lwpid_t = yes; then
+
+$as_echo "#define HAVE_LWPID_T 1" >>confdefs.h
+
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdbserver_cv_have_thread_db_type_lwpid_t" >&5
+$as_echo "$gdbserver_cv_have_thread_db_type_lwpid_t" >&6; }
+
+fi
+
+if test "$bfd_cv_have_sys_procfs_type_psaddr_t" != yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for psaddr_t in thread_db.h" >&5
+$as_echo_n "checking for psaddr_t in thread_db.h... " >&6; }
+ if test "${gdbserver_cv_have_thread_db_type_psaddr_t+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <thread_db.h>
+int
+main ()
+{
+psaddr_t avar
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gdbserver_cv_have_thread_db_type_psaddr_t=yes
+else
+  gdbserver_cv_have_thread_db_type_psaddr_t=no
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+ if test $gdbserver_cv_have_thread_db_type_psaddr_t = yes; then
+
+$as_echo "#define HAVE_PSADDR_T 1" >>confdefs.h
+
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdbserver_cv_have_thread_db_type_psaddr_t" >&5
+$as_echo "$gdbserver_cv_have_thread_db_type_psaddr_t" >&6; }
+
+fi
+
 old_LIBS="$LIBS"
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
 $as_echo_n "checking for dlopen in -ldl... " >&6; }
index 5e989fa8b32d1351153c3d05cc70057d7812d77f..ac8223a2906afc5f4731f7a26177c3a7611e8d23 100644 (file)
@@ -278,6 +278,16 @@ if test "$ac_cv_header_sys_procfs_h" = yes; then
   BFD_HAVE_SYS_PROCFS_TYPE(elf_fpregset_t)
 fi
 
+dnl Some systems (e.g., Android) have lwpid_t defined in libthread_db.h.
+if test "$bfd_cv_have_sys_procfs_type_lwpid_t" != yes; then
+  GDBSERVER_HAVE_THREAD_DB_TYPE(lwpid_t)
+fi
+
+dnl Some systems (e.g., Android) have psaddr_t defined in libthread_db.h.
+if test "$bfd_cv_have_sys_procfs_type_psaddr_t" != yes; then
+  GDBSERVER_HAVE_THREAD_DB_TYPE(psaddr_t)
+fi
+
 dnl Check for libdl, but do not add it to LIBS as only gdbserver
 dnl needs it (and gdbreplay doesn't).
 old_LIBS="$LIBS"