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

@@ -105,7 +105,7 @@ RNBRunLoopGetStartModeFromRemote (RNBRemote* remote)
err = remote->HandleReceivedPacket (&type);
// check if we tried to attach to a process
if (type == RNBRemote::vattach || type == RNBRemote::vattachwait)
if (type == RNBRemote::vattach || type == RNBRemote::vattachwait || type == RNBRemote::vattachorwait)
{
if (err == rnb_success)
return eRNBRunLoopModeInferiorExecuting;
@@ -1319,8 +1319,8 @@ main (int argc, char *argv[])
}
ctx.SetLaunchFlavor(launch_flavor);
nub_process_t pid = DNBProcessAttachWait (waitfor_pid_name.c_str(), launch_flavor, timeout_ptr, waitfor_interval, err_str, sizeof(err_str));
bool ignore_existing = false;
nub_process_t pid = DNBProcessAttachWait (waitfor_pid_name.c_str(), launch_flavor, ignore_existing, timeout_ptr, waitfor_interval, err_str, sizeof(err_str));
g_pid = pid;
if (pid == INVALID_NUB_PROCESS)