Add "vAttachOrWait" to debugserver, so you can implement "attach to the process if it exists OR wait for it" without race conditions. Use that in lldb.

llvm-svn: 160578
This commit is contained in:
Jim Ingham
2012-07-20 21:37:13 +00:00
parent 5e4fe00e64
commit cd16df9154
14 changed files with 159 additions and 114 deletions

View File

@@ -2709,75 +2709,6 @@ Process::Attach (ProcessAttachInfo &attach_info)
return error;
}
//Error
//Process::Attach (const char *process_name, bool wait_for_launch)
//{
// m_abi_sp.reset();
// m_process_input_reader.reset();
//
// // Find the process and its architecture. Make sure it matches the architecture
// // of the current Target, and if not adjust it.
// Error error;
//
// if (!wait_for_launch)
// {
// ProcessInstanceInfoList process_infos;
// PlatformSP platform_sp (m_target.GetPlatform ());
// assert (platform_sp.get());
//
// if (platform_sp)
// {
// ProcessInstanceInfoMatch match_info;
// match_info.GetProcessInfo().SetName(process_name);
// match_info.SetNameMatchType (eNameMatchEquals);
// platform_sp->FindProcesses (match_info, process_infos);
// if (process_infos.GetSize() > 1)
// {
// error.SetErrorStringWithFormat ("more than one process named %s", process_name);
// }
// else if (process_infos.GetSize() == 0)
// {
// error.SetErrorStringWithFormat ("could not find a process named %s", process_name);
// }
// }
// else
// {
// error.SetErrorString ("invalid platform");
// }
// }
//
// if (error.Success())
// {
// m_dyld_ap.reset();
// m_os_ap.reset();
//
// error = WillAttachToProcessWithName(process_name, wait_for_launch);
// if (error.Success())
// {
// SetPublicState (eStateAttaching);
// error = DoAttachToProcessWithName (process_name, wait_for_launch);
// if (error.Fail())
// {
// if (GetID() != LLDB_INVALID_PROCESS_ID)
// {
// SetID (LLDB_INVALID_PROCESS_ID);
// const char *error_string = error.AsCString();
// if (error_string == NULL)
// error_string = "attach failed";
//
// SetExitStatus(-1, error_string);
// }
// }
// else
// {
// SetNextEventAction(new Process::AttachCompletionHandler(this, 0));
// StartPrivateStateThread();
// }
// }
// }
// return error;
//}
void
Process::CompleteAttach ()
{