[Lldb-commits] [lldb] r360432 - minidump: Don't eagerly resolve module paths read from the minidump

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri May 10 08:05:26 PDT 2019


Author: labath
Date: Fri May 10 08:05:26 2019
New Revision: 360432

URL: http://llvm.org/viewvc/llvm-project?rev=360432&view=rev
Log:
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).

Added:
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/relative_module_name.yaml
Modified:
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
    lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py?rev=360432&r1=360431&r2=360432&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py Fri May 10 08:05:26 2019
@@ -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)

Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/relative_module_name.yaml
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/relative_module_name.yaml?rev=360432&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/relative_module_name.yaml (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/relative_module_name.yaml Fri May 10 08:05:26 2019
@@ -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: ''
+...

Modified: lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp?rev=360432&r1=360431&r2=360432&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp (original)
+++ lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp Fri May 10 08:05:26 2019
@@ -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;




More information about the lldb-commits mailing list