106c3fb27SDimitry Andric %feature("docstring", 206c3fb27SDimitry Andric "Represents a logical breakpoint and its associated settings. 306c3fb27SDimitry Andric 406c3fb27SDimitry Andric For example (from test/functionalities/breakpoint/breakpoint_ignore_count/ 506c3fb27SDimitry Andric TestBreakpointIgnoreCount.py),:: 606c3fb27SDimitry Andric 706c3fb27SDimitry Andric def breakpoint_ignore_count_python(self): 806c3fb27SDimitry Andric '''Use Python APIs to set breakpoint ignore count.''' 906c3fb27SDimitry Andric exe = os.path.join(os.getcwd(), 'a.out') 1006c3fb27SDimitry Andric 1106c3fb27SDimitry Andric # Create a target by the debugger. 1206c3fb27SDimitry Andric target = self.dbg.CreateTarget(exe) 1306c3fb27SDimitry Andric self.assertTrue(target, VALID_TARGET) 1406c3fb27SDimitry Andric 1506c3fb27SDimitry Andric # Now create a breakpoint on main.c by name 'c'. 1606c3fb27SDimitry Andric breakpoint = target.BreakpointCreateByName('c', 'a.out') 1706c3fb27SDimitry Andric self.assertTrue(breakpoint and 1806c3fb27SDimitry Andric breakpoint.GetNumLocations() == 1, 1906c3fb27SDimitry Andric VALID_BREAKPOINT) 2006c3fb27SDimitry Andric 2106c3fb27SDimitry Andric # Get the breakpoint location from breakpoint after we verified that, 2206c3fb27SDimitry Andric # indeed, it has one location. 2306c3fb27SDimitry Andric location = breakpoint.GetLocationAtIndex(0) 2406c3fb27SDimitry Andric self.assertTrue(location and 2506c3fb27SDimitry Andric location.IsEnabled(), 2606c3fb27SDimitry Andric VALID_BREAKPOINT_LOCATION) 2706c3fb27SDimitry Andric 2806c3fb27SDimitry Andric # Set the ignore count on the breakpoint location. 2906c3fb27SDimitry Andric location.SetIgnoreCount(2) 3006c3fb27SDimitry Andric self.assertTrue(location.GetIgnoreCount() == 2, 3106c3fb27SDimitry Andric 'SetIgnoreCount() works correctly') 3206c3fb27SDimitry Andric 3306c3fb27SDimitry Andric # Now launch the process, and do not stop at entry point. 3406c3fb27SDimitry Andric process = target.LaunchSimple(None, None, os.getcwd()) 3506c3fb27SDimitry Andric self.assertTrue(process, PROCESS_IS_VALID) 3606c3fb27SDimitry Andric 3706c3fb27SDimitry Andric # Frame#0 should be on main.c:37, frame#1 should be on main.c:25, and 3806c3fb27SDimitry Andric # frame#2 should be on main.c:48. 3906c3fb27SDimitry Andric #lldbutil.print_stacktraces(process) 4006c3fb27SDimitry Andric from lldbutil import get_stopped_thread 4106c3fb27SDimitry Andric thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint) 42*0fca6ea1SDimitry Andric self.assertTrue(thread is not None, 'There should be a thread stopped due to breakpoint') 4306c3fb27SDimitry Andric frame0 = thread.GetFrameAtIndex(0) 4406c3fb27SDimitry Andric frame1 = thread.GetFrameAtIndex(1) 4506c3fb27SDimitry Andric frame2 = thread.GetFrameAtIndex(2) 4606c3fb27SDimitry Andric self.assertTrue(frame0.GetLineEntry().GetLine() == self.line1 and 4706c3fb27SDimitry Andric frame1.GetLineEntry().GetLine() == self.line3 and 4806c3fb27SDimitry Andric frame2.GetLineEntry().GetLine() == self.line4, 4906c3fb27SDimitry Andric STOPPED_DUE_TO_BREAKPOINT_IGNORE_COUNT) 5006c3fb27SDimitry Andric 5106c3fb27SDimitry Andric # The hit count for the breakpoint should be 3. 5206c3fb27SDimitry Andric self.assertTrue(breakpoint.GetHitCount() == 3) 5306c3fb27SDimitry Andric 5406c3fb27SDimitry Andric process.Continue() 5506c3fb27SDimitry Andric 5606c3fb27SDimitry Andric SBBreakpoint supports breakpoint location iteration, for example,:: 5706c3fb27SDimitry Andric 5806c3fb27SDimitry Andric for bl in breakpoint: 5906c3fb27SDimitry Andric print('breakpoint location load addr: %s' % hex(bl.GetLoadAddress())) 6006c3fb27SDimitry Andric print('breakpoint location condition: %s' % hex(bl.GetCondition())) 6106c3fb27SDimitry Andric 6206c3fb27SDimitry Andric and rich comparison methods which allow the API program to use,:: 6306c3fb27SDimitry Andric 6406c3fb27SDimitry Andric if aBreakpoint == bBreakpoint: 6506c3fb27SDimitry Andric ... 6606c3fb27SDimitry Andric 6706c3fb27SDimitry Andric to compare two breakpoints for equality." 6806c3fb27SDimitry Andric ) lldb::SBBreakpoint; 6906c3fb27SDimitry Andric 7006c3fb27SDimitry Andric %feature("docstring", " 7106c3fb27SDimitry Andric The breakpoint stops only if the condition expression evaluates to true." 7206c3fb27SDimitry Andric ) lldb::SBBreakpoint::SetCondition; 7306c3fb27SDimitry Andric 7406c3fb27SDimitry Andric %feature("docstring", " 7506c3fb27SDimitry Andric Get the condition expression for the breakpoint." 7606c3fb27SDimitry Andric ) lldb::SBBreakpoint::GetCondition; 7706c3fb27SDimitry Andric 7806c3fb27SDimitry Andric %feature("docstring", " 7906c3fb27SDimitry Andric Set the name of the script function to be called when the breakpoint is hit." 8006c3fb27SDimitry Andric ) lldb::SBBreakpoint::SetScriptCallbackFunction; 8106c3fb27SDimitry Andric 8206c3fb27SDimitry Andric %feature("docstring", " 8306c3fb27SDimitry Andric Set the name of the script function to be called when the breakpoint is hit. 8406c3fb27SDimitry Andric To use this variant, the function should take (frame, bp_loc, extra_args, internal_dict) and 8506c3fb27SDimitry Andric when the breakpoint is hit the extra_args will be passed to the callback function." 8606c3fb27SDimitry Andric ) lldb::SBBreakpoint::SetScriptCallbackFunction; 8706c3fb27SDimitry Andric 8806c3fb27SDimitry Andric %feature("docstring", " 8906c3fb27SDimitry Andric Provide the body for the script function to be called when the breakpoint is hit. 9006c3fb27SDimitry Andric The body will be wrapped in a function, which be passed two arguments: 9106c3fb27SDimitry Andric 'frame' - which holds the bottom-most SBFrame of the thread that hit the breakpoint 9206c3fb27SDimitry Andric 'bpno' - which is the SBBreakpointLocation to which the callback was attached. 9306c3fb27SDimitry Andric 9406c3fb27SDimitry Andric The error parameter is currently ignored, but will at some point hold the Python 9506c3fb27SDimitry Andric compilation diagnostics. 9606c3fb27SDimitry Andric Returns true if the body compiles successfully, false if not." 9706c3fb27SDimitry Andric ) lldb::SBBreakpoint::SetScriptCallbackBody; 9806c3fb27SDimitry Andric 9906c3fb27SDimitry Andric 10006c3fb27SDimitry Andric %feature("docstring", 10106c3fb27SDimitry Andric "Represents a list of :py:class:`SBBreakpoint`." 10206c3fb27SDimitry Andric ) lldb::SBBreakpointList; 103