Skip to content

Commit 8911dac

Browse files
author
rockyb
committed
configure.ac: in 0.10.4vc now. Add -d in irb facilitate debugger testing via global $rdebug_state. Also set $rdebug_state in debuggertesting is set.
"kill" is now allowed as a control command, this adjusts output. and this changes git-svn-id: http://ruby-debug.rubyforge.org/svn/trunk@911 453b2852-3d18-0410-866e-d09c099698e4
1 parent 1ecc928 commit 8911dac

File tree

6 files changed

+23
-13
lines changed

6 files changed

+23
-13
lines changed

cli/ruby-debug/commands/irb.rb

+13-5
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ class IRBCommand < Command
4545
end
4646

4747
def regexp
48-
/^irb$/
48+
/^\s* irb
49+
(?:\s+(-d))?
50+
\s*$/x
4951
end
5052

5153
def execute
@@ -55,10 +57,12 @@ def execute
5557
end
5658

5759
save_trap = trap("SIGINT") do
58-
throw :IRB_EXIT, :cont if $debug_in_irb
60+
throw :IRB_EXIT, :cont if $rdebug_in_irb
5961
end
6062

61-
$debug_in_irb = true
63+
add_debugging = '-d' == @match[1]
64+
$rdebug_state = @state if add_debugging
65+
$rdebug_in_irb = true
6266
cont = IRB.start_session(get_binding)
6367
if cont == :cont
6468
@state.proceed
@@ -70,7 +74,8 @@ def execute
7074
end
7175

7276
ensure
73-
$debug_in_irb = false
77+
$rdebug_in_irb = nil
78+
$rdebug_state = nil if add_debugging
7479
trap("SIGINT", save_trap) if save_trap
7580
end
7681

@@ -81,7 +86,10 @@ def help_command
8186

8287
def help(cmd)
8388
%{
84-
irb\tstarts an Interactive Ruby (IRB) session.
89+
irb [-d]\tstarts an Interactive Ruby (IRB) session.
90+
91+
If -d is added you can get access to debugger state via the global variable
92+
$RDEBUG_state.
8593
}
8694
end
8795
end

cli/ruby-debug/processor.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def always_run(context, file, line, run_level)
224224
# Handle debugger commands
225225
def process_commands(context, file, line)
226226
state, commands = always_run(context, file, line, 1)
227-
227+
$rdebug_state = state if Command.settings[:debuggertesting]
228228
splitter = lambda do |str|
229229
str.split(/;/).inject([]) do |m, v|
230230
if m.empty?

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
AC_INIT(ruby-debug-extra, 0.10.4vc,)
1+
AC_INIT(pydbgr, 0.10.4vc,)
22
AC_CONFIG_SRCDIR(doc/ruby-debug.texi)
33
AM_INIT_AUTOMAKE
44

test/data/ctrl.right

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ width is 80.
33
Type 'help <command-name>' for help on a specific command
44

55
Available commands:
6-
break delete eval help interrupt pp putl reload save show thread
7-
catch edit exit info p ps quit restart set source
6+
break delete eval help interrupt p ps quit restart set source
7+
catch edit exit info kill pp putl reload save show thread
88

99
Generic command for showing things about the program being debugged.
1010
--

test/data/post-mortem.right

+5-4
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ Exception: #<ZeroDivisionError: divided by 0>
2323
Type 'help <command-name>' for help on a specific command
2424

2525
Available commands:
26-
backtrace continue down exit irb pp reload show undisplay
27-
break delete edit frame list ps restart source up
28-
catch disable enable help method putl save thread var
29-
condition display eval info p quit set trace where
26+
backtrace delete enable info p reload source var
27+
break disable eval irb pp restart thread where
28+
catch display exit kill ps save trace
29+
condition down frame list putl set undisplay
30+
continue edit help method quit show up
3031

3132
# quit

test/test-ctrl.rb

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def cheap_diff(got_lines, correct_lines, outfile)
2727
puts "difference found at line #{i+1}"
2828
puts "got : #{got_lines[i]}"
2929
puts "need: #{correct_lines[i]}"
30+
File.open(outfile, 'w') {|f| f.puts got_lines}
3031
return false
3132
end
3233
end

0 commit comments

Comments
 (0)