diff --git a/lldb/tools/debugserver/source/DNB.cpp b/lldb/tools/debugserver/source/DNB.cpp index 1ac9a8040c616..10c55dc3f769f 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);