1""" 2Test that breakpoints set on a bad address say they are bad. 3""" 4 5 6 7import lldb 8import lldbsuite.test.lldbutil as lldbutil 9from lldbsuite.test.lldbtest import * 10 11 12class BadAddressBreakpointTestCase(TestBase): 13 14 mydir = TestBase.compute_mydir(__file__) 15 16 NO_DEBUG_INFO_TESTCASE = True 17 18 def test_bad_address_breakpoints(self): 19 """Test that breakpoints set on a bad address say they are bad.""" 20 self.build() 21 self.address_breakpoints() 22 23 def address_breakpoints(self): 24 """Test that breakpoints set on a bad address say they are bad.""" 25 target, process, thread, bkpt = \ 26 lldbutil.run_to_source_breakpoint(self, 27 "Set a breakpoint here", 28 lldb.SBFileSpec("main.c")) 29 30 # Now see if we can read from 0. If I can't do that, I don't 31 # have a good way to know what an illegal address is... 32 error = lldb.SBError() 33 34 ptr = process.ReadPointerFromMemory(0x0, error) 35 36 if not error.Success(): 37 bkpt = target.BreakpointCreateByAddress(0x0) 38 for bp_loc in bkpt: 39 self.assertEquals(bp_loc.IsResolved(), False) 40 else: 41 self.fail( 42 "Could not find an illegal address at which to set a bad breakpoint.") 43