-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lldb] Fixed the TestCompletion test running on a remote target #92281
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
Conversation
Install the image to the remote target if necessary. Platform::LoadImage() uses the following logic before DoLoadImage() ``` if (IsRemote() || local_file != remote_file) { error = Install(local_file, remote_file); ... } ``` The FileSpec for the local path may be resolved, so it is necessary to use the condition `if lldb.remote_platform:`.
@llvm/pr-subscribers-lldb Author: Dmitry Vasilyev (slydiman) ChangesInstall the image to the remote target if necessary. Platform::LoadImage() uses the following logic before DoLoadImage()
The FileSpec for the local path may be resolved, so it is necessary to use the condition Full diff: https://github.com/llvm/llvm-project/pull/92281.diff 1 Files Affected:
diff --git a/lldb/test/API/functionalities/completion/TestCompletion.py b/lldb/test/API/functionalities/completion/TestCompletion.py
index 0d6907e0c3d22..9959c7363aa2b 100644
--- a/lldb/test/API/functionalities/completion/TestCompletion.py
+++ b/lldb/test/API/functionalities/completion/TestCompletion.py
@@ -107,9 +107,20 @@ def test_process_unload(self):
self, "// Break here", lldb.SBFileSpec("main.cpp")
)
err = lldb.SBError()
- self.process().LoadImage(
- lldb.SBFileSpec(self.getBuildArtifact("libshared.so")), err
- )
+ if lldb.remote_platform:
+ self.process().LoadImage(
+ lldb.SBFileSpec(self.getBuildArtifact("libshared.so")),
+ lldb.SBFileSpec(
+ lldbutil.append_to_process_working_directory(self, "libshared.so"),
+ False,
+ ),
+ err,
+ )
+ else:
+ self.process().LoadImage(
+ lldb.SBFileSpec(self.getBuildArtifact("libshared.so")),
+ err,
+ )
self.assertSuccess(err)
self.complete_from_to("process unload ", "process unload 0")
|
if lldb.remote_platform: | ||
self.process().LoadImage( | ||
lldb.SBFileSpec(self.getBuildArtifact("libshared.so")), | ||
lldb.SBFileSpec( | ||
lldbutil.append_to_process_working_directory(self, "libshared.so"), | ||
False, | ||
), | ||
err, | ||
) | ||
else: | ||
self.process().LoadImage( | ||
lldb.SBFileSpec(self.getBuildArtifact("libshared.so")), | ||
err, | ||
) |
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.
I think this can be simplified to:
err = lldb.SBError()
local_spec = lldb.SBFileSpec(self.getBuildArtifact("libshared.so"))
remote_spec = lldb.SBFileSpec(lldbutil.append_to_process_working_directory(self, "libshared.so"), false) if lldb.remote_platform else lldb.SBFileSpec()
self.process().LoadImage(local_spec, remote_spec)
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.
I have updated the patch. Thanks.
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.
Unfortunately, this ends up modifying the source tree. I'm going to revert this back to the intermediate version.
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.
Thanks. LGTM!
This was a side-effect of the "optimization" in #92281. Deoptimize the code slightly.
Install the image to the remote target if necessary. Platform::LoadImage() uses the following logic before DoLoadImage()
The FileSpec for the local path may be resolved, so it is necessary to use the condition
if lldb.remote_platform:
.