minidump: Don't eagerly resolve module paths read from the minidump

This can cause us to return paths to files on the local filesystem even
if we don't end up using that file (for instance because the file is not
a real module).

llvm-svn: 360432
This commit is contained in:
Pavel Labath 2019-05-10 15:05:26 +00:00
parent b284414a1b
commit 78c1dcb7b7
3 changed files with 29 additions and 2 deletions

View File

@ -34,7 +34,7 @@ class MiniDumpUUIDTestCase(TestBase):
self.assertEqual(verify_uuid, uuid)
def get_minidump_modules(self, yaml_file):
minidump_path = self.getBuildArtifact(yaml_file + ".dmp")
minidump_path = self.getBuildArtifact(os.path.basename(yaml_file) + ".dmp")
self.yaml2obj(yaml_file, minidump_path)
self.target = self.dbg.CreateTarget(None)
self.process = self.target.LoadCore(minidump_path)
@ -166,3 +166,14 @@ class MiniDumpUUIDTestCase(TestBase):
self.verify_module(modules[0],
"/invalid/path/on/current/system/libuuidmismatch.so",
"7295E17C-6668-9E05-CBB5-DEE5003865D5")
def test_relative_module_name(self):
old_cwd = os.getcwd()
self.addTearDownHook(lambda: os.chdir(old_cwd))
os.chdir(self.getBuildDir())
name = "file-with-a-name-unlikely-to-exist-in-the-current-directory.so"
open(name, "a").close()
modules = self.get_minidump_modules(
self.getSourcePath("relative_module_name.yaml"))
self.assertEqual(1, len(modules))
self.verify_module(modules[0], name, None)

View File

@ -0,0 +1,17 @@
--- !minidump
Streams:
- Type: SystemInfo
Processor Arch: AMD64
Platform ID: Linux
CSD Version: '15E216'
CPU:
Vendor ID: GenuineIntel
Version Info: 0x00000000
Feature Info: 0x00000000
- Type: ModuleList
Modules:
- Base of Image: 0x0000000000001000
Size of Image: 0x00001000
Module Name: 'file-with-a-name-unlikely-to-exist-in-the-current-directory.so'
CodeView Record: ''
...

View File

@ -368,7 +368,6 @@ void ProcessMinidump::ReadModuleList() {
const auto uuid = m_minidump_parser->GetModuleUUID(module);
auto file_spec = FileSpec(name, GetArchitecture().GetTriple());
FileSystem::Instance().Resolve(file_spec);
ModuleSpec module_spec(file_spec, uuid);
module_spec.GetArchitecture() = GetArchitecture();
Status error;