[binutils-gdb] Revert 'Remove unused struct serial::name field'

Pedro Alves palves@sourceware.org
Fri Jan 10 20:10:00 GMT 2020


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4f83758119ddf0f114477760d79bdde7bbc76835

commit 4f83758119ddf0f114477760d79bdde7bbc76835
Author: Pedro Alves <palves@redhat.com>
Date:   Fri Jan 10 20:06:11 2020 +0000

    Revert 'Remove unused struct serial::name field'
    
    This commit reverts:
    
     commit 5f5219fc34f7557296272230123a3837960a6f09
     Author:     Pedro Alves <palves@redhat.com>
     AuthorDate: Tue Apr 12 16:49:30 2016 +0100
    
         Remove unused struct serial::name field
    
    The following patches will add uses for the field.
    
    gdb/ChangeLog:
    2020-01-10  Pedro Alves  <palves@redhat.com>
    
    	Revert:
    	2016-04-12  Pedro Alves  <palves@redhat.com>
    	* serial.c (serial_open, serial_fdopen_ops, do_serial_close):
    	Remove references to name.
    	* serial.h (struct serial) <name>: Delete.

Diff:
---
 gdb/ChangeLog | 8 ++++++++
 gdb/serial.c  | 4 ++++
 gdb/serial.h  | 1 +
 3 files changed, 13 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d676966..7d15993 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
 2020-01-10  Pedro Alves  <palves@redhat.com>
 
+	Revert:
+	2016-04-12  Pedro Alves  <palves@redhat.com>
+	* serial.c (serial_open, serial_fdopen_ops, do_serial_close):
+	Remove references to name.
+	* serial.h (struct serial) <name>: Delete.
+
+2020-01-10  Pedro Alves  <palves@redhat.com>
+
 	* gdbarch-selftests.c (register_to_value_test): Remove "target
 	already pushed" check.
 
diff --git a/gdb/serial.c b/gdb/serial.c
index 804ef18..a1c3b91 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -247,6 +247,7 @@ serial_open_ops_1 (const struct serial_ops *ops, const char *open_name)
       return NULL;
     }
 
+  scb->name = open_name != NULL ? xstrdup (open_name) : NULL;
   scb->next = scb_base;
   scb_base = scb;
 
@@ -291,6 +292,7 @@ serial_fdopen_ops (const int fd, const struct serial_ops *ops)
 
   scb = new_serial (ops);
 
+  scb->name = NULL;
   scb->next = scb_base;
   scb_base = scb;
 
@@ -330,6 +332,8 @@ do_serial_close (struct serial *scb, int really_close)
   if (really_close)
     scb->ops->close (scb);
 
+  xfree (scb->name);
+
   /* For serial_is_open.  */
   scb->bufp = NULL;
 
diff --git a/gdb/serial.h b/gdb/serial.h
index 446b896..8d67c4b 100644
--- a/gdb/serial.h
+++ b/gdb/serial.h
@@ -240,6 +240,7 @@ struct serial
 				   buffer.  -ve for sticky errors.  */
     unsigned char *bufp;	/* Current byte */
     unsigned char buf[BUFSIZ];	/* Da buffer itself */
+    char *name;			/* The name of the device or host */
     struct serial *next;	/* Pointer to the next `struct serial *' */
     int debug_p;		/* Trace this serial devices operation.  */
     int async_state;		/* Async internal state.  */



More information about the Gdb-cvs mailing list