我正在Mac OS X上使用Aptana Studio3。我试图以调试模式运行服务器,以便可以设置断点并逐步执行代码。我创建了以下调试配置
带有“服务器”参数...
但是,当我以调试模式启动服务器时(通过右键单击我的项目,选择Debug As-> Debug Configurations,然后在选择上述配置后在出现的对话框中单击“ Debug”按钮),该服务器启动,但是当我调用代码(使用curl命令)来调用该方法时,curl方法挂起,似乎在断点处...
在Aptana Studio控制台中,我看到“输入的创建”输出,但没有看到“完成的建筑”行。但是Aptana IDE并没有像我期望的那样突出显示我设置断点的那一行。以下是Aptana控制台。为了在调试模式下可以与IDE正确交互,我还需要做什么?
Fast Debugger (ruby-debug-ide 0.7.0, debase 0.2.4.1, file filtering is supported) listens on 127.0.0.1:50900
=> Booting Puma
=> Rails 5.2.2.1 application starting in development
=> Run `rails server -h` for more startup options
[79989] Puma starting in cluster mode...
[79989] * Version 3.11.4 (ruby 2.5.1-p57), codename: Love Song
[79989] * Min threads: 5, max threads: 5
[79989] * Environment: development
[79989] * Process workers: 2
[79989] * Phased restart available
[79989] * Listening on tcp://0.0.0.0:3000
[79989] Use Ctrl-C to stop
[79989] - Worker 0 (pid: 80014) booted, phase: 0
[79989] - Worker 1 (pid: 80015) booted, phase: 0
Started POST "/users" for 127.0.0.1 at 2019-10-13 13:44:17 -0500
[1m[35m (5.5ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
Processing by UserController#create as JSON
Parameters: {"first_name"=>"Dave", "last_name"=>"Smith", "email"=>"[email protected]"}
entered create
您所采用的方法是正确的,据我所知,设置调试配置的步骤也是正确的。
要解决的方法1:
使用rails s --debugger
并检查其是否正常工作。
要解决的方法2:
通过更新为ruby-debug-base19 (0.11.25) ruby-debug-ide19 (0.4.12) ruby-debug19 (0.11.6)
尝试一次,然后验证一次。
要解决的方法3:远程调试::: >>
由于netbeans和Aptana共享相同的调试核心,我们也可以进行远程调试,这里提到的线程可以提供帮助。 Remote debugging Rails application in Aptana Studio 3我们可以按照以下步骤操作,以确保可以进行远程调试。
基本上,使用rdebug-ide -p 7000
(或所需的任何端口)运行ruby应用程序,然后在IDE中转到Run > Debug configurations
。在左侧,选择"Remote Ruby Debug Session"
,然后在此处添加新配置(列表上方的加号图标)。输入您在命令行上输入的正确的主机IP /名称和端口。
如果有rake文件和要执行的任务,我们该如何调试?
如果我们使用rake文件和要执行的任务,则可以在这里的线程中获得引用How to debug ruby tests in Eclipse/Aptana Studio?1.运行>调试为>调试配置。然后在Ruby应用程序下添加一个条目。将其指向您的rake脚本路径(say /usr/local/bin/rake)
作为要启动的文件。2.应该对Arguments进行编辑,以将应用程序的Rakefile作为第一个参数传递,并将rake任务作为第二个参数传递。 (即/my/path/to/project/Rakefile build
)。注意:有时可能是某个特定的宝石引起了问题,如果我们移除宝石然后将其捆扎起来并尝试解决,则如果没有解决问题,请尝试执行此操作。