gdb/
* configure.tgt: Build gdbserver for Cygwin and mingw32. gdb/gdbserver/ * configure.ac: Check for more headers which are missing on Windows. Automatically supply -lwsock32 and USE_WIN32API. * configure.srv: Add Cygwin and mingw32. * remote-utils.c: Don't include headers unconditionally which are missing on mingw32. Include <winsock.h> for mingw32. (remote_open): Adjust for mingw32 support. Flush standard error after writing to it. (remote_close, putpkt_binary, input_interrupt, block_async_io) (unblock_async_io, enable_async_io, disable_async_io) (readchar, getpkt): Update for Winsock support. (prepare_resume_reply): Expect a protocol signal number. * server.c: Disable <sys/wait.h> on mingw32. (start_inferior): Adjust for mingw32 support. Flush standard error after writing to it. (attach_inferior): Likewise. Use protocol signal numbers. (main): Skip 'D' packet on mingw32. Use protocol signal numbers and names. * win32-i386-low.c: New file. * Makefile.in (XM_CLIBS): Set. (gdbserver, gdbreplay): Use $(INTERNAL_CFLAGS). (win32-i386-low.o): New dependency rule. * linux-low.c (linux_wait): Use target signal numbers. * target.h (struct target_ops): Doc fix. * server.h (target_signal_to_name): New prototype. * gdbreplay.c: Don't include headers unconditionally which are missing on mingw32. Include <winsock.h> for mingw32. (remote_close, remote_open): Adjust for Winsock support. * configure, config.in: Regenerated.
This commit is contained in:
parent
66a79c16a6
commit
b80864fbe5
15 changed files with 3996 additions and 1929 deletions
|
@ -1,3 +1,7 @@
|
|||
2006-07-22 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* configure.tgt: Build gdbserver for Cygwin and mingw32.
|
||||
|
||||
2006-07-22 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* config/i386/cygwin.mt (DEPRECATED_TM_FILE): Delete.
|
||||
|
|
|
@ -97,7 +97,12 @@ i[34567]86-*-linux*) gdb_target=linux
|
|||
;;
|
||||
i[34567]86-*-gnu*) gdb_target=i386gnu ;;
|
||||
i[34567]86-*-netware*) gdb_target=i386 ;;
|
||||
i[34567]86-*-cygwin*) gdb_target=cygwin ;;
|
||||
i[34567]86-*-cygwin*) gdb_target=cygwin
|
||||
build_gdbserver=yes
|
||||
;;
|
||||
i[34567]86-*-mingw32*) gdb_target=i386
|
||||
build_gdbserver=yes
|
||||
;;
|
||||
i[34567]86-*-*) gdb_target=i386 ;;
|
||||
|
||||
ia64-*-linux*) gdb_target=linux
|
||||
|
|
|
@ -1,3 +1,35 @@
|
|||
2006-07-22 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* configure.ac: Check for more headers which are missing on
|
||||
Windows. Automatically supply -lwsock32 and USE_WIN32API.
|
||||
* configure.srv: Add Cygwin and mingw32.
|
||||
* remote-utils.c: Don't include headers unconditionally which
|
||||
are missing on mingw32. Include <winsock.h> for mingw32.
|
||||
(remote_open): Adjust for mingw32 support. Flush
|
||||
standard error after writing to it.
|
||||
(remote_close, putpkt_binary, input_interrupt, block_async_io)
|
||||
(unblock_async_io, enable_async_io, disable_async_io)
|
||||
(readchar, getpkt): Update for Winsock support.
|
||||
(prepare_resume_reply): Expect a protocol signal number.
|
||||
* server.c: Disable <sys/wait.h> on mingw32.
|
||||
(start_inferior): Adjust for mingw32 support. Flush
|
||||
standard error after writing to it.
|
||||
(attach_inferior): Likewise. Use protocol signal
|
||||
numbers.
|
||||
(main): Skip 'D' packet on mingw32. Use protocol signal numbers
|
||||
and names.
|
||||
* win32-i386-low.c: New file.
|
||||
* Makefile.in (XM_CLIBS): Set.
|
||||
(gdbserver, gdbreplay): Use $(INTERNAL_CFLAGS).
|
||||
(win32-i386-low.o): New dependency rule.
|
||||
* linux-low.c (linux_wait): Use target signal numbers.
|
||||
* target.h (struct target_ops): Doc fix.
|
||||
* server.h (target_signal_to_name): New prototype.
|
||||
* gdbreplay.c: Don't include headers unconditionally which
|
||||
are missing on mingw32. Include <winsock.h> for mingw32.
|
||||
(remote_close, remote_open): Adjust for Winsock support.
|
||||
* configure, config.in: Regenerated.
|
||||
|
||||
2006-07-12 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* server.c (decode_xfer_read, write_qxfer_response): New.
|
||||
|
|
|
@ -139,6 +139,7 @@ OBS = inferiors.o regcache.o remote-utils.o server.o signals.o target.o \
|
|||
mem-break.o \
|
||||
$(DEPFILES)
|
||||
GDBSERVER_LIBS = @GDBSERVER_LIBS@
|
||||
XM_CLIBS = @LIBS@
|
||||
|
||||
# Prevent Sun make from putting in the machine type. Setting
|
||||
# TARGET_ARCH to nothing works for SunOS 3, 4.0, but not for 4.1.
|
||||
|
@ -176,12 +177,12 @@ clean-info:
|
|||
|
||||
gdbserver: $(OBS) ${ADD_DEPS} ${CDEPS}
|
||||
rm -f gdbserver
|
||||
${CC-LD} $(GLOBAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbserver $(OBS) \
|
||||
${CC-LD} $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbserver $(OBS) \
|
||||
$(GDBSERVER_LIBS) $(XM_CLIBS)
|
||||
|
||||
gdbreplay: gdbreplay.o
|
||||
rm -f gdbreplay
|
||||
${CC-LD} $(GLOBAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbreplay gdbreplay.o \
|
||||
${CC-LD} $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbreplay gdbreplay.o \
|
||||
$(XM_CLIBS)
|
||||
|
||||
# Put the proper machine-specific files first, so M-. on a machine
|
||||
|
@ -286,6 +287,8 @@ linux-sh-low.o: linux-sh-low.c $(linux_low_h) $(server_h)
|
|||
linux-x86-64-low.o: linux-x86-64-low.c $(linux_low_h) $(server_h) \
|
||||
$(gdb_proc_service_h)
|
||||
|
||||
win32-i386-low.o: win32-i386-low.c $(server_h) $(regdef_h) $(regcache_h)
|
||||
|
||||
reg-arm.o : reg-arm.c $(regdef_h)
|
||||
reg-arm.c : $(srcdir)/../regformats/reg-arm.dat $(regdat_sh)
|
||||
sh $(regdat_sh) $(srcdir)/../regformats/reg-arm.dat reg-arm.c
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
/* config.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to 1 if you have the <arpa/inet.h> header file. */
|
||||
#undef HAVE_ARPA_INET_H
|
||||
|
||||
/* Define to 1 if you have the declaration of `strerror', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_STRERROR
|
||||
|
@ -25,6 +28,15 @@
|
|||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the <netdb.h> header file. */
|
||||
#undef HAVE_NETDB_H
|
||||
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */
|
||||
#undef HAVE_NETINET_IN_H
|
||||
|
||||
/* Define to 1 if you have the <netinet/tcp.h> header file. */
|
||||
#undef HAVE_NETINET_TCP_H
|
||||
|
||||
/* Define if <sys/procfs.h> has prgregset_t. */
|
||||
#undef HAVE_PRGREGSET_T
|
||||
|
||||
|
@ -59,21 +71,33 @@
|
|||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the <sys/ioctl.h> header file. */
|
||||
#undef HAVE_SYS_IOCTL_H
|
||||
|
||||
/* Define to 1 if you have the <sys/procfs.h> header file. */
|
||||
#undef HAVE_SYS_PROCFS_H
|
||||
|
||||
/* Define to 1 if you have the <sys/reg.h> header file. */
|
||||
#undef HAVE_SYS_REG_H
|
||||
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */
|
||||
#undef HAVE_SYS_SOCKET_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <sys/wait.h> header file. */
|
||||
#undef HAVE_SYS_WAIT_H
|
||||
|
||||
/* Define if TD_VERSION is available. */
|
||||
#undef HAVE_TD_VERSION
|
||||
|
||||
/* Define to 1 if you have the <terminal.h> header file. */
|
||||
#undef HAVE_TERMINAL_H
|
||||
|
||||
/* Define to 1 if you have the <termios.h> header file. */
|
||||
#undef HAVE_TERMIOS_H
|
||||
|
||||
|
@ -103,3 +127,8 @@
|
|||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define if we should use the Windows API, instead of the POSIX API. On
|
||||
Windows, we use the Windows API when building for MinGW, but the POSIX API
|
||||
when building for Cygwin. */
|
||||
#undef USE_WIN32API
|
||||
|
|
4581
gdb/gdbserver/configure
vendored
4581
gdb/gdbserver/configure
vendored
File diff suppressed because it is too large
Load diff
|
@ -38,7 +38,9 @@ AC_HEADER_STDC
|
|||
|
||||
AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl
|
||||
proc_service.h sys/procfs.h thread_db.h linux/elf.h dnl
|
||||
stdlib.h unistd.h)
|
||||
stdlib.h unistd.h dnl
|
||||
terminal.h sys/ioctl.h netinet/in.h sys/socket.h netdb.h dnl
|
||||
netinet/tcp.h arpa/inet.h sys/wait.h)
|
||||
|
||||
AC_CHECK_DECLS(strerror)
|
||||
|
||||
|
@ -48,6 +50,15 @@ AC_CHECK_TYPES(socklen_t, [], [],
|
|||
])
|
||||
. ${srcdir}/configure.srv
|
||||
|
||||
if test "${srv_mingw}" = "yes"; then
|
||||
LIBS="$LIBS -lwsock32"
|
||||
AC_DEFINE(USE_WIN32API, 1,
|
||||
[Define if we should use the Windows API, instead of the
|
||||
POSIX API. On Windows, we use the Windows API when
|
||||
building for MinGW, but the POSIX API when building
|
||||
for Cygwin.])
|
||||
fi
|
||||
|
||||
if test "${srv_linux_usrregs}" = "yes"; then
|
||||
AC_DEFINE(HAVE_LINUX_USRREGS, 1,
|
||||
[Define if the target supports PTRACE_PEEKUSR for register ]
|
||||
|
|
|
@ -33,12 +33,19 @@ case "${target}" in
|
|||
srv_linux_usrregs=yes
|
||||
srv_linux_thread_db=yes
|
||||
;;
|
||||
i[34567]86-*-cygwin*) srv_regobj=reg-i386.o
|
||||
srv_tgtobj="win32-i386-low.o"
|
||||
;;
|
||||
i[34567]86-*-linux*) srv_regobj=reg-i386-linux.o
|
||||
srv_tgtobj="linux-low.o linux-i386-low.o i387-fp.o"
|
||||
srv_linux_usrregs=yes
|
||||
srv_linux_regsets=yes
|
||||
srv_linux_thread_db=yes
|
||||
;;
|
||||
i[34567]86-*-mingw*) srv_regobj=reg-i386.o
|
||||
srv_tgtobj="win32-i386-low.o"
|
||||
srv_mingw=yes
|
||||
;;
|
||||
ia64-*-linux*) srv_regobj=reg-ia64.o
|
||||
srv_tgtobj="linux-low.o linux-ia64-low.o"
|
||||
srv_linux_usrregs=yes
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Replay a remote debug session logfile for GDB.
|
||||
Copyright (C) 1996, 1998, 1999, 2000, 2002, 2003, 2005
|
||||
Copyright (C) 1996, 1998, 1999, 2000, 2002, 2003, 2005, 2006
|
||||
Free Software Foundation, Inc.
|
||||
Written by Fred Fish (fnf@cygnus.com) from pieces of gdbserver.
|
||||
|
||||
|
@ -23,10 +23,6 @@
|
|||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <sys/file.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <signal.h>
|
||||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -41,6 +37,22 @@
|
|||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#if HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#if HAVE_NETINET_TCP_H
|
||||
#include <netinet/tcp.h>
|
||||
#endif
|
||||
|
||||
#if USE_WIN32API
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SOCKLEN_T
|
||||
typedef int socklen_t;
|
||||
|
@ -90,7 +102,11 @@ sync_error (FILE *fp, char *desc, int expect, int got)
|
|||
static void
|
||||
remote_close (void)
|
||||
{
|
||||
#ifdef USE_WIN32API
|
||||
closesocket (remote_desc);
|
||||
#else
|
||||
close (remote_desc);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Open a connection to a remote debugger.
|
||||
|
@ -107,6 +123,9 @@ remote_open (char *name)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef USE_WIN32API
|
||||
static int winsock_initialized;
|
||||
#endif
|
||||
char *port_str;
|
||||
int port;
|
||||
struct sockaddr_in sockaddr;
|
||||
|
@ -117,6 +136,16 @@ remote_open (char *name)
|
|||
|
||||
port = atoi (port_str + 1);
|
||||
|
||||
#ifdef USE_WIN32API
|
||||
if (!winsock_initialized)
|
||||
{
|
||||
WSADATA wsad;
|
||||
|
||||
WSAStartup (MAKEWORD (1, 0), &wsad);
|
||||
winsock_initialized = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
tmp_desc = socket (PF_INET, SOCK_STREAM, 0);
|
||||
if (tmp_desc < 0)
|
||||
perror_with_name ("Can't open socket");
|
||||
|
@ -151,11 +180,19 @@ remote_open (char *name)
|
|||
|
||||
close (tmp_desc); /* No longer need this */
|
||||
|
||||
#ifndef USE_WIN32API
|
||||
close (tmp_desc); /* No longer need this */
|
||||
|
||||
signal (SIGPIPE, SIG_IGN); /* If we don't do this, then gdbreplay simply
|
||||
exits when the remote side dies. */
|
||||
#else
|
||||
closesocket (tmp_desc); /* No longer need this */
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(F_SETFL) && defined (FASYNC)
|
||||
fcntl (remote_desc, F_SETFL, FASYNC);
|
||||
#endif
|
||||
|
||||
fprintf (stderr, "Replay logfile using %s\n", name);
|
||||
fflush (stderr);
|
||||
|
|
|
@ -714,7 +714,7 @@ retry:
|
|||
clear_inferiors ();
|
||||
free (all_processes.head);
|
||||
all_processes.head = all_processes.tail = NULL;
|
||||
return ((unsigned char) WEXITSTATUS (w));
|
||||
return WEXITSTATUS (w);
|
||||
}
|
||||
else if (!WIFSTOPPED (w))
|
||||
{
|
||||
|
@ -723,7 +723,7 @@ retry:
|
|||
clear_inferiors ();
|
||||
free (all_processes.head);
|
||||
all_processes.head = all_processes.tail = NULL;
|
||||
return ((unsigned char) WTERMSIG (w));
|
||||
return target_signal_from_host (WTERMSIG (w));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -733,7 +733,7 @@ retry:
|
|||
}
|
||||
|
||||
*status = 'T';
|
||||
return ((unsigned char) WSTOPSIG (w));
|
||||
return target_signal_from_host (WSTOPSIG (w));
|
||||
}
|
||||
|
||||
/* Send a signal to an LWP. For LinuxThreads, kill is enough; however, if
|
||||
|
|
|
@ -21,21 +21,41 @@
|
|||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include "server.h"
|
||||
#if HAVE_TERMINAL_H
|
||||
#include "terminal.h"
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#if HAVE_SYS_IOCTL_H
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
#include <sys/file.h>
|
||||
#if HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#if HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#if HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#if HAVE_NETINET_TCP_H
|
||||
#include <netinet/tcp.h>
|
||||
#endif
|
||||
#if HAVE_SYS_IOCTL_H
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#if HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#if USE_WIN32API
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SOCKLEN_T
|
||||
typedef int socklen_t;
|
||||
|
@ -71,10 +91,15 @@ extern int debug_threads;
|
|||
void
|
||||
remote_open (char *name)
|
||||
{
|
||||
#if defined(F_SETFL) && defined (FASYNC)
|
||||
int save_fcntl_flags;
|
||||
#endif
|
||||
|
||||
if (!strchr (name, ':'))
|
||||
{
|
||||
#ifdef USE_WIN32API
|
||||
error ("Only <host>:<port> is supported on this platform.");
|
||||
#else
|
||||
remote_desc = open (name, O_RDWR);
|
||||
if (remote_desc < 0)
|
||||
perror_with_name ("Could not open remote device");
|
||||
|
@ -124,9 +149,13 @@ remote_open (char *name)
|
|||
#endif
|
||||
|
||||
fprintf (stderr, "Remote debugging using %s\n", name);
|
||||
#endif /* USE_WIN32API */
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef USE_WIN32API
|
||||
static int winsock_initialized;
|
||||
#endif
|
||||
char *port_str;
|
||||
int port;
|
||||
struct sockaddr_in sockaddr;
|
||||
|
@ -137,7 +166,17 @@ remote_open (char *name)
|
|||
|
||||
port = atoi (port_str + 1);
|
||||
|
||||
tmp_desc = socket (PF_INET, SOCK_STREAM, 0);
|
||||
#ifdef USE_WIN32API
|
||||
if (!winsock_initialized)
|
||||
{
|
||||
WSADATA wsad;
|
||||
|
||||
WSAStartup (MAKEWORD (1, 0), &wsad);
|
||||
winsock_initialized = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
tmp_desc = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
if (tmp_desc < 0)
|
||||
perror_with_name ("Can't open socket");
|
||||
|
||||
|
@ -155,6 +194,7 @@ remote_open (char *name)
|
|||
perror_with_name ("Can't bind address");
|
||||
|
||||
fprintf (stderr, "Listening on port %d\n", port);
|
||||
fflush (stderr);
|
||||
|
||||
tmp = sizeof (sockaddr);
|
||||
remote_desc = accept (tmp_desc, (struct sockaddr *) &sockaddr, &tmp);
|
||||
|
@ -171,10 +211,15 @@ remote_open (char *name)
|
|||
setsockopt (remote_desc, IPPROTO_TCP, TCP_NODELAY,
|
||||
(char *) &tmp, sizeof (tmp));
|
||||
|
||||
|
||||
#ifndef USE_WIN32API
|
||||
close (tmp_desc); /* No longer need this */
|
||||
|
||||
signal (SIGPIPE, SIG_IGN); /* If we don't do this, then gdbserver simply
|
||||
exits when the remote side dies. */
|
||||
#else
|
||||
closesocket (tmp_desc); /* No longer need this */
|
||||
#endif
|
||||
|
||||
/* Convert IP address to string. */
|
||||
fprintf (stderr, "Remote debugging from host %s\n",
|
||||
|
@ -194,7 +239,11 @@ remote_open (char *name)
|
|||
void
|
||||
remote_close (void)
|
||||
{
|
||||
#ifdef USE_WIN32API
|
||||
closesocket (remote_desc);
|
||||
#else
|
||||
close (remote_desc);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Convert hex digit A to a number. */
|
||||
|
@ -395,7 +444,7 @@ putpkt_binary (char *buf, int cnt)
|
|||
{
|
||||
int cc;
|
||||
|
||||
if (write (remote_desc, buf2, p - buf2) != p - buf2)
|
||||
if (send (remote_desc, buf2, p - buf2, 0) != p - buf2)
|
||||
{
|
||||
perror ("putpkt(write)");
|
||||
return -1;
|
||||
|
@ -406,7 +455,7 @@ putpkt_binary (char *buf, int cnt)
|
|||
fprintf (stderr, "putpkt (\"%s\"); [looking for ack]\n", buf2);
|
||||
fflush (stderr);
|
||||
}
|
||||
cc = read (remote_desc, buf3, 1);
|
||||
cc = recv (remote_desc, buf3, 1, 0);
|
||||
if (remote_debug)
|
||||
{
|
||||
fprintf (stderr, "[received '%c' (0x%x)]\n", buf3[0], buf3[0]);
|
||||
|
@ -444,6 +493,7 @@ putpkt (char *buf)
|
|||
return putpkt_binary (buf, strlen (buf));
|
||||
}
|
||||
|
||||
#ifndef USE_WIN32API
|
||||
|
||||
/* Come here when we get an input interrupt from the remote side. This
|
||||
interrupt should only be active while we are waiting for the child to do
|
||||
|
@ -466,7 +516,7 @@ input_interrupt (int unused)
|
|||
int cc;
|
||||
char c = 0;
|
||||
|
||||
cc = read (remote_desc, &c, 1);
|
||||
cc = recv (remote_desc, &c, 1, 0);
|
||||
|
||||
if (cc != 1 || c != '\003')
|
||||
{
|
||||
|
@ -478,29 +528,34 @@ input_interrupt (int unused)
|
|||
(*the_target->send_signal) (SIGINT);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Asynchronous I/O support. SIGIO must be enabled when waiting, in order to
|
||||
accept Control-C from the client, and must be disabled when talking to
|
||||
the client. */
|
||||
|
||||
void
|
||||
block_async_io (void)
|
||||
{
|
||||
#ifndef USE_WIN32API
|
||||
sigset_t sigio_set;
|
||||
sigemptyset (&sigio_set);
|
||||
sigaddset (&sigio_set, SIGIO);
|
||||
sigprocmask (SIG_BLOCK, &sigio_set, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
unblock_async_io (void)
|
||||
{
|
||||
#ifndef USE_WIN32API
|
||||
sigset_t sigio_set;
|
||||
sigemptyset (&sigio_set);
|
||||
sigaddset (&sigio_set, SIGIO);
|
||||
sigprocmask (SIG_UNBLOCK, &sigio_set, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Asynchronous I/O support. SIGIO must be enabled when waiting, in order to
|
||||
accept Control-C from the client, and must be disabled when talking to
|
||||
the client. */
|
||||
|
||||
/* Current state of asynchronous I/O. */
|
||||
static int async_io_enabled;
|
||||
|
||||
|
@ -511,7 +566,9 @@ enable_async_io (void)
|
|||
if (async_io_enabled)
|
||||
return;
|
||||
|
||||
#ifndef USE_WIN32API
|
||||
signal (SIGIO, input_interrupt);
|
||||
#endif
|
||||
async_io_enabled = 1;
|
||||
}
|
||||
|
||||
|
@ -522,7 +579,9 @@ disable_async_io (void)
|
|||
if (!async_io_enabled)
|
||||
return;
|
||||
|
||||
#ifndef USE_WIN32API
|
||||
signal (SIGIO, SIG_IGN);
|
||||
#endif
|
||||
async_io_enabled = 0;
|
||||
}
|
||||
|
||||
|
@ -538,7 +597,7 @@ readchar (void)
|
|||
if (bufcnt-- > 0)
|
||||
return *bufp++;
|
||||
|
||||
bufcnt = read (remote_desc, buf, sizeof (buf));
|
||||
bufcnt = recv (remote_desc, buf, sizeof (buf), 0);
|
||||
|
||||
if (bufcnt <= 0)
|
||||
{
|
||||
|
@ -605,7 +664,7 @@ getpkt (char *buf)
|
|||
|
||||
fprintf (stderr, "Bad checksum, sentsum=0x%x, csum=0x%x, buf=%s\n",
|
||||
(c1 << 4) + c2, csum, buf);
|
||||
write (remote_desc, "-", 1);
|
||||
send (remote_desc, "-", 1, 0);
|
||||
}
|
||||
|
||||
if (remote_debug)
|
||||
|
@ -614,7 +673,7 @@ getpkt (char *buf)
|
|||
fflush (stderr);
|
||||
}
|
||||
|
||||
write (remote_desc, "+", 1);
|
||||
send (remote_desc, "+", 1, 0);
|
||||
|
||||
if (remote_debug)
|
||||
{
|
||||
|
@ -723,14 +782,12 @@ dead_thread_notify (int id)
|
|||
}
|
||||
|
||||
void
|
||||
prepare_resume_reply (char *buf, char status, unsigned char signo)
|
||||
prepare_resume_reply (char *buf, char status, unsigned char sig)
|
||||
{
|
||||
int nib, sig;
|
||||
int nib;
|
||||
|
||||
*buf++ = status;
|
||||
|
||||
sig = (int)target_signal_from_host (signo);
|
||||
|
||||
nib = ((sig & 0xf0) >> 4);
|
||||
*buf++ = tohex (nib);
|
||||
nib = sig & 0x0f;
|
||||
|
|
|
@ -24,7 +24,9 @@
|
|||
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#if HAVE_SYS_WAIT_H
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
unsigned long cont_thread;
|
||||
unsigned long general_thread;
|
||||
|
@ -46,17 +48,22 @@ unsigned long signal_pid;
|
|||
static int
|
||||
start_inferior (char *argv[], char *statusptr)
|
||||
{
|
||||
#ifdef SIGTTOU
|
||||
signal (SIGTTOU, SIG_DFL);
|
||||
signal (SIGTTIN, SIG_DFL);
|
||||
#endif
|
||||
|
||||
signal_pid = create_inferior (argv[0], argv);
|
||||
|
||||
fprintf (stderr, "Process %s created; pid = %ld\n", argv[0],
|
||||
signal_pid);
|
||||
fflush (stderr);
|
||||
|
||||
#ifdef SIGTTOU
|
||||
signal (SIGTTOU, SIG_IGN);
|
||||
signal (SIGTTIN, SIG_IGN);
|
||||
tcsetpgrp (fileno (stderr), signal_pid);
|
||||
#endif
|
||||
|
||||
/* Wait till we are at 1st instruction in program, return signal number. */
|
||||
return mywait (statusptr, 0);
|
||||
|
@ -72,6 +79,7 @@ attach_inferior (int pid, char *statusptr, int *sigptr)
|
|||
return -1;
|
||||
|
||||
fprintf (stderr, "Attached; pid = %d\n", pid);
|
||||
fflush (stderr);
|
||||
|
||||
/* FIXME - It may be that we should get the SIGNAL_PID from the
|
||||
attach function, so that it can be the main thread instead of
|
||||
|
@ -83,8 +91,8 @@ attach_inferior (int pid, char *statusptr, int *sigptr)
|
|||
/* GDB knows to ignore the first SIGSTOP after attaching to a running
|
||||
process using the "attach" command, but this is different; it's
|
||||
just using "target remote". Pretend it's just starting up. */
|
||||
if (*statusptr == 'T' && *sigptr == SIGSTOP)
|
||||
*sigptr = SIGTRAP;
|
||||
if (*statusptr == 'T' && *sigptr == TARGET_SIGNAL_STOP)
|
||||
*sigptr = TARGET_SIGNAL_TRAP;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -516,6 +524,9 @@ main (int argc, char *argv[])
|
|||
case 'd':
|
||||
remote_debug = !remote_debug;
|
||||
break;
|
||||
#ifndef USE_WIN32API
|
||||
/* Skip "detach" support on mingw32, since we don't have
|
||||
waitpid. */
|
||||
case 'D':
|
||||
fprintf (stderr, "Detaching from inferior\n");
|
||||
detach_inferior ();
|
||||
|
@ -537,6 +548,7 @@ main (int argc, char *argv[])
|
|||
}
|
||||
|
||||
exit (0);
|
||||
#endif
|
||||
|
||||
case '!':
|
||||
if (attached == 0)
|
||||
|
@ -794,8 +806,9 @@ main (int argc, char *argv[])
|
|||
fprintf (stderr,
|
||||
"\nChild exited with status %d\n", signal);
|
||||
if (status == 'X')
|
||||
fprintf (stderr, "\nChild terminated with signal = 0x%x\n",
|
||||
signal);
|
||||
fprintf (stderr, "\nChild terminated with signal = 0x%x (%s)\n",
|
||||
target_signal_to_host (signal),
|
||||
target_signal_to_name (signal));
|
||||
if (status == 'W' || status == 'X')
|
||||
{
|
||||
if (extended_protocol)
|
||||
|
|
|
@ -171,6 +171,7 @@ int look_up_one_symbol (const char *name, CORE_ADDR *addrp);
|
|||
enum target_signal target_signal_from_host (int hostsig);
|
||||
int target_signal_to_host_p (enum target_signal oursig);
|
||||
int target_signal_to_host (enum target_signal oursig);
|
||||
char *target_signal_to_name (enum target_signal);
|
||||
|
||||
/* Functions from utils.c */
|
||||
|
||||
|
|
|
@ -81,9 +81,11 @@ struct target_ops
|
|||
|
||||
/* Wait for the inferior process to change state.
|
||||
|
||||
STATUSP will be filled in with a response code to send to GDB.
|
||||
STATUS will be filled in with a response code to send to GDB.
|
||||
|
||||
Returns the signal which caused the process to stop. */
|
||||
Returns the signal which caused the process to stop, in the
|
||||
remote protocol numbering (e.g. TARGET_SIGNAL_STOP), or the
|
||||
exit code as an integer if *STATUS is 'W'. */
|
||||
|
||||
unsigned char (*wait) (char *status);
|
||||
|
||||
|
|
1077
gdb/gdbserver/win32-i386-low.c
Normal file
1077
gdb/gdbserver/win32-i386-low.c
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue