[Bug 22497] New: Create test that floods target with SBProcess.PutSTDIN

Bug ID 22497
Summary Create test that floods target with SBProcess.PutSTDIN
Product lldb
Version unspecified
Hardware All
OS All
Status NEW
Severity enhancement
Priority P
Component All Bugs
Assignee lldb-dev@cs.uiuc.edu
Reporter vince@nethacker.com
Classification Unclassified

SBProcess.PutSTDIN naively sends stdin to a remote process.  This fixes many
use cases.  I think that if you flood the remote target with stdin, the remote
debug server will eventually block, which will potentially cause a deadlock.

There are two ways to improve this in remote debugging scenarios:

1) change the pty master file handle on the remote debug server to non-blocking
(if possible) and just return an error if there is a partial write

2) the better and much more complicated fix is for the debug server to create a
thread that reads from a circular buffer and writes it to a the pty master file
 handle in blocking mode and advertises available space in the circular buffer
after every successful write.  When SBProcess.PutSTDIN is called on a remote
host with insufficient window space, the thread calling SBProcess.PutSTDIN
blocks until there is sufficient window space.