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.
This commit is contained in:
Daniel Jacobowitz
2002-04-09 21:11:35 +00:00
parent 97658e92df
commit 0729219dab
13 changed files with 87 additions and 22 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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 */

View File

@@ -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;

View File

@@ -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

View File

@@ -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>
#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
/* FIXME: Both of these should be autoconf'd for. */
#define NORETURN
#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). */

View File

@@ -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;