Package lldb :: Class SBBreakpoint
[hide private]
[frames] | no frames]

Class SBBreakpoint

source code

Represents a logical breakpoint and its associated settings.

For example (from test/functionalities/breakpoint/breakpoint_ignore_count/,

    def breakpoint_ignore_count_python(self):
        '''Use Python APIs to set breakpoint ignore count.'''
        exe = os.path.join(os.getcwd(), 'a.out')

        # Create a target by the debugger.
        target = self.dbg.CreateTarget(exe)
        self.assertTrue(target, VALID_TARGET)

        # Now create a breakpoint on main.c by name 'c'.
        breakpoint = target.BreakpointCreateByName('c', 'a.out')
        self.assertTrue(breakpoint and
                        breakpoint.GetNumLocations() == 1,

        # Get the breakpoint location from breakpoint after we verified that,
        # indeed, it has one location.
        location = breakpoint.GetLocationAtIndex(0)
        self.assertTrue(location and

        # Set the ignore count on the breakpoint location.
        self.assertTrue(location.GetIgnoreCount() == 2,
                        'SetIgnoreCount() works correctly')

        # Now launch the process, and do not stop at entry point.
        process = target.LaunchSimple(None, None, os.getcwd())
        self.assertTrue(process, PROCESS_IS_VALID)

        # Frame#0 should be on main.c:37, frame#1 should be on main.c:25, and
        # frame#2 should be on main.c:48.
        from lldbutil import get_stopped_thread
        thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
        self.assertTrue(thread != None, 'There should be a thread stopped due to breakpoint')
        frame0 = thread.GetFrameAtIndex(0)
        frame1 = thread.GetFrameAtIndex(1)
        frame2 = thread.GetFrameAtIndex(2)
        self.assertTrue(frame0.GetLineEntry().GetLine() == self.line1 and
                        frame1.GetLineEntry().GetLine() == self.line3 and
                        frame2.GetLineEntry().GetLine() == self.line4,

        # The hit count for the breakpoint should be 3.
        self.assertTrue(breakpoint.GetHitCount() == 3)


SBBreakpoint supports breakpoint location iteration, for example,

    for bl in breakpoint:
        print('breakpoint location load addr: %s' % hex(bl.GetLoadAddress()))
        print('breakpoint location condition: %s' % hex(bl.GetCondition()))

and rich comparison methods which allow the API program to use,

    if aBreakpoint == bBreakpoint:

to compare two breakpoints for equality.

Nested Classes [hide private]
A helper object that will lazily hand out locations for a breakpoint when supplied an index.
Instance Methods [hide private]
__repr__(self) source code
__init__(self, *args)
__init__(lldb::SBBreakpoint self) -> SBBreakpoint __init__(lldb::SBBreakpoint self, SBBreakpoint rhs) -> SBBreakpoint
source code
GetID(SBBreakpoint self) -> lldb::break_id_t
source code
IsValid(SBBreakpoint self) -> bool
source code
__nonzero__(self) source code
__bool__(self) source code
ClearAllBreakpointSites(SBBreakpoint self)
source code
FindLocationByAddress(self, *args)
FindLocationByAddress(SBBreakpoint self, lldb::addr_t vm_addr) -> SBBreakpointLocation
source code
FindLocationIDByAddress(self, *args)
FindLocationIDByAddress(SBBreakpoint self, lldb::addr_t vm_addr) -> lldb::break_id_t
source code
FindLocationByID(self, *args)
FindLocationByID(SBBreakpoint self, lldb::break_id_t bp_loc_id) -> SBBreakpointLocation
source code
GetLocationAtIndex(self, *args)
GetLocationAtIndex(SBBreakpoint self, uint32_t index) -> SBBreakpointLocation
source code
SetEnabled(self, *args)
SetEnabled(SBBreakpoint self, bool enable)
source code
IsEnabled(SBBreakpoint self) -> bool
source code
SetOneShot(self, *args)
SetOneShot(SBBreakpoint self, bool one_shot)
source code
IsOneShot(SBBreakpoint self) -> bool
source code
IsInternal(SBBreakpoint self) -> bool
source code
GetHitCount(SBBreakpoint self) -> uint32_t
source code
SetIgnoreCount(self, *args)
SetIgnoreCount(SBBreakpoint self, uint32_t count)
source code
GetIgnoreCount(SBBreakpoint self) -> uint32_t
source code
SetCondition(self, *args)
SetCondition(SBBreakpoint self, char const * condition)
source code
GetCondition(SBBreakpoint self) -> char const *
source code
SetAutoContinue(self, *args)
SetAutoContinue(SBBreakpoint self, bool auto_continue)
source code
GetAutoContinue(SBBreakpoint self) -> bool
source code
SetThreadID(self, *args)
SetThreadID(SBBreakpoint self, lldb::tid_t sb_thread_id)
source code
GetThreadID(SBBreakpoint self) -> lldb::tid_t
source code
SetThreadIndex(self, *args)
SetThreadIndex(SBBreakpoint self, uint32_t index)
source code
GetThreadIndex(SBBreakpoint self) -> uint32_t
source code
SetThreadName(self, *args)
SetThreadName(SBBreakpoint self, char const * thread_name)
source code
GetThreadName(SBBreakpoint self) -> char const *
source code
SetQueueName(self, *args)
SetQueueName(SBBreakpoint self, char const * queue_name)
source code
GetQueueName(SBBreakpoint self) -> char const *
source code
SetScriptCallbackFunction(self, *args)
SetScriptCallbackFunction(SBBreakpoint self, char const * callback_function_name)
source code
SetScriptCallbackBody(self, *args)
SetScriptCallbackBody(SBBreakpoint self, char const * script_body_text) -> SBError
source code
SetCommandLineCommands(self, *args)
SetCommandLineCommands(SBBreakpoint self, SBStringList commands)
source code
GetCommandLineCommands(self, *args)
GetCommandLineCommands(SBBreakpoint self, SBStringList commands) -> bool
source code
AddName(self, *args)
AddName(SBBreakpoint self, char const * new_name) -> bool
source code
RemoveName(self, *args)
RemoveName(SBBreakpoint self, char const * name_to_remove)
source code
MatchesName(self, *args)
MatchesName(SBBreakpoint self, char const * name) -> bool
source code
GetNames(self, *args)
GetNames(SBBreakpoint self, SBStringList names)
source code
GetNumResolvedLocations(SBBreakpoint self) -> size_t
source code
GetNumLocations(SBBreakpoint self) -> size_t
source code
GetDescription(self, *args)
GetDescription(SBBreakpoint self, SBStream description) -> bool GetDescription(SBBreakpoint self, SBStream description, bool include_locations) -> bool
source code
AddLocation(self, *args)
AddLocation(SBBreakpoint self, SBAddress address) -> SBError
source code
EventIsBreakpointEvent(SBEvent event) -> bool
source code
GetBreakpointEventTypeFromEvent(SBEvent event) -> lldb::BreakpointEventType
source code
GetBreakpointFromEvent(SBEvent event) -> SBBreakpoint
source code
GetBreakpointLocationAtIndexFromEvent(SBEvent event, uint32_t loc_idx) -> SBBreakpointLocation
source code
GetNumBreakpointLocationsFromEvent(SBEvent event_sp) -> uint32_t
source code
IsHardware(SBBreakpoint self) -> bool
source code
An accessor function that returns a locations_access() object which allows lazy location access from a lldb.SBBreakpoint object.
source code
An accessor function that returns a list() that contains all locations in a lldb.SBBreakpoint object.
source code
Iterate over all breakpoint locations in a lldb.SBBreakpoint object.
source code
Return the number of breakpoint locations in a lldb.SBBreakpoint object.
source code
__str__(SBBreakpoint self) -> PyObject *
source code
__eq__(self, rhs) source code
__ne__(self, rhs) source code
Class Variables [hide private]
  __swig_setmethods__ = {}
  __setattr__ = lambda self, name, value:
  __swig_getmethods__ = {}
  __getattr__ = lambda self, name:
  __swig_destroy__ = _lldb.delete_SBBreakpoint
  __del__ = lambda self:
Method Details [hide private]

SetCondition(self, *args)

source code 

SetCondition(SBBreakpoint self, char const * condition)

The breakpoint stops only if the condition expression evaluates to true.


source code 

GetCondition(SBBreakpoint self) -> char const *

Get the condition expression for the breakpoint.

SetScriptCallbackFunction(self, *args)

source code 

SetScriptCallbackFunction(SBBreakpoint self, char const * callback_function_name)

Set the name of the script function to be called when the breakpoint is hit.

SetScriptCallbackBody(self, *args)

source code 

SetScriptCallbackBody(SBBreakpoint self, char const * script_body_text) -> SBError

Provide the body for the script function to be called when the breakpoint is hit. The body will be wrapped in a function, which be passed two arguments: 'frame' - which holds the bottom-most SBFrame of the thread that hit the breakpoint 'bpno' - which is the SBBreakpointLocation to which the callback was attached.

The error parameter is currently ignored, but will at some point hold the Python compilation diagnostics. Returns true if the body compiles successfully, false if not.