-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lldb][debugserver] Check if Rosetta debugserver exists #110943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lldb][debugserver] Check if Rosetta debugserver exists #110943
Conversation
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
@llvm/pr-subscribers-lldb Author: Jason Molenda (jasonmolenda) ChangesIf 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:
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",
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. In fact, it looks WAY better than the error handling just above it where instead of logging something that we could find later in the system logs, we fprintf to stderr - which in most cases won't get seen, and exit (but w/o an error?).
OTOH, that wasn't part of your patch, so...
message and then return attach failed.
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)
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)
…error-out-if-cannot-find-rosetta-debugserver-20240723 [lldb][debugserver] Check if Rosetta debugserver exists (llvm#110943)
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/18/builds/4894 Here is the relevant piece of the build log for the reference
|
There's something flaky about this test, I've seen it failing on unrelated patches a few times. We'll look into it. |
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