diff --git a/lldb/source/Target/RemoteAwarePlatform.cpp b/lldb/source/Target/RemoteAwarePlatform.cpp --- a/lldb/source/Target/RemoteAwarePlatform.cpp +++ b/lldb/source/Target/RemoteAwarePlatform.cpp @@ -21,7 +21,7 @@ return m_remote_platform_sp->GetModuleSpec(module_file_spec, arch, module_spec); - return Platform::GetModuleSpec(module_file_spec, arch, module_spec); + return false; } Status RemoteAwarePlatform::RunShellCommand( diff --git a/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py b/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py --- a/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py +++ b/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py @@ -209,6 +209,33 @@ self.dbg.DeleteTarget(target) + @skipIf(triple='^mips') + @skipIfLLVMTargetMissing("X86") + def test_x86_64_sysroot(self): + """Test that sysroot has more priority then local filesystem.""" + + # linux-x86_64-bin_sh.core is a copy of linux-x86_64.core with executable file path patched to /bin/sh: + # sed 's/\/home\/labath\/test\/a\.out/\/bin\/sh\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@\c@/g;s/a\.out/sh\c@\c@\c@/g' < linux-x86_64.core > linux-x86_64-bin_sh.core + + # Copy linux-x86_64.out to tmp_sysroot/bin/sh + tmp_sysroot = os.path.join(self.getBuildDir(), "lldb_x86_64_mock_sysroot") + executable = os.path.join(tmp_sysroot, "bin", "sh") + lldbutil.mkdir_p(os.path.dirname(executable)) + shutil.copyfile("linux-x86_64.out", executable) + + # Set sysroot and load core + self.runCmd("platform select remote-linux --sysroot '%s'" % tmp_sysroot) + target = self.dbg.CreateTarget(None) + self.assertTrue(target, VALID_TARGET) + process = target.LoadCore("linux-x86_64-bin_sh.core") + + # Check that we found executable from the sysroot + mod_path = str(target.GetModuleAtIndex(0).GetFileSpec()) + self.assertEqual(mod_path, executable) + self.check_all(process, self._x86_64_pid, self._x86_64_regions, "sh") + + self.dbg.DeleteTarget(target) + @skipIf(triple='^mips') @skipIfLLVMTargetMissing("ARM") def test_arm_core(self): diff --git a/lldb/test/API/functionalities/postmortem/elf-core/linux-x86_64-bin_sh.core b/lldb/test/API/functionalities/postmortem/elf-core/linux-x86_64-bin_sh.core new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 GIT binary patch literal 0 Hc$@