diff options
author | Greg Clayton <gclayton@apple.com> | 2014-10-14 20:18:05 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2014-10-14 20:18:05 +0000 |
commit | b8e9b8b703b27c8c4e6fe986b80e80e934269c75 (patch) | |
tree | 519eb03371acc16d3839f0a20ef28c007ea6b02a /lldb/source | |
parent | e5121f3c109e65099f5e422f14f697d1cd8a4eac (diff) | |
download | bcm5719-llvm-b8e9b8b703b27c8c4e6fe986b80e80e934269c75.tar.gz bcm5719-llvm-b8e9b8b703b27c8c4e6fe986b80e80e934269c75.zip |
Fixed stdio redirection within LLDB to "do the right thing" in all cases.
The main issue was if you didn't specify all three (stdin/out/err), you would get file actions added to the launch that would always use the pseudo terminal. This is now fixed.
Also fixed the test suite test that handles IO to test redirecting things individually and all together and in other combinations to make sure we don't regress.
<rdar://problem/18638226>
llvm-svn: 219711
Diffstat (limited to 'lldb/source')
-rw-r--r-- | lldb/source/Target/ProcessLaunchInfo.cpp | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/lldb/source/Target/ProcessLaunchInfo.cpp b/lldb/source/Target/ProcessLaunchInfo.cpp index ddfd6291148..5b6d1a8ddc4 100644 --- a/lldb/source/Target/ProcessLaunchInfo.cpp +++ b/lldb/source/Target/ProcessLaunchInfo.cpp @@ -267,7 +267,8 @@ ProcessLaunchInfo::FinalizeFileActions (Target *target, bool default_to_use_pty) // If nothing for stdin or stdout or stderr was specified, then check the process for any default // settings that were set with "settings set" - if (GetFileActionForFD(STDIN_FILENO) == NULL || GetFileActionForFD(STDOUT_FILENO) == NULL || + if (GetFileActionForFD(STDIN_FILENO) == NULL || + GetFileActionForFD(STDOUT_FILENO) == NULL || GetFileActionForFD(STDERR_FILENO) == NULL) { if (log) @@ -294,9 +295,14 @@ ProcessLaunchInfo::FinalizeFileActions (Target *target, bool default_to_use_pty) FileSpec err_path; if (target) { - in_path = target->GetStandardInputPath(); - out_path = target->GetStandardOutputPath(); - err_path = target->GetStandardErrorPath(); + // Only override with the target settings if we don't already have + // an action for in, out or error + if (GetFileActionForFD(STDIN_FILENO) == NULL) + in_path = target->GetStandardInputPath(); + if (GetFileActionForFD(STDOUT_FILENO) == NULL) + out_path = target->GetStandardOutputPath(); + if (GetFileActionForFD(STDERR_FILENO) == NULL) + err_path = target->GetStandardErrorPath(); } if (log) @@ -344,17 +350,23 @@ ProcessLaunchInfo::FinalizeFileActions (Target *target, bool default_to_use_pty) { const char *slave_path = m_pty->GetSlaveName(NULL, 0); - if (!in_path) + // Only use the slave tty if we don't have anything specified for + // input and don't have an action for stdin + if (!in_path && GetFileActionForFD(STDIN_FILENO) == NULL) { AppendOpenFileAction(STDIN_FILENO, slave_path, true, false); } - if (!out_path) + // Only use the slave tty if we don't have anything specified for + // output and don't have an action for stdout + if (!out_path && GetFileActionForFD(STDOUT_FILENO) == NULL) { AppendOpenFileAction(STDOUT_FILENO, slave_path, false, true); } - if (!err_path) + // Only use the slave tty if we don't have anything specified for + // error and don't have an action for stderr + if (!err_path && GetFileActionForFD(STDERR_FILENO) == NULL) { AppendOpenFileAction(STDERR_FILENO, slave_path, false, true); } |