* [PATCH] Add 'getthrds' declaration check in configure for AIX
@ 2011-03-16 0:17 Joel Brobecker
2011-03-16 2:30 ` Pedro Alves
0 siblings, 1 reply; 7+ messages in thread
From: Joel Brobecker @ 2011-03-16 0:17 UTC (permalink / raw)
To: gdb-patches; +Cc: Joel Brobecker
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.
Tested by rebuilding GDB on AIX 5.3. Michael Haubenwallner, who
reported the problem, verified that it fixes the problem on AIX 6.1.
Will commit in a couple of days if no objection.
---
gdb/aix-thread.c | 8 ++++----
gdb/config.in | 4 ++++
gdb/configure | 15 +++++++++++++++
gdb/configure.ac | 4 ++++
4 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index 37b798a..c5db262 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 ccceabf..01ba750 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 5ee5ce6..ebac1f6 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -12819,6 +12819,21 @@ _ACEOF
fi
+# 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
+
+
if test "$cross_compiling" = no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether setpgrp takes no argument" >&5
$as_echo_n "checking whether setpgrp takes no argument... " >&6; }
diff --git a/gdb/configure.ac b/gdb/configure.ac
index d2b75f6..2c708cb 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1069,6 +1069,10 @@ if test -n "$[5]"; then
[Define to the type of arg 5 for ptrace.])
fi
+# 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>]])
+
dnl AC_FUNC_SETPGRP does not work when cross compiling
dnl Instead, assume we will have a prototype for setpgrp if cross compiling.
if test "$cross_compiling" = no; then
--
1.7.1
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] Add 'getthrds' declaration check in configure for AIX
2011-03-16 0:17 [PATCH] Add 'getthrds' declaration check in configure for AIX Joel Brobecker
@ 2011-03-16 2:30 ` Pedro Alves
2011-03-16 4:48 ` Joel Brobecker
0 siblings, 1 reply; 7+ messages in thread
From: Pedro Alves @ 2011-03-16 2:30 UTC (permalink / raw)
To: gdb-patches; +Cc: Joel Brobecker
On Tuesday 15 March 2011 23:25:53, Joel Brobecker wrote:
> +# 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>]])
> +
Any reason this isn't done close to where we check for AIX
thread support, and decide to whether to build aix-thread.c in the
first place? Look for "AiX thread debugging library" further down.
--
Pedro Alves
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Add 'getthrds' declaration check in configure for AIX
2011-03-16 2:30 ` Pedro Alves
@ 2011-03-16 4:48 ` Joel Brobecker
2011-03-16 13:49 ` Pedro Alves
0 siblings, 1 reply; 7+ messages in thread
From: Joel Brobecker @ 2011-03-16 4:48 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
> > +# 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>]])
> > +
>
> Any reason this isn't done close to where we check for AIX
> thread support, and decide to whether to build aix-thread.c in the
> first place? Look for "AiX thread debugging library" further down.
No specific reason, no. I placed the check there because it seemed
to be the general area where we make cheks of this kind (checks for
library functions, ptrace prototypes, etc). But I'm happy to move
it next to the AIX thread detection check. We could even perform
the check on AIX only, although I had the feeling that we usually
this type of check regardless of the host (this is the case for
the ptrace checks, for instance).
--
Joel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Add 'getthrds' declaration check in configure for AIX
2011-03-16 4:48 ` Joel Brobecker
@ 2011-03-16 13:49 ` Pedro Alves
2011-03-16 13:58 ` Joel Brobecker
0 siblings, 1 reply; 7+ messages in thread
From: Pedro Alves @ 2011-03-16 13:49 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
On Wednesday 16 March 2011 01:40:23, Joel Brobecker wrote:
> > > +# 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>]])
> > > +
> >
> > Any reason this isn't done close to where we check for AIX
> > thread support, and decide to whether to build aix-thread.c in the
> > first place? Look for "AiX thread debugging library" further down.
>
> No specific reason, no. I placed the check there because it seemed
> to be the general area where we make cheks of this kind (checks for
> library functions, ptrace prototypes, etc). But I'm happy to move
> it next to the AIX thread detection check. We could even perform
> the check on AIX only, although I had the feeling that we usually
> this type of check regardless of the host (this is the case for
> the ptrace checks, for instance).
I just thought it made sense to keep the aix thread support
checks together, and that you might have missed the existing code.
If you want to keep them where you were putting them, it's fine
with me.
(I think the ptrace checks are where they are for both historical
reasons, and for the fact that the ptrace support is built by
several different hosts (inf-ptrace.c), with slightly different
ptrace implentations, and that nobody ever bothered to make them
run only on hosts that require them, and that are building the native
debugger backend. Library functions used by common code need to be
checked in all hosts, of course.)
--
Pedro Alves
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Add 'getthrds' declaration check in configure for AIX
2011-03-16 13:49 ` Pedro Alves
@ 2011-03-16 13:58 ` Joel Brobecker
2011-03-16 15:02 ` Pedro Alves
2011-03-17 14:58 ` Joel Brobecker
0 siblings, 2 replies; 7+ messages in thread
From: Joel Brobecker @ 2011-03-16 13:58 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 151 bytes --]
> I just thought it made sense to keep the aix thread support
> checks together,
That works for me. Here is a new patch, tested on AIX 5.3.
--
Joel
[-- Attachment #2: aix-getthrds.diff --]
[-- Type: text/x-diff, Size: 3446 bytes --]
commit 29e65e51e7344d6a2a68a887013b3c732914b056
Author: Joel Brobecker <brobecker@adacore.com>
Date: Tue Mar 15 10:58:39 2011 -0700
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.
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index 37b798a..c5db262 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 ccceabf..01ba750 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 5ee5ce6..92818a0 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 d2b75f6..96e0a7b 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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-03-17 13:20 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-16 0:17 [PATCH] Add 'getthrds' declaration check in configure for AIX Joel Brobecker
2011-03-16 2:30 ` Pedro Alves
2011-03-16 4:48 ` Joel Brobecker
2011-03-16 13:49 ` Pedro Alves
2011-03-16 13:58 ` Joel Brobecker
2011-03-16 15:02 ` Pedro Alves
2011-03-17 14:58 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox