debugging - 如何配置 Aptana 3 以在 Debug模式下运行我的 Rails 服务器,以便它在断点处停止?

标签 debugging configuration ruby-on-rails-5 aptana aptana3

我在 Mac OS X 上使用 Aptana Studio 3。我试图在 Debug模式下运行我的服务器,以便我可以设置断点并逐步执行我的代码。我创建了以下调试配置

onfigure

使用“服务器”参数......

enter image description here

但是,当我在 Debug模式下启动我的服务器时(通过右键单击我的项目,选择调试为 -> 调试配置并在我选择上述配置后单击结果对话框上的“调试”按钮),服务器启动,但是当我调用代码(使用 curl 命令)来调用该方法时,curl 方法挂起,似乎在断点处......

enter image description here

在 Aptana Studio 控制台中,我看到“entered create”输出,但没有看到“done building”行。但是 Aptana IDE 并没有像我期望的那样突出显示我设置断点的行。下面是 Aptana 控制台。我还需要做什么才能在 Debug模式下与 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"=>"test@example.com"}
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. 应编辑参数以将应用程序的 Rakefile 作为第一个参数传递,并将 rake 任务作为第二个参数传递。 (即 /my/path/to/project/Rakefile build )。

笔记 :
有时可能是某个特定的 gem 导致了问题,如果我们删除一个 gem 然后将其捆绑并尝试它可能会成功,如果没有任何效果,请尝试此操作。

关于debugging - 如何配置 Aptana 3 以在 Debug模式下运行我的 Rails 服务器,以便它在断点处停止?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58366746/

相关文章:

c# - System.Diagnostics.Debug.Write 输出出现在哪里?

c# - Debugger.Break 有副作用吗?

reactjs - 如何直接从 VSCode 运行和调试 React 应用程序?

java - Web 应用程序密码安全

ruby-on-rails - 重新组织 Rails 5 中的前端文件

javascript - 如何获取promise的 "initiator"调试信息?

c - 我的代码块无法编译

java - 在 Tomcat 应用程序中配置 logback

ruby-on-rails - ActionCable - 无法在生产环境中升级到 WebSocket

ruby-on-rails - 抛出异常时,before_remove 中止删除会使服务器崩溃