tberghammer created this revision. tberghammer added reviewers: labath, clayborg. tberghammer added a subscriber: lldb-commits. Herald added subscribers: danalbert, tberghammer, emaste.
Change Platform::LoadImage to copy the file to the remote platform The new implementation mimic the behavior of "process launch" what also copy the target executable from the host to the target. http://reviews.llvm.org/D15152 Files: packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py source/Plugins/Platform/Android/PlatformAndroid.cpp source/Plugins/Platform/POSIX/PlatformPOSIX.cpp Index: source/Plugins/Platform/POSIX/PlatformPOSIX.cpp =================================================================== --- source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -903,6 +903,16 @@ char path[PATH_MAX]; image_spec.GetPath(path, sizeof(path)); + if (IsRemote() && IsConnected()) + { + FileSpec remote_file = GetRemoteWorkingDirectory(); + remote_file.AppendPathComponent(image_spec.GetFilename().GetCString()); + error = Install(image_spec, remote_file); + if (error.Fail()) + return LLDB_INVALID_IMAGE_TOKEN; + remote_file.GetPath(path, sizeof(path)); + } + StreamString expr; expr.Printf(R"( struct __lldb_dlopen_result { void *image_ptr; const char *error_str; } the_result; Index: source/Plugins/Platform/Android/PlatformAndroid.cpp =================================================================== --- source/Plugins/Platform/Android/PlatformAndroid.cpp +++ source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -383,6 +383,16 @@ char path[PATH_MAX]; image_spec.GetPath(path, sizeof(path)); + if (IsRemote() && IsConnected()) + { + FileSpec remote_file = GetRemoteWorkingDirectory(); + remote_file.AppendPathComponent(image_spec.GetFilename().GetCString()); + error = Install(image_spec, remote_file); + if (error.Fail()) + return LLDB_INVALID_IMAGE_TOKEN; + remote_file.GetPath(path, sizeof(path)); + } + StreamString expr; expr.Printf(R"( struct __lldb_dlopen_result { void *image_ptr; const char *error_str; } the_result; Index: packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py +++ packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py @@ -210,18 +210,13 @@ else: dylibName = 'libloadunload_a.so' - if lldb.remote_platform: - dylibPath = os.path.join(shlib_dir, dylibName) - else: - dylibPath = dylibName - # Make sure that a_function does not exist at this point. self.expect("image lookup -n a_function", "a_function should not exist yet", error=True, matching=False, patterns = ["1 match found"]) # Use lldb 'process load' to load the dylib. - self.expect("process load %s" % dylibPath, "%s loaded correctly" % dylibPath, - patterns = ['Loading "%s".*ok' % dylibPath, + self.expect("process load %s" % dylibName, "%s loaded correctly" % dylibName, + patterns = ['Loading "%s".*ok' % dylibName, 'Image [0-9]+ loaded']) # Search for and match the "Image ([0-9]+) loaded" pattern.
Index: source/Plugins/Platform/POSIX/PlatformPOSIX.cpp =================================================================== --- source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -903,6 +903,16 @@ char path[PATH_MAX]; image_spec.GetPath(path, sizeof(path)); + if (IsRemote() && IsConnected()) + { + FileSpec remote_file = GetRemoteWorkingDirectory(); + remote_file.AppendPathComponent(image_spec.GetFilename().GetCString()); + error = Install(image_spec, remote_file); + if (error.Fail()) + return LLDB_INVALID_IMAGE_TOKEN; + remote_file.GetPath(path, sizeof(path)); + } + StreamString expr; expr.Printf(R"( struct __lldb_dlopen_result { void *image_ptr; const char *error_str; } the_result; Index: source/Plugins/Platform/Android/PlatformAndroid.cpp =================================================================== --- source/Plugins/Platform/Android/PlatformAndroid.cpp +++ source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -383,6 +383,16 @@ char path[PATH_MAX]; image_spec.GetPath(path, sizeof(path)); + if (IsRemote() && IsConnected()) + { + FileSpec remote_file = GetRemoteWorkingDirectory(); + remote_file.AppendPathComponent(image_spec.GetFilename().GetCString()); + error = Install(image_spec, remote_file); + if (error.Fail()) + return LLDB_INVALID_IMAGE_TOKEN; + remote_file.GetPath(path, sizeof(path)); + } + StreamString expr; expr.Printf(R"( struct __lldb_dlopen_result { void *image_ptr; const char *error_str; } the_result; Index: packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py +++ packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py @@ -210,18 +210,13 @@ else: dylibName = 'libloadunload_a.so' - if lldb.remote_platform: - dylibPath = os.path.join(shlib_dir, dylibName) - else: - dylibPath = dylibName - # Make sure that a_function does not exist at this point. self.expect("image lookup -n a_function", "a_function should not exist yet", error=True, matching=False, patterns = ["1 match found"]) # Use lldb 'process load' to load the dylib. - self.expect("process load %s" % dylibPath, "%s loaded correctly" % dylibPath, - patterns = ['Loading "%s".*ok' % dylibPath, + self.expect("process load %s" % dylibName, "%s loaded correctly" % dylibName, + patterns = ['Loading "%s".*ok' % dylibName, 'Image [0-9]+ loaded']) # Search for and match the "Image ([0-9]+) loaded" pattern.
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits