Author: Jason Molenda Date: 2024-10-03T15:08:01-07:00 New Revision: c20b90ab8557b38efe8e8e993d41d8c08b798267
URL: https://github.com/llvm/llvm-project/commit/c20b90ab8557b38efe8e8e993d41d8c08b798267 DIFF: https://github.com/llvm/llvm-project/commit/c20b90ab8557b38efe8e8e993d41d8c08b798267.diff LOG: [lldb][debugserver] Check if Rosetta debugserver exists (#110943) 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 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 1ac9a8040c6163..10c55dc3f769fa 100644 --- a/lldb/tools/debugserver/source/DNB.cpp +++ b/lldb/tools/debugserver/source/DNB.cpp @@ -475,9 +475,17 @@ nub_process_t DNBProcessAttach(nub_process_t attach_pid, extern int communication_fd; if (communication_fd == -1) { - fprintf(stderr, "Trying to attach to a translated process with the " - "native debugserver, exiting...\n"); - exit(1); + DNBLogError("Trying to attach to a translated process with the " + "native debugserver, exiting...\n"); + return INVALID_NUB_PROCESS_ARCH; + } + + 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); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits