summaryrefslogtreecommitdiff
path: root/misc/lldb_rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-09-30 02:06:02 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-09-30 02:09:29 +0900
commit9fa7ec9332a7d39f1c7d8056bbcf62cb6f9340df (patch)
tree20ee63cea61ff913947f0381ad8ee6d1662ff33a /misc/lldb_rb
parente8251602574d6736e48eafc239718a6a9d91d261 (diff)
Fix RArray print [ci skip]
Diffstat (limited to 'misc/lldb_rb')
-rw-r--r--misc/lldb_rb/rb_heap_structs.py11
-rw-r--r--misc/lldb_rb/utils.py1
2 files changed, 8 insertions, 4 deletions
diff --git a/misc/lldb_rb/rb_heap_structs.py b/misc/lldb_rb/rb_heap_structs.py
index 7222766ef3..b86ba2b2d6 100644
--- a/misc/lldb_rb/rb_heap_structs.py
+++ b/misc/lldb_rb/rb_heap_structs.py
@@ -108,11 +108,15 @@ class RbObject(LLDBInterface):
else:
return False
+ def as_type(self, type_name):
+ return self.val.Cast(self.tRValue.GetPointerType()).GetValueForExpressionPath("->as."+type_name)
+
def ary_ptr(self):
+ rval = self.as_type("array")
if self.flags & self.ruby_globals["RUBY_FL_USER1"]:
- ptr = self.val.GetValueForExpressionPath("->as.ary")
+ ptr = rval.GetValueForExpressionPath("->as.ary")
else:
- ptr = self.val.GetValueForExpressionPath("->as.heap.ptr")
+ ptr = rval.GetValueForExpressionPath("->as.heap.ptr")
return ptr
def ary_len(self):
@@ -122,7 +126,8 @@ class RbObject(LLDBInterface):
self.flUser7 | self.flUser8 | self.flUser9)
) >> (self.flUshift + 3))
else:
- len = self.val.GetValueForExpressionPath("->as.heap.len")
+ rval = self.as_type("array")
+ len = rval.GetValueForExpressionPath("->as.heap.len").GetValueAsSigned()
return len
diff --git a/misc/lldb_rb/utils.py b/misc/lldb_rb/utils.py
index c4a39b7a09..6c50bd3cfe 100644
--- a/misc/lldb_rb/utils.py
+++ b/misc/lldb_rb/utils.py
@@ -146,7 +146,6 @@ class RbInspector(LLDBInterface):
self.output_string(val.GetValueForExpressionPath("->fstr").Cast(tRString))
elif rval.is_type("RUBY_T_ARRAY"):
- tRArray = self.target.FindFirstType("struct RArray").GetPointerType()
len = rval.ary_len()
ptr = rval.ary_ptr()