summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/Process.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2012-03-06 04:01:04 +0000
committerGreg Clayton <gclayton@apple.com>2012-03-06 04:01:04 +0000
commit9845a8d54db4f9d8d53853cc1c9a47236b18070a (patch)
tree468ee8de094f4428139aa15690caef310c3ce3d8 /lldb/source/Target/Process.cpp
parent97f7e8189149390ea4eb3daa46fac132dbb5183e (diff)
downloadbcm5719-llvm-9845a8d54db4f9d8d53853cc1c9a47236b18070a.tar.gz
bcm5719-llvm-9845a8d54db4f9d8d53853cc1c9a47236b18070a.zip
<rdar://problem/10840355>
Fixed STDERR to not be opened as readable. Also cleaned up some of the code that implemented the file actions as some of the code was using the wrong variables, they now use the right ones (in for stdin, out for stdout, err for stderr). llvm-svn: 152102
Diffstat (limited to 'lldb/source/Target/Process.cpp')
-rw-r--r--lldb/source/Target/Process.cpp42
1 files changed, 22 insertions, 20 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index b26c78eeccb..f6c598b5e40 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -259,9 +259,9 @@ ProcessLaunchInfo::FinalizeFileActions (Target *target, bool default_to_use_pty)
{
if (m_flags.Test(eLaunchFlagDisableSTDIO))
{
- AppendSuppressFileAction (STDERR_FILENO, true , true );
- AppendSuppressFileAction (STDIN_FILENO , true , false);
- AppendSuppressFileAction (STDOUT_FILENO, false, true );
+ AppendSuppressFileAction (STDIN_FILENO , true, false);
+ AppendSuppressFileAction (STDOUT_FILENO, false, true);
+ AppendSuppressFileAction (STDERR_FILENO, false, true);
}
else
{
@@ -274,9 +274,9 @@ ProcessLaunchInfo::FinalizeFileActions (Target *target, bool default_to_use_pty)
const char *err_path = NULL;
if (target)
{
- in_path = target->GetStandardErrorPath();
- out_path = target->GetStandardInputPath();
- err_path = target->GetStandardOutputPath();
+ in_path = target->GetStandardInputPath();
+ out_path = target->GetStandardOutputPath();
+ err_path = target->GetStandardErrorPath();
}
if (default_to_use_pty && (!in_path && !out_path && !err_path))
@@ -288,13 +288,14 @@ ProcessLaunchInfo::FinalizeFileActions (Target *target, bool default_to_use_pty)
}
if (in_path)
- AppendOpenFileAction(STDERR_FILENO, in_path, true, true);
-
+ AppendOpenFileAction(STDIN_FILENO, in_path, true, false);
+
if (out_path)
- AppendOpenFileAction(STDIN_FILENO, out_path, true, false);
+ AppendOpenFileAction(STDOUT_FILENO, out_path, false, true);
if (err_path)
- AppendOpenFileAction(STDOUT_FILENO, err_path, false, true);
+ AppendOpenFileAction(STDERR_FILENO, err_path, false, true);
+
}
}
}
@@ -518,30 +519,31 @@ ProcessLaunchCommandOptions::SetOptionValue (uint32_t option_idx, const char *op
launch_info.GetFlags().Set (eLaunchFlagStopAtEntry);
break;
- case 'e': // STDERR for read + write
+ case 'i': // STDIN for read only
{
ProcessLaunchInfo::FileAction action;
- if (action.Open(STDERR_FILENO, option_arg, true, true))
+ if (action.Open (STDIN_FILENO, option_arg, true, false))
launch_info.AppendFileAction (action);
}
break;
- case 'i': // STDIN for read only
+ case 'o': // Open STDOUT for write only
{
ProcessLaunchInfo::FileAction action;
- if (action.Open(STDIN_FILENO, option_arg, true, false))
+ if (action.Open (STDOUT_FILENO, option_arg, false, true))
launch_info.AppendFileAction (action);
}
break;
-
- case 'o': // Open STDOUT for write only
+
+ case 'e': // STDERR for write only
{
ProcessLaunchInfo::FileAction action;
- if (action.Open(STDOUT_FILENO, option_arg, false, true))
+ if (action.Open (STDERR_FILENO, option_arg, false, true))
launch_info.AppendFileAction (action);
}
break;
+
case 'p': // Process plug-in name
launch_info.SetProcessPluginName (option_arg);
break;
@@ -549,11 +551,11 @@ ProcessLaunchCommandOptions::SetOptionValue (uint32_t option_idx, const char *op
case 'n': // Disable STDIO
{
ProcessLaunchInfo::FileAction action;
- if (action.Open(STDERR_FILENO, "/dev/null", true, true))
+ if (action.Open (STDIN_FILENO, "/dev/null", true, false))
launch_info.AppendFileAction (action);
- if (action.Open(STDOUT_FILENO, "/dev/null", false, true))
+ if (action.Open (STDOUT_FILENO, "/dev/null", false, true))
launch_info.AppendFileAction (action);
- if (action.Open(STDIN_FILENO, "/dev/null", true, false))
+ if (action.Open (STDERR_FILENO, "/dev/null", false, true))
launch_info.AppendFileAction (action);
}
break;
OpenPOWER on IntegriCloud