trepanning 0.0.4 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/ChangeLog +161 -0
  2. data/NEWS +10 -0
  3. data/Rakefile +13 -19
  4. data/app/frame.rb +1 -1
  5. data/app/irb.rb +1 -1
  6. data/app/util.rb +3 -10
  7. data/data/irbrc +1 -1
  8. data/lib/trepanning.rb +2 -2
  9. data/processor/command/alias.rb +10 -11
  10. data/processor/command/backtrace.rb +8 -9
  11. data/processor/command/base/cmd.rb +4 -0
  12. data/processor/command/base/subcmd.rb +0 -1
  13. data/processor/command/base/submgr.rb +12 -3
  14. data/processor/command/break.rb +14 -15
  15. data/processor/command/condition.rb +11 -12
  16. data/processor/command/continue.rb +10 -11
  17. data/processor/command/debug.rb +7 -8
  18. data/processor/command/delete.rb +10 -9
  19. data/processor/command/directory.rb +1 -1
  20. data/processor/command/disable.rb +8 -9
  21. data/processor/command/disassemble.rb +7 -8
  22. data/processor/command/display.rb +10 -11
  23. data/processor/command/down.rb +8 -9
  24. data/processor/command/enable.rb +9 -10
  25. data/processor/command/exit.rb +11 -10
  26. data/processor/command/finish.rb +12 -11
  27. data/processor/command/frame.rb +3 -4
  28. data/processor/command/help.rb +14 -16
  29. data/processor/command/info.rb +7 -8
  30. data/processor/command/irb.rb +13 -14
  31. data/processor/command/kill.rb +21 -10
  32. data/processor/command/list.rb +36 -36
  33. data/processor/command/macro.rb +4 -5
  34. data/processor/command/next.rb +19 -20
  35. data/processor/command/nocache.rb +3 -4
  36. data/processor/command/{print.rb → pr.rb} +11 -9
  37. data/processor/command/ps.rb +8 -8
  38. data/processor/command/quit.rb +17 -15
  39. data/processor/command/raise.rb +11 -10
  40. data/processor/command/reload.rb +4 -5
  41. data/processor/command/restart.rb +11 -10
  42. data/processor/command/save.rb +12 -9
  43. data/processor/command/set.rb +14 -15
  44. data/processor/command/set_subcmd/debug_subcmd/dbgr.rb +1 -1
  45. data/processor/command/set_subcmd/debug_subcmd/skip.rb +1 -1
  46. data/processor/command/show.rb +7 -7
  47. data/processor/command/show_subcmd/alias.rb +3 -4
  48. data/processor/command/show_subcmd/args.rb +0 -2
  49. data/processor/command/show_subcmd/auto.rb +2 -3
  50. data/processor/command/show_subcmd/basename.rb +0 -3
  51. data/processor/command/show_subcmd/debug.rb +2 -1
  52. data/processor/command/show_subcmd/debug_subcmd/dbgr.rb +1 -1
  53. data/processor/command/show_subcmd/different.rb +0 -3
  54. data/processor/command/show_subcmd/events.rb +0 -2
  55. data/processor/command/show_subcmd/macro.rb +2 -5
  56. data/processor/command/show_subcmd/max.rb +2 -1
  57. data/processor/command/show_subcmd/trace.rb +2 -2
  58. data/processor/command/source.rb +9 -8
  59. data/processor/command/step.rb +28 -29
  60. data/processor/command/stepi.rb +1 -1
  61. data/processor/command/unalias.rb +4 -5
  62. data/processor/command/undisplay.rb +4 -5
  63. data/processor/command/up.rb +9 -10
  64. data/processor/eval.rb +6 -2
  65. data/processor/frame.rb +32 -26
  66. data/processor/main.rb +1 -1
  67. data/processor/mock.rb +9 -3
  68. data/processor/running.rb +11 -7
  69. data/processor/validate.rb +1 -2
  70. data/test/functional/test-fn_helper.rb +42 -0
  71. data/test/functional/test-raise.rb +1 -1
  72. data/test/functional/test-return.rb +2 -2
  73. data/test/unit/test-app-util.rb +3 -4
  74. data/test/unit/test-base-subcmd.rb +2 -1
  75. data/test/unit/test-cmd-help.rb +4 -4
  76. data/test/unit/test-proc-frame.rb +1 -2
  77. data/test/unit/test-proc-main.rb +1 -1
  78. metadata +10 -7
@@ -10,15 +10,15 @@ class Trepan::Command::EnableCommand < Trepan::Command::DisableCommand
10
10
  # Silence already initialized constant .. warnings
11
11
  old_verbose = $VERBOSE
12
12
  $VERBOSE = nil
13
- HELP =
14
- 'enable [display] bpnumber [bpnumber ...]
13
+ NAME = File.basename(__FILE__, '.rb')
14
+ HELP = <<-HELP
15
+ #{NAME} [display] bpnumber [bpnumber ...]
15
16
 
16
17
  Enables the breakpoints given as a space separated list of breakpoint
17
18
  numbers. See also "info break" to get a list.
18
- '
19
+ HELP
19
20
 
20
21
  ALIASES = %w(en)
21
- NAME = File.basename(__FILE__, '.rb')
22
22
  SHORT_HELP = 'Enable some breakpoints'
23
23
  $VERBOSE = old_verbose
24
24
 
@@ -31,13 +31,12 @@ end
31
31
 
32
32
  if __FILE__ == $0
33
33
  require_relative '../mock'
34
- name = File.basename(__FILE__, '.rb')
35
- dbgr, cmd = MockDebugger::setup(name)
36
- cmd.run([name])
37
- cmd.run([name, '1'])
38
- cmdproc = dbgr.core.processor
34
+ dbgr, cmd = MockDebugger::setup
35
+ cmd.run([cmd.name])
36
+ cmd.run([cmd.name, '1'])
37
+ cmdproc = cmd.proc
39
38
  cmds = cmdproc.commands
40
39
  break_cmd = cmds['break']
41
40
  break_cmd.run(['break', cmdproc.frame.source_location[0].to_s])
42
- cmd.run([name, '1'])
41
+ cmd.run([cmd.name, '1'])
43
42
  end
@@ -3,19 +3,22 @@ require_relative 'base/cmd'
3
3
  class Trepan::Command::ExitCommand < Trepan::Command
4
4
 
5
5
  unless defined?(HELP)
6
- HELP =
7
- 'exit [exitcode] - hard exit of the debugged program.
6
+ NAME = File.basename(__FILE__, '.rb')
7
+ HELP = <<-HELP
8
+ #{NAME} [exitcode]
9
+
10
+ hard exit of the debugged program.
8
11
 
9
12
  The program being debugged is exited via exit!() which does not run
10
13
  the Kernel at_exit finalizers. If a return code is given, that is the
11
14
  return code passed to exit() - presumably the return code that will be
12
15
  passed back to the OS. If no exit code is given, 0 is used.
13
16
 
14
- See also the commands "quit" and "kill".'
17
+ See also the commands "quit" and "kill".
18
+ HELP
15
19
 
16
20
  CATEGORY = 'support'
17
21
  MAX_ARGS = 2 # Need at most this many
18
- NAME = File.basename(__FILE__, '.rb')
19
22
  SHORT_HELP = 'Exit program via "exit!"'
20
23
  end
21
24
 
@@ -23,7 +26,7 @@ See also the commands "quit" and "kill".'
23
26
  # whether exit! or exit is used.
24
27
 
25
28
  # This method runs the command
26
- def run(args) # :nodoc
29
+ def run(args)
27
30
  unconditional =
28
31
  if args.size > 1 && args[1] == 'unconditionally'
29
32
  args.shift
@@ -46,9 +49,7 @@ end
46
49
 
47
50
  if __FILE__ == $0
48
51
  require_relative '../mock'
49
- name = File.basename(__FILE__, '.rb')
50
- dbgr, cmd = MockDebugger::setup(name)
51
- name = File.basename(__FILE__, '.rb')
52
- fork { cmd.run([name]) }
53
- cmd.run([name, '10'])
52
+ dbgr, cmd = MockDebugger::setup
53
+ fork { cmd.run([cmd.name]) }
54
+ cmd.run([cmd.name, '10'])
54
55
  end
@@ -5,8 +5,9 @@ require_relative 'base/cmd'
5
5
  class Trepan::Command::FinishCommand < Trepan::Command
6
6
 
7
7
  unless defined?(HELP)
8
- HELP =
9
- "finish [levels]
8
+ NAME = File.basename(__FILE__, '.rb')
9
+ HELP = <<-HELP
10
+ #{NAME} [levels]
10
11
 
11
12
  Continue execution until leaving the current function.
12
13
  Sometimes this is called 'step out'.
@@ -21,20 +22,21 @@ guarentee the stack level is the same as or less than the current
21
22
  one.
22
23
 
23
24
  See the break command if you want to stop at a particular point in a
24
- program. In general, 'finish', 'step' and 'next' may slow a program down
25
+ program. In general, '#{NAME}', 'step' and 'next' may slow a program down
25
26
  while 'break' will have less overhead.
26
- "
27
+ HELP
27
28
  ALIASES = %w(fin)
28
29
  CATEGORY = 'running'
29
30
  # execution_set = ['Running']
30
- MAX_ARGS = 1 # Need at most this many.
31
- NAME = File.basename(__FILE__, '.rb')
31
+
32
+ # Need at most this many.
33
+ MAX_ARGS = 1
32
34
  NEED_STACK = true
33
35
  SHORT_HELP = 'Step program without entering called functions'
34
36
  end
35
37
 
36
38
  # This method runs the command
37
- def run(args) # :nodoc
39
+ def run(args)
38
40
  opts = {}
39
41
  if args.size == 1
40
42
  # Form is: "finish" which means "finish 1"
@@ -62,9 +64,8 @@ end
62
64
 
63
65
  if __FILE__ == $0
64
66
  require_relative '../mock'
65
- name = File.basename(__FILE__, '.rb')
66
- dbgr, cmd = MockDebugger::setup(name)
67
- [%w(finish 1), %w(fin 2-1), %w(n foo)].each do |c|
67
+ dbgr, cmd = MockDebugger::setup
68
+ [%W(#{cmd.name} 1), %w(fin 2-1), %w(n foo)].each do |c|
68
69
  cmd.proc.next_level = 0
69
70
  cmd.proc.leave_cmd_loop = false
70
71
  result = cmd.run(c)
@@ -72,7 +73,7 @@ if __FILE__ == $0
72
73
  puts 'level_count %d, leave_cmd_loop: %s' % [cmd.proc.next_level,
73
74
  cmd.proc.leave_cmd_loop]
74
75
  end
75
- [%w(fin), %w(finish)].each do |c|
76
+ [%w(fin), [cmd.name]].each do |c|
76
77
  cmd.proc.next_level = 0
77
78
  cmd.proc.leave_cmd_loop = false
78
79
  result = cmd.run(c)
@@ -104,14 +104,13 @@ if __FILE__ == $0
104
104
  # Demo it.
105
105
  require 'thread_frame'
106
106
  require_relative '../mock'
107
- name = File.basename(__FILE__, '.rb')
108
- dbgr, cmd = MockDebugger::setup(name)
107
+ dbgr, cmd = MockDebugger::setup
109
108
 
110
109
  def sep ; puts '=' * 40 end
111
- %w(0 1 -2).each {|count| cmd.run([name, count]); sep }
110
+ %w(0 1 -2).each {|count| cmd.run([cmd.name, count]); sep }
112
111
  def foo(cmd, name)
113
112
  cmd.proc.frame_setup(RubyVM::ThreadFrame::current)
114
113
  %w(0 -1).each {|count| cmd.run([name, count]); sep }
115
114
  end
116
- foo(cmd, name)
115
+ foo(cmd, cmd.name)
117
116
  end
@@ -3,8 +3,9 @@ require_relative 'base/cmd'
3
3
  class Trepan::Command::HelpCommand < Trepan::Command
4
4
 
5
5
  unless defined?(HELP)
6
- HELP =
7
- "help [command [subcommand]|expression]
6
+ NAME = File.basename(__FILE__, '.rb')
7
+ HELP = <<-HELP
8
+ #{NAME} [command [subcommand]|expression]
8
9
 
9
10
  Without argument, print the list of available debugger commands.
10
11
 
@@ -21,8 +22,7 @@ subcommand. For example 'help info line' give help about the
21
22
  info line command.
22
23
 
23
24
  See also 'examine' and 'whatis'.
24
- "
25
-
25
+ HELP
26
26
 
27
27
  ALIASES = %w(?)
28
28
  CATEGORIES = {
@@ -35,7 +35,6 @@ See also 'examine' and 'whatis'.
35
35
  'stack' => 'Examining the call stack'
36
36
  }
37
37
  CATEGORY = 'support'
38
- NAME = File.basename(__FILE__, '.rb')
39
38
  NEED_STACK = false
40
39
  SHORT_HELP = 'Print commands or give help for command(s)'
41
40
  end
@@ -57,7 +56,7 @@ Type "help" followed by command name for full documentation.
57
56
  end
58
57
 
59
58
  # This method runs the command
60
- def run(args) # :nodoc
59
+ def run(args)
61
60
  if args.size > 1
62
61
  cmd_name = args[1]
63
62
  if cmd_name == '*'
@@ -124,23 +123,22 @@ end
124
123
  if __FILE__ == $0
125
124
  # Demo it.
126
125
  require_relative '../mock'
127
- name = File.basename(__FILE__, '.rb')
128
- dbgr, cmd = MockDebugger::setup(name)
126
+ dbgr, cmd = MockDebugger::setup
129
127
 
130
- cmd.run %w(help help)
128
+ cmd.run %W(cmd.name help)
131
129
  puts '=' * 40
132
- cmd.run %w(help *)
130
+ cmd.run %W(cmd.name *)
133
131
  puts '=' * 40
134
- cmd.run %w(help fdafsasfda)
132
+ cmd.run %W(cmd.name fdafsasfda)
135
133
  puts '=' * 40
136
- cmd.run %w(help)
134
+ cmd.run %W(cmd.name)
137
135
  puts '=' * 40
138
- cmd.run %w(help support)
136
+ cmd.run %W(cmd.name support)
139
137
  puts '=' * 40
140
- cmd.run %w(help support *)
138
+ cmd.run %W(cmd.name support *)
141
139
 
142
140
  puts '=' * 40
143
- cmd.run %w(help s.*)
141
+ cmd.run %W(cmd.name s.*)
144
142
  puts '=' * 40
145
- cmd.run %w(help s<>)
143
+ cmd.run %W(cmd.name s<>)
146
144
  end
@@ -4,25 +4,24 @@ require_relative 'base/submgr'
4
4
 
5
5
  class Trepan::Command::InfoCommand < Trepan::SubcommandMgr
6
6
  unless defined?(HELP)
7
- HELP =
8
- 'Generic command for showing things about the program being debugged.
7
+ NAME = File.basename(__FILE__, '.rb')
8
+ HELP = <<-HELP
9
+ Generic command for showing things about the program being debugged.
9
10
 
10
11
  You can give unique prefix of the name of a subcommand to get
11
12
  information about just that subcommand.
12
13
 
13
- Type "info" for a list of "info" subcommands and what they do.
14
- Type "help info *" for just a list of "info" subcommands.
15
- '
14
+ Type "#{NAME}" for a list of "info" subcommands and what they do.
15
+ Type "help #{NAME} *" for just a list of "info" subcommands.
16
+ HELP
16
17
 
17
18
  ALIASES = %w(i)
18
19
  CATEGORY = 'status'
19
- NAME = File.basename(__FILE__, '.rb')
20
20
  SHORT_HELP = 'Information about debugged program and its environment'
21
21
  end
22
22
  end
23
23
 
24
24
  if __FILE__ == $0
25
25
  require_relative '../mock'
26
- name = File.basename(__FILE__, '.rb')
27
- dbgr, cmd = MockDebugger::setup(name)
26
+ dbgr, cmd = MockDebugger::setup
28
27
  end
@@ -5,23 +5,24 @@ require_relative '../../app/irb'
5
5
  class Trepan::Command::IRBCommand < Trepan::Command
6
6
 
7
7
  unless defined?(HELP)
8
- HELP =
9
- " irb [-d]\tstarts an Interactive Ruby (IRB) session.
8
+ NAME = File.basename(__FILE__, '.rb')
9
+ HELP = <<-HELP
10
+ #{NAME} [-d]\tstarts an Interactive Ruby (IRB) session.
10
11
 
11
12
  If -d is added you can get access to debugger frame the global variables
12
13
  $trepan_frame and $trepan_cmdproc.
13
14
 
14
- irb is extended with methods 'cont', 'dbgr', 'n', and, 'q', 'step' which
15
- run the corresponding debugger commands.
15
+ #{NAME} is extended with methods 'cont', 'ne', and, 'q', 'step' which
16
+ run the corresponding debugger commands 'continue', 'next', 'exit' and 'step'.
16
17
 
17
- To issue a debugger command, inside irb nested inside a debugger use
18
+ To issue a debugger command, inside #{NAME} nested inside a debugger use
18
19
  'dbgr'. For example:
19
20
 
20
- dbgr %%w(info program)
21
+ dbgr %w(info program)
21
22
  dbgr('info', 'program') # Same as above
22
23
  dbgr 'info program' # Single quoted string also works
23
24
 
24
- But arguments have to be quoted because irb will evaluate them:
25
+ But arguments have to be quoted because #{NAME} will evaluate them:
25
26
 
26
27
  dbgr info program # wrong!
27
28
  dbgr info, program # wrong!
@@ -29,16 +30,15 @@ But arguments have to be quoted because irb will evaluate them:
29
30
 
30
31
  Here then is a loop to query VM stack values:
31
32
  (-1..1).each {|i| dbgr(\"info reg sp \#{i}\")}
32
- "
33
+ HELP
33
34
 
34
35
  CATEGORY = 'support'
35
36
  MAX_ARGS = 1 # Need at most this many
36
- NAME = File.basename(__FILE__, '.rb')
37
- SHORT_HELP = 'Run interactive Ruby session irb as a command subshell'
37
+ SHORT_HELP = "Run #{NAME} as a command subshell"
38
38
  end
39
39
 
40
40
  # This method runs the command
41
- def run(args) # :nodoc
41
+ def run(args)
42
42
  add_debugging =
43
43
  if args.size > 1
44
44
  '-d' == args[1]
@@ -99,8 +99,7 @@ end
99
99
  if __FILE__ == $0
100
100
  require 'thread_frame'
101
101
  require_relative '../mock'
102
- name = File.basename(__FILE__, '.rb')
103
- dbgr, cmd = MockDebugger::setup(name)
102
+ dbgr, cmd = MockDebugger::setup
104
103
  # Get an IRB session -- the hard way :-)
105
- cmd.run([name]) if ARGV.size > 0
104
+ cmd.run([cmd.name]) if ARGV.size > 0
106
105
  end
@@ -3,26 +3,38 @@ require_relative 'base/cmd'
3
3
  class Trepan::Command::KillCommand < Trepan::Command
4
4
 
5
5
  unless defined?(HELP)
6
- HELP =
7
- "Kill execution of program being debugged.
6
+ NAME = File.basename(__FILE__, '.rb')
7
+ HELP = <<-HELP
8
+ #{NAME} [signal-number|signal-name|unconditionally]
9
+
10
+ Kill execution of program being debugged.
8
11
 
9
12
  Equivalent of Process.kill('KILL', Process.pid). This is an unmaskable
10
13
  signal. When all else fails, e.g. in thread code, use this.
11
14
 
12
15
  If 'unconditionally' is given, no questions are asked. Otherwise, if
13
- we are in interactive mode, we'll prompt to make sure."
16
+ we are in interactive mode, we'll prompt to make sure.
17
+
18
+ Examples:
19
+
20
+ #{NAME}
21
+ #{NAME} unconditionally
22
+ #{NAME} KILL # same as above
23
+ #{NAME} kill # same as above
24
+ #{NAME} -9 # same as above
25
+ #{NAME} 9 # same as above
26
+ HELP
14
27
 
15
28
  CATEGORY = 'running'
16
29
  MAX_ARGS = 1 # Need at most this many
17
- NAME = File.basename(__FILE__, '.rb')
18
30
  SHORT_HELP = 'Send this process a POSIX signal (default "9" is "kill -9")'
19
31
  end
20
32
 
21
33
  # This method runs the command
22
- def run(args) # :nodoc
34
+ def run(args)
23
35
  if args.size > 1
24
36
  sig = Integer(args[1]) rescue args[1]
25
- unless sig.is_a?(Integer) || Signal.list.member?(sig)
37
+ unless sig.is_a?(Integer) || Signal.list.member?(sig.upcase)
26
38
  errmsg("Signal name '#{sig}' is not a signal I know about.\n")
27
39
  return false
28
40
  end
@@ -48,11 +60,10 @@ end
48
60
 
49
61
  if __FILE__ == $0
50
62
  require_relative '../mock'
51
- name = File.basename(__FILE__, '.rb')
52
- dbgr, cmd = MockDebugger::setup(name)
63
+ dbgr, cmd = MockDebugger::setup
53
64
  %w(fooo 1 -1 HUP -9).each do |arg|
54
- puts "#{name} #{arg}"
55
- cmd.run([name, arg])
65
+ puts "#{cmd.name} #{arg}"
66
+ cmd.run([cmd.name, arg])
56
67
  puts '=' * 40
57
68
  end
58
69
  end
@@ -5,16 +5,17 @@ require_relative 'base/cmd'
5
5
 
6
6
  class Trepan::Command::ListCommand < Trepan::Command
7
7
  unless defined?(HELP)
8
- HELP =
9
- "list[>] [MODULE] [FIRST [NUM]]
10
- list[>] LOCATION [NUM]
8
+ NAME = File.basename(__FILE__, '.rb')
9
+ HELP = <<-HELP
10
+ #{NAME}[>] [MODULE] [FIRST [NUM]]
11
+ #{NAME}[>] LOCATION [NUM]
11
12
 
12
- List source code.
13
+ #{NAME} source code.
13
14
 
14
15
  Without arguments, prints lines centered around the current
15
- line. If this is the first list command issued since the debugger
16
+ line. If this is the first #{NAME} command issued since the debugger
16
17
  command loop was entered, then the current line is the current
17
- frame. If a subsequent list command was issued with no intervening
18
+ frame. If a subsequent #{NAME} command was issued with no intervening
18
19
  frame changing, then that is start the line after we last one
19
20
  previously shown.
20
21
 
@@ -25,7 +26,7 @@ The number of line to show is controled by the debugger listsize
25
26
  setting. Use 'set listsize' or 'show listsize' to see or set the
26
27
  value.
27
28
 
28
- \"list -\" shows lines before a previous listing.
29
+ \"#{NAME} -\" shows lines before a previous listing.
29
30
 
30
31
  A LOCATION is a either
31
32
  - number, e.g. 5,
@@ -47,22 +48,22 @@ just something that evaluates to a positive integer.
47
48
 
48
49
  Some examples:
49
50
 
50
- list 5 # List centered around line 5
51
- list 4+1 # Same as above.
52
- list 5> # List starting at line 5
53
- list foo.rb:5 # List centered around line 5 of foo.rb
54
- list foo.rb 5 # Same as above.
55
- list foo.rb:5> # List starting around line 5 of foo.rb
56
- list foo.rb 5 6 # list lines 5 and 6 of foo.rb
57
- list foo.rb 5 2 # Same as above, since 2 < 5.
58
- list foo.rb:5 2 # Same as above
59
- list FileUtils.cp # List lines around the FileUtils.cp function.
60
- list . # List lines centered from where we currently are stopped
61
- list - # List lines previous to those just shown
62
-
63
- The output of the list command give a line number, and some status
51
+ #{NAME} 5 # List centered around line 5
52
+ #{NAME} 4+1 # Same as above.
53
+ #{NAME} 5> # List starting at line 5
54
+ #{NAME} foo.rb:5 # List centered around line 5 of foo.rb
55
+ #{NAME} foo.rb 5 # Same as above.
56
+ #{NAME} foo.rb:5> # List starting around line 5 of foo.rb
57
+ #{NAME} foo.rb 5 6 # list lines 5 and 6 of foo.rb
58
+ #{NAME} foo.rb 5 2 # Same as above, since 2 < 5.
59
+ #{NAME} foo.rb:5 2 # Same as above
60
+ #{NAME} FileUtils.cp # List lines around the FileUtils.cp function.
61
+ #{NAME} . # List lines centered from where we currently are stopped
62
+ #{NAME} - # List lines previous to those just shown
63
+
64
+ The output of the #{NAME} command give a line number, and some status
64
65
  information about the line and the text of the line. Here is some
65
- hypothetical list output modeled roughly around line 251 of one
66
+ hypothetical #{NAME} output modeled roughly around line 251 of one
66
67
  version of this code:
67
68
 
68
69
  251 cmd.proc.frame_setup(tf)
@@ -74,12 +75,12 @@ version of this code:
74
75
  Line 251 has nothing special about it. Line 252 is where we are
75
76
  currently stopped. On line 253 there is a breakpoint 1 which is
76
77
  enabled, while at line 255 there is an breakpoint 2 which is
77
- disabled."
78
+ disabled.
79
+ HELP
78
80
 
79
- ALIASES = %w(l list> l>)
81
+ ALIASES = %W(l #{NAME}> l>)
80
82
  CATEGORY = 'files'
81
83
  MAX_ARGS = 3
82
- NAME = File.basename(__FILE__, '.rb')
83
84
  SHORT_HELP = 'List source code'
84
85
  end
85
86
 
@@ -256,8 +257,7 @@ if __FILE__ == $0
256
257
  require_relative '../location'
257
258
  require_relative '../mock'
258
259
  require_relative '../frame'
259
- name = File.basename(__FILE__, '.rb')
260
- dbgr, cmd = MockDebugger::setup(name)
260
+ dbgr, cmd = MockDebugger::setup
261
261
  cmd.proc.send('frame_initialize')
262
262
  LineCache::cache(__FILE__)
263
263
  cmd.run(['list'])
@@ -296,19 +296,19 @@ if __FILE__ == $0
296
296
  run_cmd(cmd, %w(list Columnize.columnize))
297
297
 
298
298
  # Use Class/method name. 15 isn't in the function - should this be okay?
299
- run_cmd(cmd, %w(list Columnize.columnize 15))
299
+ run_cmd(cmd, %W(#{cmd.name} Columnize.columnize 15))
300
300
 
301
301
  # Start line and count, since 3 < 30
302
- run_cmd(cmd, %w(list Columnize.columnize 30 3))
302
+ run_cmd(cmd, %W(#{cmd.name} Columnize.columnize 30 3))
303
303
 
304
304
  # Start line finish line
305
- run_cmd(cmd, %w(list Columnize.columnize 40 50))
305
+ run_cmd(cmd, %W(#{cmd.name} Columnize.columnize 40 50))
306
306
 
307
307
  # puts '--' * 10
308
- # cmd.run(['list', os.path.abspath(__file__)+':3', '4'])
308
+ # cmd.run([cmd.name, os.path.abspath(__file__)+':3', '4'])
309
309
  # puts '--' * 10
310
- # cmd.run(['list', os.path.abspath(__file__)+':3', '12-10'])
311
- # cmd.run(['list', 'os.path:5'])
310
+ # cmd.run([cmd.name, os.path.abspath(__file__)+':3', '12-10'])
311
+ # cmd.run([cmd.name, 'os.path:5'])
312
312
 
313
313
  require 'thread_frame'
314
314
  tf = RubyVM::ThreadFrame.current
@@ -316,12 +316,12 @@ if __FILE__ == $0
316
316
  brkpt_cmd = cmd.proc.instance_variable_get('@commands')['break']
317
317
  brkpt_cmd.run(['break'])
318
318
  line = __LINE__
319
- run_cmd(cmd, ['list', __LINE__.to_s])
319
+ run_cmd(cmd, [cmd.name, __LINE__.to_s])
320
320
 
321
321
  disable_cmd = cmd.proc.instance_variable_get('@commands')['disable']
322
322
  disable_cmd.run(['disable', '1'])
323
323
 
324
- run_cmd(cmd, ['list', line.to_s])
325
- run_cmd(cmd, %w(list parse_list_cmd))
324
+ run_cmd(cmd, [cmd.name, line.to_s])
325
+ run_cmd(cmd, %W(#{cmd.name} run_cmd))
326
326
  end
327
327
  end