调试Shoes应用程序的最佳方法是什么?

时间:2022-09-06 00:25:44

Shoes has some built in dump commands (Shoes.debug), but are there other tools that can debug the code without injecting debug messages throughout? Something like gdb would be great.

Shoes有一些内置的转储命令(Shoes.debug),但还有其他工具可以调试代码而不会在整个注入调试消息吗?像gdb这样的东西会很棒。

5 个解决方案

#1


5  

You can also use Shoes.show_log to automatically open a debug console.

您还可以使用Shoes.show_log自动打开调试控制台。

#2


3  

The shoes console. Press Alt+/ (or apple+/ on a mac) to see the stack trace of your application.

鞋子控制台。按Alt + /(或mac上的apple + /)查看应用程序的堆栈跟踪。

#3


2  

Note that if you use Alt + / you'll have to run that "before" starting the app

请注意,如果您使用Alt + /,则必须在启动应用之前“运行”

#4


1  

Have you looked at the ruby-debug gem?

你看过ruby-debug gem吗?


% sudo gem install ruby-debug

The rdebug executable gives you a similar interface to gdb (breakpoint setting, etc). You just simply execute your script with rdebug instead of ruby.

rdebug可执行文件为您提供了与gdb类似的接口(断点设置等)。您只需使用rdebug而不是ruby执行脚本。

You can also do something like this to avoid manually setting breakpoints:

您也可以执行以下操作以避免手动设置断点:


class Foo
  require 'ruby-debug'
  def some_method_somewhere
    debugger # acts like a breakpoint is set at this point
  end
end

Here's a tutorial on ruby-debug: http://www.datanoise.com/articles/2006/7/12/tutorial-on-ruby-debug

这是关于ruby-debug的教程:http://www.datanoise.com/articles/2006/7/12/tutorial-on-ruby-debug

#5


0  

I was a bit confused about the Apple-/ (or Alt-/) bit mentioned here. What I ended up doing was running ./shoes with no arguments, which popped up the console, then started my app with ./shoes my_app.rb.

我对这里提到的Apple- /(或Alt- /)位有点困惑。我最终做的是运行没有参数的./shoes,它弹出控制台,然后用./shoes my_app.rb启动我的应用程序。

#1


5  

You can also use Shoes.show_log to automatically open a debug console.

您还可以使用Shoes.show_log自动打开调试控制台。

#2


3  

The shoes console. Press Alt+/ (or apple+/ on a mac) to see the stack trace of your application.

鞋子控制台。按Alt + /(或mac上的apple + /)查看应用程序的堆栈跟踪。

#3


2  

Note that if you use Alt + / you'll have to run that "before" starting the app

请注意,如果您使用Alt + /,则必须在启动应用之前“运行”

#4


1  

Have you looked at the ruby-debug gem?

你看过ruby-debug gem吗?


% sudo gem install ruby-debug

The rdebug executable gives you a similar interface to gdb (breakpoint setting, etc). You just simply execute your script with rdebug instead of ruby.

rdebug可执行文件为您提供了与gdb类似的接口(断点设置等)。您只需使用rdebug而不是ruby执行脚本。

You can also do something like this to avoid manually setting breakpoints:

您也可以执行以下操作以避免手动设置断点:


class Foo
  require 'ruby-debug'
  def some_method_somewhere
    debugger # acts like a breakpoint is set at this point
  end
end

Here's a tutorial on ruby-debug: http://www.datanoise.com/articles/2006/7/12/tutorial-on-ruby-debug

这是关于ruby-debug的教程:http://www.datanoise.com/articles/2006/7/12/tutorial-on-ruby-debug

#5


0  

I was a bit confused about the Apple-/ (or Alt-/) bit mentioned here. What I ended up doing was running ./shoes with no arguments, which popped up the console, then started my app with ./shoes my_app.rb.

我对这里提到的Apple- /(或Alt- /)位有点困惑。我最终做的是运行没有参数的./shoes,它弹出控制台,然后用./shoes my_app.rb启动我的应用程序。