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

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 10 11:24:10 PDT 2023


JDevlieghere created this revision.
JDevlieghere added reviewers: jasonmolenda, aprantl.
Herald added a project: All.
JDevlieghere requested review of this revision.

On the Swift forums [1][2], 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.

[1] https://forums.swift.org/t/yo-apple-xcode-debugging-swift-is-still-horribly-broken/62702/26
[2] https://forums.swift.org/t/finding-cycles-with-the-memory-graph-debugger-with-swift-pm-projects/62769/7

rdar://113704200


https://reviews.llvm.org/D157640

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


Index: lldb/tools/debugserver/source/DNB.cpp
===================================================================
--- lldb/tools/debugserver/source/DNB.cpp
+++ lldb/tools/debugserver/source/DNB.cpp
@@ -382,11 +382,15 @@
         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 {
             ::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 get-task-allow entitlement.",
+                       pid);
           }
         }
       } else {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157640.549119.patch
Type: text/x-patch
Size: 1040 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230810/31bcfda9/attachment.bin>


More information about the lldb-commits mailing list