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 != 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
A read/write property that configures whether this breakpoint is enabled or not.
A read only property that returns the ID of this breakpoint.
A read only property that returns an object that can access locations by index (not location ID) (location = bkpt.location[12]).
A read only property that returns a list() of lldb.SBBreakpointLocation objects for this breakpoint.
A read only property that returns the count of locations of this breakpoint.
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)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)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.
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, ...)An accessor function that returns a list() that contains all locations in a lldb.SBBreakpoint 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
- AddName(SBBreakpoint self, char const * new_name) bool #
- 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 * #
- 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.
- __iter__()#
Iterate over all breakpoint locations in a lldb.SBBreakpoint object.
- __len__()#
Return the number of breakpoint locations in a lldb.SBBreakpoint object.