ruby-debug 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,8 @@
1
+ 0.5.2
2
+ - Fixes interoperability problems with rspec.
3
+ - Made 'exit' as an alias to 'quit'
4
+ - Added 'restart' command. Patch from R. Bernstein.
5
+
1
6
  0.5.1
2
7
  - Bugfixes.
3
8
 
data/bin/rdebug CHANGED
@@ -54,6 +54,12 @@ EOB
54
54
  end
55
55
 
56
56
  begin
57
+ Debugger::ARGV = ARGV.clone
58
+ rdebug_path = File.expand_path($0)
59
+ if RUBY_PLATFORM =~ /mswin/
60
+ rdebug_path += ".cmd" unless rdebug_path =~ /\.cmd$/i
61
+ end
62
+ Debugger::RDEBUG_SCRIPT = rdebug_path
57
63
  opts.parse! ARGV
58
64
  rescue StandardError => e
59
65
  puts opts
@@ -72,13 +78,14 @@ else
72
78
  exit(-1)
73
79
  end
74
80
 
81
+ Debugger::PROG_SCRIPT = ARGV.shift
75
82
  trap('INT') { Debugger.interrupt_last }
76
83
  Debugger.stop_on_connect = !options.nostop
77
84
  Debugger.wait_connection = options.wait
78
85
  load "#{ENV["HOME"]}/.rdebugrc" if File.exists?("#{ENV["HOME"]}/.rdebugrc")
79
86
  if options.server
80
87
  Debugger.start_remote(options.host, [options.port, options.cport], options.post_mortem)
81
- Debugger.debug_load ARGV.shift
88
+ Debugger.debug_load Debugger::PROG_SCRIPT
82
89
  else
83
90
  Debugger.start
84
91
  if options.script
@@ -86,6 +93,6 @@ else
86
93
  end
87
94
  Debugger.post_mortem if options.post_mortem
88
95
  debugger 2
89
- Debugger.debug_load ARGV.shift
96
+ Debugger.debug_load Debugger::PROG_SCRIPT
90
97
  end
91
98
  end
data/ext/ruby_debug.c CHANGED
@@ -4,7 +4,7 @@
4
4
  #include <rubysig.h>
5
5
  #include <st.h>
6
6
 
7
- #define DEBUG_VERSION "0.5.1"
7
+ #define DEBUG_VERSION "0.5.2"
8
8
 
9
9
  #define CTX_FL_MOVED (1<<1)
10
10
  #define CTX_FL_SUSPEND (1<<2)
@@ -10,7 +10,7 @@ module Debugger
10
10
  :control => false,
11
11
  :always_run => false,
12
12
  :unknown => false,
13
- :context => false,
13
+ :need_context => false,
14
14
  }
15
15
 
16
16
  def inherited(klass)
@@ -3,7 +3,7 @@ module Debugger
3
3
  self.control = true
4
4
 
5
5
  def regexp
6
- /^\s*q(?:uit)?\s*$/
6
+ /^\s*(?:q(?:uit)?|exit)\s*$/
7
7
  end
8
8
 
9
9
  def execute
@@ -15,21 +15,65 @@ module Debugger
15
15
 
16
16
  class << self
17
17
  def help_command
18
- 'quit'
18
+ %w[quit exit]
19
19
  end
20
20
 
21
21
  def help(cmd)
22
22
  %{
23
- q[uit]\texit from debugger
23
+ q[uit]\texit from debugger,
24
+ exit\talias to quit
24
25
  }
25
26
  end
26
27
  end
27
28
  end
28
29
 
30
+ class RestartCommand < Command # :nodoc:
31
+ self.control = true
32
+
33
+ def regexp
34
+ / ^\s*
35
+ (restart|R)
36
+ (\s+ \S+ .*)?
37
+ $
38
+ /x
39
+ end
40
+
41
+ def execute
42
+ if not defined? Debugger::RDEBUG_SCRIPT or not defined? Debugger::ARGV
43
+ print "We are not in a context we can restart from.\n"
44
+ return
45
+ end
46
+ if @match[2]
47
+ args = Debugger::PROG_SCRIPT + " " + @match[2]
48
+ else
49
+ args = Debugger::ARGV.join(" ")
50
+ end
51
+
52
+ # An execv would be preferable to the "exec" below.
53
+ cmd = Debugger::RDEBUG_SCRIPT + " " + args
54
+ print "Re exec'ing:\n\t#{cmd}\n"
55
+ exec cmd
56
+ end
57
+
58
+ class << self
59
+ def help_command
60
+ 'restart'
61
+ end
62
+
63
+ def help(cmd)
64
+ %{
65
+ restart|R [args]
66
+ Restart the program. This is is a re-exec - all debugger state
67
+ is lost. If command arguments are passed those are used.
68
+ }
69
+ end
70
+ end
71
+ end
72
+
29
73
  class InterruptCommand < Command # :nodoc:
30
74
  self.event = false
31
75
  self.control = true
32
- self.context = true
76
+ self.need_context = true
33
77
 
34
78
  def regexp
35
79
  /^\s*i(?:nterrupt)?\s*$/
@@ -1,6 +1,7 @@
1
1
  module Debugger
2
2
  module FrameFunctions # :nodoc:
3
3
  def format_frame(frame, pos)
4
+ printf "\032\032" if ENV['EMACS']
4
5
  file, line, id = frame.file, frame.line, frame.id
5
6
  "#%d %s:%s%s\n" % [pos + 1, file, line, (id ? ":in `#{id.id2name}'" : "")]
6
7
  end
@@ -1,6 +1,6 @@
1
1
  module Debugger
2
2
  class NextCommand < Command # :nodoc:
3
- self.context = true
3
+ self.need_context = true
4
4
 
5
5
  def regexp
6
6
  /^\s*n(?:ext)?(?:\s+(\d+))?$/
@@ -26,7 +26,7 @@ module Debugger
26
26
  end
27
27
 
28
28
  class StepCommand < Command # :nodoc:
29
- self.context = true
29
+ self.need_context = true
30
30
 
31
31
  def regexp
32
32
  /^\s*s(?:tep)?(?:\s+(\d+))?$/
@@ -51,7 +51,7 @@ module Debugger
51
51
  end
52
52
 
53
53
  class FinishCommand < Command # :nodoc:
54
- self.context = true
54
+ self.need_context = true
55
55
 
56
56
  def regexp
57
57
  /^\s*fin(?:ish)?$/
@@ -47,7 +47,7 @@ module Debugger
47
47
 
48
48
  class ThreadSwitchCommand < Command # :nodoc:
49
49
  self.control = true
50
- self.context = true
50
+ self.need_context = true
51
51
 
52
52
  include ThreadFunctions
53
53
 
@@ -85,7 +85,7 @@ module Debugger
85
85
 
86
86
  class ThreadStopCommand < Command # :nodoc:
87
87
  self.control = true
88
- self.context = true
88
+ self.need_context = true
89
89
 
90
90
  include ThreadFunctions
91
91
 
@@ -122,7 +122,7 @@ module Debugger
122
122
  end
123
123
 
124
124
  class ThreadCurrentCommand < Command # :nodoc:
125
- self.context = true
125
+ self.need_context = true
126
126
 
127
127
  include ThreadFunctions
128
128
 
@@ -149,7 +149,7 @@ module Debugger
149
149
 
150
150
  class ThreadResumeCommand < Command # :nodoc:
151
151
  self.control = true
152
- self.context = true
152
+ self.need_context = true
153
153
 
154
154
  include ThreadFunctions
155
155
 
@@ -8,9 +8,9 @@ module Debugger
8
8
  if @match[2]
9
9
  Debugger.tracing = @match[1] == 'on'
10
10
  elsif @match[1]
11
- @state.context.tracing = @match[1] == 'on'
11
+ Debugger.current_context.tracing = @match[1] == 'on'
12
12
  end
13
- if Debugger.tracing || @state.context.tracing
13
+ if Debugger.tracing || Debugger.current_context.tracing
14
14
  print "Trace on.\n"
15
15
  else
16
16
  print "Trace off.\n"
@@ -107,7 +107,7 @@ module Debugger
107
107
  end
108
108
 
109
109
  if cmd = commands.find{ |c| c.match(input) }
110
- if context.nil? && cmd.class.context
110
+ if context.nil? && cmd.class.need_context
111
111
  print "Command is unavailable\n"
112
112
  else
113
113
  cmd.execute
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: ruby-debug
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.5.1
7
- date: 2006-12-20 21:01:48 -05:00
6
+ version: 0.5.2
7
+ date: 2006-12-21 16:17:01 -05:00
8
8
  summary: Fast Ruby debugger
9
9
  require_paths:
10
10
  - lib