This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR gdb/20643: Remote file IO not reset by run command


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.

diff --git a/gdb/remote.c b/gdb/remote.c
index ec8b498..589a386 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -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 ();
 }
 

 /* 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 ())
     {

Attachment: remote_io.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]