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

ruby-changes:72216

From: Matt <ko1@a...>
Date: Fri, 17 Jun 2022 22:15:37 +0900 (JST)
Subject: [ruby-changes:72216] 721e012d42 (master): [ci skip][lldb] Fix array length representation with USING_RVARGC

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

From 721e012d42a9fbc5b8484805c880f70cfefa94ef Mon Sep 17 00:00:00 2001
From: Matt Valentine-House <matt@e...>
Date: Fri, 17 Jun 2022 11:40:11 +0100
Subject: [ci skip][lldb] Fix array length representation with USING_RVARGC

This commit makes `rp` report the correct array length in lldb.

When USING_RVARGC is set we use 7 bits of the flags to store the array
len rather than the usual 2, so they need to be part of the mask when
calculating the length in lldb.

When calculating whether rvargc is enabled I've used the same approach
that's used by `GC.using_rvargc?` which is to detect whether there is
more than one size pool in the current objspace.
---
 misc/lldb_cruby.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/misc/lldb_cruby.py b/misc/lldb_cruby.py
index ef4820b1a5..a752b98bb3 100755
--- a/misc/lldb_cruby.py
+++ b/misc/lldb_cruby.py
@@ -77,7 +77,7 @@ class BackTrace: https://github.com/ruby/ruby/blob/trunk/misc/lldb_cruby.py#L77
             pathobj = pathobj.Cast(self.tRArray)
 
             if flags & RUBY_FL_USER1:
-                len = ((flags & (RUBY_FL_USER3|RUBY_FL_USER4)) >> (RUBY_FL_USHIFT+3))
+                len = ((flags & (RUBY_FL_USER3|RUBY_FL_USER4|RUBY_FL_USER5|RUBY_FL_USER6|RUBY_FL_USER7|RUBY_FL_USER8|RUBY_FL_USER9)) >> (RUBY_FL_USHIFT+3))
                 ptr = pathobj.GetValueForExpressionPath("->as.ary")
             else:
                 len = pathobj.GetValueForExpressionPath("->as.heap.len").GetValueAsSigned()
@@ -321,7 +321,7 @@ def lldb_inspect(debugger, target, result, val): https://github.com/ruby/ruby/blob/trunk/misc/lldb_cruby.py#L321
             tRArray = target.FindFirstType("struct RArray").GetPointerType()
             val = val.Cast(tRArray)
             if flags & RUBY_FL_USER1:
-                len = ((flags & (RUBY_FL_USER3|RUBY_FL_USER4)) >> (RUBY_FL_USHIFT+3))
+                len = ((flags & (RUBY_FL_USER3|RUBY_FL_USER4|RUBY_FL_USER5|RUBY_FL_USER6|RUBY_FL_USER7|RUBY_FL_USER8|RUBY_FL_USER9)) >> (RUBY_FL_USHIFT+3))
                 ptr = val.GetValueForExpressionPath("->as.ary")
             else:
                 len = val.GetValueForExpressionPath("->as.heap.len").GetValueAsSigned()
-- 
cgit v1.2.1


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

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