]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* gdb/remote-fileio.c (remote_fileio_reset): New.
authorNathan Sidwell <nathan@codesourcery.com>
Wed, 24 May 2006 08:00:02 +0000 (08:00 +0000)
committerNathan Sidwell <nathan@codesourcery.com>
Wed, 24 May 2006 08:00:02 +0000 (08:00 +0000)
* gdb/remote-fileio.h (remote_fileio_reset): Prototype.
* gdb/remote.c (extended_remote_restart, remote_open_1): Call it.

ChangeLog.csl
gdb/remote-fileio.c
gdb/remote-fileio.h
gdb/remote.c

index 01d00f5f4bab3ffb75243706c060d4b130774b95..d22ce1ab2d43c9fc2e7bfea7be76b22b04cb3b7c 100644 (file)
@@ -1,3 +1,9 @@
+2006-05-24  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * gdb/remote-fileio.c (remote_fileio_reset): New.
+       * gdb/remote-fileio.h (remote_fileio_reset): Prototype.
+       * gdb/remote.c (extended_remote_restart, remote_open_1): Call it.
+
 2006-05-22  Richard Sandiford  <richard@codesourcery.com>
 
        opcodes/
index 7056a34e51b577aa9667c8ee82ac339732ddfee3..c9fbb03fb95cb350aa050cdb50f093014cb95ef2 100644 (file)
@@ -1355,6 +1355,25 @@ do_remote_fileio_request (struct ui_out *uiout, void *buf_arg)
   return 0;
 }
 
+/* Close any open descriptors, and reinitialize the file mapping */
+
+void
+remote_fileio_reset (void)
+{
+  int ix;
+
+  for (ix = 0; ix != remote_fio_data.fd_map_size; ix++)
+    {
+      int fd = remote_fio_data.fd_map[ix];
+
+      if (fd >= 0)
+       close (fd);
+    }
+  free (remote_fio_data.fd_map);
+  remote_fio_data.fd_map = NULL;
+  remote_fio_data.fd_map_size = 0;
+}
+
 void
 remote_fileio_request (char *buf)
 {
index 4b9b064686b079036e6f5c6e766184de8df9e9ec..7cb9fd332310fa49488da4e34a8e83fbf41acbc6 100644 (file)
@@ -30,6 +30,9 @@ struct cmd_list_element;
    remote_wait () and remote_async_wait () */
 extern void remote_fileio_request (char *buf);
 
+/* Cleanup any remote fileio state.  */
+extern void remote_fileio_reset (void);
+
 /* Called from _initialize_remote () */
 extern void initialize_remote_fileio (
   struct cmd_list_element *remote_set_cmdlist,
index b078e6c7d706a477528503bed139ad8ae462e22a..4602635f26281d456725d0731b064380e7205b66 100644 (file)
@@ -1820,6 +1820,8 @@ extended_remote_restart (void)
   xsnprintf (buf, rs->remote_packet_size, "R%x", 0);
   putpkt (buf);
 
+  remote_fileio_reset ();
+  
   /* Now query for status so this looks just like we restarted
      gdbserver from scratch.  */
   putpkt ("?");
@@ -2176,6 +2178,8 @@ remote_open_1 (char *name, int from_tty, struct target_ops *target,
   if (!async_p)
     wait_forever_enabled_p = 1;
 
+  remote_fileio_reset ();
+  
   reopen_exec_file ();
   reread_symbols ();