1 """ Adds the 'toggle-disassembly' command to switch you into a disassembly only mode """
6 def __init__(self
, debugger
, unused
):
8 self
.interp
= debugger
.GetCommandInterpreter()
12 def store_state(self
):
13 self
.dis_count
= self
.get_string_value("stop-disassembly-count")
14 self
.dis_display
= self
.get_string_value("stop-disassembly-display")
15 self
.before_count
= self
.get_string_value("stop-line-count-before")
16 self
.after_count
= self
.get_string_value("stop-line-count-after")
18 def get_string_value(self
, setting
):
19 result
= lldb
.SBCommandReturnObject()
20 self
.interp
.HandleCommand("settings show " + setting
, result
)
21 value
= result
.GetOutput().split(" = ")[1].rstrip("\n")
24 def set_value(self
, setting
, value
):
25 result
= lldb
.SBCommandReturnObject()
26 self
.interp
.HandleCommand("settings set " + setting
+ " " + value
, result
)
28 def __call__(self
, debugger
, command
, exe_ctx
, result
):
32 self
.set_value("stop-disassembly-display", "always")
33 self
.set_value("stop-disassembly-count", "8")
34 self
.set_value("stop-line-count-before", "0")
35 self
.set_value("stop-line-count-after", "0")
36 result
.AppendMessage("Disassembly mode on.")
39 self
.set_value("stop-disassembly-display", self
.dis_display
)
40 self
.set_value("stop-disassembly-count", self
.dis_count
)
41 self
.set_value("stop-line-count-before", self
.before_count
)
42 self
.set_value("stop-line-count-after", self
.after_count
)
43 result
.AppendMessage("Disassembly mode off.")
45 def get_short_help(self
):
46 return "Toggles between a disassembly only mode and normal source mode\n"
49 def __lldb_init_module(debugger
, unused
):
50 debugger
.HandleCommand(
51 "command script add -o -c disassembly_mode.DisassemblyMode toggle-disassembly"