如何在 RadRails 中调试纯 ruby 程序
我是 Ruby 新手,所以安装了 RadRails、Ruby 1.92 和 ruby-debug-ide19。我有一个非常简单的 ruby 程序来打印 hello world。但是,当我尝试在代码中放置断点并在调试模式下运行时,我在控制台上得到的只是以下行:
Fast Debugger (ruby-debug-ide 0.4.9) listens on :51224
为什么它仍然需要侦听端口?我怎样才能让它运行我的程序直到断点?
I am new to Ruby so have installed RadRails, Ruby 1.92 and ruby-debug-ide19. I have a very simple ruby program that prints hello world. But when I try and place a breakpoint in the code and run in debug mode all i get is the following line on the console:
Fast Debugger (ruby-debug-ide 0.4.9) listens on :51224
Why does it need to listen on a port anyway? And how can i get it to run my program until the breakpoint?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
就我个人而言,我并不费心使用 IDE 进行调试。我更喜欢接近金属...呃...命令行,所以我从命令行使用 ruby-debug19。
对于基础知识,请使用:
b
设置断点n
跳过方法s
进入方法c
命中断点后继续运行cn
运行到特定行然后停止p
显示值h
将显示内置帮助更多文档位于 Ruby-Debug 站点。
Personally, I don't bother with an IDE for debugging. I prefer to be closer to the metal... err... command-line, so I use ruby-debug19 from the command-line.
For the basics use:
b
to set your breakpointsn
to step over methodss
to step into methodsc
to continue running after hitting a breakpointc n
to run to a particular line then stopp
to display a valueh
will display the built-in helpirb
drops into IRB with the current variables pre-initialized so you can poke at things with a stick and see what they'll do.More docs are at the Ruby-Debug site.
它使用端口在 IDE 和 ruby-debug 进程之间进行通信,ruby-debug-ide 正在打开一个端口并等待 IDE 连接到它,但这必须立即发生。
根据您的陈述,调试应该已经开始工作:您可以右键单击并选择“切换断点”,或者双击编辑器的左侧装订线。当您的程序遇到任何启用的断点行时,程序应该挂起,您可以检查变量、堆栈帧、执行任意代码、单步执行代码、继续等。
It uses the port to communicate between the IDE and the ruby-debug process, ruby-debug-ide is opening a port and waiting for the IDE to connect to it, but that happens pretty must instantly.
From what you've stated, debugging should already be working: You can right-click and select Toggle breakpoint, or double-click on the left-hand gutter of the editor. When your program hits any enabled breakpoint line the program should suspend and you can inspect variables, the stackframes, execute arbitrary code, step into or through your code, continue, etc.