From 1a93fbc01449ccc34e5f7738a2d2a10a99e3fb8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Rodrigues?= Date: Tue, 19 Feb 2019 14:55:19 -0300 Subject: [PATCH 01/18] Removed deprecation warning message --- ruby-debug-ide.gemspec | 3 --- 1 file changed, 3 deletions(-) diff --git a/ruby-debug-ide.gemspec b/ruby-debug-ide.gemspec index 7cd29ef4..47af820d 100644 --- a/ruby-debug-ide.gemspec +++ b/ruby-debug-ide.gemspec @@ -45,7 +45,4 @@ EOF spec.required_ruby_version = '>= 1.8.2' spec.date = DateTime.now spec.rubyforge_project = 'debug-commons' - - # rdoc - spec.has_rdoc = false end From 8c29caa57cd03f484c8d92b221dc6f398099d19b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Rodrigues?= Date: Tue, 19 Feb 2019 14:56:40 -0300 Subject: [PATCH 02/18] Added option to skip waitting for start --- bin/rdebug-ide | 2 ++ lib/ruby-debug-ide.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/rdebug-ide b/bin/rdebug-ide index 30543534..618e291d 100755 --- a/bin/rdebug-ide +++ b/bin/rdebug-ide @@ -17,6 +17,7 @@ options = OpenStruct.new( 'port' => 1234, 'stop' => false, 'tracing' => false, + 'skip_wait_for_start' => false, 'int_handler' => true, 'dispatcher_port' => -1, 'evaluation_timeout' => 10, @@ -67,6 +68,7 @@ EOB opts.on('--stop', 'stop when the script is loaded') {options.stop = true} opts.on("-x", "--trace", "turn on line tracing") {options.tracing = true} + opts.on("--skip_wait_for_start", "skip wait for 'start' command") {options.skip_wait_for_start = true} opts.on("-l", "--load-mode", "load mode (experimental)") {options.load_mode = true} opts.on("-d", "--debug", "Debug self - prints information for debugging ruby-debug itself") do Debugger.cli_debug = true diff --git a/lib/ruby-debug-ide.rb b/lib/ruby-debug-ide.rb index 10f70f43..97644dfc 100644 --- a/lib/ruby-debug-ide.rb +++ b/lib/ruby-debug-ide.rb @@ -90,7 +90,7 @@ def prepare_debugger(options) # wait for 'start' command @mutex.synchronize do @proceed.wait(@mutex) - end + end unless options.skip_wait_for_start end def debug_program(options) From 28c3385707c7d60993ffd61c33fef3f202fdfe94 Mon Sep 17 00:00:00 2001 From: Viuginov Nickolay Date: Fri, 23 Mar 2018 01:09:51 +0300 Subject: [PATCH 03/18] check if debase installed (already_installed doesn't work) --- ext/mkrf_conf.rb | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/ext/mkrf_conf.rb b/ext/mkrf_conf.rb index c8170ac3..ece549f4 100644 --- a/ext/mkrf_conf.rb +++ b/ext/mkrf_conf.rb @@ -1,11 +1,6 @@ jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE) rbx = defined?(RUBY_ENGINE) && 'rbx' == RUBY_ENGINE -def already_installed(dep) - !Gem::DependencyInstaller.new(:domain => :local).find_gems_with_sources(dep).empty? || - !Gem::DependencyInstaller.new(:domain => :local,:prerelease => true).find_gems_with_sources(dep).empty? -end - unless jruby || rbx require 'rubygems' require 'rubygems/command.rb' @@ -14,14 +9,14 @@ def already_installed(dep) begin Gem::Command.build_args = ARGV - rescue NoMethodError + rescue NoMethodError end if RUBY_VERSION < "1.9" dep = Gem::Dependency.new("ruby-debug-base", '>=0.10.4') elsif RUBY_VERSION < '2.0' dep = Gem::Dependency.new("ruby-debug-base19x", '>=0.11.30.pre15') - else + else dep = Gem::Dependency.new("debase", '> 0') end @@ -38,7 +33,7 @@ def already_installed(dep) puts e.backtrace.join "\n " exit(1) end - end unless dep.nil? || already_installed(dep) + end unless dep.nil? || dep.matching_specs.any? end # create dummy rakefile to indicate success From 37d0a64ffbe92245b142c4e06a09ca6de79d1cae Mon Sep 17 00:00:00 2001 From: Viuginov Nickolay Date: Tue, 2 Jul 2019 15:59:45 +0300 Subject: [PATCH 04/18] [RUBY-23972] Improve ruby-debug-ide documentation --- README.md | 33 +++- protocol-spec.md | 406 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 435 insertions(+), 4 deletions(-) create mode 100644 protocol-spec.md diff --git a/README.md b/README.md index d0522d6e..0125c3b1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,32 @@ -[gem]: https://rubygems.org/gems/ruby-debug-ide -# ruby-debug-ide -An interface which glues ruby-debug to IDEs like Eclipse (RDT), NetBeans and RubyMine. - [![official JetBrains project](http://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub) [![Gem Version](https://badge.fury.io/rb/ruby-debug-ide.svg)][gem] [![Build Status](https://travis-ci.org/ruby-debug/ruby-debug-ide.svg?branch=master)](https://travis-ci.org/ruby-debug/ruby-debug-ide) + +[gem]: https://rubygems.org/gems/ruby-debug-ide +# ruby-debug-ide + +The 'ruby-debug-ide' gem provides the protocol to establish communication between the debugger engine (such as [debase](https://rubygems.org/gems/debase) or [ruby-debug-base](https://rubygems.org/gems/ruby-debug-base)) and IDEs (for example, RubyMine, Visual Studio Code, or Eclipse). 'ruby-debug-ide' redirect commands from the IDE to the debugger engine. Then, it returns answers/events received from the debugger engine to the IDE. To learn more about a communication protocol, see the following document: [ruby-debug-ide protocol](protocol-spec.md). + +## Install debugging gems +Depending on the used Ruby version, you need to add/install the following debugging gems to the Gemfile: +- Ruby 2.x - [ruby-debug-ide](https://rubygems.org/gems/ruby-debug-ide) and [debase](https://rubygems.org/gems/debase) +- Ruby 1.9.x - [ruby-debug-ide](https://rubygems.org/gems/ruby-debug-ide) and [ruby-debug-base19x](https://rubygems.org/gems/ruby-debug-base19x) +- jRuby or Ruby 1.8.x - [ruby-debug-ide](https://rubygems.org/gems/ruby-debug-ide) and [ruby-debug-base](https://rubygems.org/gems/ruby-debug-base) +> For Windows, make sure that the Ruby [DevKit](https://github.com/oneclick/rubyinstaller/wiki/Development-Kit) is installed. + +## Start debugging session +To start the debugging session for a Rails application, run the following command: +```shell +rdebug-ide --host 0.0.0.0 --port 1234 --dispatcher-port 1234 -- bin/rails s +``` +If you want to debug a Rails application run using Docker Compose, you need to start the Rails server from the Docker in the following way: +```yaml +command: bundle exec rdebug-ide --host 0.0.0.0 --port 1234 -- bin/rails s -p 3000 -b 0.0.0.0 +volumes: + - .:/sample_rails_app +ports: + - "1234:1234" + - "3000:3000" + - "26162:26162" +``` +Note that all ports above should be exposed in the Dockerfile. \ No newline at end of file diff --git a/protocol-spec.md b/protocol-spec.md new file mode 100644 index 00000000..b6f42c0a --- /dev/null +++ b/protocol-spec.md @@ -0,0 +1,406 @@ +ruby-debug-ide protocol +======================= + +* * * + +Next: [Summary](#Summary), Previous: [(dir)](#dir), Up: [(dir)](#dir) + +_ruby-debug-ide_ protocol +------------------------- + +This file contains specification of the protocol used by _ruby-debug-ide_. + +* [Summary](#Summary) +* [Specification](#Specification) +* [Changes](#Changes) + +* * * + +Next: [Specification](#Specification), Previous: [Top](#Top), Up: [Top](#Top) + +1 Summary +--------- + +This document describes protocol used by _ruby-debug-ide_ for communication between debugger engine and a frontend. It is a work in progress and might, and very likely will, change in the future. If you have any comments or questions please [send me](mailto:martin.krauskopf@gmail.com) an email. + +The communication has two parts/sides. First ones are _commands_ sent from a frontend to the debugger engine and the second is the opposite way, _answers_ and _events_ sent from the debugger engine to the frontend. + +_commands_ are almost the same as the ones used by CLI ruby-debug. So you might want to contact [the _ruby-debug-ide_ document](http://bashdb.sourceforge.net/ruby-debug.html). + +_answers_ and _events_ are sent in XML format described in the specification [below](#Specification). + +**Specification is far from complete.** Will be completed as time permits. In the meantime, source code is always the best spec. + +* * * + +Next: [Changes](#Changes), Previous: [Summary](#Summary), Up: [Top](#Top) + +2 Specification +--------------- + +* [Commands](#Commands) +* [Events](#Events) + +Terms: + +* _Command_ is what frontend sends to the debugger engine +* _Answer_ is what debugger engine sends back to the frontend +* _Example_ shows simple example + +* * * + +Next: [Events](#Events), Up: [Specification](#Specification) + +### 2.1 Commands + +* [Adding Breakpoint](#Adding-Breakpoint) +* [Deleting Breakpoint](#Deleting-Breakpoint) +* [Enabling Breakpoint](#Enabling-Breakpoint) +* [Disabling Breakpoint](#Disabling-Breakpoint) +* [Condition](#Condition) +* [Catchpoint](#Catchpoint) +* [Threads](#Threads) +* [Frames](#Frames) +* [Variables](#Variables) + +* * * + +Next: [Deleting Breakpoint](#Deleting-Breakpoint), Up: [Commands](#Commands) + +#### 2.1.1 Adding Breakpoint + +Command: + + break