1import lldb 2 3 4class OperatingSystemPlugIn(object): 5 """Class that provides data for an instance of a LLDB 'OperatingSystemPython' plug-in class""" 6 7 def __init__(self, process): 8 """Initialization needs a valid.SBProcess object. 9 10 This plug-in will get created after a live process is valid and has stopped for the first time. 11 """ 12 self.process = None 13 self.registers = None 14 self.threads = None 15 if isinstance(process, lldb.SBProcess) and process.IsValid(): 16 self.process = process 17 self.threads = None # Will be an dictionary containing info for each thread 18 19 def get_target(self): 20 return self.process.target 21 22 def get_thread_info(self): 23 if not self.threads: 24 # FIXME: LLDB is not actually parsing thread stop reasons. 25 self.threads = [ 26 { 27 "tid": 0x111111111, 28 "name": "one", 29 "queue": "queue1", 30 "state": "stopped", 31 "stop_reason": "not parsed", 32 }, 33 { 34 "tid": 0x222222222, 35 "name": "two", 36 "queue": "queue2", 37 "state": "stopped", 38 "stop_reason": "not parsed", 39 }, 40 { 41 "tid": 0x333333333, 42 "name": "three", 43 "queue": "queue3", 44 "state": "stopped", 45 "stop_reason": 'not parsed - should be "sigstop" though', 46 "core": 0, 47 }, 48 ] 49 return self.threads 50