[Lldb-commits] [lldb] be237b7 - [lldb] Improve error message when trying to debug a non-debuggable process

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 11 10:47:45 PDT 2023


Author: Jonas Devlieghere
Date: 2023-08-11T10:47:00-07:00
New Revision: be237b76da7e29debd9cf1e557235f945b92cead

URL: https://github.com/llvm/llvm-project/commit/be237b76da7e29debd9cf1e557235f945b92cead
DIFF: https://github.com/llvm/llvm-project/commit/be237b76da7e29debd9cf1e557235f945b92cead.diff

LOG: [lldb] Improve error message when trying to debug a non-debuggable process

On the Swift forums, people are disabling SIP in order to debug process
that are missing the get-task-allow entitlement. Improve the error to
give developers a hint at the potential issues.

rdar://113704200

Differential revision: https://reviews.llvm.org/D157640

Added: 
    

Modified: 
    lldb/tools/debugserver/source/DNB.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/tools/debugserver/source/DNB.cpp b/lldb/tools/debugserver/source/DNB.cpp
index 2a9a486f3e134e..f6c1130fdd8054 100644
--- a/lldb/tools/debugserver/source/DNB.cpp
+++ b/lldb/tools/debugserver/source/DNB.cpp
@@ -382,11 +382,22 @@ nub_process_t DNBProcessLaunch(
         if (err_str && err_len > 0) {
           if (launch_err.AsString()) {
             ::snprintf(err_str, err_len,
-                       "failed to get the task for process %i (%s)", pid,
+                       "failed to get the task for process %i: %s", pid,
                        launch_err.AsString());
           } else {
+
+            const char *ent_name =
+#if TARGET_OS_OSX
+              "com.apple.security.get-task-allow";
+#else
+              "get-task-allow";
+#endif
             ::snprintf(err_str, err_len,
-                       "failed to get the task for process %i", pid);
+                       "failed to get the task for process %i: this likely "
+                       "means the process cannot be debugged, either because "
+                       "it's a system process or because the process is "
+                       "missing the %s entitlement.",
+                       pid, ent_name);
           }
         }
       } else {


        


More information about the lldb-commits mailing list