summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-20 12:48:07 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-20 12:48:07 +0000
commitfa78eb2fcf184eeb38ad02a967d7a109b6ca9853 (patch)
tree8f80d9fcb90075f45748220d410cbf04d41439cb /misc
parent12b085a7bf4c8c9a2ad7e30813983bbd8d8712ca (diff)
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
Diffstat (limited to 'misc')
-rwxr-xr-xmisc/lldb_cruby.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/misc/lldb_cruby.py b/misc/lldb_cruby.py
index d411b32ecf..c9bb5cac7b 100755
--- a/misc/lldb_cruby.py
+++ b/misc/lldb_cruby.py
@@ -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)