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/
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 != 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 comparion methods which allow the API program to use,

    if aBreakpoint == bBreakpoint:
        ...

to compare two breakpoints for equality.

Instance Methods [hide private]
 
__setattr__(self, name, value)
x.__setattr__('name', value) <==> x.name = value
source code
 
__getattr__(self, name) source code
 
__repr__(self)
repr(x)
source code
 
__iter__(self) source code
 
__len__(self) source code
 
__init__(self, *args)
__init__(lldb::SBBreakpoint self) -> SBBreakpoint __init__(lldb::SBBreakpoint self, SBBreakpoint rhs) -> SBBreakpoint
source code
 
__swig_destroy__(...)
delete_SBBreakpoint(SBBreakpoint self)
 
__del__(self) source code
 
GetID(self)
GetID(SBBreakpoint self) -> lldb::break_id_t
source code
 
__nonzero__(self) source code
 
IsValid(self)
IsValid(SBBreakpoint self) -> bool
source code
 
ClearAllBreakpointSites(self)
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(self)
IsEnabled(SBBreakpoint self) -> bool
source code
 
SetOneShot(self, *args)
SetOneShot(SBBreakpoint self, bool one_shot)
source code
 
IsOneShot(self)
IsOneShot(SBBreakpoint self) -> bool
source code
 
IsInternal(self)
IsInternal(SBBreakpoint self) -> bool
source code
 
GetHitCount(self)
GetHitCount(SBBreakpoint self) -> uint32_t
source code
 
SetIgnoreCount(self, *args)
SetIgnoreCount(SBBreakpoint self, uint32_t count)
source code
 
GetIgnoreCount(self)
GetIgnoreCount(SBBreakpoint self) -> uint32_t
source code
 
SetCondition(self, *args)
SetCondition(SBBreakpoint self, str const * condition)
source code
 
GetCondition(self)
GetCondition(SBBreakpoint self) -> str const *
source code
 
SetThreadID(self, *args)
SetThreadID(SBBreakpoint self, lldb::tid_t sb_thread_id)
source code
 
GetThreadID(self)
GetThreadID(SBBreakpoint self) -> lldb::tid_t
source code
 
SetThreadIndex(self, *args)
SetThreadIndex(SBBreakpoint self, uint32_t index)
source code
 
GetThreadIndex(self)
GetThreadIndex(SBBreakpoint self) -> uint32_t
source code
 
SetThreadName(self, *args)
SetThreadName(SBBreakpoint self, str const * thread_name)
source code
 
GetThreadName(self)
GetThreadName(SBBreakpoint self) -> str const *
source code
 
SetQueueName(self, *args)
SetQueueName(SBBreakpoint self, str const * queue_name)
source code
 
GetQueueName(self)
GetQueueName(SBBreakpoint self) -> str const *
source code
 
SetCallback(self, *args)
SetCallback(SBBreakpoint self, lldb::SBBreakpoint::BreakpointHitCallback callback, void * baton)
source code
 
GetNumResolvedLocations(self)
GetNumResolvedLocations(SBBreakpoint self) -> size_t
source code
 
GetNumLocations(self)
GetNumLocations(SBBreakpoint self) -> size_t
source code
 
GetDescription(self, *args)
GetDescription(SBBreakpoint self, SBStream description) -> bool
source code
 
__str__(self)
__str__(SBBreakpoint self) -> PyObject *
source code
 
__eq__(self, rhs) source code
 
__ne__(self, rhs) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __sizeof__, __subclasshook__

Static Methods [hide private]
 
EventIsBreakpointEvent(*args)
EventIsBreakpointEvent(SBEvent event) -> bool
source code
 
GetBreakpointEventTypeFromEvent(*args)
GetBreakpointEventTypeFromEvent(SBEvent event) -> lldb::BreakpointEventType
source code
 
GetBreakpointFromEvent(*args)
GetBreakpointFromEvent(SBEvent event) -> SBBreakpoint
source code
 
GetBreakpointLocationAtIndexFromEvent(*args)
GetBreakpointLocationAtIndexFromEvent(SBEvent event, uint32_t loc_idx) -> SBBreakpointLocation
source code
 
GetNumBreakpointLocationsFromEvent(*args)
GetNumBreakpointLocationsFromEvent(SBEvent event_sp) -> uint32_t
source code
Class Variables [hide private]
  __swig_setmethods__ = {}
  __swig_getmethods__ = {}
Properties [hide private]
  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.
  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.

Inherited from object: __class__

Method Details [hide private]

__setattr__(self, name, value)

source code 

x.__setattr__('name', value) <==> x.name = value

Overrides: object.__setattr__
(inherited documentation)

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

__init__(self, *args)
(Constructor)

source code 

__init__(lldb::SBBreakpoint self) -> SBBreakpoint __init__(lldb::SBBreakpoint self, SBBreakpoint rhs) -> SBBreakpoint

Overrides: object.__init__

SetCondition(self, *args)

source code 

SetCondition(SBBreakpoint self, str const * condition)

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

GetCondition(self)

source code 

GetCondition(SBBreakpoint self) -> str const *

Get the condition expression for the breakpoint.

__str__(self)
(Informal representation operator)

source code 

__str__(SBBreakpoint self) -> PyObject *

Overrides: object.__str__

Property Details [hide private]

enabled

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

Get Method:
IsEnabled(self) - IsEnabled(SBBreakpoint self) -> bool
Set Method:
SetEnabled(self, *args) - SetEnabled(SBBreakpoint self, bool enable)

id

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

Get Method:
GetID(self) - GetID(SBBreakpoint self) -> lldb::break_id_t

num_locations

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

Get Method:
GetNumLocations(self) - GetNumLocations(SBBreakpoint self) -> size_t

one_shot

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

Get Method:
IsOneShot(self) - IsOneShot(SBBreakpoint self) -> bool
Set Method:
SetOneShot(self, *args) - SetOneShot(SBBreakpoint self, bool one_shot)