This is the mail archive of the
gdb@sourceware.cygnus.com
mailing list for the GDB project.
[patch] UDP transport support
- To: GDB List <gdb at sourceware dot cygnus dot com>
- Subject: [patch] UDP transport support
- From: Momchil Velikov <velco at fadata dot bg>
- Date: Wed, 29 Mar 2000 22:50:15 +0300
Hi,
This patch adds generic UDP support to GDB.
The attachments contain:
gdb-udp.diff -- the patch itself
gdbChangeLog -- changelog entry for gdb/ChangeLog
docChangeLog -- changelog entry for gdb/doc/ChangeLog
ser-udp.c -- new file for the UDP transport.
Regards,
-velco
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.17
diff -c -3 -p -r1.17 Makefile.in
*** Makefile.in 2000/03/28 21:19:04 1.17
--- Makefile.in 2000/03/30 19:40:13
*************** ALLDEPFILES = 29k-share/udi/udip2soc.c 2
*** 1086,1092 ****
remote-st.c remote-utils.c dcache.c \
remote-udi.c remote-vx.c remote-vx29k.c \
rs6000-nat.c rs6000-tdep.c \
! ser-go32.c ser-pipe.c ser-ocd.c ser-tcp.c \
sh-tdep.c solib.c sparc-nat.c \
sparc-tdep.c sparcl-tdep.c sun3-nat.c sun386-nat.c \
symm-tdep.c symm-nat.c \
--- 1086,1092 ----
remote-st.c remote-utils.c dcache.c \
remote-udi.c remote-vx.c remote-vx29k.c \
rs6000-nat.c rs6000-tdep.c \
! ser-go32.c ser-pipe.c ser-ocd.c ser-tcp.c ser-udp.c \
sh-tdep.c solib.c sparc-nat.c \
sparc-tdep.c sparcl-tdep.c sun3-nat.c sun386-nat.c \
symm-tdep.c symm-nat.c \
*************** ser-ocd.o: ser-ocd.c $(defs_h) serial.h
*** 1760,1765 ****
--- 1760,1767 ----
ser-pipe.o: ser-pipe.c $(defs_h) serial.h signals.h gdb_string.h ser-unix.h
ser-tcp.o: ser-tcp.c $(defs_h) serial.h signals.h gdb_string.h ser-unix.h
+
+ ser-udp.o: ser-udp.c $(defs_h) serial.h signals.h gdb_string.h ser-unix.h
ser-unix.o: ser-unix.c $(defs_h) serial.h ser-unix.h
Index: ser-tcp.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-tcp.c,v
retrieving revision 1.1.1.9
diff -c -3 -p -r1.1.1.9 ser-tcp.c
*** ser-tcp.c 1999/10/05 23:08:47 1.1.1.9
--- ser-tcp.c 2000/03/30 19:40:13
*************** tcp_open (serial_t scb, const char *name
*** 57,63 ****
port_str = strchr (name, ':');
if (!port_str)
! error ("tcp_open: No colon in host name!"); /* Shouldn't ever happen */
tmp = min (port_str - name, (int) sizeof hostname - 1);
strncpy (hostname, name, tmp); /* Don't want colon */
--- 57,63 ----
port_str = strchr (name, ':');
if (!port_str)
! error ("tcp_open: No colon in host name!");
tmp = min (port_str - name, (int) sizeof hostname - 1);
strncpy (hostname, name, tmp); /* Don't want colon */
Index: serial.c
===================================================================
RCS file: /cvs/src/src/gdb/serial.c,v
retrieving revision 1.2
diff -c -3 -p -r1.2 serial.c
*** serial.c 2000/03/28 02:25:14 1.2
--- serial.c 2000/03/30 19:40:13
*************** serial_open (const char *name)
*** 185,192 ****
ops = serial_interface_lookup ("ocd");
else if (strcmp (name, "pc") == 0)
ops = serial_interface_lookup ("pc");
! else if (strchr (name, ':'))
! ops = serial_interface_lookup ("tcp");
else if (strncmp (name, "lpt", 3) == 0)
ops = serial_interface_lookup ("parallel");
else if (strncmp (name, "|", 1) == 0)
--- 185,200 ----
ops = serial_interface_lookup ("ocd");
else if (strcmp (name, "pc") == 0)
ops = serial_interface_lookup ("pc");
! else if (strncmp (name, "udp:", 4) == 0)
! {
! ops = serial_interface_lookup ("udp");
! open_name = name + 4; /* discard ``udp:'' */
! }
! else if (strncmp (name, "tcp:", 4) == 0)
! {
! ops = serial_interface_lookup ("tcp");
! open_name = name + 4; /* discard ``tcp:'' */
! }
else if (strncmp (name, "lpt", 3) == 0)
ops = serial_interface_lookup ("parallel");
else if (strncmp (name, "|", 1) == 0)
Index: config/alpha/alpha-linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/alpha/alpha-linux.mh,v
retrieving revision 1.2
diff -c -3 -p -r1.2 alpha-linux.mh
*** alpha-linux.mh 2000/03/03 02:18:26 1.2
--- alpha-linux.mh 2000/03/30 19:40:13
***************
*** 1,5 ****
# Host: Little-endian Alpha running Linux
! XDEPFILES= ser-tcp.o
XM_FILE= xm-alphalinux.h
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o inftarg.o corelow.o alpha-nat.o \
--- 1,5 ----
# Host: Little-endian Alpha running Linux
! XDEPFILES= ser-tcp.o ser-udp.o
XM_FILE= xm-alphalinux.h
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o inftarg.o corelow.o alpha-nat.o \
Index: config/arm/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/arm/linux.mh,v
retrieving revision 1.2
diff -c -3 -p -r1.2 linux.mh
*** linux.mh 2000/02/28 20:28:10 1.2
--- linux.mh 2000/03/30 19:40:13
***************
*** 1,7 ****
# Host: ARM based machine running GNU/Linux
XM_FILE= xm-linux.h
! XDEPFILES= ser-tcp.o
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o \
--- 1,7 ----
# Host: ARM based machine running GNU/Linux
XM_FILE= xm-linux.h
! XDEPFILES= ser-tcp.o ser-udp.o
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o \
Index: config/i386/cygwin.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/cygwin.mh,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 cygwin.mh
*** cygwin.mh 1999/04/16 01:34:17 1.1.1.1
--- cygwin.mh 2000/03/30 19:40:13
***************
*** 1,6 ****
MH_CFLAGS=
XM_FILE=xm-cygwin.h
! XDEPFILES=ser-tcp.o
NATDEPFILES= win32-nat.o
NAT_FILE=../nm-empty.h
XM_CLIBS=
--- 1,6 ----
MH_CFLAGS=
XM_FILE=xm-cygwin.h
! XDEPFILES=ser-tcp.o ser-udp.o
NATDEPFILES= win32-nat.o
NAT_FILE=../nm-empty.h
XM_CLIBS=
Index: config/i386/fbsd.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/fbsd.mh,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 fbsd.mh
*** fbsd.mh 1999/04/16 01:34:17 1.1.1.1
--- fbsd.mh 2000/03/30 19:40:13
***************
*** 1,5 ****
# Host: Intel 386 running FreeBSD
! XDEPFILES= ser-tcp.o
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o core-aout.o i386b-nat.o
XM_FILE= xm-i386bsd.h
NAT_FILE= nm-fbsd.h
--- 1,5 ----
# Host: Intel 386 running FreeBSD
! XDEPFILES= ser-tcp.o ser-udp.o
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o core-aout.o i386b-nat.o
XM_FILE= xm-i386bsd.h
NAT_FILE= nm-fbsd.h
Index: config/i386/i386dgux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/i386dgux.mh,v
retrieving revision 1.1.1.3
diff -c -3 -p -r1.1.1.3 i386dgux.mh
*** i386dgux.mh 2000/02/01 03:19:14 1.1.1.3
--- i386dgux.mh 2000/03/30 19:40:13
***************
*** 1,7 ****
# Host: Intel 386 running DGUX, cloned from SVR4
XM_FILE= xm-i386v4.h
! XDEPFILES= ser-tcp.o
# for network communication
XM_CLIBS= -lsocket -lnsl
--- 1,7 ----
# Host: Intel 386 running DGUX, cloned from SVR4
XM_FILE= xm-i386v4.h
! XDEPFILES= ser-tcp.o ser-udp.o
# for network communication
XM_CLIBS= -lsocket -lnsl
Index: config/i386/i386lynx.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/i386lynx.mh,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 i386lynx.mh
*** i386lynx.mh 1999/04/16 01:34:18 1.1.1.1
--- i386lynx.mh 2000/03/30 19:40:13
***************
*** 2,8 ****
XM_FILE= xm-i386lynx.h
XM_CLIBS= -lbsd
! XDEPFILES= ser-tcp.o
NAT_FILE= nm-i386lynx.h
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o lynx-nat.o
--- 2,8 ----
XM_FILE= xm-i386lynx.h
XM_CLIBS= -lbsd
! XDEPFILES= ser-tcp.o ser-udp.o
NAT_FILE= nm-i386lynx.h
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o lynx-nat.o
Index: config/i386/i386sco5.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/i386sco5.mh,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 i386sco5.mh
*** i386sco5.mh 1999/04/16 01:34:19 1.1.1.1
--- i386sco5.mh 2000/03/30 19:40:13
*************** XM_FILE= xm-i386sco.h
*** 8,14 ****
# runtime, but all come with the development system, so we always
# have socket(), gethostbyname(), and friends.
#
! XDEPFILES= ser-tcp.o
XM_CLIBS= -lPW -lsocket
NAT_FILE= nm-i386sco5.h
--- 8,14 ----
# runtime, but all come with the development system, so we always
# have socket(), gethostbyname(), and friends.
#
! XDEPFILES= ser-tcp.o ser-udp.o
XM_CLIBS= -lPW -lsocket
NAT_FILE= nm-i386sco5.h
Index: config/i386/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/linux.mh,v
retrieving revision 1.1.1.4
diff -c -3 -p -r1.1.1.4 linux.mh
*** linux.mh 1999/12/22 21:45:13 1.1.1.4
--- linux.mh 2000/03/30 19:40:13
***************
*** 1,7 ****
# Host: Intel 386 running GNU/Linux
XM_FILE= xm-linux.h
! XDEPFILES= ser-tcp.o
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o \
--- 1,7 ----
# Host: Intel 386 running GNU/Linux
XM_FILE= xm-linux.h
! XDEPFILES= ser-tcp.o ser-udp.o
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o \
Index: config/i386/nbsd.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nbsd.mh,v
retrieving revision 1.2
diff -c -3 -p -r1.2 nbsd.mh
*** nbsd.mh 2000/03/22 01:36:31 1.2
--- nbsd.mh 2000/03/30 19:40:13
***************
*** 1,5 ****
# Host: Intel 386 running NetBSD
! XDEPFILES= ser-tcp.o
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o i386nbsd-nat.o
XM_FILE= xm-nbsd.h
NAT_FILE= nm-nbsd.h
--- 1,5 ----
# Host: Intel 386 running NetBSD
! XDEPFILES= ser-tcp.o ser-udp.o
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o i386nbsd-nat.o
XM_FILE= xm-nbsd.h
NAT_FILE= nm-nbsd.h
Index: config/ia64/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/ia64/linux.mh,v
retrieving revision 1.1
diff -c -3 -p -r1.1 linux.mh
*** linux.mh 2000/03/21 00:11:10 1.1
--- linux.mh 2000/03/30 19:40:13
***************
*** 1,7 ****
# Host: Intel IA-64 running GNU/Linux
XM_FILE= xm-linux.h
! XDEPFILES= ser-tcp.o
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o \
--- 1,7 ----
# Host: Intel IA-64 running GNU/Linux
XM_FILE= xm-linux.h
! XDEPFILES= ser-tcp.o ser-udp.o
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o \
Index: config/m68k/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/m68k/linux.mh,v
retrieving revision 1.1.1.2
diff -c -3 -p -r1.1.1.2 linux.mh
*** linux.mh 1999/12/07 03:56:10 1.1.1.2
--- linux.mh 2000/03/30 19:40:13
***************
*** 1,7 ****
# Host: Motorola m68k running Linux
XM_FILE= xm-linux.h
! XDEPFILES= ser-tcp.o
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o \
--- 1,7 ----
# Host: Motorola m68k running Linux
XM_FILE= xm-linux.h
! XDEPFILES= ser-tcp.o ser-udp.o
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o \
Index: config/m68k/m68klynx.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/m68k/m68klynx.mh,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 m68klynx.mh
*** m68klynx.mh 1999/04/16 01:34:21 1.1.1.1
--- m68klynx.mh 2000/03/30 19:40:13
***************
*** 2,8 ****
XM_FILE= xm-m68klynx.h
XM_CLIBS= -lbsd
! XDEPFILES= ser-tcp.o
NAT_FILE= nm-m68klynx.h
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o lynx-nat.o
--- 2,8 ----
XM_FILE= xm-m68klynx.h
XM_CLIBS= -lbsd
! XDEPFILES= ser-tcp.o ser-udp.o
NAT_FILE= nm-m68klynx.h
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o lynx-nat.o
Index: config/m68k/nbsd.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/m68k/nbsd.mh,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 nbsd.mh
*** nbsd.mh 1999/04/16 01:34:21 1.1.1.1
--- nbsd.mh 2000/03/30 19:40:13
***************
*** 1,5 ****
# Host: Motorola m68k running NetBSD
! XDEPFILES= ser-tcp.o
NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o m68knbsd-nat.o
XM_FILE= xm-nbsd.h
NAT_FILE= nm-nbsd.h
--- 1,5 ----
# Host: Motorola m68k running NetBSD
! XDEPFILES= ser-tcp.o ser-udp.o
NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o m68knbsd-nat.o
XM_FILE= xm-nbsd.h
NAT_FILE= nm-nbsd.h
Index: config/mips/irix4.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/irix4.mh,v
retrieving revision 1.1.1.3
diff -c -3 -p -r1.1.1.3 irix4.mh
*** irix4.mh 2000/02/01 03:19:17 1.1.1.3
--- irix4.mh 2000/03/30 19:40:13
***************
*** 1,5 ****
# Host: SGI Iris running irix 4.x
! XDEPFILES= ser-tcp.o
XM_FILE= xm-irix4.h
NAT_FILE= nm-irix4.h
NATDEPFILES= fork-child.o irix4-nat.o corelow.o procfs.o \
--- 1,5 ----
# Host: SGI Iris running irix 4.x
! XDEPFILES= ser-tcp.o ser-udp.o
XM_FILE= xm-irix4.h
NAT_FILE= nm-irix4.h
NATDEPFILES= fork-child.o irix4-nat.o corelow.o procfs.o \
Index: config/mips/irix5.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/irix5.mh,v
retrieving revision 1.1.1.3
diff -c -3 -p -r1.1.1.3 irix5.mh
*** irix5.mh 2000/02/01 03:19:17 1.1.1.3
--- irix5.mh 2000/03/30 19:40:13
***************
*** 1,5 ****
# Host: SGI Iris running irix 5.x
! XDEPFILES= ser-tcp.o
XM_FILE= xm-irix5.h
NAT_FILE= nm-irix5.h
NATDEPFILES= fork-child.o irix5-nat.o corelow.o procfs.o \
--- 1,5 ----
# Host: SGI Iris running irix 5.x
! XDEPFILES= ser-tcp.o ser-udp.o
XM_FILE= xm-irix5.h
NAT_FILE= nm-irix5.h
NATDEPFILES= fork-child.o irix5-nat.o corelow.o procfs.o \
Index: config/ns32k/nbsd.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/ns32k/nbsd.mh,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 nbsd.mh
*** nbsd.mh 1999/04/16 01:34:24 1.1.1.1
--- nbsd.mh 2000/03/30 19:40:13
***************
*** 1,5 ****
# Host: PC532 running NetBSD
! XDEPFILES= ser-tcp.o
XM_FILE= xm-nbsd.h
NAT_FILE= nm-nbsd.h
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o ns32knbsd-nat.o
--- 1,5 ----
# Host: PC532 running NetBSD
! XDEPFILES= ser-tcp.o ser-udp.o
XM_FILE= xm-nbsd.h
NAT_FILE= nm-nbsd.h
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o ns32knbsd-nat.o
Index: config/pa/hppabsd.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/pa/hppabsd.mh,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 hppabsd.mh
*** hppabsd.mh 1999/04/16 01:34:24 1.1.1.1
--- hppabsd.mh 2000/03/30 19:40:13
***************
*** 1,5 ****
# Host: Hewlett-Packard PA-RISC machine, running BSD
! XDEPFILES= ser-tcp.o
XM_FILE= xm-hppab.h
NAT_FILE= nm-hppab.h
NATDEPFILES= hppab-nat.o corelow.o core-aout.o inftarg.o fork-child.o somread.o infptrace.o hp-psymtab-read.o hp-symtab-read.o somsolib.o
--- 1,5 ----
# Host: Hewlett-Packard PA-RISC machine, running BSD
! XDEPFILES= ser-tcp.o ser-udp.o
XM_FILE= xm-hppab.h
NAT_FILE= nm-hppab.h
NATDEPFILES= hppab-nat.o corelow.o core-aout.o inftarg.o fork-child.o somread.o infptrace.o hp-psymtab-read.o hp-symtab-read.o somsolib.o
Index: config/pa/hppahpux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/pa/hppahpux.mh,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 hppahpux.mh
*** hppahpux.mh 1999/04/16 01:34:24 1.1.1.1
--- hppahpux.mh 2000/03/30 19:40:13
***************
*** 1,7 ****
# Host: Hewlett-Packard PA-RISC machine, running HPUX
XM_FILE= xm-hppah.h
! XDEPFILES= ser-tcp.o
NAT_FILE= nm-hppah.h
NATDEPFILES= hppah-nat.o corelow.o core-aout.o inftarg.o fork-child.o somread.o infptrace.o hp-psymtab-read.o hp-symtab-read.o somsolib.o
--- 1,7 ----
# Host: Hewlett-Packard PA-RISC machine, running HPUX
XM_FILE= xm-hppah.h
! XDEPFILES= ser-tcp.o ser-udp.o
NAT_FILE= nm-hppah.h
NATDEPFILES= hppah-nat.o corelow.o core-aout.o inftarg.o fork-child.o somread.o infptrace.o hp-psymtab-read.o hp-symtab-read.o somsolib.o
Index: config/pa/hppaosf.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/pa/hppaosf.mh,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 hppaosf.mh
*** hppaosf.mh 1999/04/16 01:34:24 1.1.1.1
--- hppaosf.mh 2000/03/30 19:40:13
***************
*** 1,5 ****
# Host: Hewlett-Packard PA-RISC machine, running BSD
! XDEPFILES= ser-tcp.o
XM_FILE= xm-hppab.h
NAT_FILE= nm-hppao.h
NATDEPFILES= fork-child.o m3-nat.o hppam3-nat.o somread.o hp-psymtab-read.o hp-symtab-read.o somsolib.o
--- 1,5 ----
# Host: Hewlett-Packard PA-RISC machine, running BSD
! XDEPFILES= ser-tcp.o ser-udp.o
XM_FILE= xm-hppab.h
NAT_FILE= nm-hppao.h
NATDEPFILES= fork-child.o m3-nat.o hppam3-nat.o somread.o hp-psymtab-read.o hp-symtab-read.o somsolib.o
Index: config/pa/hpux1020.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/pa/hpux1020.mh,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 hpux1020.mh
*** hpux1020.mh 1999/04/16 01:34:24 1.1.1.1
--- hpux1020.mh 2000/03/30 19:40:13
***************
*** 3,9 ****
MH_CFLAGS = -D__HP_CURSES
XM_FILE= xm-hppah.h
! XDEPFILES= ser-tcp.o
NAT_FILE= nm-hppah.h
NATDEPFILES= hppah-nat.o corelow.o core-aout.o inftarg.o fork-child.o infptrace.o somread.o hp-psymtab-read.o hp-symtab-read.o somsolib.o
--- 3,9 ----
MH_CFLAGS = -D__HP_CURSES
XM_FILE= xm-hppah.h
! XDEPFILES= ser-tcp.o ser-udp.o
NAT_FILE= nm-hppah.h
NATDEPFILES= hppah-nat.o corelow.o core-aout.o inftarg.o fork-child.o infptrace.o somread.o hp-psymtab-read.o hp-symtab-read.o somsolib.o
Index: config/pa/hpux11.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/pa/hpux11.mh,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 hpux11.mh
*** hpux11.mh 1999/08/23 22:37:07 1.1.1.1
--- hpux11.mh 2000/03/30 19:40:13
***************
*** 3,9 ****
MH_CFLAGS = -D__HP_CURSES
XM_FILE= xm-hppah.h
! XDEPFILES= ser-tcp.o
NAT_FILE= nm-hppah11.h
NATDEPFILES= hppah-nat.o corelow.o core-aout.o inftarg.o fork-child.o infttrace.o somread.o hp-psymtab-read.o hp-symtab-read.o somsolib.o
--- 3,9 ----
MH_CFLAGS = -D__HP_CURSES
XM_FILE= xm-hppah.h
! XDEPFILES= ser-tcp.o ser-udp.o
NAT_FILE= nm-hppah11.h
NATDEPFILES= hppah-nat.o corelow.o core-aout.o inftarg.o fork-child.o infttrace.o somread.o hp-psymtab-read.o hp-symtab-read.o somsolib.o
Index: config/pa/hpux11w.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/pa/hpux11w.mh,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 hpux11w.mh
*** hpux11w.mh 1999/08/23 22:37:07 1.1.1.1
--- hpux11w.mh 2000/03/30 19:40:13
***************
*** 3,9 ****
MH_CFLAGS = -D__HP_CURSES
XM_FILE= xm-hppah.h
! XDEPFILES= ser-tcp.o
NAT_FILE= nm-hppah11.h
NATDEPFILES= hppah-nat.o corelow.o core-aout.o inftarg.o fork-child.o infttrace.o hp-psymtab-read.o hp-symtab-read.o pa64solib.o
--- 3,9 ----
MH_CFLAGS = -D__HP_CURSES
XM_FILE= xm-hppah.h
! XDEPFILES= ser-tcp.o ser-udp.o
NAT_FILE= nm-hppah11.h
NATDEPFILES= hppah-nat.o corelow.o core-aout.o inftarg.o fork-child.o infttrace.o hp-psymtab-read.o hp-symtab-read.o pa64solib.o
Index: config/powerpc/cygwin.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/powerpc/cygwin.mh,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 cygwin.mh
*** cygwin.mh 1999/04/16 01:34:24 1.1.1.1
--- cygwin.mh 2000/03/30 19:40:13
***************
*** 1,5 ****
MH_CFLAGS=
XM_FILE=xm-cygwin.h
! XDEP_FILES=ser-tcp.o
NATDEPFILES=win32-nat.o
XM_CLIBS=-lkernel32
--- 1,5 ----
MH_CFLAGS=
XM_FILE=xm-cygwin.h
! XDEP_FILES=ser-tcp.o ser-udp.o
NATDEPFILES=win32-nat.o
XM_CLIBS=-lkernel32
Index: config/powerpc/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/powerpc/linux.mh,v
retrieving revision 1.2
diff -c -3 -p -r1.2 linux.mh
*** linux.mh 2000/02/22 01:27:34 1.2
--- linux.mh 2000/03/30 19:40:13
***************
*** 1,7 ****
# Host: PowerPC, running Linux
XM_FILE= xm-linux.h
! XDEPFILES= ser-tcp.o
XM_CLIBS=
NAT_FILE= nm-linux.h
--- 1,7 ----
# Host: PowerPC, running Linux
XM_FILE= xm-linux.h
! XDEPFILES= ser-tcp.o ser-udp.o
XM_CLIBS=
NAT_FILE= nm-linux.h
Index: config/powerpc/solaris.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/powerpc/solaris.mh,v
retrieving revision 1.1.1.3
diff -c -3 -p -r1.1.1.3 solaris.mh
*** solaris.mh 2000/02/01 03:19:18 1.1.1.3
--- solaris.mh 2000/03/30 19:40:13
***************
*** 1,7 ****
# Host: PowerPC, running Solaris 2
XM_FILE= xm-solaris.h
! XDEPFILES= ser-tcp.o
XM_CLIBS= -lsocket -lnsl
NAT_FILE= nm-solaris.h
--- 1,7 ----
# Host: PowerPC, running Solaris 2
XM_FILE= xm-solaris.h
! XDEPFILES= ser-tcp.o ser-udp.o
XM_CLIBS= -lsocket -lnsl
NAT_FILE= nm-solaris.h
Index: config/rs6000/rs6000lynx.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/rs6000/rs6000lynx.mh,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 rs6000lynx.mh
*** rs6000lynx.mh 1999/04/16 01:34:25 1.1.1.1
--- rs6000lynx.mh 2000/03/30 19:40:13
***************
*** 1,7 ****
# Host: RS6000 running LynxOS
XM_FILE= xm-rs6000ly.h
! XDEPFILES= ser-tcp.o
XM_CLIBS= -lbsd
NAT_FILE= nm-rs6000ly.h
--- 1,7 ----
# Host: RS6000 running LynxOS
XM_FILE= xm-rs6000ly.h
! XDEPFILES= ser-tcp.o ser-udp.o
XM_CLIBS= -lbsd
NAT_FILE= nm-rs6000ly.h
Index: config/sparc/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/linux.mh,v
retrieving revision 1.1.1.2
diff -c -3 -p -r1.1.1.2 linux.mh
*** linux.mh 1999/12/07 03:56:12 1.1.1.2
--- linux.mh 2000/03/30 19:40:13
***************
*** 1,5 ****
# Host: Sparcstation, running Linux
! XDEPFILES= ser-tcp.o
XM_FILE= xm-linux.h
NAT_FILE= nm-linux.h
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o \
--- 1,5 ----
# Host: Sparcstation, running Linux
! XDEPFILES= ser-tcp.o ser-udp.o
XM_FILE= xm-linux.h
NAT_FILE= nm-linux.h
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o \
Index: config/sparc/nbsd.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/nbsd.mh,v
retrieving revision 1.1.1.2
diff -c -3 -p -r1.1.1.2 nbsd.mh
*** nbsd.mh 1999/12/14 01:05:42 1.1.1.2
--- nbsd.mh 2000/03/30 19:40:13
***************
*** 1,5 ****
# Host: Sun 4 or Sparcstation, running NetBSD
! XDEPFILES= ser-tcp.o
XM_FILE= xm-nbsd.h
NAT_FILE= nm-nbsd.h
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o solib.o
--- 1,5 ----
# Host: Sun 4 or Sparcstation, running NetBSD
! XDEPFILES= ser-tcp.o ser-udp.o
XM_FILE= xm-nbsd.h
NAT_FILE= nm-nbsd.h
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o solib.o
Index: config/sparc/nbsdelf.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/nbsdelf.mh,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 nbsdelf.mh
*** nbsdelf.mh 1999/12/14 01:05:42 1.1.1.1
--- nbsdelf.mh 2000/03/30 19:40:13
***************
*** 1,5 ****
# Host: Sun 4 or Sparcstation, running NetBSD
! XDEPFILES= ser-tcp.o
XM_FILE= xm-nbsd.h
NAT_FILE= nm-nbsdelf.h
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o solib.o
--- 1,5 ----
# Host: Sun 4 or Sparcstation, running NetBSD
! XDEPFILES= ser-tcp.o ser-udp.o
XM_FILE= xm-nbsd.h
NAT_FILE= nm-nbsdelf.h
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o solib.o
Index: config/sparc/sparclynx.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/sparclynx.mh,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 sparclynx.mh
*** sparclynx.mh 1999/04/16 01:34:25 1.1.1.1
--- sparclynx.mh 2000/03/30 19:40:13
***************
*** 1,7 ****
# Host: Sparc running LynxOS
XM_FILE= xm-sparclynx.h
! XDEPFILES= ser-tcp.o
XM_CLIBS= -lbsd
NAT_FILE= nm-sparclynx.h
--- 1,7 ----
# Host: Sparc running LynxOS
XM_FILE= xm-sparclynx.h
! XDEPFILES= ser-tcp.o ser-udp.o
XM_CLIBS= -lbsd
NAT_FILE= nm-sparclynx.h
Index: config/sparc/sun4os4.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/sun4os4.mh,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 sun4os4.mh
*** sun4os4.mh 1999/04/16 01:34:26 1.1.1.1
--- sun4os4.mh 2000/03/30 19:40:13
***************
*** 1,5 ****
# Host: Sun 4 or Sparcstation, running SunOS 4
! XDEPFILES= ser-tcp.o
XM_FILE= xm-sun4os4.h
NAT_FILE= nm-sun4os4.h
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o
--- 1,5 ----
# Host: Sun 4 or Sparcstation, running SunOS 4
! XDEPFILES= ser-tcp.o ser-udp.o
XM_FILE= xm-sun4os4.h
NAT_FILE= nm-sun4os4.h
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o
Index: config/sparc/sun4sol2.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/sun4sol2.mh,v
retrieving revision 1.1.1.3
diff -c -3 -p -r1.1.1.3 sun4sol2.mh
*** sun4sol2.mh 2000/01/25 02:40:07 1.1.1.3
--- sun4sol2.mh 2000/03/30 19:40:13
***************
*** 1,7 ****
# Host: Sun 4 or Sparcstation, running Solaris 2
XM_FILE= xm-sun4sol2.h
! XDEPFILES= ser-tcp.o
XM_CLIBS= -lsocket -lnsl
NAT_FILE= nm-sun4sol2.h
--- 1,7 ----
# Host: Sun 4 or Sparcstation, running Solaris 2
XM_FILE= xm-sun4sol2.h
! XDEPFILES= ser-tcp.o ser-udp.o
XM_CLIBS= -lsocket -lnsl
NAT_FILE= nm-sun4sol2.h
Index: doc/gdbint.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
retrieving revision 1.4
diff -c -3 -p -r1.4 gdbint.texinfo
*** gdbint.texinfo 2000/03/23 23:50:51 1.4
--- gdbint.texinfo 2000/03/30 19:40:53
*************** using the GO32 execution environment.
*** 905,910 ****
--- 905,913 ----
@item ser-tcp.c
This contains generic TCP support using sockets.
+ @item ser-udp.c
+ This contains generic UDP support using sockets.
+
@end table
@section Host Conditionals
2000-03-29 Momchil Velikov <velco@fadata.bg>
* config/alpha/alpha-linux.mh (XDEPFILES): Added ser-udp.o.
* config/arm/linux.mh: Likewise.
* config/i386/cygwin.mh: Likewise.
* config/i386/fbsd.mh: Likewise.
* config/i386/i386dgux.mh: Likewise.
* config/i386/i386lynx.mh: Likewise.
* config/i386/i386sco5.mh: Likewise.
* config/i386/linux.mh: Likewise.
* config/i386/nbsd.mh: Likewise.
* config/ia64/linux.mh: Likewise.
* config/m68k/linux.mh: Likewise.
* config/m68k/m68klynx.mh: Likewise.
* config/m68k/nbsd.mh: Likewise.
* config/mips/irix4.mh: Likewise.
* config/mips/irix5.mh: Likewise.
* config/ns32k/nbsd.mh: Likewise.
* config/pa/hppabsd.mh: Likewise.
* config/pa/hppahpux.mh: Likewise.
* config/pa/hppaosf.mh: Likewise.
* config/pa/hpux1020.mh: Likewise.
* config/pa/hpux11.mh: Likewise.
* config/pa/hpux11w.mh: Likewise.
* config/powerpc/cygwin.mh: Likewise.
* config/powerpc/linux.mh: Likewise.
* config/powerpc/solaris.mh: Likewise.
* config/rs6000/rs6000lynx.mh: Likewise.
* config/sparc/linux.mh: Likewise.
* config/sparc/nbsd.mh: Likewise.
* config/sparc/nbsdelf.mh: Likewise.
* config/sparc/sparclynx.mh: Likewise.
* config/sparc/sun4os4.mh: Likewise.
* config/sparc/sun4sol2.mh: Likewise.
* serial.c (serial_open): Changed parsing of the NAME
parameter for TCP and UDP transports - now the syntax is
``tcp:<host>:<port>'' and ``udp:<host>:<port>''.
* ser-tcp.c (tcp_open): Removed inappropriate comment.
* ser-udp.c: New file.
* Makefile.in (ALLDEPFILES): Added ser-udp.c.
Added dependency for ser-udp.o.
2000-03-29 Momchil Velikov <velco@fadata.bg>
* gdbint.texinfo (Host Definition): Mention ser-udp.c
under subheading ``Generic Host Support Files''.
/* Serial interface for raw UDP connections on Un*x like systems
Copyright 2000 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "defs.h"
#include "serial.h"
#include <sys/types.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/socket.h>
#ifndef __CYGWIN32__
#include <netinet/udp.h>
#endif
#include "signals.h"
#include "gdb_string.h"
struct udp_ttystate
{
int bogus;
};
static int udp_open PARAMS ((serial_t scb, const char *name));
static void udp_raw PARAMS ((serial_t scb));
static int wait_for PARAMS ((serial_t scb, int timeout));
static int udp_readchar PARAMS ((serial_t scb, int timeout));
static int udp_setbaudrate PARAMS ((serial_t scb, int rate));
static int udp_setstopbits PARAMS ((serial_t scb, int num));
static int udp_write PARAMS ((serial_t scb, const char *str, int len));
/* FIXME: static void udp_restore PARAMS ((serial_t scb)); */
static void udp_close PARAMS ((serial_t scb));
static serial_ttystate udp_get_tty_state PARAMS ((serial_t scb));
static int udp_set_tty_state PARAMS ((serial_t scb, serial_ttystate state));
static int udp_return_0 PARAMS ((serial_t));
static int udp_noflush_set_tty_state PARAMS ((serial_t, serial_ttystate,
serial_ttystate));
static void udp_print_tty_state PARAMS ((serial_t, serial_ttystate));
void _initialize_ser_udp PARAMS ((void));
/* Open up a raw udp socket */
static int
udp_open(scb, name)
serial_t scb;
const char *name;
{
char *port_str;
int port;
struct hostent *hostent;
struct sockaddr_in sockaddr;
int tmp;
char hostname[100];
struct protoent *protoent;
int i;
port_str = strchr (name, ':');
if (!port_str)
error ("udp_open: No colon in host name!");
tmp = min (port_str - name, (int) sizeof hostname - 1);
strncpy (hostname, name, tmp); /* Don't want colon */
hostname[tmp] = '\000'; /* Tie off host name */
port = atoi (port_str + 1);
hostent = gethostbyname (hostname);
if (!hostent)
{
fprintf_unfiltered (gdb_stderr, "%s: unknown host\n", hostname);
errno = ENOENT;
return -1;
}
scb->fd = socket (PF_INET, SOCK_DGRAM, 0);
if (scb->fd < 0)
return -1;
/* Allow rapid reuse of this port. */
tmp = 1;
setsockopt (scb->fd, SOL_SOCKET, SO_REUSEADDR, (char *)&tmp, sizeof(tmp));
sockaddr.sin_family = PF_INET;
sockaddr.sin_port = htons(port);
memcpy (&sockaddr.sin_addr.s_addr, hostent->h_addr,
sizeof (struct in_addr));
if (connect (scb->fd, (struct sockaddr *) &sockaddr, sizeof(sockaddr)))
return -1;
return 0;
}
static serial_ttystate
udp_get_tty_state(scb)
serial_t scb;
{
struct udp_ttystate *state;
state = (struct udp_ttystate *)xmalloc(sizeof *state);
return (serial_ttystate)state;
}
static int
udp_set_tty_state(scb, ttystate)
serial_t scb;
serial_ttystate ttystate;
{
struct udp_ttystate *state;
state = (struct udp_ttystate *)ttystate;
return 0;
}
static int
udp_return_0 (scb)
serial_t scb;
{
return 0;
}
static void
udp_raw(scb)
serial_t scb;
{
return; /* Always in raw mode */
}
/* Wait for input on scb, with timeout seconds. Returns 0 on success,
otherwise SERIAL_TIMEOUT or SERIAL_ERROR.
For termio{s}, we actually just setup VTIME if necessary, and let the
timeout occur in the read() in udp_read().
*/
static int
wait_for (scb, timeout)
serial_t scb;
int timeout;
{
int numfds;
struct timeval tv;
fd_set readfds, exceptfds;
FD_ZERO (&readfds);
FD_ZERO (&exceptfds);
tv.tv_sec = timeout;
tv.tv_usec = 0;
FD_SET(scb->fd, &readfds);
FD_SET(scb->fd, &exceptfds);
while (1)
{
if (timeout >= 0)
numfds = select(scb->fd+1, &readfds, 0, &exceptfds, &tv);
else
numfds = select(scb->fd+1, &readfds, 0, &exceptfds, 0);
if (numfds <= 0)
{
if (numfds == 0)
return SERIAL_TIMEOUT;
else if (errno == EINTR)
continue;
else
return SERIAL_ERROR; /* Got an error from select or poll */
}
return 0;
}
}
/* Read a character with user-specified timeout. TIMEOUT is number of seconds
to wait, or -1 to wait forever. Use timeout of 0 to effect a poll. Returns
char if successful. Returns -2 if timeout expired, EOF if line dropped
dead, or -3 for any other error (see errno in that case). */
static int
udp_readchar (scb, timeout)
serial_t scb;
int timeout;
{
int status;
if (scb->bufcnt-- > 0)
return *scb->bufp++;
status = wait_for(scb, timeout);
if (status < 0)
return status;
while (1)
{
scb->bufcnt = read(scb->fd, scb->buf, BUFSIZ);
if (scb->bufcnt != -1 || errno != EINTR)
break;
}
if (scb->bufcnt <= 0)
{
if (scb->bufcnt == 0)
return SERIAL_TIMEOUT; /* 0 chars means timeout [may need to
distinguish between EOF & timeouts
someday] */
else
return SERIAL_ERROR; /* Got an error from read */
}
scb->bufcnt--;
scb->bufp = scb->buf;
return *scb->bufp++;
}
static int
udp_noflush_set_tty_state (scb, new_ttystate, old_ttystate)
serial_t scb;
serial_ttystate new_ttystate;
serial_ttystate old_ttystate;
{
return 0;
}
static void
udp_print_tty_state (scb, ttystate)
serial_t scb;
serial_ttystate ttystate;
{
/* Nothing to print. */
return;
}
static int
udp_setbaudrate(scb, rate)
serial_t scb;
int rate;
{
return 0; /* Never fails! */
}
static int
udp_setstopbits(scb, num)
serial_t scb;
int num;
{
return 0; /* Never fails! */
}
static int
udp_write(scb, str, len)
serial_t scb;
const char *str;
int len;
{
int cc;
while (len > 0)
{
cc = write(scb->fd, str, len);
if (cc < 0)
return 1;
len -= cc;
str += cc;
}
return 0;
}
static void
udp_close(scb)
serial_t scb;
{
if (scb->fd < 0)
return;
close(scb->fd);
scb->fd = -1;
}
static struct serial_ops udp_ops =
{
"udp",
0,
udp_open,
udp_close,
udp_readchar,
udp_write,
udp_return_0, /* flush output */
udp_return_0, /* flush input */
udp_return_0, /* send break */
udp_raw,
udp_get_tty_state,
udp_set_tty_state,
udp_print_tty_state,
udp_noflush_set_tty_state,
udp_setbaudrate,
udp_setstopbits,
udp_return_0, /* wait for output to drain */
};
void
_initialize_ser_udp ()
{
serial_add_interface (&udp_ops);
}