Files
TheRock/compiler/amd-llvm/lldb/examples/python/disassembly_mode.py
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

53 lines
2.1 KiB
Python

""" Adds the 'toggle-disassembly' command to switch you into a disassembly only mode """
import lldb
class DisassemblyMode:
def __init__(self, debugger, unused):
self.dbg = debugger
self.interp = debugger.GetCommandInterpreter()
self.store_state()
self.mode_off = True
def store_state(self):
self.dis_count = self.get_string_value("stop-disassembly-count")
self.dis_display = self.get_string_value("stop-disassembly-display")
self.before_count = self.get_string_value("stop-line-count-before")
self.after_count = self.get_string_value("stop-line-count-after")
def get_string_value(self, setting):
result = lldb.SBCommandReturnObject()
self.interp.HandleCommand("settings show " + setting, result)
value = result.GetOutput().split(" = ")[1].rstrip("\n")
return value
def set_value(self, setting, value):
result = lldb.SBCommandReturnObject()
self.interp.HandleCommand("settings set " + setting + " " + value, result)
def __call__(self, debugger, command, exe_ctx, result):
if self.mode_off:
self.mode_off = False
self.store_state()
self.set_value("stop-disassembly-display", "always")
self.set_value("stop-disassembly-count", "8")
self.set_value("stop-line-count-before", "0")
self.set_value("stop-line-count-after", "0")
result.AppendMessage("Disassembly mode on.")
else:
self.mode_off = True
self.set_value("stop-disassembly-display", self.dis_display)
self.set_value("stop-disassembly-count", self.dis_count)
self.set_value("stop-line-count-before", self.before_count)
self.set_value("stop-line-count-after", self.after_count)
result.AppendMessage("Disassembly mode off.")
def get_short_help(self):
return "Toggles between a disassembly only mode and normal source mode\n"
def __lldb_init_module(debugger, unused):
debugger.HandleCommand(
"command script add -o -c disassembly_mode.DisassemblyMode toggle-disassembly"
)