[PATCH 09/15] Mostly remove GDBSERVER from linux-waitpid.c

Gary Benson
2014-07-09T10:39:38Z

This commit mostly removes the use of GDBSERVER from
nat/linux-waitpid.c. A use remains for some debugging
code that I will remove when the Linux thread_db code
is refactored.

gdb/
2014-07-09 Gary Benson <gbenson@redhat.com>

* configure.ac [AC_CHECK_HEADERS] <errno.h>: New check.
* configure: Regenerate.
* config.in: Likewise.
* nat/linux-waitpid.c: Don't include server.h or defs.h.
(linux_debug) [debug_threads]: New declaration.
---
gdb/ChangeLog | 8 ++++++++
gdb/config.in | 3 +++
gdb/configure | 2 +-
gdb/configure.ac | 2 +-
gdb/nat/linux-waitpid.c | 13 ++++++++-----
5 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/gdb/config.in b/gdb/config.in
index 8585b49..10b9887 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -129,6 +129,9 @@
/* Define to 1 if you have the <elf_hp.h> header file. */
#undef HAVE_ELF_HP_H

+/* Define to 1 if you have the <errno.h> header file. */
+#undef HAVE_ERRNO_H
+
/* Define to 1 if your system has the etext variable. */
#undef HAVE_ETEXT

diff --git a/gdb/configure b/gdb/configure
index a4c0a8c..45f3f5f 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -9307,7 +9307,7 @@ for ac_header in nlist.h machine/reg.h poll.h sys/poll.h proc_service.h \
sys/reg.h sys/debugreg.h sys/select.h sys/syscall.h \
termios.h termio.h \
sgtty.h elf_hp.h \
- dlfcn.h
+ dlfcn.h errno.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"
diff --git a/gdb/configure.ac b/gdb/configure.ac
index a2ac15f..5f2ace4 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1254,7 +1254,7 @@ AC_CHECK_HEADERS([nlist.h machine/reg.h poll.h sys/poll.h proc_service.h \
sys/reg.h sys/debugreg.h sys/select.h sys/syscall.h \
termios.h termio.h \
sgtty.h elf_hp.h \
- dlfcn.h])
+ dlfcn.h errno.h])
AC_CHECK_HEADERS(sys/proc.h, [], [],
[#if HAVE_SYS_PARAM_H
# include <sys/param.h>
diff --git a/gdb/nat/linux-waitpid.c b/gdb/nat/linux-waitpid.c
index 5159f03..b97ae58 100644
--- a/gdb/nat/linux-waitpid.c
+++ b/gdb/nat/linux-waitpid.c
@@ -17,11 +17,12 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */

-#ifdef GDBSERVER
-#include "server.h"
-#else
-#include "defs.h"
-#include "signal.h"
+#include "config.h"
+
+#include <stdio.h>
+#include <stdarg.h>
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
#endif

#include "linux-nat.h"
@@ -37,6 +38,8 @@ static inline void
linux_debug (const char *format, ...)
{
#ifdef GDBSERVER
+ extern int debug_threads;
+
if (debug_threads)
{
va_list args;
--
1.7.1