Skip to content

Commit 8bbb150

Browse files
committed
Add a new test case
1 parent 973117a commit 8bbb150

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,3 +636,36 @@ def minidump_saves_fs_base_region(self):
636636
self.assertTrue(self.dbg.DeleteTarget(target))
637637
if os.path.isfile(tls_file):
638638
os.unlink(tls_file)
639+
640+
@skipUnlessPlatform(["linux"])
641+
@skipUnlessArch("x86_64")
642+
def test_invalid_custom_regions_not_included(self):
643+
options = lldb.SBSaveCoreOptions()
644+
self.build()
645+
exe = self.getBuildArtifact("a.out")
646+
output_file = self.getBuildArtifact("no_empty_regions.dmp")
647+
try:
648+
target = self.dbg.CreateTarget(exe)
649+
process = target.LaunchSimple(
650+
None, None, self.get_process_working_directory()
651+
)
652+
self.assertState(process.GetState(), lldb.eStateStopped)
653+
options.SetPluginName("minidump")
654+
options.SetOutputFile(lldb.SBFileSpec(output_file))
655+
options.SetStyle(lldb.eSaveCoreCustomOnly)
656+
region_one = lldb.SBMemoryRegionInfo()
657+
process.GetMemoryRegions().GetMemoryRegionAtIndex(0, region_one)
658+
options.AddMemoryRegionToSave(region_one)
659+
empty_region = lldb.SBMemoryRegionInfo("empty region", 0x0, 0x0, 3, True, False)
660+
options.AddMemoryRegionToSave(empty_region)
661+
region_with_no_permissions = lldb.SBMemoryRegionInfo("no permissions", 0x2AAA, 0x2BBB, 0, True, False)
662+
options.AddMemoryRegionToSave(region_with_no_permissions)
663+
error = process.SaveCore(options)
664+
self.assertTrue(error.Success(), error.GetCString())
665+
core_target = self.dbg.CreateTarget(None)
666+
core_process = core_target.LoadCore(output_file)
667+
self.assertNotIn(region_with_no_permissions, core_process.GetMemoryRegions())
668+
self.assertNotIn(empty_region, core_process.GetMemoryRegions())
669+
finally:
670+
if os.path.isfile(output_file):
671+
os.unlink(output_file)

0 commit comments

Comments
 (0)