aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2002-04-09 21:11:35 +0000
committerDaniel Jacobowitz <drow@false.org>2002-04-09 21:11:35 +0000
commit0729219dab3a669a294ea00f471fe18c4ba65d79 (patch)
tree402766eba5b19f554e3f712f0586b07dcd149798 /gdb/gdbserver
parent97658e92dfc5dd20031100cf6a3b26d700228613 (diff)
downloadgdb-0729219dab3a669a294ea00f471fe18c4ba65d79.zip
gdb-0729219dab3a669a294ea00f471fe18c4ba65d79.tar.gz
gdb-0729219dab3a669a294ea00f471fe18c4ba65d79.tar.bz2
2002-04-09 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/Makefile.in: Add WARN_CFLAGS. Update configury dependencies. * gdbserver/configure.in: Check for <string.h> * gdbserver/configure: Regenerate. * gdbserver/config.in: Regenerate. * gdbserver/gdbreplay.c: Include needed system headers. (remote_open): Remove strchr prototype. * gdbserver/linux-low.h: Correct #ifdef to HAVE_LINUX_USRREGS. * gdbserver/regcache.c (supply_register): Change buf argument to const void *. (supply_register_by_name): Likewise. (collect_register): Change buf argument to void *. (collect_register_by_name): Likewise. * gdbserver/regcache.h: Add missing prototypes. * gdbserver/remote-utils.c: Include <arpa/inet.h> for inet_ntoa. * gdbserver/server.c (handle_query): New function. (attached): New static variable, moved out of main. (main): Quiet longjmp clobber warnings. * gdbserver/server.h: Add ATTR_NORETURN and ATTR_FORMAT. Update prototypes. * gdbserver/utils.c (error): Remove NORETURN. (fatal): Likewise.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r--gdb/gdbserver/Makefile.in11
-rw-r--r--gdb/gdbserver/config.in3
-rwxr-xr-xgdb/gdbserver/configure2
-rw-r--r--gdb/gdbserver/configure.in2
-rw-r--r--gdb/gdbserver/gdbreplay.c8
-rw-r--r--gdb/gdbserver/linux-low.h2
-rw-r--r--gdb/gdbserver/regcache.c8
-rw-r--r--gdb/gdbserver/regcache.h8
-rw-r--r--gdb/gdbserver/remote-utils.c1
-rw-r--r--gdb/gdbserver/server.c9
-rw-r--r--gdb/gdbserver/server.h30
-rw-r--r--gdb/gdbserver/utils.c4
12 files changed, 65 insertions, 23 deletions
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index c553d92..076484c 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -90,13 +90,15 @@ INCLUDE_CFLAGS = -I. -I${srcdir} -I$(srcdir)/../regformats -I$(INCLUDE_DIR)
GLOBAL_CFLAGS = ${MT_CFLAGS} ${MH_CFLAGS}
#PROFILE_CFLAGS = -pg
+WARN_CFLAGS = -Wall
+
# CFLAGS is specifically reserved for setting from the command line
# when running make. I.E. "make CFLAGS=-Wmissing-prototypes".
CFLAGS = @CFLAGS@
# INTERNAL_CFLAGS is the aggregate of all other *CFLAGS macros.
-INTERNAL_CFLAGS = ${CFLAGS} ${GLOBAL_CFLAGS} ${PROFILE_CFLAGS} \
- ${INCLUDE_CFLAGS} ${BFD_CFLAGS}
+INTERNAL_CFLAGS = $(WARN_CFLAGS) ${CFLAGS} ${GLOBAL_CFLAGS} \
+ ${PROFILE_CFLAGS} ${INCLUDE_CFLAGS} ${BFD_CFLAGS}
# LDFLAGS is specifically reserved for setting from the command line
# when running make.
@@ -195,8 +197,11 @@ maintainer-clean realclean: clean
STAGESTUFF=${OBS} ${TSOBS} ${NTSOBS} ${ADD_FILES} init.c init.o version.c gdb
+config.h: config.in config.status
+ CONFIG_FILES="" $(SHELL) ./config.status
+
Makefile: Makefile.in config.status
- $(SHELL) ./config.status
+ CONFIG_HEADERS="" $(SHELL) ./config.status
config.status: configure configure.srv
$(SHELL) ./config.status --recheck
diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in
index e77d5a7..9d553f2 100644
--- a/gdb/gdbserver/config.in
+++ b/gdb/gdbserver/config.in
@@ -16,6 +16,9 @@
/* Define if you have the <sgtty.h> header file. */
#undef HAVE_SGTTY_H
+/* Define if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
/* Define if you have the <sys/reg.h> header file. */
#undef HAVE_SYS_REG_H
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index c08d5c2..d3e0b64 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -1105,7 +1105,7 @@ EOF
fi
-for ac_hdr in sgtty.h termio.h termios.h sys/reg.h
+for ac_hdr in sgtty.h termio.h termios.h sys/reg.h string.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
diff --git a/gdb/gdbserver/configure.in b/gdb/gdbserver/configure.in
index 744aac2..a0bde9b 100644
--- a/gdb/gdbserver/configure.in
+++ b/gdb/gdbserver/configure.in
@@ -30,7 +30,7 @@ AC_PROG_INSTALL
AC_HEADER_STDC
-AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h)
+AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h)
. ${srcdir}/configure.srv
diff --git a/gdb/gdbserver/gdbreplay.c b/gdb/gdbserver/gdbreplay.c
index dce4079..65831b1 100644
--- a/gdb/gdbserver/gdbreplay.c
+++ b/gdb/gdbserver/gdbreplay.c
@@ -30,6 +30,12 @@
#include <ctype.h>
#include <fcntl.h>
#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
/* Sort of a hack... */
#define EOL (EOF - 1)
@@ -83,8 +89,6 @@ remote_close (void)
void
remote_open (char *name)
{
- extern char *strchr ();
-
if (!strchr (name, ':'))
{
fprintf (stderr, "%s: Must specify tcp connection as host:addr\n", name);
diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h
index 421fa22..5f06db1 100644
--- a/gdb/gdbserver/linux-low.h
+++ b/gdb/gdbserver/linux-low.h
@@ -18,7 +18,7 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifdef HAVE_LINUX_USR_REGISTERS
+#ifdef HAVE_LINUX_USRREGS
extern int regmap[];
extern int num_regs;
int cannot_fetch_register (int regno);
diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c
index bec20bb..5e3c62f 100644
--- a/gdb/gdbserver/regcache.c
+++ b/gdb/gdbserver/regcache.c
@@ -123,25 +123,25 @@ register_data (int n)
}
void
-supply_register (int n, const char *buf)
+supply_register (int n, const void *buf)
{
memcpy (register_data (n), buf, register_size (n));
}
void
-supply_register_by_name (const char *name, const char *buf)
+supply_register_by_name (const char *name, const void *buf)
{
supply_register (find_regno (name), buf);
}
void
-collect_register (int n, char *buf)
+collect_register (int n, void *buf)
{
memcpy (buf, register_data (n), register_size (n));
}
void
-collect_register_by_name (const char *name, char *buf)
+collect_register_by_name (const char *name, void *buf)
{
collect_register (find_regno (name), buf);
}
diff --git a/gdb/gdbserver/regcache.h b/gdb/gdbserver/regcache.h
index 07195b3..e71aee2 100644
--- a/gdb/gdbserver/regcache.h
+++ b/gdb/gdbserver/regcache.h
@@ -46,4 +46,12 @@ int find_regno (const char *name);
extern const char **gdbserver_expedite_regs;
+void supply_register (int n, const void *buf);
+
+void supply_register_by_name (const char *name, const void *buf);
+
+void collect_register (int n, void *buf);
+
+void collect_register_by_name (const char *name, void *buf);
+
#endif /* REGCACHE_H */
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index adf5299..edfcace 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -35,6 +35,7 @@
#include <fcntl.h>
#include <sys/time.h>
#include <unistd.h>
+#include <arpa/inet.h>
int remote_debug = 0;
struct ui_file *gdb_stdlog;
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index adaabac..b567688 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -55,6 +55,7 @@ attach_inferior (int pid, char *statusptr, unsigned char *sigptr)
}
extern int remote_debug;
+static int attached;
int
main (int argc, char *argv[])
@@ -64,9 +65,8 @@ main (int argc, char *argv[])
unsigned char signal;
unsigned int len;
CORE_ADDR mem_addr;
- int bad_attach = 0;
- int pid = 0;
- int attached = 0;
+ int bad_attach;
+ int pid;
char *arg_end;
if (setjmp (toplevel))
@@ -75,6 +75,9 @@ main (int argc, char *argv[])
exit (1);
}
+ bad_attach = 0;
+ pid = 0;
+ attached = 0;
if (argc >= 3 && strcmp (argv[2], "--attach") == 0)
{
if (argc == 4
diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h
index 7f22041..9de0d73 100644
--- a/gdb/gdbserver/server.h
+++ b/gdb/gdbserver/server.h
@@ -23,20 +23,36 @@
#define SERVER_H
#include "config.h"
+
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
+#include <setjmp.h>
-
-/* FIXME: Both of these should be autoconf'd for. */
-#define NORETURN
+#ifndef ATTR_NORETURN
+#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
+#define ATTR_NORETURN __attribute__ ((noreturn))
+#else
+#define ATTR_NORETURN /* nothing */
+#endif
+#endif
+
+#ifndef ATTR_FORMAT
+#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 4))
+#define ATTR_FORMAT(type, x, y) __attribute__ ((format(type, x, y)))
+#else
+#define ATTR_FORMAT(type, x, y) /* nothing */
+#endif
+#endif
+
+/* FIXME: This should probably be autoconf'd for. It's an integer type at
+ least the size of a (void *). */
typedef long long CORE_ADDR;
#include "regcache.h"
#include "gdb/signals.h"
-#include <setjmp.h>
/* Target-specific functions */
@@ -93,11 +109,13 @@ int target_signal_to_host (enum target_signal oursig);
/* Functions from utils.c */
void perror_with_name (char *string);
-void error (const char *string,...);
-void fatal (const char *string,...);
+void error (const char *string,...) ATTR_NORETURN;
+void fatal (const char *string,...) ATTR_NORETURN;
void warning (const char *string,...);
+/* Functions from the register cache definition. */
+void init_registers (void);
/* Maximum number of bytes to read/write at once. The value here
is chosen to fill up a packet (the headers account for the 32). */
diff --git a/gdb/gdbserver/utils.c b/gdb/gdbserver/utils.c
index a8ea9a1..e13eda8 100644
--- a/gdb/gdbserver/utils.c
+++ b/gdb/gdbserver/utils.c
@@ -57,7 +57,7 @@ perror_with_name (char *string)
STRING is the error message, used as a fprintf string,
and ARG is passed as an argument to it. */
-NORETURN void
+void
error (const char *string,...)
{
extern jmp_buf toplevel;
@@ -74,7 +74,7 @@ error (const char *string,...)
STRING and ARG are passed to fprintf. */
/* VARARGS */
-NORETURN void
+void
fatal (const char *string,...)
{
va_list args;