SBBreakpointΒΆ

class lldb.SBBreakpoint(*args)ΒΆ

Represents a logical breakpoint and its associated settings.

For example (from test/functionalities/breakpoint/breakpoint_ignore_count/ TestBreakpointIgnoreCount.py),:

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,
                    VALID_BREAKPOINT)

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

    # Set the ignore count on the breakpoint location.
    location.SetIgnoreCount(2)
    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.
    #lldbutil.print_stacktraces(process)
    from lldbutil import get_stopped_thread
    thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
    self.assertTrue(thread is not 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,
                    STOPPED_DUE_TO_BREAKPOINT_IGNORE_COUNT)

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

    process.Continue()

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.

Attributes Summary

enabled

A read/write property that configures whether this breakpoint is enabled or not.

id

A read only property that returns the ID of this breakpoint.

location

A read only property that returns an object that can access locations by index (not location ID) (location = bkpt.location[12]).

locations

A read only property that returns a list() of lldb.SBBreakpointLocation objects for this breakpoint.

num_locations

A read only property that returns the count of locations of this breakpoint.

one_shot

A read/write property that configures whether this breakpoint is one-shot (deleted when hit) or not.

Methods Summary

AddLocation(SBBreakpoint self, SBAddress address)

AddName(SBBreakpoint self, char const * new_name)

AddNameWithErrorHandling(SBBreakpoint self, ...)

ClearAllBreakpointSites(SBBreakpoint self)

EventIsBreakpointEvent(SBEvent event)

FindLocationByAddress(SBBreakpoint self, lldb)

FindLocationByID(SBBreakpoint self, lldb)

FindLocationIDByAddress(SBBreakpoint self, lldb)

GetAutoContinue(SBBreakpoint self)

GetBreakpointEventTypeFromEvent(SBEvent event)

GetBreakpointFromEvent(SBEvent event)

GetBreakpointLocationAtIndexFromEvent(...)

GetCommandLineCommands(SBBreakpoint self, ...)

GetCondition(SBBreakpoint self)

Get the condition expression for the breakpoint.

GetDescription(-> bool)

GetHitCount(SBBreakpoint self)

GetID(SBBreakpoint self)

GetIgnoreCount(SBBreakpoint self)

GetLocationAtIndex(SBBreakpoint self, ...)

GetNames(SBBreakpoint self, SBStringList names)

GetNumBreakpointLocationsFromEvent(...)

GetNumLocations(SBBreakpoint self)

GetNumResolvedLocations(SBBreakpoint self)

GetQueueName(SBBreakpoint self)

GetTarget(SBBreakpoint self)

GetThreadID(SBBreakpoint self)

GetThreadIndex(SBBreakpoint self)

GetThreadName(SBBreakpoint self)

IsEnabled(SBBreakpoint self)

IsHardware(SBBreakpoint self)

IsInternal(SBBreakpoint self)

IsOneShot(SBBreakpoint self)

IsValid(SBBreakpoint self)

MatchesName(SBBreakpoint self, char const * name)

RemoveName(SBBreakpoint self, ...)

SerializeToStructuredData(SBBreakpoint self)

SetAutoContinue(SBBreakpoint self, ...)

SetCommandLineCommands(SBBreakpoint self, ...)

SetCondition(SBBreakpoint self, ...)

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

SetEnabled(SBBreakpoint self, bool enable)

SetIgnoreCount(SBBreakpoint self, uint32_t count)

SetOneShot(SBBreakpoint self, bool one_shot)

SetQueueName(SBBreakpoint self, ...)

SetScriptCallbackBody(SBBreakpoint self, ...)

Provide the body for the script function to be called when the breakpoint is hit.

SetScriptCallbackFunction()

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

SetThreadID(SBBreakpoint self, lldb)

SetThreadIndex(SBBreakpoint self, uint32_t index)

SetThreadName(SBBreakpoint self, ...)

get_breakpoint_location_list()

An accessor function that returns a list() that contains all locations in a lldb.SBBreakpoint object.

get_locations_access_object()

An accessor function that returns a locations_access() object which allows lazy location access from a lldb.SBBreakpoint object.

Attributes Documentation

enabledΒΆ

A read/write property that configures whether this breakpoint is enabled or not.

idΒΆ

A read only property that returns the ID of this breakpoint.

locationΒΆ

A read only property that returns an object that can access locations by index (not location ID) (location = bkpt.location[12]).

locationsΒΆ

A read only property that returns a list() of lldb.SBBreakpointLocation objects for this breakpoint.

num_locationsΒΆ

A read only property that returns the count of locations of this breakpoint.

one_shotΒΆ

A read/write property that configures whether this breakpoint is one-shot (deleted when hit) or not.

Methods Documentation

AddLocation(SBBreakpoint self, SBAddress address) SBErrorΒΆ
AddName(SBBreakpoint self, char const * new_name) boolΒΆ
AddNameWithErrorHandling(SBBreakpoint self, char const * new_name) SBErrorΒΆ
ClearAllBreakpointSites(SBBreakpoint self)ΒΆ
static EventIsBreakpointEvent(SBEvent event) boolΒΆ
FindLocationByAddress(SBBreakpoint self, lldb::addr_t vm_addr) SBBreakpointLocationΒΆ
FindLocationByID(SBBreakpoint self, lldb::break_id_t bp_loc_id) SBBreakpointLocationΒΆ
FindLocationIDByAddress(SBBreakpoint self, lldb::addr_t vm_addr) lldb::break_id_tΒΆ
GetAutoContinue(SBBreakpoint self) boolΒΆ
static GetBreakpointEventTypeFromEvent(SBEvent event) lldb::BreakpointEventTypeΒΆ
static GetBreakpointFromEvent(SBEvent event) SBBreakpointΒΆ
static GetBreakpointLocationAtIndexFromEvent(SBEvent event, uint32_t loc_idx) SBBreakpointLocationΒΆ
GetCommandLineCommands(SBBreakpoint self, SBStringList commands) boolΒΆ
GetCondition(SBBreakpoint self) char const *ΒΆ

Get the condition expression for the breakpoint.

GetDescription(SBBreakpoint self, SBStream description) boolΒΆ
GetDescription(SBBreakpoint self, SBStream description, bool include_locations) bool
GetHitCount(SBBreakpoint self) uint32_tΒΆ
GetID(SBBreakpoint self) lldb::break_id_tΒΆ
GetIgnoreCount(SBBreakpoint self) uint32_tΒΆ
GetLocationAtIndex(SBBreakpoint self, uint32_t index) SBBreakpointLocationΒΆ
GetNames(SBBreakpoint self, SBStringList names)ΒΆ
static GetNumBreakpointLocationsFromEvent(SBEvent event_sp) uint32_tΒΆ
GetNumLocations(SBBreakpoint self) size_tΒΆ
GetNumResolvedLocations(SBBreakpoint self) size_tΒΆ
GetQueueName(SBBreakpoint self) char const *ΒΆ
GetTarget(SBBreakpoint self) SBTargetΒΆ
GetThreadID(SBBreakpoint self) lldb::tid_tΒΆ
GetThreadIndex(SBBreakpoint self) uint32_tΒΆ
GetThreadName(SBBreakpoint self) char const *ΒΆ
IsEnabled(SBBreakpoint self) boolΒΆ
IsHardware(SBBreakpoint self) boolΒΆ
IsInternal(SBBreakpoint self) boolΒΆ
IsOneShot(SBBreakpoint self) boolΒΆ
IsValid(SBBreakpoint self) boolΒΆ
MatchesName(SBBreakpoint self, char const * name) boolΒΆ
RemoveName(SBBreakpoint self, char const * name_to_remove)ΒΆ
SerializeToStructuredData(SBBreakpoint self) SBStructuredDataΒΆ
SetAutoContinue(SBBreakpoint self, bool auto_continue)ΒΆ
SetCommandLineCommands(SBBreakpoint self, SBStringList commands)ΒΆ
SetCondition(SBBreakpoint self, char const * condition)ΒΆ

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

SetEnabled(SBBreakpoint self, bool enable)ΒΆ
SetIgnoreCount(SBBreakpoint self, uint32_t count)ΒΆ
SetOneShot(SBBreakpoint self, bool one_shot)ΒΆ
SetQueueName(SBBreakpoint self, char const * queue_name)ΒΆ
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.

SetScriptCallbackFunction(SBBreakpoint self, char const * callback_function_name)ΒΆ
SetScriptCallbackFunction(SBBreakpoint self, char const * callback_function_name, SBStructuredData extra_args) SBError

Set the name of the script function to be called when the breakpoint is hit. To use this variant, the function should take (frame, bp_loc, extra_args, internal_dict) and when the breakpoint is hit the extra_args will be passed to the callback function.

SetThreadID(SBBreakpoint self, lldb::tid_t sb_thread_id)ΒΆ
SetThreadIndex(SBBreakpoint self, uint32_t index)ΒΆ
SetThreadName(SBBreakpoint self, char const * thread_name)ΒΆ
get_breakpoint_location_list()ΒΆ

An accessor function that returns a list() that contains all locations in a lldb.SBBreakpoint object.

get_locations_access_object()ΒΆ

An accessor function that returns a locations_access() object which allows lazy location access from a lldb.SBBreakpoint object.