diff options
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/remote-fileio.c | 22 | ||||
-rw-r--r-- | gdb/remote.c | 3 |
3 files changed, 30 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 928f9a6..9a48694 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,6 +1,10 @@ 2006-06-08 Nathan Sidwell <nathan@codesourcery.com> - * gdb/remote.c (remote_open_1): Do preopen tasks before + * remote-fileio.c (remote_fileio_reset): New. + * remote-fileio.h (remote_fileio_reset): Prototype. + * remote.c (extended_remote_restart, remote_open_1): Call it. + + * remote.c (remote_open_1): Do preopen tasks before irreversably destroying state. 2006-06-08 Daniel Jacobowitz <dan@codesourcery.com> diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c index 7056a34..d445d40 100644 --- a/gdb/remote-fileio.c +++ b/gdb/remote-fileio.c @@ -1355,6 +1355,28 @@ 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); + } + if (remote_fio_data.fd_map) + { + 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) { diff --git a/gdb/remote.c b/gdb/remote.c index d06ac86..9b7483d 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -1818,6 +1818,8 @@ extended_remote_restart (void) xsnprintf (rs->buf, get_remote_packet_size (), "R%x", 0); putpkt (rs->buf); + remote_fileio_reset (); + /* Now query for status so this looks just like we restarted gdbserver from scratch. */ putpkt ("?"); @@ -2073,6 +2075,7 @@ remote_open_1 (char *name, int from_tty, struct target_ops *target, unpush_target (target); + remote_fileio_reset (); reopen_exec_file (); reread_symbols (); |