65 lines · plain
1STRING_EXTENSION_OUTSIDE(SBBreakpoint)2 3%extend lldb::SBBreakpoint {4#ifdef SWIGPYTHON5 %pythoncode %{6 7 class locations_access(object):8 '''A helper object that will lazily hand out locations for a breakpoint when supplied an index.'''9 def __init__(self, sbbreakpoint):10 self.sbbreakpoint = sbbreakpoint11 12 def __len__(self):13 if self.sbbreakpoint:14 return int(self.sbbreakpoint.GetNumLocations())15 return 016 17 def __getitem__(self, key):18 if isinstance(key, int):19 count = len(self)20 if -count <= key < count:21 key %= count22 return self.sbbreakpoint.GetLocationAtIndex(key)23 return None24 25 def get_locations_access_object(self):26 '''An accessor function that returns a locations_access() object which allows lazy location access from a lldb.SBBreakpoint object.'''27 return self.locations_access (self)28 29 def get_breakpoint_location_list(self):30 '''An accessor function that returns a list() that contains all locations in a lldb.SBBreakpoint object.'''31 locations = []32 accessor = self.get_locations_access_object()33 for idx in range(len(accessor)):34 locations.append(accessor[idx])35 return locations36 37 def __iter__(self):38 '''Iterate over all breakpoint locations in a lldb.SBBreakpoint39 object.'''40 return lldb_iter(self, 'GetNumLocations', 'GetLocationAtIndex')41 42 def __len__(self):43 '''Return the number of breakpoint locations in a lldb.SBBreakpoint44 object.'''45 return self.GetNumLocations()46 47 locations = property(get_breakpoint_location_list, None, doc='''A read only property that returns a list() of lldb.SBBreakpointLocation objects for this breakpoint.''')48 location = property(get_locations_access_object, None, doc='''A read only property that returns an object that can access locations by index (not location ID) (location = bkpt.location[12]).''')49 id = property(GetID, None, doc='''A read only property that returns the ID of this breakpoint.''')50 enabled = property(IsEnabled, SetEnabled, doc='''A read/write property that configures whether this breakpoint is enabled or not.''')51 one_shot = property(IsOneShot, SetOneShot, doc='''A read/write property that configures whether this breakpoint is one-shot (deleted when hit) or not.''')52 num_locations = property(GetNumLocations, None, doc='''A read only property that returns the count of locations of this breakpoint.''')53 auto_continue = property(GetAutoContinue, SetAutoContinue, doc='A read/write property that configures the auto-continue property of this breakpoint.')54 condition = property(GetCondition, SetCondition, doc='A read/write property that configures the condition of this breakpoint.')55 hit_count = property(GetHitCount, doc='A read only property that returns the hit count of this breakpoint.')56 ignore_count = property(GetIgnoreCount, SetIgnoreCount, doc='A read/write property that configures the ignore count of this breakpoint.')57 queue_name = property(GetQueueName, SetQueueName, doc='A read/write property that configures the queue name criteria of this breakpoint.')58 target = property(GetTarget, doc='A read only property that returns the target of this breakpoint.')59 thread_id = property(GetThreadID, SetThreadID, doc='A read/write property that configures the thread id criteria of this breakpoint.')60 thread_index = property(GetThreadIndex, SetThreadIndex, doc='A read/write property that configures the thread index criteria of this breakpoint.')61 thread_name = property(GetThreadName, SetThreadName, doc='A read/write property that configures the thread name criteria of this breakpoint.')62 %}63#endif64}65