Always look for the top-level RBasic in LLDB scripts

`rp` and other commands were broken for me because they always showed
the object as a T_NONE.

The reason was that instead of returning the type `struct RBasic`,
FindFirstType("struct RBasic") was returning
`yjit::cruby::autogened::RBasic`.

Explicitly asking for the top-level RBasic by prefixing it with `::` is
enough to fix those commands.
This commit is contained in:
Étienne Barrié 2025-04-10 15:26:06 +02:00 committed by Jean Boussier
parent 6e184ebb5a
commit e1f544c1cf
Notes: git 2025-04-15 02:59:19 +00:00
3 changed files with 5 additions and 5 deletions

View File

@ -68,7 +68,7 @@ class BackTrace:
return self.VM_FRAME_MAGIC_NAME.get(frame_type, "(none)")
def rb_iseq_path_str(self, iseq):
tRBasic = self.target.FindFirstType("struct RBasic").GetPointerType()
tRBasic = self.target.FindFirstType("::RBasic").GetPointerType()
pathobj = iseq.GetValueForExpressionPath("->body->location.pathobj")
pathobj = pathobj.Cast(tRBasic)
@ -270,7 +270,7 @@ def lldb_inspect(debugger, target, result, val):
elif num & RUBY_IMMEDIATE_MASK:
print('immediate(%x)' % num, file=result)
else:
tRBasic = target.FindFirstType("struct RBasic").GetPointerType()
tRBasic = target.FindFirstType("::RBasic").GetPointerType()
val = val.Cast(tRBasic)
flags = val.GetValueForExpressionPath("->flags").GetValueAsUnsigned()
@ -550,7 +550,7 @@ class HeapPageIter:
self.num_slots = page.GetChildMemberWithName('total_slots').unsigned
self.slot_size = page.GetChildMemberWithName('heap').GetChildMemberWithName('slot_size').unsigned
self.counter = 0
self.tRBasic = target.FindFirstType("struct RBasic")
self.tRBasic = target.FindFirstType("::RBasic")
def is_valid(self):
heap_page_header_size = self.target.FindFirstType("struct heap_page_header").GetByteSize()

View File

@ -11,7 +11,7 @@ class PrintFlagsCommand(RbBaseCommand):
# call is where our command logic will be implemented
def call(self, debugger, command, exe_ctx, result):
rclass_t = self.target.FindFirstType("struct RBasic")
rclass_t = self.target.FindFirstType("::RBasic")
rcass_ptr = self.target.EvaluateExpression(command).Cast(rclass_t.GetPointerType())
obj_flags = rcass_ptr.GetValueForExpressionPath("->flags").GetValueAsUnsigned()

View File

@ -51,7 +51,7 @@ class RbObject(LLDBInterface):
self.flUser9 = self.ruby_globals["RUBY_FL_USER9"]
self.flUshift = self.ruby_globals["RUBY_FL_USHIFT"]
self.tRBasic = self.target.FindFirstType("struct RBasic").GetPointerType()
self.tRBasic = self.target.FindFirstType("::RBasic").GetPointerType()
self.val = ptr.Cast(self.tRBasic)
self.page = HeapPage(self.debugger, self.val)