Be sure to propagate the error back out SBTarget::Attach() when we fail to launch debugserver as root.

<rdar://problem/15669788>

llvm-svn: 202536
This commit is contained in:
Greg Clayton 2014-02-28 20:47:08 +00:00
parent ec67ab1e0c
commit 3121fde41a
1 changed files with 25 additions and 22 deletions

View File

@ -768,31 +768,34 @@ GDBRemoteCommunication::StartDebugserverProcess (const char *hostname,
error = Host::LaunchProcess(launch_info);
if (named_pipe_path[0])
if (error.Success() && launch_info.GetProcessID() != LLDB_INVALID_PROCESS_ID)
{
File name_pipe_file;
error = name_pipe_file.Open(named_pipe_path, File::eOpenOptionRead);
if (error.Success())
if (named_pipe_path[0])
{
char port_cstr[256];
port_cstr[0] = '\0';
size_t num_bytes = sizeof(port_cstr);
error = name_pipe_file.Read(port_cstr, num_bytes);
assert (error.Success());
assert (num_bytes > 0 && port_cstr[num_bytes-1] == '\0');
out_port = Args::StringToUInt32(port_cstr, 0);
name_pipe_file.Close();
File name_pipe_file;
error = name_pipe_file.Open(named_pipe_path, File::eOpenOptionRead);
if (error.Success())
{
char port_cstr[256];
port_cstr[0] = '\0';
size_t num_bytes = sizeof(port_cstr);
error = name_pipe_file.Read(port_cstr, num_bytes);
assert (error.Success());
assert (num_bytes > 0 && port_cstr[num_bytes-1] == '\0');
out_port = Args::StringToUInt32(port_cstr, 0);
name_pipe_file.Close();
}
Host::Unlink(named_pipe_path);
}
else if (listen)
{
}
else
{
// Make sure we actually connect with the debugserver...
JoinListenThread();
}
Host::Unlink(named_pipe_path);
}
else if (listen)
{
}
else
{
// Make sure we actually connect with the debugserver...
JoinListenThread();
}
}
else