diff options
author | Matt Valentine-House <matt@eightbitraptor.com> | 2022-07-13 23:12:53 +0100 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2022-07-14 08:25:37 -0700 |
commit | 1df9b6c39040f21a26aa8879a6966c92a298b40d (patch) | |
tree | 9d0633592d69f3e7f0c96b2bd962221448741dea | |
parent | 673759328ca2ff46cc37989dd81c59fe3518e426 (diff) | |
download | ruby-1df9b6c39040f21a26aa8879a6966c92a298b40d.tar.gz |
Get the insns_address_table from the vm_exec_core module table...
-rw-r--r-- | misc/lldb_disasm.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/misc/lldb_disasm.py b/misc/lldb_disasm.py index 713a935285..ab759f009a 100644 --- a/misc/lldb_disasm.py +++ b/misc/lldb_disasm.py @@ -63,6 +63,7 @@ class IseqDisassembler: self.internal_dict = internal_dict self.target = debugger.GetSelectedTarget() + self.insns_address_table = self.__get_insns_address_table() self.process = self.target.GetProcess() self.thread = self.process.GetSelectedThread() self.frame = self.thread.GetSelectedFrame() @@ -88,7 +89,7 @@ class IseqDisassembler: tIntPtr = target.FindFirstType("intptr_t") size = target.EvaluateExpression('ruby_vminsn_type::VM_INSTRUCTION_SIZE').unsigned sizeOfIntPtr = tIntPtr.GetByteSize() - addr_of_table = target.FindSymbols("vm_exec_core.insns_address_table")[0].GetSymbol().GetStartAddress().GetLoadAddress(target) + addr_of_table = self.insns_address_table.GetStartAddress().GetLoadAddress(target) my_dict = {} @@ -220,6 +221,15 @@ class IseqDisassembler: else: print('error getting insn name', error) + def __get_insns_address_table(self): + module = self.target.FindSymbols("vm_exec_core")[0].GetModule() + + for symbol in module: + if "insns_address_table" in symbol.name and symbol.GetType() == lldb.eSymbolTypeData: + print(f"found symbol {symbol.name}") + return symbol + + def disasm(debugger, command, result, internal_dict): disassembler = IseqDisassembler(debugger, command, result, internal_dict) frame = disassembler.frame @@ -235,7 +245,6 @@ def disasm(debugger, command, result, internal_dict): disassembler.disasm(val); - def __lldb_init_module(debugger, internal_dict): debugger.HandleCommand("command script add -f lldb_disasm.disasm rbdisasm") print("lldb Ruby disasm installed.") |