summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Seitz <keiths@cygnus>1998-09-25 19:04:46 +0000
committerKeith Seitz <keiths@cygnus>1998-09-25 19:04:46 +0000
commit69da960729726894f3323027b23de8901f09e856 (patch)
tree647741a49ecff15ea195d9f316102b6618083b36
parent1af37f6bde766785b703ebd52378f3109fd85483 (diff)
downloadbinutils-gdb-69da960729726894f3323027b23de8901f09e856.tar.gz
Merge with armelf980813:
* rdi-share/unixcomm.c: If using cygwin32, also use the SERPORT and PARPORT defines for win32. (Unix_MatchValidSerialDevice): For cygwin32, valid serial port names start with "com", not "/dev/tty". (Unix_OpenSerial): Do not use O_NONBLOCK on cygwin32. * rdi-share/devsw.c (DevSW_Close): Free the device's state (SwitcherState) so that the device may be reopened. * remote-rdi.c (mywritec): Send all output through gdb's *_unfiltered functions, ignoring non-ASCII chars, so that non-tty UI's can snarf the output from fputs_hook. (mywrite): Ditto. (arm_rdi_open): Set inferior_pid. (arm_rdi_detach): Pop the target off the target stack so that users can attach and detach multiple times. (arm_rdi_close): Close the opened device and reset inferior_pid, too.
-rw-r--r--gdb/ChangeLog20
-rw-r--r--gdb/rdi-share/devsw.c4
-rw-r--r--gdb/rdi-share/unixcomm.c13
-rw-r--r--gdb/remote-rdi.c25
4 files changed, 55 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c8908686023..04969a3a01d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -208,6 +208,26 @@ Mon Aug 31 15:42:10 1998 Tom Tromey <tromey@cygnus.com>
* top.c (context_hook): Define.
+1998-08-26 Keith Seitz <keiths@cygnus.com>
+
+ * rdi-share/unixcomm.c: If using cygwin32, also use the SERPORT and
+ PARPORT defines for win32.
+ (Unix_MatchValidSerialDevice): For cygwin32, valid serial port names
+ start with "com", not "/dev/tty".
+ (Unix_OpenSerial): Do not use O_NONBLOCK on cygwin32.
+
+ * rdi-share/devsw.c (DevSW_Close): Free the device's state (SwitcherState)
+ so that the device may be reopened.
+
+ * remote-rdi.c (mywritec): Send all output through gdb's *_unfiltered
+ functions, ignoring non-ASCII chars, so that non-tty UI's can snarf
+ the output from fputs_hook.
+ (mywrite): Ditto.
+ (arm_rdi_open): Set inferior_pid.
+ (arm_rdi_detach): Pop the target off the target stack so that
+ users can attach and detach multiple times.
+ (arm_rdi_close): Close the opened device and reset inferior_pid, too.
+
Tue Aug 25 13:21:58 1998 Michael Snyder <msnyder@cleaver.cygnus.com>
* ax-gdb.c (gen_var_ref): Allow for typedef types.
diff --git a/gdb/rdi-share/devsw.c b/gdb/rdi-share/devsw.c
index 590b81241e8..7fa142b4722 100644
--- a/gdb/rdi-share/devsw.c
+++ b/gdb/rdi-share/devsw.c
@@ -265,6 +265,10 @@ AdpErrs DevSW_Close(const DeviceDescr *device, const DevChanID type)
pk = Adp_removeFromQueue(&(ds->ds_readqueue[type])))
DevSW_FreePacket(pk);
+ /* Free memory */
+ free ((char *) device->SwitcherState);
+ device->SwitcherState = 0x0;
+
/* that's all */
return adp_ok;
}
diff --git a/gdb/rdi-share/unixcomm.c b/gdb/rdi-share/unixcomm.c
index 7cb55e6c8d5..400d1fdf5bf 100644
--- a/gdb/rdi-share/unixcomm.c
+++ b/gdb/rdi-share/unixcomm.c
@@ -88,11 +88,14 @@
#define PARPORT2 "/dev/par1"
#endif
-#ifdef _WIN32
+#define SERIAL_PREFIX "/dev/tty"
+#if defined(_WIN32) || defined (__CYGWIN32__)
#define SERPORT1 "com1"
#define SERPORT2 "com2"
#define PARPORT1 "lpt1"
#define PARPORT2 "lpt2"
+#undef SERIAL_PREFIX
+#define SERIAL_PREFIX "com"
#endif
/*
@@ -121,7 +124,11 @@ extern const char *Unix_MatchValidSerialDevice(const char *name)
*/
/* Accept /dev/tty* where * is limited */
- if (strlen(name) == strlen(SERPORT1) && strncmp(name, "/dev/tty", 8) == 0) return name;
+ if (strlen(name) == strlen(SERPORT1)
+ && strncmp(name, SERIAL_PREFIX, strlen (SERIAL_PREFIX)) == 0)
+ {
+ return name;
+ }
/* Accept "1" or "2" or "S" - S is equivalent to "1" */
if (strcmp(name, "1") == 0 ||
@@ -224,7 +231,7 @@ extern int Unix_IsSerialInUse(void)
extern int Unix_OpenSerial(const char *name)
{
-#if defined(BSD)
+#if defined(BSD) || defined(__CYGWIN32__)
serpfd = open(name, O_RDWR);
#else
serpfd = open(name, O_RDWR | O_NONBLOCK);
diff --git a/gdb/remote-rdi.c b/gdb/remote-rdi.c
index ee025850581..137bc59f762 100644
--- a/gdb/remote-rdi.c
+++ b/gdb/remote-rdi.c
@@ -42,6 +42,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "rdi-share/adp.h"
#include "rdi-share/hsys.h"
+extern int isascii PARAMS ((int));
+
/* Prototypes for local functions */
static void arm_rdi_files_info PARAMS ((struct target_ops *ignore));
@@ -145,7 +147,8 @@ mywritec (arg, c)
PTR arg;
int c;
{
- fputc (c, (FILE *) arg);
+ if (isascii (c))
+ fputc_unfiltered (c, (FILE *) arg);
}
static int
@@ -154,7 +157,20 @@ mywrite (arg, buffer, len)
char const *buffer;
int len;
{
- return fwrite (buffer, 1, len, stdout);
+ int i;
+ char *e;
+
+ e = (char *) buffer;
+ for (i = 0; i < len; i++)
+{
+ if (isascii ((int) *e))
+ {
+ fputc_unfiltered ((int) *e, gdb_stdout);
+ e++;
+ }
+}
+
+ return len;
}
static void
@@ -300,8 +316,8 @@ device is attached to the remote system (e.g. /dev/ttya).");
}
printf_filtered ("Connected to ARM RDI target.\n");
-
closed_already = 0;
+ inferior_pid = 42;
}
/* Start an inferior process and set inferior_pid to its pid.
@@ -387,7 +403,7 @@ arm_rdi_detach (args, from_tty)
char *args;
int from_tty;
{
- /* (anything to do?) */
+ pop_target ();
}
/* Clean up connection to a remote debugger. */
@@ -406,6 +422,7 @@ arm_rdi_close (quitting)
printf_filtered ("RDI_close: %s\n", rdi_error_message (rslt));
}
closed_already = 1;
+ inferior_pid = 0;
}
}