diff options
author | Jim Ingham <jingham@apple.com> | 2012-07-20 21:37:13 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2012-07-20 21:37:13 +0000 |
commit | cd16df9154d46bb4ff49ed8843df714a7376d072 (patch) | |
tree | ee33109563981740402ee3d93477eca660d07876 /lldb/tools/debugserver/source/DNB.cpp | |
parent | 5e4fe00e644177dd5b6c8bd330be6dfe0f25610b (diff) | |
download | bcm5719-llvm-cd16df9154d46bb4ff49ed8843df714a7376d072.tar.gz bcm5719-llvm-cd16df9154d46bb4ff49ed8843df714a7376d072.zip |
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
Diffstat (limited to 'lldb/tools/debugserver/source/DNB.cpp')
-rw-r--r-- | lldb/tools/debugserver/source/DNB.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lldb/tools/debugserver/source/DNB.cpp b/lldb/tools/debugserver/source/DNB.cpp index 0a29eaa8202..6de893d0396 100644 --- a/lldb/tools/debugserver/source/DNB.cpp +++ b/lldb/tools/debugserver/source/DNB.cpp @@ -499,7 +499,6 @@ GetAllInfosMatchingName(const char *full_process_name, std::vector<struct kinfo_ else { // We found a matching process, add it to our list - matching_proc_infos.push_back(proc_infos[i]); } } @@ -513,6 +512,7 @@ GetAllInfosMatchingName(const char *full_process_name, std::vector<struct kinfo_ nub_process_t DNBProcessAttachWait (const char *waitfor_process_name, nub_launch_flavor_t launch_flavor, + bool ignore_existing, struct timespec *timeout_abstime, useconds_t waitfor_interval, char *err_str, @@ -536,7 +536,12 @@ DNBProcessAttachWait (const char *waitfor_process_name, } if (attach_token == NULL) - num_exclude_proc_infos = GetAllInfosMatchingName (waitfor_process_name, exclude_proc_infos); + { + if (ignore_existing) + num_exclude_proc_infos = GetAllInfosMatchingName (waitfor_process_name, exclude_proc_infos); + else + num_exclude_proc_infos = 0; + } DNBLogThreadedIf (LOG_PROCESS, "Waiting for '%s' to appear...\n", waitfor_process_name); |