[前][次][番号順一覧][スレッド一覧]

ruby-changes:72964

From: Matt <ko1@a...>
Date: Fri, 19 Aug 2022 02:25:55 +0900 (JST)
Subject: [ruby-changes:72964] a4ef2f1672 (master): [ci-skip][Feature #18910][lldb] Port rclass_ext to new LLDB Framework

https://git.ruby-lang.org/ruby.git/commit/?id=a4ef2f1672

From a4ef2f16728b4b1eb49cc3aded26219cabdfa7e7 Mon Sep 17 00:00:00 2001
From: Matt Valentine-House <matt@e...>
Date: Wed, 13 Jul 2022 13:19:41 +0100
Subject: [ci-skip][Feature #18910][lldb] Port rclass_ext to new LLDB Framework

---
 misc/commands/rclass_ext_command.py | 14 ++++++++++++++
 misc/lldb_cruby.py                  | 19 -------------------
 2 files changed, 14 insertions(+), 19 deletions(-)
 create mode 100644 misc/commands/rclass_ext_command.py

diff --git a/misc/commands/rclass_ext_command.py b/misc/commands/rclass_ext_command.py
new file mode 100644
index 0000000000..3d17f646bd
--- /dev/null
+++ b/misc/commands/rclass_ext_command.py
@@ -0,0 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/misc/commands/rclass_ext_command.py#L1
+from rb_base_command import RbBaseCommand
+
+class RclassExtCommand(RbBaseCommand):
+    program = "rclass_ext"
+    help_string = "retrieves and prints the rb_classext_struct for the VALUE pointer passed in"
+
+    def call(self, debugger, command, exe_ctx, result):
+        uintptr_t = self.target.FindFirstType("uintptr_t")
+        rclass_t = self.target.FindFirstType("struct RClass")
+        rclass_ext_t = self.target.FindFirstType("rb_classext_t")
+
+        rclass_addr = self.target.EvaluateExpression(command).Cast(uintptr_t)
+        rclass_ext_addr = (rclass_addr.GetValueAsUnsigned() + rclass_t.GetByteSize())
+        debugger.HandleCommand("p *(rb_classext_t *)%0#x" % rclass_ext_addr)
diff --git a/misc/lldb_cruby.py b/misc/lldb_cruby.py
index 5106f78881..6655d768ae 100755
--- a/misc/lldb_cruby.py
+++ b/misc/lldb_cruby.py
@@ -711,23 +711,6 @@ def rb_id2str(debugger, command, result, internal_dict): https://github.com/ruby/ruby/blob/trunk/misc/lldb_cruby.py#L711
         pos = (num % ID_ENTRY_UNIT) * ID_ENTRY_SIZE
         id_str = rb_ary_entry(target, ary, pos, result)
         lldb_inspect(debugger, target, result, id_str)
-
-def rb_rclass_ext(debugger, command, result, internal_dict):
-    if not ('RUBY_Qfalse' in globals()):
-        lldb_init(debugger)
-
-    target = debugger.GetSelectedTarget()
-    process = target.GetProcess()
-    thread = process.GetSelectedThread()
-    frame = thread.GetSelectedFrame()
-
-    uintptr_t = target.FindFirstType("uintptr_t")
-    rclass_t = target.FindFirstType("struct RClass")
-    rclass_ext_t = target.FindFirstType("rb_classext_t")
-
-    rclass_addr = target.EvaluateExpression(command).Cast(uintptr_t)
-    rclass_ext_addr = (rclass_addr.GetValueAsUnsigned() + rclass_t.GetByteSize())
-    debugger.HandleCommand("p *(rb_classext_t *)%0#x" % rclass_ext_addr)
 # END FUNCTION STYLE DECLS
 
 
@@ -758,7 +741,5 @@ def __lldb_init_module(debugger, internal_dict): https://github.com/ruby/ruby/blob/trunk/misc/lldb_cruby.py#L741
     debugger.HandleCommand("command script add -f lldb_cruby.dump_page dump_page")
     debugger.HandleCommand("command script add -f lldb_cruby.dump_page_rvalue dump_page_rvalue")
     debugger.HandleCommand("command script add -f lldb_cruby.rb_id2str rb_id2str")
-    debugger.HandleCommand("command script add -f lldb_cruby.rb_rclass_ext rclass_ext")
-
     lldb_init(debugger)
     print("lldb scripts for ruby has been installed.")
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]