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 NO_DEBUG_INFO_TESTCASE = True 17 18 def initial_setup(self): 19 self.build() 20 self.exe = self.getBuildArtifact("a.out") 21 self.corefile = self.getBuildArtifact("corefile") 22 23 @skipIf(archs=no_match(['arm64e'])) 24 @skipUnlessDarwin 25 def test_lc_note_addrable_bits(self): 26 self.initial_setup() 27 28 self.target = self.dbg.CreateTarget(self.exe) 29 err = lldb.SBError() 30 (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, "break here", 31 lldb.SBFileSpec('main.c')) 32 self.assertEqual(process.IsValid(), True) 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 58