public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/17502] New: Lost standard input using the file I/O extension
@ 2014-10-21 10:46 guerr at julio dot in
  0 siblings, 0 replies; only message in thread
From: guerr at julio dot in @ 2014-10-21 10:46 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17502

            Bug ID: 17502
           Summary: Lost standard input using the file I/O extension
           Product: gdb
           Version: 7.8
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: guerr at julio dot in

Hi,

The standard input is read using a hard-coded 16k-buffer when receiving a File
I/O read request into the standard input [1]. This 16k-buffer is local to the
function [2]and thus completely lost for potential upcoming *gdb commands*. For
example, if a File I/O communication produces a breakpoint and gdb commands
(like a simple `continue`) are sent into `stding` and are present into stdin's
fifo at the moment of the 16k-read, the command is "lost" into the local
buffer. It is an error to read more than required by the target.

This problem is only visible with non-interactive inputs like `gdb -x file` or
`gdb < file`.

Simple use case:
<-- target asks a read of 1 byte in stdin 
gdb reads 16K
--> gdb sends 1 byte of this 16k-buffer
gdb retains this buffer in `remaining_buf` for further fileio reads [3]

I think the same as the default case [4] which only reads the number of bytes
asked by the target [5] should be done in this case too. It would avoid this
problem keeping into the stdin fifo what was not asked by the target read
request. 

Regards,

[1]:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gdb/remote-fileio.c;h=e20d209ca1ea84b0b44274187a1e3d654e9748b0;hb=f39c1f89ab85ab7e1469e758487a5bee1164fda1#l728

[2]:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gdb/remote-fileio.c;h=e20d209ca1ea84b0b44274187a1e3d654e9748b0;hb=f39c1f89ab85ab7e1469e758487a5bee1164fda1#l725

[3]:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gdb/remote-fileio.c;h=e20d209ca1ea84b0b44274187a1e3d654e9748b0;hb=f39c1f89ab85ab7e1469e758487a5bee1164fda1#l765

[4]:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gdb/remote-fileio.c;h=e20d209ca1ea84b0b44274187a1e3d654e9748b0;hb=f39c1f89ab85ab7e1469e758487a5bee1164fda1#l773

[5]:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gdb/remote-fileio.c;h=e20d209ca1ea84b0b44274187a1e3d654e9748b0;hb=f39c1f89ab85ab7e1469e758487a5bee1164fda1#l782

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-10-21 10:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-21 10:46 [Bug gdb/17502] New: Lost standard input using the file I/O extension guerr at julio dot in

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).