7 class OperatingSystemPlugIn(object):
8 """Class that provides data for an instance of a LLDB 'OperatingSystemPython' plug-in class"""
10 def __init__(self
, process
):
11 """Initialization needs a valid.SBProcess object.
13 This plug-in will get created after a live process is valid and has stopped for the
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
23 # NOTE: Don't use "lldb.target" when trying to get your target as the "lldb.target"
24 # tracks the current target in the LLDB command interpreter which isn't the
25 # correct thing to use for this plug-in.
26 return self
.process
.target
28 def create_thread(self
, tid
, context
):
29 if tid
== 0x444444444:
35 "stop_reason": "none",
37 self
.threads
.append(thread_info
)
41 def get_thread_info(self
):
43 # The sample dictionary below shows the values that can be returned for a thread
44 # tid => thread ID (mandatory)
45 # name => thread name (optional key/value pair)
46 # queue => thread dispatch queue name (optional key/value pair)
47 # state => thred state (mandatory, set to 'stopped' for now)
48 # stop_reason => thread stop reason. (mandatory, usually set to 'none')
49 # Possible values include:
50 # 'breakpoint' if the thread is stopped at a breakpoint
51 # 'none' thread is just stopped because the process is stopped
52 # 'trace' the thread just single stepped
53 # The usual value for this while threads are in memory is 'none'
54 # register_data_addr => the address of the register data in memory (optional key/value pair)
55 # Specifying this key/value pair for a thread will avoid a call to get_register_data()
56 # and can be used when your registers are in a thread context structure that is contiguous
57 # in memory. Don't specify this if your register layout in memory doesn't match the layout
58 # described by the dictionary returned from a call to the
59 # get_register_info() method.
66 "stop_reason": "breakpoint",
73 "stop_reason": "none",
80 "stop_reason": "trace",
81 "register_data_addr": 0x100000000,
86 def get_register_info(self
):
87 if self
.registers
is None:
88 self
.registers
= dict()
89 triple
= self
.process
.target
.triple
91 arch
= triple
.split("-")[0]
93 self
.registers
["sets"] = ["GPR", "FPU", "EXC"]
94 self
.registers
["registers"] = [
318 return self
.registers
320 def get_register_data(self
, tid
):
321 if tid
== 0x111111111:
346 elif tid
== 0x222222222:
371 elif tid
== 0x333333333:
396 elif tid
== 0x444444444: