[前][次][番号順一覧][スレッド一覧]

ruby-changes:53030

From: nobu <ko1@a...>
Date: Sat, 20 Oct 2018 21:48:12 +0900 (JST)
Subject: [ruby-changes:53030] nobu:r65244 (trunk): lldb_cruby.py: T_RATIONAL support [ci skip]

nobu	2018-10-20 21:48:07 +0900 (Sat, 20 Oct 2018)

  New Revision: 65244

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65244

  Log:
    lldb_cruby.py: T_RATIONAL support [ci skip]

  Modified files:
    trunk/misc/lldb_cruby.py
Index: misc/lldb_cruby.py
===================================================================
--- misc/lldb_cruby.py	(revision 65243)
+++ misc/lldb_cruby.py	(revision 65244)
@@ -82,6 +82,9 @@ def lldb_rp(debugger, command, result, i https://github.com/ruby/ruby/blob/trunk/misc/lldb_cruby.py#L82
     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, i https://github.com/ruby/ruby/blob/trunk/misc/lldb_cruby.py#L177
             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)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]