ruby-changes:72548
From: Matt <ko1@a...>
Date: Fri, 15 Jul 2022 00:25:57 +0900 (JST)
Subject: [ruby-changes:72548] 1df9b6c390 (master): Get the insns_address_table from the vm_exec_core module table...
https://git.ruby-lang.org/ruby.git/commit/?id=1df9b6c390 From 1df9b6c39040f21a26aa8879a6966c92a298b40d Mon Sep 17 00:00:00 2001 From: Matt Valentine-House <matt@e...> Date: Wed, 13 Jul 2022 23:12:53 +0100 Subject: Get the insns_address_table from the vm_exec_core module table... --- misc/lldb_disasm.py | 13 +++++++++++-- 1 file 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: https://github.com/ruby/ruby/blob/trunk/misc/lldb_disasm.py#L63 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: https://github.com/ruby/ruby/blob/trunk/misc/lldb_disasm.py#L89 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: https://github.com/ruby/ruby/blob/trunk/misc/lldb_disasm.py#L221 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): https://github.com/ruby/ruby/blob/trunk/misc/lldb_disasm.py#L245 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.") -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/