diff options
author | Jason Molenda <jmolenda@apple.com> | 2015-07-29 01:42:16 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 2015-07-29 01:42:16 +0000 |
commit | 752e1e833b6c09cc18f81e0af3aebf04f6650345 (patch) | |
tree | 5a80efff3645368996484dd3a9089451c3215e92 /lldb/tools/debugserver/source/DNB.cpp | |
parent | 6a40cd71f69c0456e1004e3e057d663b0f1e69c3 (diff) | |
download | bcm5719-llvm-752e1e833b6c09cc18f81e0af3aebf04f6650345.tar.gz bcm5719-llvm-752e1e833b6c09cc18f81e0af3aebf04f6650345.zip |
When debugserver fails to attach to a process on a Darwin
system, make a couple of additional checks to see if the
attach was denied via the System Integrity Protection that
is new in Mac OS X 10.11. If so, return a special E87
error code to indicate this to lldb.
Up in lldb, if we receive the E87 error code, be specific
about why the attach failed.
Also detect the more common case of general attach failure
and print a better error message than "lost connection".
I believe this code will all build on Mac OS X 10.10 systems.
It may not compile or run on earlier versions of the OS.
None of this should build on other non-darwin systems.
llvm-svn: 243511
Diffstat (limited to 'lldb/tools/debugserver/source/DNB.cpp')
-rw-r--r-- | lldb/tools/debugserver/source/DNB.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lldb/tools/debugserver/source/DNB.cpp b/lldb/tools/debugserver/source/DNB.cpp index 5462cc40f1f..77154bb6e51 100644 --- a/lldb/tools/debugserver/source/DNB.cpp +++ b/lldb/tools/debugserver/source/DNB.cpp @@ -455,6 +455,19 @@ DNBProcessLaunch (const char *path, return INVALID_NUB_PROCESS; } +// If there is one process with a given name, return the pid for that process. +nub_process_t +DNBProcessGetPIDByName (const char *name) +{ + std::vector<struct kinfo_proc> matching_proc_infos; + size_t num_matching_proc_infos = GetAllInfosMatchingName(name, matching_proc_infos); + if (num_matching_proc_infos == 1) + { + return matching_proc_infos[0].kp_proc.p_pid; + } + return INVALID_NUB_PROCESS; +} + nub_process_t DNBProcessAttachByName (const char *name, struct timespec *timeout, char *err_str, size_t err_len) { |