1import lldb 2 3 4class OperatingSystemPlugIn(object): 5 """Class that provides data for an instance of a LLDB 'OperatingSystemPython' plug-in class 6 This version stops once with threads 0x111 and 0x222, then stops a second time with threads 7 0x111 and 0x333.""" 8 9 def __init__(self, process): 10 '''Initialization needs a valid.SBProcess object. 11 12 This plug-in will get created after a live process is valid and has stopped for the first time. 13 ''' 14 self.process = None 15 self.registers = None 16 self.threads = None 17 self.times_called = 0 18 if isinstance(process, lldb.SBProcess) and process.IsValid(): 19 self.process = process 20 self.threads = None # Will be an dictionary containing info for each thread 21 22 def get_target(self): 23 return self.process.target 24 25 def get_thread_info(self): 26 self.times_called += 1 27 28 if self.times_called == 1: 29 self.threads = [{ 30 'tid': 0x111, 31 'name': 'one', 32 'queue': 'queue1', 33 'state': 'stopped', 34 'stop_reason': 'none', 35 'core': 1 36 }, { 37 'tid': 0x222, 38 'name': 'two', 39 'queue': 'queue2', 40 'state': 'stopped', 41 'stop_reason': 'none', 42 'core': 0 43 }] 44 else: 45 self.threads = [{ 46 'tid': 0x111, 47 'name': 'one', 48 'queue': 'queue1', 49 'state': 'stopped', 50 'stop_reason': 'none', 51 'core': 1 52 }, { 53 'tid': 0x333, 54 'name': 'three', 55 'queue': 'queue3', 56 'state': 'stopped', 57 'stop_reason': 'none', 58 'core': 0 59 }] 60 return self.threads 61 62