mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Refined rp
output [ci skip]
So that the result structure can be accessed as `$number` variables, not a mere `VALUE`.
This commit is contained in:
parent
dc44ab2913
commit
8439caab0a
1 changed files with 15 additions and 14 deletions
|
@ -111,30 +111,30 @@ def lldb_inspect(debugger, target, result, val):
|
||||||
tRBasic = target.FindFirstType("struct RBasic").GetPointerType()
|
tRBasic = target.FindFirstType("struct RBasic").GetPointerType()
|
||||||
val = val.Cast(tRBasic)
|
val = val.Cast(tRBasic)
|
||||||
flags = val.GetValueForExpressionPath("->flags").GetValueAsUnsigned()
|
flags = val.GetValueForExpressionPath("->flags").GetValueAsUnsigned()
|
||||||
|
flaginfo = ""
|
||||||
if (flags & RUBY_FL_PROMOTED) == RUBY_FL_PROMOTED:
|
if (flags & RUBY_FL_PROMOTED) == RUBY_FL_PROMOTED:
|
||||||
print("[PROMOTED] ", file=result)
|
flaginfo += "[PROMOTED] "
|
||||||
if (flags & RUBY_FL_FREEZE) == RUBY_FL_FREEZE:
|
if (flags & RUBY_FL_FREEZE) == RUBY_FL_FREEZE:
|
||||||
print("[FROZEN] ", file=result)
|
flaginfo += "[FROZEN] "
|
||||||
flType = flags & RUBY_T_MASK
|
flType = flags & RUBY_T_MASK
|
||||||
if flType == RUBY_T_NONE:
|
if flType == RUBY_T_NONE:
|
||||||
print('T_NONE: %s' % val.Dereference(), file=result)
|
print('T_NONE: %s%s' % (flaginfo, val.Dereference()), file=result)
|
||||||
elif flType == RUBY_T_NIL:
|
elif flType == RUBY_T_NIL:
|
||||||
print('T_NIL: %s' % val.Dereference(), file=result)
|
print('T_NIL: %s%s' % (flaginfo, val.Dereference()), file=result)
|
||||||
elif flType == RUBY_T_OBJECT:
|
elif flType == RUBY_T_OBJECT:
|
||||||
tRObject = target.FindFirstType("struct RObject").GetPointerType()
|
result.write('T_OBJECT: %s' % flaginfo)
|
||||||
val = val.Cast(tRObject)
|
append_command_output(debugger, "print *(struct RObject*)%0#x" % val.GetValueAsUnsigned(), result)
|
||||||
print('T_OBJECT: %s' % val.Dereference(), file=result)
|
|
||||||
elif flType == RUBY_T_CLASS or flType == RUBY_T_MODULE or flType == RUBY_T_ICLASS:
|
elif flType == RUBY_T_CLASS or flType == RUBY_T_MODULE or flType == RUBY_T_ICLASS:
|
||||||
tRClass = target.FindFirstType("struct RClass").GetPointerType()
|
result.write('T_%s: %s' % ('CLASS' if flType == RUBY_T_CLASS else 'MODULE' if flType == RUBY_T_MODULE else 'ICLASS', flaginfo))
|
||||||
val = val.Cast(tRClass)
|
append_command_output(debugger, "print *(struct RClass*)%0#x" % val.GetValueAsUnsigned(), result)
|
||||||
print('T_%s: %s' % ('CLASS' if flType == RUBY_T_CLASS else 'MODULE' if flType == RUBY_T_MODULE else 'ICLASS', val.Dereference()), file=result)
|
|
||||||
elif flType == RUBY_T_STRING:
|
elif flType == RUBY_T_STRING:
|
||||||
|
result.write('T_STRING: %s' % flaginfo)
|
||||||
tRString = target.FindFirstType("struct RString").GetPointerType()
|
tRString = target.FindFirstType("struct RString").GetPointerType()
|
||||||
ptr, len = string2cstr(val.Cast(tRString))
|
ptr, len = string2cstr(val.Cast(tRString))
|
||||||
append_command_output(debugger, "print *(const char (*)[%d])%0#x" % (len, ptr), result)
|
append_command_output(debugger, "print *(const char (*)[%d])%0#x" % (len, ptr), result)
|
||||||
elif flType == RUBY_T_SYMBOL:
|
elif flType == RUBY_T_SYMBOL:
|
||||||
tRSymbol = target.FindFirstType("struct RSymbol").GetPointerType()
|
result.write('T_SYMBOL: %s' % flaginfo)
|
||||||
print(val.Cast(tRSymbol).Dereference(), file=result)
|
append_command_output(debugger, "print *(struct RSymbol*)%0#x" % val.GetValueAsUnsigned(), result)
|
||||||
elif flType == RUBY_T_ARRAY:
|
elif flType == RUBY_T_ARRAY:
|
||||||
tRArray = target.FindFirstType("struct RArray").GetPointerType()
|
tRArray = target.FindFirstType("struct RArray").GetPointerType()
|
||||||
val = val.Cast(tRArray)
|
val = val.Cast(tRArray)
|
||||||
|
@ -145,7 +145,7 @@ def lldb_inspect(debugger, target, result, val):
|
||||||
len = val.GetValueForExpressionPath("->as.heap.len").GetValueAsSigned()
|
len = val.GetValueForExpressionPath("->as.heap.len").GetValueAsSigned()
|
||||||
ptr = val.GetValueForExpressionPath("->as.heap.ptr")
|
ptr = val.GetValueForExpressionPath("->as.heap.ptr")
|
||||||
#print(val.GetValueForExpressionPath("->as.heap"), file=result)
|
#print(val.GetValueForExpressionPath("->as.heap"), file=result)
|
||||||
result.write("T_ARRAY: len=%d" % len)
|
result.write("T_ARRAY: %slen=%d" % (flaginfo, len))
|
||||||
if flags & RUBY_FL_USER1:
|
if flags & RUBY_FL_USER1:
|
||||||
result.write(" (embed)")
|
result.write(" (embed)")
|
||||||
elif flags & RUBY_FL_USER2:
|
elif flags & RUBY_FL_USER2:
|
||||||
|
@ -155,11 +155,12 @@ def lldb_inspect(debugger, target, result, val):
|
||||||
capa = val.GetValueForExpressionPath("->as.heap.aux.capa").GetValueAsSigned()
|
capa = val.GetValueForExpressionPath("->as.heap.aux.capa").GetValueAsSigned()
|
||||||
result.write(" (ownership) capa=%d" % capa)
|
result.write(" (ownership) capa=%d" % capa)
|
||||||
if len == 0:
|
if len == 0:
|
||||||
result.write(" {(empty)}")
|
result.write(" {(empty)}\n")
|
||||||
else:
|
else:
|
||||||
result.write("\n")
|
result.write("\n")
|
||||||
append_command_output(debugger, "expression -Z %d -fx -- (const VALUE*)%0#x" % (len, ptr.GetValueAsUnsigned()), result)
|
append_command_output(debugger, "expression -Z %d -fx -- (const VALUE*)%0#x" % (len, ptr.GetValueAsUnsigned()), result)
|
||||||
elif flType == RUBY_T_HASH:
|
elif flType == RUBY_T_HASH:
|
||||||
|
result.write("T_HASH: %s" % flaginfo)
|
||||||
append_command_output(debugger, "p *(struct RHash *) %0#x" % val.GetValueAsUnsigned(), result)
|
append_command_output(debugger, "p *(struct RHash *) %0#x" % val.GetValueAsUnsigned(), result)
|
||||||
elif flType == RUBY_T_BIGNUM:
|
elif flType == RUBY_T_BIGNUM:
|
||||||
tRBignum = target.FindFirstType("struct RBignum").GetPointerType()
|
tRBignum = target.FindFirstType("struct RBignum").GetPointerType()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue