summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2011-03-17 13:19:07 +0000
committerJoel Brobecker <brobecker@gnat.com>2011-03-17 13:19:07 +0000
commit8cf9d7bc2daf04b1f2c826325a2dd45a12d34fe6 (patch)
treee9ead428d22ed3bef26c893ae965a09b84007b3a /gdb
parentf240035c535706a46f27375e92907dea172d34ec (diff)
downloadgdb-8cf9d7bc2daf04b1f2c826325a2dd45a12d34fe6.tar.gz
Add 'getthrds' declaration check in configure for AIX
On newer versions of AIX (6.x and later), this function is actually declared in procinfo.h, thus causing a compilation warning when we re-declare it ourselves. This patch adds a configure check for that function allowing us to declare the function only if the declaration isn't already present in one of procinfo system header. gdb/ChangeLog: PR gdb/12116: * configure.ac: Add getthrds declaration check. * configure, config.in: Regenerate. * aix-thread.c (getthrds): Declare only if not already declared in procinfo.h. More declaration out of get_signaled_thread to global scope.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/aix-thread.c8
-rw-r--r--gdb/config.in4
-rwxr-xr-xgdb/configure16
-rw-r--r--gdb/configure.ac5
5 files changed, 38 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9645394a3ac..67fed20c88a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2011-03-17 Joel Brobecker <brobecker@gnat.com>
+
+ PR gdb/12116:
+ * configure.ac: Add getthrds declaration check.
+ * configure, config.in: Regenerate.
+ * aix-thread.c (getthrds): Declare only if not already declared
+ in procinfo.h. More declaration out of get_signaled_thread to
+ global scope.
+
2011-03-17 Phil Muldoon <pmuldoon@redhat.com>
* python/py-symtab.c: Populate symtab_object_methods,
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index 37b798a43ba..c5db262e1f6 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -58,6 +58,10 @@
#include <sched.h>
#include <sys/pthdebug.h>
+#if !HAVE_DECL_GETTHRDS
+extern int getthrds (pid_t, struct thrdsinfo64 *, int, pthdb_tid_t *, int);
+#endif
+
/* Whether to emit debugging output. */
static int debug_aix_thread;
@@ -647,10 +651,6 @@ get_signaled_thread (void)
pthdb_tid_t ktid = 0;
int result = 0;
- /* getthrds(3) isn't prototyped in any AIX 4.3.3 #include file. */
- extern int getthrds (pid_t, struct thrdsinfo64 *,
- int, pthdb_tid_t *, int);
-
while (1)
{
if (getthrds (PIDGET (inferior_ptid), &thrinf,
diff --git a/gdb/config.in b/gdb/config.in
index ccceabf96c9..01ba750ebda 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -118,6 +118,10 @@
*/
#undef HAVE_DECL_GETOPT
+/* Define to 1 if you have the declaration of `getthrds', and to 0 if you
+ don't. */
+#undef HAVE_DECL_GETTHRDS
+
/* Define to 1 if you have the declaration of `malloc', and to 0 if you don't.
*/
#undef HAVE_DECL_MALLOC
diff --git a/gdb/configure b/gdb/configure
index 5ee5ce6db49..92818a0a0e0 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -14487,6 +14487,22 @@ $as_echo "$gdb_cv_have_aix_thread_debug" >&6; }
CONFIG_SRCS="${CONFIG_SRCS} aix-thread.c"
CONFIG_OBS="${CONFIG_OBS} aix-thread.o"
CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -lpthdebug"
+
+ # Older versions of AIX do not provide the declaration for
+ # the getthrds function (it appears that it was introduced
+ # with AIX 6.x).
+ ac_fn_c_check_decl "$LINENO" "getthrds" "ac_cv_have_decl_getthrds" "#include <procinfo.h>
+"
+if test "x$ac_cv_have_decl_getthrds" = x""yes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_GETTHRDS $ac_have_decl
+_ACEOF
+
fi
;;
esac
diff --git a/gdb/configure.ac b/gdb/configure.ac
index d2b75f63752..96e0a7b79bc 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1593,6 +1593,11 @@ if test ${build} = ${host} -a ${host} = ${target} ; then
CONFIG_SRCS="${CONFIG_SRCS} aix-thread.c"
CONFIG_OBS="${CONFIG_OBS} aix-thread.o"
CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -lpthdebug"
+
+ # Older versions of AIX do not provide the declaration for
+ # the getthrds function (it appears that it was introduced
+ # with AIX 6.x).
+ AC_CHECK_DECLS(getthrds, [], [], [[#include <procinfo.h>]])
fi
;;
esac