Skip to content

Commit e23ef02

Browse files
committed
[lldb][debugserver] Check if Rosetta debugserver exists (llvm#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 (cherry picked from commit c20b90a)
1 parent 95f3fb0 commit e23ef02

File tree

1 file changed

+11
-3
lines changed
  • lldb/tools/debugserver/source

1 file changed

+11
-3
lines changed

lldb/tools/debugserver/source/DNB.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -463,9 +463,17 @@ nub_process_t DNBProcessAttach(nub_process_t attach_pid,
463463
extern int communication_fd;
464464

465465
if (communication_fd == -1) {
466-
fprintf(stderr, "Trying to attach to a translated process with the "
467-
"native debugserver, exiting...\n");
468-
exit(1);
466+
DNBLogError("Trying to attach to a translated process with the "
467+
"native debugserver, exiting...\n");
468+
return INVALID_NUB_PROCESS_ARCH;
469+
}
470+
471+
struct stat st;
472+
if (::stat(translated_debugserver, &st) != 0) {
473+
DNBLogError("Translated inferior process but Rosetta debugserver not "
474+
"found at %s",
475+
translated_debugserver);
476+
return INVALID_NUB_PROCESS_ARCH;
469477
}
470478

471479
snprintf(fdstr, sizeof(fdstr), "--fd=%d", communication_fd);

0 commit comments

Comments
 (0)