Skip to content

Commit 67d9bf7

Browse files
committed
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.
1 parent 9ce55b3 commit 67d9bf7

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

misc/lldb_cruby.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def vm_frame_magic(self, cfp):
6868
return self.VM_FRAME_MAGIC_NAME.get(frame_type, "(none)")
6969

7070
def rb_iseq_path_str(self, iseq):
71-
tRBasic = self.target.FindFirstType("struct RBasic").GetPointerType()
71+
tRBasic = self.target.FindFirstType("::RBasic").GetPointerType()
7272

7373
pathobj = iseq.GetValueForExpressionPath("->body->location.pathobj")
7474
pathobj = pathobj.Cast(tRBasic)
@@ -270,7 +270,7 @@ def lldb_inspect(debugger, target, result, val):
270270
elif num & RUBY_IMMEDIATE_MASK:
271271
print('immediate(%x)' % num, file=result)
272272
else:
273-
tRBasic = target.FindFirstType("struct RBasic").GetPointerType()
273+
tRBasic = target.FindFirstType("::RBasic").GetPointerType()
274274

275275
val = val.Cast(tRBasic)
276276
flags = val.GetValueForExpressionPath("->flags").GetValueAsUnsigned()
@@ -550,7 +550,7 @@ def __init__(self, page, target):
550550
self.num_slots = page.GetChildMemberWithName('total_slots').unsigned
551551
self.slot_size = page.GetChildMemberWithName('heap').GetChildMemberWithName('slot_size').unsigned
552552
self.counter = 0
553-
self.tRBasic = target.FindFirstType("struct RBasic")
553+
self.tRBasic = target.FindFirstType("::RBasic")
554554

555555
def is_valid(self):
556556
heap_page_header_size = self.target.FindFirstType("struct heap_page_header").GetByteSize()

misc/lldb_rb/commands/print_flags_command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class PrintFlagsCommand(RbBaseCommand):
1111

1212
# call is where our command logic will be implemented
1313
def call(self, debugger, command, exe_ctx, result):
14-
rclass_t = self.target.FindFirstType("struct RBasic")
14+
rclass_t = self.target.FindFirstType("::RBasic")
1515
rcass_ptr = self.target.EvaluateExpression(command).Cast(rclass_t.GetPointerType())
1616
obj_flags = rcass_ptr.GetValueForExpressionPath("->flags").GetValueAsUnsigned()
1717

misc/lldb_rb/rb_heap_structs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def __init__(self, ptr, debugger, ruby_globals):
5151
self.flUser9 = self.ruby_globals["RUBY_FL_USER9"]
5252
self.flUshift = self.ruby_globals["RUBY_FL_USHIFT"]
5353

54-
self.tRBasic = self.target.FindFirstType("struct RBasic").GetPointerType()
54+
self.tRBasic = self.target.FindFirstType("::RBasic").GetPointerType()
5555

5656
self.val = ptr.Cast(self.tRBasic)
5757
self.page = HeapPage(self.debugger, self.val)

0 commit comments

Comments
 (0)