llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Jason Molenda (jasonmolenda)

<details>
<summary>Changes</summary>

If lldb tries to attach to a process that is marked 'Translated' with 
debugserver, it will exec the Rosetta debugserver to handle the debug session 
without checking if it is present.  If there is a configuration that is somehow 
missing this, it will fail poorly.

rdar://135641680

---
Full diff: https://github.com/llvm/llvm-project/pull/110943.diff


1 Files Affected:

- (modified) lldb/tools/debugserver/source/DNB.cpp (+8) 


``````````diff
diff --git a/lldb/tools/debugserver/source/DNB.cpp 
b/lldb/tools/debugserver/source/DNB.cpp
index 1ac9a8040c6163..3e213a1f8b9bc0 100644
--- a/lldb/tools/debugserver/source/DNB.cpp
+++ b/lldb/tools/debugserver/source/DNB.cpp
@@ -480,6 +480,14 @@ nub_process_t DNBProcessAttach(nub_process_t attach_pid,
           exit(1);
         }
 
+        struct stat st;
+        if (::stat(translated_debugserver, &st) != 0) {
+          DNBLogError("Translated inferior process but Rosetta debugserver not 
"
+                      "found at %s",
+                      translated_debugserver);
+          return INVALID_NUB_PROCESS_ARCH;
+        }
+
         snprintf(fdstr, sizeof(fdstr), "--fd=%d", communication_fd);
         snprintf(pidstr, sizeof(pidstr), "--attach=%d", attach_pid);
         execl(translated_debugserver, translated_debugserver, "--native-regs",

``````````

</details>


https://github.com/llvm/llvm-project/pull/110943
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to