+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.
+
2002-04-09 Daniel Jacobowitz <drow@mvista.com>
* symtab.h (ALL_BLOCK_SYMBOLS): Don't dereference the pointer
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.
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
/* 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
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
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
#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)
void
remote_open (char *name)
{
- extern char *strchr ();
-
if (!strchr (name, ':'))
{
fprintf (stderr, "%s: Must specify tcp connection as host:addr\n", name);
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);
}
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);
}
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 */
#include <fcntl.h>
#include <sys/time.h>
#include <unistd.h>
+#include <arpa/inet.h>
int remote_debug = 0;
struct ui_file *gdb_stdlog;
}
extern int remote_debug;
+static int attached;
int
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))
exit (1);
}
+ bad_attach = 0;
+ pid = 0;
+ attached = 0;
if (argc >= 3 && strcmp (argv[2], "--attach") == 0)
{
if (argc == 4
#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 */
/* 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). */
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;
STRING and ARG are passed to fprintf. */
/* VARARGS */
-NORETURN void
+void
fatal (const char *string,...)
{
va_list args;