* remote-fileio.c (remote_fileio_reset): New.

* remote-fileio.h (remote_fileio_reset): Prototype.
	* remote.c (extended_remote_restart, remote_open_1): Call it.
This commit is contained in:
Nathan Sidwell 2006-06-08 19:08:22 +00:00
parent 1dd41f16d1
commit ad9a8f3f00
3 changed files with 30 additions and 1 deletions

View File

@ -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>

View File

@ -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)
{

View File

@ -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 ();