1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

lldb_cruby.py: T_RATIONAL support [ci skip]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-10-20 12:48:07 +00:00
parent 12b085a7bf
commit fa78eb2fcf

View file

@ -82,6 +82,9 @@ def lldb_rp(debugger, command, result, internal_dict):
if error.Fail():
print >> result, error
return
lldb_inspect(debugger, target, result, val)
def lldb_inspect(debugger, target, result, val):
num = val.GetValueAsSigned()
if num == RUBY_Qfalse:
print >> result, 'false'
@ -174,6 +177,14 @@ def lldb_rp(debugger, command, result, internal_dict):
tRFloat = target.FindFirstType("struct RFloat").GetPointerType()
val = val.Cast(tRFloat)
append_command_output(debugger, "p *(double *)%0#x" % val.GetValueForExpressionPath("->float_value").GetAddress(), result)
elif flType == RUBY_T_RATIONAL:
tRRational = target.FindFirstType("struct RRational").GetPointerType()
val = val.Cast(tRRational)
lldb_inspect(debugger, target, result, val.GetValueForExpressionPath("->num"))
output = result.GetOutput()
result.Clear()
result.write("(Rational) " + output.rstrip() + " / ")
lldb_inspect(debugger, target, result, val.GetValueForExpressionPath("->den"))
elif flType == RUBY_T_DATA:
tRTypedData = target.FindFirstType("struct RTypedData").GetPointerType()
val = val.Cast(tRTypedData)