lldb_rp: fix the order of results [ci skip]
The outputs from HandleCommand are printed immediately before print statements. Fix the order in `result` by capturing the outputs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3cfe3051c5
commit
7c496b6624
@ -55,6 +55,14 @@ def fixnum_p(x):
|
|||||||
def flonum_p(x):
|
def flonum_p(x):
|
||||||
return (x&RUBY_FLONUM_MASK) == RUBY_FLONUM_FLAG
|
return (x&RUBY_FLONUM_MASK) == RUBY_FLONUM_FLAG
|
||||||
|
|
||||||
|
def append_command_output(debugger, command, result):
|
||||||
|
output1 = result.GetOutput()
|
||||||
|
debugger.GetCommandInterpreter().HandleCommand(command, result)
|
||||||
|
output2 = result.GetOutput()
|
||||||
|
result.Clear()
|
||||||
|
result.write(output1)
|
||||||
|
result.write(output2)
|
||||||
|
|
||||||
def lldb_rp(debugger, command, result, internal_dict):
|
def lldb_rp(debugger, command, result, internal_dict):
|
||||||
if not ('RUBY_Qfalse' in globals()):
|
if not ('RUBY_Qfalse' in globals()):
|
||||||
lldb_init(debugger)
|
lldb_init(debugger)
|
||||||
@ -113,35 +121,35 @@ def lldb_rp(debugger, command, result, internal_dict):
|
|||||||
val = val.Cast(tRArray)
|
val = val.Cast(tRArray)
|
||||||
if flags & RUBY_FL_USER1:
|
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_USHIFT+3))
|
||||||
print >> result, "T_ARRAY: len=%d (embed)" % len
|
ptr = val.GetValueForExpressionPath("->as.ary")
|
||||||
if len == 0:
|
|
||||||
print >> result, "{(empty)}"
|
|
||||||
else:
|
|
||||||
print >> result, val.GetValueForExpressionPath("->as.ary")
|
|
||||||
else:
|
else:
|
||||||
len = val.GetValueForExpressionPath("->as.heap.len").GetValueAsSigned()
|
len = val.GetValueForExpressionPath("->as.heap.len").GetValueAsSigned()
|
||||||
print >> result, "T_ARRAY: len=%d " % len
|
ptr = val.GetValueForExpressionPath("->as.heap.ptr")
|
||||||
#print >> result, val.GetValueForExpressionPath("->as.heap")
|
#print >> result, val.GetValueForExpressionPath("->as.heap")
|
||||||
if flags & RUBY_FL_USER2:
|
result.write("T_ARRAY: len=%d" % len)
|
||||||
shared = val.GetValueForExpressionPath("->as.heap.aux.shared").GetValueAsUnsigned()
|
if flags & RUBY_FL_USER1:
|
||||||
print >> result, "(shared) shared=%016x " % shared
|
result.write(" (embed)")
|
||||||
else:
|
elif flags & RUBY_FL_USER2:
|
||||||
capa = val.GetValueForExpressionPath("->as.heap.aux.capa").GetValueAsSigned()
|
shared = val.GetValueForExpressionPath("->as.heap.aux.shared").GetValueAsUnsigned()
|
||||||
print >> result, "(ownership) capa=%d " % capa
|
result.write(" (shared) shared=%016x")
|
||||||
if len == 0:
|
else:
|
||||||
print >> result, "{(empty)}"
|
capa = val.GetValueForExpressionPath("->as.heap.aux.capa").GetValueAsSigned()
|
||||||
else:
|
result.write(" (ownership) capa=%d" % capa)
|
||||||
debugger.HandleCommand("expression -Z %d -fx -- (const VALUE*)((struct RArray*)%d)->as.heap.ptr" % (len, val.GetValueAsUnsigned()))
|
if len == 0:
|
||||||
debugger.HandleCommand("p (struct RArray *) %0#x" % val.GetValueAsUnsigned())
|
result.write(" {(empty)}")
|
||||||
|
else:
|
||||||
|
result.write("\n")
|
||||||
|
append_command_output(debugger, "expression -Z %d -fx -- (const VALUE*)%0#x" % (len, ptr.GetValueAsUnsigned()), result)
|
||||||
elif flType == RUBY_T_DATA:
|
elif flType == RUBY_T_DATA:
|
||||||
tRTypedData = target.FindFirstType("struct RTypedData").GetPointerType()
|
tRTypedData = target.FindFirstType("struct RTypedData").GetPointerType()
|
||||||
val = val.Cast(tRTypedData)
|
val = val.Cast(tRTypedData)
|
||||||
flag = val.GetValueForExpressionPath("->typed_flag")
|
flag = val.GetValueForExpressionPath("->typed_flag")
|
||||||
if flag.GetValueAsUnsigned() == 1:
|
if flag.GetValueAsUnsigned() == 1:
|
||||||
debugger.HandleCommand("p *(rb_data_type_t *) %0#x" % val.GetValueForExpressionPath("->type").GetValueAsUnsigned())
|
print >> result, "T_DATA: %s" % val.GetValueForExpressionPath("->type->wrap_struct_name")
|
||||||
debugger.HandleCommand("p (void *) %0#x" % val.GetValueForExpressionPath("->data").GetValueAsUnsigned())
|
append_command_output(debugger, "p *(struct RTypedData *) %0#x" % val.GetValueAsUnsigned(), result)
|
||||||
else:
|
else:
|
||||||
debugger.HandleCommand("p *(struct RData *) %0#x" % val.GetValueAsUnsigned())
|
print >> result, "T_DATA:"
|
||||||
|
append_command_output(debugger, "p *(struct RData *) %0#x" % val.GetValueAsUnsigned(), result)
|
||||||
|
|
||||||
def count_objects(debugger, command, ctx, result, internal_dict):
|
def count_objects(debugger, command, ctx, result, internal_dict):
|
||||||
objspace = ctx.frame.EvaluateExpression("ruby_current_vm->objspace")
|
objspace = ctx.frame.EvaluateExpression("ruby_current_vm->objspace")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user