1"""Test that corefiles with LC_NOTE "addrable bits" load command, creating and reading.""" 2 3 4 5import os 6import re 7import subprocess 8 9import lldb 10from lldbsuite.test.decorators import * 11from lldbsuite.test.lldbtest import * 12from lldbsuite.test import lldbutil 13 14 15class TestAddrableBitsCorefile(TestBase): 16 17 mydir = TestBase.compute_mydir(__file__) 18 NO_DEBUG_INFO_TESTCASE = True 19 20 def initial_setup(self): 21 self.build() 22 self.exe = self.getBuildArtifact("a.out") 23 self.corefile = self.getBuildArtifact("corefile") 24 25 @skipIf(archs=no_match(['arm64e'])) 26 @skipUnlessDarwin 27 def test_lc_note_addrable_bits(self): 28 self.initial_setup() 29 30 self.target = self.dbg.CreateTarget(self.exe) 31 err = lldb.SBError() 32 (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, "break here", 33 lldb.SBFileSpec('main.c')) 34 self.assertEqual(process.IsValid(), True) 35 36 found_main = False 37 for f in thread.frames: 38 if f.GetFunctionName() == "main": 39 found_main = True 40 self.assertTrue(found_main) 41 42 cmdinterp = self.dbg.GetCommandInterpreter() 43 res = lldb.SBCommandReturnObject() 44 cmdinterp.HandleCommand("process save-core %s" % self.corefile, res) 45 self.assertTrue(res.Succeeded(), True) 46 process.Kill() 47 self.dbg.DeleteTarget(target) 48 49 target = self.dbg.CreateTarget('') 50 process = target.LoadCore(self.corefile) 51 self.assertTrue(process.IsValid(), True) 52 thread = process.GetSelectedThread() 53 54 found_main = False 55 for f in thread.frames: 56 if f.GetFunctionName() == "main": 57 found_main = True 58 self.assertTrue(found_main) 59 60