diff options
author | Eileen <[email protected]> | 2025-04-08 12:52:49 -0400 |
---|---|---|
committer | <[email protected]> | 2025-04-08 12:52:49 -0400 |
commit | 5aa05f179c028981950cb5f40112ce058c5a40cd () | |
tree | 4966db1302f4f90acd9d631f884697f6b36a982a /misc/lldb_rb | |
parent | b68fe530f1880ed314099b61a70e3c0b1ee7cf6d (diff) |
Fix lldb debug scripts (#13048)
In ruby/ruby#13008 `RVALUE` was removed without replacement. This means the lldb scripts that relied on `RVALUE` stopped working. I updated the ones that were using it just for the bytesize to use `slot_size` and then round to the nearest power of 40. We can't use `slot_size` directly because in debug mode it's `48` but `RVALUE` is `40` bytes. For the `as_type` method, I updated it to check the type. It's only used for `bignum` and `array` so that's a simple change. Lastly, for the `dump_page` method I replaced it with `struct free_slot` since that's looking at the freelist. `struct RVALUE` has been removed from all the scripts and I verified that `rp` is fixed. I'm not confident the `dump_page` method is fixed, the freelist looks off, but for now this gets us closer.
Notes: Merged-By: eileencodes <[email protected]>
-rw-r--r-- | misc/lldb_rb/rb_heap_structs.py | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -1,4 +1,5 @@ import lldb from lldb_rb.lldb_interface import LLDBInterface from lldb_rb.constants import * @@ -51,7 +52,6 @@ class RbObject(LLDBInterface): self.flUshift = self.ruby_globals["RUBY_FL_USHIFT"] self.tRBasic = self.target.FindFirstType("struct RBasic").GetPointerType() - self.tRValue = self.target.FindFirstType("struct RVALUE") self.val = ptr.Cast(self.tRBasic) self.page = HeapPage(self.debugger, self.val) @@ -70,10 +70,12 @@ class RbObject(LLDBInterface): return ' ' def dump_bits(self, result, end = "\n"): - tRValue = self.target.FindFirstType("struct RVALUE") tUintPtr = self.target.FindFirstType("uintptr_t") # bits_t - num_in_page = (self.val.GetValueAsUnsigned() & HEAP_PAGE_ALIGN_MASK) // tRValue.GetByteSize(); bits_bitlength = tUintPtr.GetByteSize() * 8 bitmap_index = num_in_page // bits_bitlength bitmap_offset = num_in_page & (bits_bitlength - 1) @@ -109,7 +111,14 @@ class RbObject(LLDBInterface): 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") |