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