ruby 调试_Ruby调试器| Ruby工具

ruby 调试

Ruby调试器 (Ruby Debugger)

Before getting to know about Ruby debugger, let us understand what a debugger is? - "Debugger is nothing but a computer program which is used to test a program, find problems and resolve them in the target program". Ruby debugger is a ruby tool which works in the same way, it tests and debugs the target program. The fact is accepted that Ruby is an easy to learn language but at the same time one cannot deny the fact that the bugs may be present in its code, especially when the code is of few lines. Ruby debugger is usually provided with the standard distribution of Ruby.

在了解Ruby调试器之前 ,让我们了解什么是调试器? - “调试器不过是用于测试程序,查找问题并在目标程序中解决问题的计算机程序”Ruby调试器是一个以相同方式工作的ruby工具,它可以测试和调试目标程序。 Ruby是一种易于学习的语言,这一事实已被接受,但同时也不能否认Ruby的代码中可能存在错误的事实,尤其是在几行代码中。 Ruby调试器通常随Ruby的标准发行版一起提供。

If you want to load the ruby debugger, first you have to type "-r debug" in the command line.

如果要加载ruby调试器 ,首先必须在命令行中键入“ -r debug”

如何使用Ruby Debugger? (How to use Ruby Debugger?)

This must be a very prominent question because reading theory is easy but implementation in practical world is little tricky. If you want to use the Ruby debugger, write the following syntax in the command prompt,

这肯定是一个非常突出的问题,因为阅读理论很容易,但在实际世界中实现起来却并不困难。 如果要使用Ruby调试器,请在命令提示符下编写以下语法,

 $ruby –r debug filename[, ...]

Ruby调试命令列表 (List of Ruby Debugging commands)

Following is the complete list of Ruby Debugging commands which you may require during the process of debugging a file. Using ...] is optional.

以下是在调试文件过程中可能需要的Ruby Debugging命令的完整列表 。 使用... ]是可选的。

  • b[reak] [< file| class>:]< line| method>

    b [reak] [<文件| class>:] 方法>

    If you want to set the breakpoint to some specific positions, you are in need to use this command. Breakpoint is nothing but a pointer position where the program execution can be stopped for debugging reasons.

    如果要将断点设置为某些特定位置,则需要使用此命令。 断点仅是指针位置,在该位置可以出于调试原因而停止程序执行。

  • wat[ch] expression

    wat [ch]表达式

    This is used to set the watch points. using ch is optional.

    这用于设置监视点。 使用ch是可选的。

  • cat[ch] (exception|off)

    cat [ch](例外|关闭)

    This command sets catchpoints to an expression. Use of ch is optional.

    此命令将捕捉点设置为表达式。 ch的使用是可选的。

  • b[reak]

    打破]

    This command is used to Display breakpoints and watchpoints.

    此命令用于显示断点和监视点。

  • del[ete] [n]

    del [ete] [n]

    It used to delete breakpoints. Use of ete is optional.

    它用来删除断点。 ete的使用是可选的。

  • disp[lay] expression

    disp [lay]表达式

    This command is used for Displaying value of expression.

    此命令用于显示表达式的值。

  • undisp[lay] [ n]

    undisp [lay] [n]

    It is used to remove the display of n(whatever specified).

    用于删除n(无论指定了什么)的显示。

  • c[ont]

    c [ont]

    By the use of this command, use can continue the paused execution.

    通过使用此命令,use可以继续暂停的执行。

  • s[tep] [ n]

    s [tep] [n]

    It is used to execute next n lines stepping into methods. writing tep is optional.

    它用于执行接下来的n行,逐步进入方法。 写提示是可选的。

  • n[ext] [ n]

    n [ext] [n]

    It is used to executes next n lines stepping over methods. typing ext is optional.

    它用于执行下n行单步执行方法。 键入ext是可选的。

  • w[here]

    哪里]

    This command is used to display the stack frame.

    该命令用于显示堆栈帧。

  • f[rame]

    帧]

    Works exactly as where.

    完全在哪里工作。

  • l[ist][]

    l [ist] []

    It is used for displaying source line from m to n.

    用于显示从m到n的源行。

  • up [ n]

    上[n]

    It is used to moves up n (specified)levels in the stack frame.

    它用于在堆栈帧中上移n(指定)级。

  • down [ n]

    向下[n]

    It is used to moves down n(specified) levels in the stack frame.

    它用于在堆栈帧中向下移动n(指定)级。

  • fin[ish]

    完]

    This command is used to finish the execution of current method.

    该命令用于完成当前方法的执行。

  • tr[ace] [on|off]

    tr [ace] [on | off]

    It is used to toggle trace mode on or off.

    它用于打开或关闭跟踪模式。

  • q[uit]

    退出]

    Quit command is used to exit the debugger.

    退出命令用于退出调试器。

  • v[ar] g[lobal]

    v [ar] g [lobal]

    If you want to display global variable, use this command.

    如果要显示全局变量,请使用此命令。

  • v[ar] l[ocal]

    v [ar] l [ocal]

    If you want to display local variable, make use of this command.

    如果要显示局部变量,请使用此命令。

  • v[ar] i[instance] object

    v [ar] i [instance]对象

    This command is used to display instance variables of an object.

    此命令用于显示对象的实例变量。

  • v[ar] c[onst] object

    v [ar] c [onst]对象

    This command helps by displaying constants of object.

    该命令通过显示对象常数来提供帮助。

  • m[ethod] i[instance] object

    m [ethod] i [instance]对象

    It Displays instance methods of an object.

    显示对象的实例方法。

  • m[ethod] class| module

    m [ethod]类| 模组

    It is used to display instance methods of the class or module.

    它用于显示类或模块的实例方法。

  • th[read] l[ist]

    th [read] l [ist]

    If you want to display threads, use this command.

    如果要显示线程,请使用此命令。

  • th[read] c[ur[rent]]

    th [read] c [ur [rent]]

    If you want to display the current thread, use this command.

    如果要显示当前线程,请使用此命令。

  • th[read] n

    读[n]

    It is used to stop specified thread.

    用于停止指定线程。

翻译自: https://www.includehelp.com/ruby/debugger-ruby-tools.aspx

ruby 调试

你可能感兴趣的:(java,linux,python,vue,设计模式,ViewUI)