ruby-debug-ide 0.4.11 → 0.4.16

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -3,23 +3,24 @@ require 'rubygems'
3
3
  require 'rake/gempackagetask'
4
4
  require 'rake/rdoctask'
5
5
  require 'rake/testtask'
6
+ require 'lib/ruby-debug/version'
6
7
  require 'date'
7
8
 
8
9
  desc 'Default: run unit tests.'
9
10
  task :default => [:test]
10
11
 
11
12
  # ------- Default Package ----------
12
- RUBY_DEBUG_IDE_VERSION = "0.4.11"
13
+ RUBY_DEBUG_IDE_VERSION = Debugger::IDE_VERSION
13
14
 
14
15
  FILES = FileList[
15
- 'CHANGES',
16
- 'ChangeLog',
17
- 'ChangeLog.archive',
16
+ # 'CHANGES',
17
+ # 'ChangeLog',
18
+ # 'ChangeLog.archive',
18
19
  'MIT-LICENSE',
19
20
  'Rakefile',
20
21
  'bin/*',
21
22
  'lib/**/*',
22
- 'test/**/*',
23
+ # 'test/**/*',
23
24
  'ext/mkrf_conf.rb'
24
25
  ]
25
26
 
@@ -29,18 +30,19 @@ ide_spec = Gem::Specification.new do |spec|
29
30
  spec.homepage = "http://rubyforge.org/projects/debug-commons/"
30
31
  spec.summary = "IDE interface for ruby-debug."
31
32
  spec.description = <<-EOF
32
- An interface which glues ruby-debug to IDEs like Eclipse (RDT) and NetBeans.
33
+ An interface which glues ruby-debug to IDEs like Eclipse (RDT), NetBeans and RubyMine.
33
34
  EOF
34
35
 
35
36
  spec.version = RUBY_DEBUG_IDE_VERSION
36
37
 
37
- spec.author = "Markus Barchfeld, Martin Krauskopf"
38
- spec.email = "rubyeclipse-dev-list@sourceforge.net"
38
+ spec.author = "Markus Barchfeld, Martin Krauskopf, Mark Moseley, JetBrains RubyMine Team"
39
+ spec.email = "rubymine-feedback@jetbrains.com"
39
40
  spec.platform = Gem::Platform::RUBY
40
41
  spec.require_path = "lib"
41
42
  spec.bindir = "bin"
42
43
  spec.executables = ["rdebug-ide"]
43
44
  spec.files = FILES.to_a
45
+
44
46
  spec.extensions << "ext/mkrf_conf.rb"
45
47
  spec.add_dependency("rake", ">= 0.8.1")
46
48
 
data/ext/mkrf_conf.rb CHANGED
@@ -12,9 +12,9 @@ unless jruby
12
12
  inst = Gem::DependencyInstaller.new
13
13
  begin
14
14
  if RUBY_VERSION < "1.9"
15
- inst.install "ruby-debug-base", "~> 0.10.3"
15
+ inst.install "ruby-debug-base", '>=0.10.4'
16
16
  else
17
- inst.install "ruby-debug-base19", "~> 0.11.15"
17
+ inst.install "ruby-debug-base19", '>=0.11.24'
18
18
  end
19
19
  rescue
20
20
  exit(1)
@@ -4,10 +4,12 @@ require "socket"
4
4
  require 'thread'
5
5
  require 'ruby-debug-base'
6
6
  if RUBY_VERSION < "1.9"
7
+ require 'ruby-debug/version'
7
8
  require 'ruby-debug/xml_printer'
8
9
  require 'ruby-debug/processor'
9
10
  require 'ruby-debug/event_processor'
10
11
  else
12
+ require_relative 'ruby-debug/version'
11
13
  require_relative 'ruby-debug/xml_printer'
12
14
  require_relative 'ruby-debug/processor'
13
15
  require_relative 'ruby-debug/event_processor'
@@ -24,6 +26,7 @@ module Debugger
24
26
  $stderr.flush
25
27
  end
26
28
  end
29
+
27
30
  end
28
31
 
29
32
  class Context
@@ -125,10 +128,10 @@ module Debugger
125
128
  return if @control_thread
126
129
  @control_thread = DebugThread.new do
127
130
  begin
128
- $stderr.printf "Fast Debugger (ruby-debug-ide 0.4.10) listens on #{host}:#{port}\n"
129
131
  # 127.0.0.1 seemingly works with all systems and with IPv6 as well.
130
- # "localhost" and nil on have problems on some systems.
132
+ # "localhost" and nil have problems on some systems.
131
133
  host ||= '127.0.0.1'
134
+ $stderr.printf "Fast Debugger (ruby-debug-ide #{IDE_VERSION}, ruby-debug-base #{VERSION}) listens on #{host}:#{port}\n"
132
135
  server = TCPServer.new(host, port)
133
136
  while (session = server.accept)
134
137
  begin
@@ -136,12 +139,14 @@ module Debugger
136
139
  @event_processor = EventProcessor.new(interface)
137
140
  ControlCommandProcessor.new(interface).process_commands
138
141
  rescue StandardError, ScriptError => ex
139
- $stderr.printf "Exception in DebugThread loop: #{ex}\n"
142
+ bt = ex.backtrace
143
+ $stderr.printf "Exception in DebugThread loop: #{ex.message}\nBacktrace:\n#{bt ? bt.join("\n from: ") : "<none>"}\n"
140
144
  exit 1
141
145
  end
142
146
  end
143
147
  rescue
144
- $stderr.printf "Exception in DebugThread: #$!\n"
148
+ bt = $!.backtrace
149
+ $stderr.printf "Fatal exception in DebugThread loop: #{$!.message}\nBacktrace:\n#{bt ? bt.join("\n from: ") : "<none>"}\n"
145
150
  exit 2
146
151
  end
147
152
  end
@@ -102,8 +102,8 @@ module Debugger
102
102
  # in ruby-debug.c
103
103
  def timeout(sec)
104
104
  return yield if sec == nil or sec.zero?
105
- if RUBY_VERSION < "1.9"
106
- raise ThreadError, "timeout within critical session" if Thread.critical
105
+ if Thread.respond_to?(:critical) and Thread.critical
106
+ raise ThreadError, "timeout within critical session"
107
107
  end
108
108
  begin
109
109
  x = Thread.current
@@ -122,7 +122,7 @@ module Debugger
122
122
  str = str.to_s
123
123
  max_time = 10
124
124
  to_inspect = str.gsub(/\\n/, "\n")
125
- @printer.print_debug("Evaluating with timeout after %i sec", max_time)
125
+ @printer.print_debug("Evaluating #{str} with timeout after %i sec", max_time)
126
126
  timeout(max_time) do
127
127
  eval(to_inspect, b)
128
128
  end
@@ -15,7 +15,8 @@ module Debugger
15
15
  end
16
16
  #
17
17
  def execute
18
- obj = debug_eval(@match.post_match)
18
+ binding = @state.context ? get_binding : TOPLEVEL_BINDING
19
+ obj = debug_eval(@match.post_match, binding)
19
20
  InspectCommand.reference_result(obj)
20
21
  @printer.print_inspect(obj)
21
22
  end
@@ -0,0 +1,73 @@
1
+ module Debugger
2
+
3
+ # Implements debugger "jump" command
4
+ class JumpCommand < Command
5
+ self.need_context = true
6
+
7
+ def numeric?(object)
8
+ true if Float(object) rescue false
9
+ end
10
+
11
+ def regexp
12
+ / ^\s*
13
+ j(?:ump)? \s*
14
+ (?:\s+(\S+))?\s*
15
+ (?:\s+(\S+))?\s*
16
+ $
17
+ /ix
18
+ end
19
+
20
+ def execute
21
+ unless @state.context.respond_to?(:jump)
22
+ print_msg "Not implemented"
23
+ return
24
+ end
25
+ if !@match[1]
26
+ print_msg "\"jump\" must be followed by a line number"
27
+ return
28
+ end
29
+ if !numeric?(@match[1])
30
+ print_msg "Bad line number: " + @match[1]
31
+ return
32
+ end
33
+ line = @match[1].to_i
34
+ line = @state.context.frame_line(0) + line if @match[1][0] == '+' or @match[1][0] == '-'
35
+ if line == @state.context.frame_line(0)
36
+ return
37
+ end
38
+ file = @match[2]
39
+ file = @state.context.frame_file(file.to_i) if numeric?(file)
40
+ file = @state.context.frame_file(0) if !file
41
+ case @state.context.jump(line, file)
42
+ when 0
43
+ @state.proceed
44
+ return
45
+ when 1
46
+ print_msg "Not possible to jump from here"
47
+ when 2
48
+ print_msg "Couldn't find debugged frame"
49
+ when 3
50
+ print_msg "Couldn't find active code at " + file + ":" + line.to_s
51
+ else
52
+ print_msg "Unknown error occurred"
53
+ end
54
+ @printer.print_at_line(@state.context, @state.context.frame_file, @state.context.frame_line)
55
+ end
56
+
57
+ class << self
58
+ def help_command
59
+ %w[jump]
60
+ end
61
+
62
+ def help(cmd)
63
+ %{
64
+ j[ump] line\tjump to line number (absolute)
65
+ j[ump] -line\tjump back to line (relative)
66
+ j[ump] +line\tjump ahead to line (relative)
67
+
68
+ Change the next line of code to be executed.
69
+ }
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,32 @@
1
+ module Debugger
2
+
3
+ # Implements debugger "pause" command
4
+ class PauseCommand < Command
5
+ self.control = true
6
+
7
+ def regexp
8
+ /^\s*pause\s*(?:\s+(\S+))?\s*$/
9
+ end
10
+
11
+ def execute
12
+ c = get_context(@match[1].to_i)
13
+ unless c.respond_to?(:pause)
14
+ print_msg "Not implemented"
15
+ return
16
+ end
17
+ c.pause
18
+ end
19
+
20
+ class << self
21
+ def help_command
22
+ %w[pause]
23
+ end
24
+
25
+ def help(cmd)
26
+ %{
27
+ pause <nnn>\tpause a running thread
28
+ }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,47 @@
1
+ module Debugger
2
+
3
+ # Implements debugger "set_type" command
4
+ class SetTypeCommand < Command
5
+ self.need_context = true
6
+
7
+ def regexp
8
+ / ^\s*
9
+ set_type? \s*
10
+ (?:\s+(\S+))?\s*
11
+ (?:\s+(\S+))?\s*
12
+ $
13
+ /ix
14
+ end
15
+
16
+ def execute
17
+ if RUBY_VERSION < "1.9"
18
+ print_msg "Not implemented"
19
+ return
20
+ end
21
+ begin
22
+ expr = @match[1] + " = " + @match[2] + "(" + @match[1] + ".inspect)"
23
+ eval(expr)
24
+ rescue
25
+ begin
26
+ expr = @match[1] + " = " + @match[2] + ".new(" + @match[1] + ".inspect)"
27
+ eval(expr)
28
+ rescue nil
29
+ end
30
+ end
31
+ end
32
+
33
+ class << self
34
+ def help_command
35
+ %w[set_type]
36
+ end
37
+
38
+ def help(cmd)
39
+ %{
40
+ set_type <var> <type>
41
+
42
+ Change the type of <var> to <type>
43
+ }
44
+ end
45
+ end
46
+ end
47
+ end
@@ -34,9 +34,13 @@ module Debugger
34
34
  end
35
35
 
36
36
  def execute
37
- # Avoid accessing deprecated global $= and its alias $IGNORECASE,
38
- # as doing so triggers a spurious warning on JRuby.
39
- print_variables(global_variables - ['$=', '$IGNORECASE'], 'global') do |var|
37
+ globals = []
38
+ if RUBY_VERSION < "1.9"
39
+ globals = global_variables - ['$=', '$IGNORECASE']
40
+ else
41
+ globals = global_variables - [:$KCODE, :$-K, :$=, :$FILENAME]
42
+ end
43
+ print_variables(globals, 'global') do |var|
40
44
  debug_eval(var)
41
45
  end
42
46
  end
@@ -32,12 +32,12 @@ end
32
32
  end
33
33
 
34
34
  def at_line(context, file, line)
35
- @printer.print_at_line(file, line) if context.nil? || context.stop_reason == :step
35
+ @printer.print_at_line(context, file, line) if context.nil? || context.stop_reason == :step
36
36
  line_event(context, file, line)
37
37
  end
38
38
 
39
39
  def at_return(context, file, line)
40
- @printer.print_at_line(file, line)
40
+ @printer.print_at_line(context, file, line)
41
41
  context.stop_frame = -1
42
42
  line_event(context, file, line)
43
43
  end
@@ -0,0 +1,3 @@
1
+ module Debugger
2
+ IDE_VERSION='0.4.16'
3
+ end
@@ -100,7 +100,7 @@ module Debugger
100
100
 
101
101
  def print_variable(name, value, kind)
102
102
  name = name.to_s
103
- unless value != nil
103
+ if value.nil?
104
104
  print("<variable name=\"%s\" kind=\"%s\"/>", CGI.escapeHTML(name), kind)
105
105
  return
106
106
  end
@@ -223,9 +223,9 @@ module Debugger
223
223
  # print "<trace file=\"%s\" line=\"%s\" threadId=\"%d\" />", file, line, context.thnum
224
224
  end
225
225
 
226
- def print_at_line(file, line)
226
+ def print_at_line(context, file, line)
227
227
  print "<suspended file=\'%s\' line=\'%s\' threadId=\'%d\' frames=\'%d\'/>",
228
- File.expand_path(file), line, Debugger.current_context.thnum, Debugger.current_context.stack_size
228
+ File.expand_path(file), line, context.thnum, context.stack_size
229
229
  end
230
230
 
231
231
  def print_exception(exception, binding)
metadata CHANGED
@@ -1,21 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-debug-ide
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 47
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 11
10
- version: 0.4.11
9
+ - 16
10
+ version: 0.4.16
11
11
  platform: ruby
12
12
  authors:
13
- - Markus Barchfeld, Martin Krauskopf
13
+ - Markus Barchfeld, Martin Krauskopf, Mark Moseley, JetBrains RubyMine Team
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-03 00:00:00 +03:00
18
+ date: 2010-11-29 00:00:00 +03:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -35,9 +35,9 @@ dependencies:
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
37
  description: |
38
- An interface which glues ruby-debug to IDEs like Eclipse (RDT) and NetBeans.
38
+ An interface which glues ruby-debug to IDEs like Eclipse (RDT), NetBeans and RubyMine.
39
39
 
40
- email: rubyeclipse-dev-list@sourceforge.net
40
+ email: rubymine-feedback@jetbrains.com
41
41
  executables:
42
42
  - rdebug-ide
43
43
  extensions:
@@ -45,9 +45,6 @@ extensions:
45
45
  extra_rdoc_files: []
46
46
 
47
47
  files:
48
- - CHANGES
49
- - ChangeLog
50
- - ChangeLog.archive
51
48
  - MIT-LICENSE
52
49
  - Rakefile
53
50
  - bin/rdebug-ide
@@ -60,7 +57,10 @@ files:
60
57
  - lib/ruby-debug/commands/eval.rb
61
58
  - lib/ruby-debug/commands/frame.rb
62
59
  - lib/ruby-debug/commands/inspect.rb
60
+ - lib/ruby-debug/commands/jump.rb
63
61
  - lib/ruby-debug/commands/load.rb
62
+ - lib/ruby-debug/commands/pause.rb
63
+ - lib/ruby-debug/commands/set_type.rb
64
64
  - lib/ruby-debug/commands/stepping.rb
65
65
  - lib/ruby-debug/commands/threads.rb
66
66
  - lib/ruby-debug/commands/variables.rb
@@ -69,18 +69,9 @@ files:
69
69
  - lib/ruby-debug/interface.rb
70
70
  - lib/ruby-debug/printers.rb
71
71
  - lib/ruby-debug/processor.rb
72
+ - lib/ruby-debug/version.rb
72
73
  - lib/ruby-debug/xml_printer.rb
73
74
  - lib/ruby-debug-ide.rb
74
- - test/rd_basic_test.rb
75
- - test/rd_catchpoint_test.rb
76
- - test/rd_condition_test.rb
77
- - test/rd_enable_disable_test.rb
78
- - test/rd_inspect_test.rb
79
- - test/rd_stepping_breakpoints_test.rb
80
- - test/rd_test_base.rb
81
- - test/rd_threads_and_frames_test.rb
82
- - test/rd_variables_test.rb
83
- - test/ruby-debug/xml_printer_test.rb
84
75
  - ext/mkrf_conf.rb
85
76
  has_rdoc: true
86
77
  homepage: http://rubyforge.org/projects/debug-commons/
data/CHANGES DELETED
@@ -1,75 +0,0 @@
1
- This document is not maintained since version 0.1.10. See ``Changes'' section
2
- in the ``ruby-debug-ide protocol'' document:
3
-
4
- http://debug-commons.rubyforge.org/protocol-spec.html
5
-
6
- and ChangeLog for details. protocol-spec.html is generated from
7
- doc/protocol-spec.texi file.
8
-
9
- ========================================================================
10
-
11
- 0.1.9 - 0.1.10
12
- --------------
13
-
14
- * fixed bug when inspected variable's to_s methods returns non-String.
15
- Returns diagonstic message now.
16
- * do not use '==' from within debugger to prevent runtime error
17
- * Workarounding JRuby issue (http://jira.codehaus.org/browse/JRUBY-2063)
18
- * switching to ruby-debug-base 0.1.10 (all tests pass)
19
-
20
- 0.1.8 - 0.1.9
21
- -------------
22
-
23
- * be sure 'exit' is always called.
24
- * to_inspect = str.gsub(/\\n/, "\n") in debug_eval() to make possible to
25
- evaluate multiline expressions. Frontend must escape new lines
26
- accordingly.
27
- * prevent exception when to_s returns nil on being evaluated value
28
-
29
- 0.1.7 - 0.1.8
30
- -------------
31
-
32
- * fixed error during breakpoint removing
33
- * (protocols merge) print debug message on $stderr like classic debugger
34
-
35
- 0.1.6 - 0.1.7
36
- -------------
37
-
38
- * ensure 'yaml' (is_binary_data?) is always loaded in xml_printer.rb
39
- * VarInstanceCommand enumerates also variables of an object's class, as it
40
- is done in the classic-debugger
41
- * do not send unneeded end-of-lines (fast and classic protocol merging)
42
- * do not send non-xml PROMPT and CONFIRM + getting rid of 'confirm' methods
43
- in the whole codebase (fast and classic protocol merging)
44
- * send info <message> when 'delete' is used without given 'pos' (deleting of
45
- all breakpoints is not supported)
46
- * return <error> on 'delete <negative_int>' (protocol unification)
47
- * always use one-based frame numbering (was not the case in <frame[s]>)
48
- * send message 'finished' back when exiting
49
-
50
- 0.1.5 - 0.1.6
51
- -------------
52
-
53
- * do not send binary data within values of variables. See
54
- http://www.netbeans.org/nonav/issues/show_bug.cgi?id=101748 for more
55
- details
56
-
57
- 0.1.4 - 0.1.5
58
- -------------
59
-
60
- * fixed subtle bug in xml_printer.rb#print_variable which caused the
61
- debugger to die when == method was overridden and did not count on nil
62
- parameters
63
- * Hash and Array subclasses did not have children thus cannot be expanded in
64
- a GUI. E.g. @params in Rails controller (HashWithIndifferentAccess)
65
-
66
- 0.1.3 - 0.1.4
67
- -------------
68
-
69
- * migration to ruby-debug 0.1.4
70
-
71
- 0.1.2 - 0.1.3
72
- -------------
73
-
74
- * adding step+ and next+ commands (since ruby-debug 0.9.1)
75
-