2 Test that LLDB can emit JIT objects when the appropriate setting is enabled
8 from lldbsuite.test.decorators import *
9 from lldbsuite.test.lldbtest import *
10 from lldbsuite.test import lldbutil
12 class SaveJITObjectsTestCase(TestBase):
13 mydir = TestBase.compute_mydir(__file__)
15 def enumerateJITFiles(self):
16 return [f for f in os.listdir(self.getBuildDir()) if f.startswith("jit")]
18 def countJITFiles(self):
19 return len(self.enumerateJITFiles())
21 def cleanJITFiles(self):
22 for j in self.enumerateJITFiles():
26 @expectedFailureAll(oslist=["windows"])
27 @expectedFailureNetBSD
28 def test_save_jit_objects(self):
30 os.chdir(self.getBuildDir())
32 src_file_spec = lldb.SBFileSpec(src_file)
34 (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
35 self, "break", src_file_spec)
37 frame = thread.frames[0]
40 frame.EvaluateExpression("(void*)malloc(0x1)")
41 self.assertTrue(self.countJITFiles() == 0,
42 "No files emitted with save-jit-objects=false")
44 self.runCmd("settings set target.save-jit-objects true")
45 frame.EvaluateExpression("(void*)malloc(0x1)")
46 jit_files_count = self.countJITFiles()
48 self.assertTrue(jit_files_count != 0,
49 "At least one file emitted with save-jit-objects=true")
52 os.chdir(self.getSourceDir())