Author: Jonas Devlieghere
Date: 2026-09-03T15:52:13-07:00
New Revision: 39b68d585b3946f5da782f016d590940349848ca

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

LOG: [lldb][debugserver] Don't overwrite the attach error with a hint (#220993)

When the attach fails with "unable to start the exception thread",
debugserver snprintf'd advice about checking Console.app over err_str,
destroying the real error before it reached both the packet sent to lldb
and the DNBLogError below it. That step can fail for reasons other than
a denied attach, so the hint replaced an authoritative error with a
guess.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/tools/debugserver/source/RNBRemote.cpp 
b/lldb/tools/debugserver/source/RNBRemote.cpp
index 523307fb526f3..075ef8670ac98 100644
--- a/lldb/tools/debugserver/source/RNBRemote.cpp
+++ b/lldb/tools/debugserver/source/RNBRemote.cpp
@@ -4228,19 +4228,19 @@ rnb_err_t RNBRemote::HandlePacket_v(const char *p) {
 
       std::string error_explainer = "attach failed";
       if (err_str[0] != '\0') {
-        // This is not a super helpful message for end users
-        if (strcmp (err_str, "unable to start the exception thread") == 0) {
-          snprintf (err_str, sizeof (err_str) - 1,
-                    "Not allowed to attach to process.  Look in the console "
-                    "messages (Console.app), near the debugserver entries, "
-                    "when the attach failed.  The subsystem that denied "
-                    "the attach permission will likely have logged an "
-                    "informative message about why it was denied.");
-          err_str[sizeof (err_str) - 1] = '\0';
-        }
         error_explainer += " (";
         error_explainer += err_str;
         error_explainer += ")";
+        // This is not a super helpful message for end users
+        if (strcmp(err_str, "unable to start the exception thread") == 0) {
+          error_explainer += ".  ";
+          error_explainer += "Not allowed to attach to process.  Look in the "
+                             "console messages (Console.app), near the "
+                             "debugserver entries, when the attach failed.  "
+                             "The subsystem that denied the attach permission "
+                             "will likely have logged an informative message "
+                             "about why it was denied.";
+        }
       }
       DNBLogError("Attach failed: \"%s\".", err_str);
       return SendErrorPacket("E96", error_explainer);


        
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to