diff options
author | Jason Molenda <jmolenda@apple.com> | 2019-08-27 00:08:27 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 2019-08-27 00:08:27 +0000 |
commit | fe64323fd5c8137244fce75605f8de197eeea988 (patch) | |
tree | e5045d41859e57bf4fc291c3a7e56204358c116a /lldb/tools/debugserver | |
parent | 2f858c2e9198ce331fdb6a4f238b0697c8d016e9 (diff) | |
download | bcm5719-llvm-fe64323fd5c8137244fce75605f8de197eeea988.tar.gz bcm5719-llvm-fe64323fd5c8137244fce75605f8de197eeea988.zip |
Send error message on failed attach from debugerserver.
Instead of using a magic return error code from debugserver to
indicate that an attach failed because of SIP being enabled in
RNBRemote::HandlePacket_v, use the extended error reporting that
Pavel added to lldb/lldb-server in https://reviews.llvm.org/D45573
<rdar://problem/39398385>
llvm-svn: 369990
Diffstat (limited to 'lldb/tools/debugserver')
-rw-r--r-- | lldb/tools/debugserver/source/RNBRemote.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lldb/tools/debugserver/source/RNBRemote.cpp b/lldb/tools/debugserver/source/RNBRemote.cpp index ad7e65b351a..513cbe10de0 100644 --- a/lldb/tools/debugserver/source/RNBRemote.cpp +++ b/lldb/tools/debugserver/source/RNBRemote.cpp @@ -2667,6 +2667,17 @@ void append_hex_value(std::ostream &ostrm, const void *buf, size_t buf_size, } } +std::string cstring_to_asciihex_string(const char *str) { + std::string hex_str; + hex_str.reserve (strlen (str) * 2); + while (str && *str) { + char hexbuf[5]; + snprintf (hexbuf, sizeof(hexbuf), "%02x", *str++); + hex_str += hexbuf; + } + return hex_str; +} + void append_hexified_string(std::ostream &ostrm, const std::string &string) { size_t string_size = string.size(); const char *string_buf = string.c_str(); @@ -3818,8 +3829,13 @@ rnb_err_t RNBRemote::HandlePacket_v(const char *p) { } } if (attach_failed_due_to_sip) { - SendPacket("E87"); // E87 is the magic value which says that we are - // not allowed to attach + std::string return_message = "E96;"; + return_message += cstring_to_asciihex_string( + "Process attach denied, possibly because " + "System Integrity Protection is enabled and " + "process does not allow attaching."); + + SendPacket(return_message.c_str()); DNBLogError("Attach failed because process does not allow " "attaching: \"%s\".", err_str); |