PR gdb/20643: Remote file IO not reset by run command
Commit Message
Hi,
Remote file I/O isn't reset after a run command. This means that if a
program is 'run' more than once, I/O from/to stdin/stdout may not work or
the second run, if those descriptors were closed by the first run.
E.g:
tar ext-rem
run
"hello world"
run
* no output *
Looking at extended_remote_create_inferior(), it seems remote_fileio_reset()
is only called via extended_remote_restart(). It isn't called if the target
supports the run command. The following patch resets file I/O for both run
and reset.
Cheers,
Jon
2016-09-27 Jon Beniston <jon@beniston.com>
PR gdb/20643:
* remote.c (extended_remote_restart): Move call to
remote_fileio_reset
to parent function.
(extended_remote_create_inferior): Call remote_fileio_reset
for both run and restart.
/* Clean up connection to a remote debugger. */
@@ -9186,6 +9184,7 @@ extended_remote_create_inferior (struct target_ops
*ops,
/* Fall back to "R". */
extended_remote_restart ();
}
+ remote_fileio_reset ();
if (!have_inferiors ())
{
@@ -3491,8 +3491,6 @@ extended_remote_restart (void)
remote side really expects a number after the "R". */
xsnprintf (rs->buf, get_remote_packet_size (), "R%x", 0);
putpkt (rs->buf);
-
- remote_fileio_reset ();
}