trepanning 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
data/ChangeLog CHANGED
@@ -1,3 +1,148 @@
1
+ 2010-10-19 rocky <rockyb@rubyforge.org>
2
+
3
+ Merge branch 'master' of github.com:rocky/rb-trepanning
4
+ Conflicts: processor/command/finish.rb
5
+
6
+ 2010-10-19 rocky <rockyb@rubyforge.org>
7
+
8
+ * .gitignore, app/frame.rb, lib/trepanning.rb,
9
+ processor/command/alias.rb, processor/command/backtrace.rb,
10
+ processor/command/break.rb, processor/command/continue.rb,
11
+ processor/command/directory.rb, processor/command/exit.rb,
12
+ processor/command/finish.rb, processor/command/help.rb,
13
+ processor/command/irb.rb, processor/command/kill.rb,
14
+ processor/command/next.rb, processor/command/nocache.rb,
15
+ processor/command/quit.rb, processor/command/raise.rb,
16
+ processor/command/restart.rb, processor/command/save.rb,
17
+ processor/frame.rb, processor/main.rb,
18
+ test/functional/test-fn_helper.rb: Add test of test-fn_helper.rb
19
+ Appease the RDoc God.
20
+
21
+ 2010-10-18 rocky <rockyb@rubyforge.org>
22
+
23
+ * processor/command/set_subcmd/debug_subcmd/skip.rb,
24
+ processor/running.rb: Minor stuff
25
+
26
+ 2010-10-17 rocky <rockyb@rubyforge.org>
27
+
28
+ * processor/command/next.rb: Use of NAME rather than hardcoding
29
+ 'next'.
30
+
31
+ 2010-10-16 rocky <rockyb@rubyforge.org>
32
+
33
+ * test/unit/test-cmd-help.rb: Reinstate expect message on assert
34
+
35
+ 2010-10-16 rocky <rockyb@rubyforge.org>
36
+
37
+ * processor/command/backtrace.rb, processor/mock.rb,
38
+ test/unit/test-cmd-help.rb: One more use of self.name
39
+
40
+ 2010-10-16 rocky <rockyb@rubyforge.org>
41
+
42
+ * processor/command/down.rb, processor/command/exit.rb,
43
+ processor/command/next.rb, processor/command/pr.rb,
44
+ processor/command/ps.rb, processor/command/raise.rb,
45
+ processor/command/reload.rb, processor/command/restart.rb,
46
+ processor/command/up.rb: Remove extraneous name setting and using
47
+ #{NAME} in help, part 2.
48
+
49
+ 2010-10-16 rocky <rockyb@rubyforge.org>
50
+
51
+ * processor/command/alias.rb, processor/command/delete.rb,
52
+ processor/command/disable.rb, processor/command/disassemble.rb,
53
+ processor/command/display.rb, processor/command/enable.rb,
54
+ processor/command/frame.rb, processor/command/help.rb,
55
+ processor/command/info.rb, processor/command/kill.rb,
56
+ processor/command/list.rb, processor/command/macro.rb,
57
+ processor/command/nocache.rb, processor/command/quit.rb,
58
+ processor/command/save.rb, processor/command/set.rb,
59
+ processor/command/show.rb, processor/command/step.rb,
60
+ processor/command/unalias.rb, processor/command/undisplay.rb: DRY
61
+ command demo code and use #{NAME} in help code. (Part 1 of 2)
62
+
63
+ 2010-10-16 rocky <rockyb@rubyforge.org>
64
+
65
+ Merge branch 'master' of github.com:rocky/rb-trepanning
66
+
67
+ 2010-10-16 rocky <rockyb@rubyforge.org>
68
+
69
+ * processor/command/backtrace.rb, processor/command/base/cmd.rb,
70
+ processor/command/break.rb, processor/command/condition.rb,
71
+ processor/command/continue.rb, processor/command/debug.rb,
72
+ processor/command/finish.rb, processor/command/irb.rb,
73
+ processor/command/source.rb: Add Trepan::Command#name and dry code
74
+ with it.
75
+
76
+ 2010-10-14 rocky <rockyb@rubyforge.org>
77
+
78
+ * processor/command/pr.rb: Add reference to "set max string" for
79
+ "pr" command.
80
+
81
+ 2010-10-14 rocky <rockyb@rubyforge.org>
82
+
83
+ Merge branch 'master' of github.com:rocky/rb-trepanning
84
+
85
+ 2010-10-14 rocky <rockyb@rubyforge.org>
86
+
87
+ * processor/command/pr.rb, processor/command/print.rb,
88
+ processor/running.rb, test/functional/test-raise.rb,
89
+ test/functional/test-return.rb, test/unit/test-proc-main.rb:
90
+ debugger "print" (print truncating long output) renamed to "pr"
91
+ since p and print are both Ruby commands. running.rb: Typo |= -> ||=
92
+
93
+
94
+ 2010-10-13 rocky <rockyb@rubyforge.org>
95
+
96
+ Merge branch 'master' of github.com:rocky/rb-trepanning
97
+
98
+ 2010-10-13 rocky <rockyb@rubyforge.org>
99
+
100
+ * app/irb.rb, data/irbrc, processor/command/irb.rb: Keep in sync
101
+ with rbx-trepanning.
102
+
103
+ 2010-10-13 rocky <rockyb@rubyforge.org>
104
+
105
+ * processor/command/set_subcmd/debug_subcmd/dbgr.rb,
106
+ processor/command/show_subcmd/debug_subcmd/dbgr.rb: A couple more
107
+ uses of NAME
108
+
109
+ 2010-10-13 rocky <rockyb@rubyforge.org>
110
+
111
+ * processor/command/base/subcmd.rb,
112
+ processor/command/base/submgr.rb,
113
+ processor/command/show_subcmd/alias.rb,
114
+ processor/command/show_subcmd/args.rb,
115
+ processor/command/show_subcmd/auto.rb,
116
+ processor/command/show_subcmd/basename.rb,
117
+ processor/command/show_subcmd/debug.rb,
118
+ processor/command/show_subcmd/different.rb,
119
+ processor/command/show_subcmd/events.rb,
120
+ processor/command/show_subcmd/macro.rb,
121
+ processor/command/show_subcmd/max.rb,
122
+ processor/command/show_subcmd/trace.rb,
123
+ test/unit/test-base-subcmd.rb: First attempt to compute NAME and
124
+ PREFIX on subcommands. Not entirely successful though.
125
+
126
+ 2010-10-12 rocky <rockyb@rubyforge.org>
127
+
128
+ Merge branch 'master' of github.com:rocky/rb-trepanning
129
+
130
+ 2010-10-12 rocky <rockyb@rubyforge.org>
131
+
132
+ * processor/frame.rb, test/unit/test-proc-frame.rb: A little cleaner
133
+ I think due to sync with rbx-trepanning.
134
+
135
+ 2010-10-11 rocky <rockyb@rubyforge.org>
136
+
137
+ Merge branch 'master' of github.com:rocky/rb-trepanning
138
+
139
+ 2010-10-10 rocky <rockyb@rubyforge.org>
140
+
141
+ * .gemspec, ChangeLog, NEWS, Rakefile, lib/trepanning.rb: Rakefile:
142
+ remove weird self-modifying double loop lib/trepanning.rb: now in
143
+ 0.0.5.git .gemspec: Add add for rbx-trepanning NEWS: forgot to
144
+ commit from before.
145
+
1
146
  2010-10-08 rocky <rockyb@rubyforge.org>
2
147
 
3
148
  * README.textile: Update install link.
@@ -42,6 +187,10 @@
42
187
  test/unit/test-app-brkptmgr.rb: Small things to sync up with
43
188
  rbx-trepanning
44
189
 
190
+ 2010-10-05 rocky <rockyb@rubyforge.org>
191
+
192
+ Merge branch 'master' of github.com:rocky/rb-trepanning
193
+
45
194
  2010-10-05 rocky <rockyb@rubyforge.org>
46
195
 
47
196
  * app/breakpoint.rb, app/brkptmgr.rb,
@@ -105,10 +254,22 @@
105
254
  * processor/eval.rb, processor/main.rb: Undo last change - error
106
255
  message for internal error. Messes up backtrace
107
256
 
257
+ 2010-09-28 rocky <rockyb@rubyforge.org>
258
+
259
+ Merge branch 'master' of github.com:rocky/rb-trepanning
260
+
108
261
  2010-09-28 rocky <rockyb@rubyforge.org>
109
262
 
110
263
  * lib/trepanning.rb, processor/eval.rb: Add VERSION number
111
264
 
265
+ 2010-09-28 rocky <rockyb@rubyforge.org>
266
+
267
+ Merge branch 'master' of github.com:rocky/rb-trepanning
268
+
269
+ 2010-09-28 rocky <rockyb@rubyforge.org>
270
+
271
+ * processor/command/source.rb, processor/eval.rb: Small tweaks
272
+
112
273
  2010-09-27 rocky <rockyb@rubyforge.org>
113
274
 
114
275
  * processor/command/backtrace.rb, processor/command/where.rb:
data/NEWS CHANGED
@@ -1,3 +1,12 @@
1
+ Oct 27, 2010 (0.0.6)
2
+
3
+ * Add gdb directory command - this time for sure!
4
+ * Debugger "print" command rename to "pr" to avoid conflict with Ruby fns
5
+ "p" and "print" (when autoeval is in effect)
6
+ * RDoc concessions in some comments
7
+ * "break" command looks up line in file better
8
+ * Numerous bugfixes and code refactoring.
9
+
1
10
  Oct 8, 2010
2
11
  First release under the name trepanning
3
12
 
@@ -5,6 +14,7 @@ First release under the name trepanning
5
14
  * Add "set max list" to set number of lines to list by default.
6
15
  * "break line" searches parent instruction sequences in the same file. This
7
16
  should allow more line numbers to be breakpointable.
17
+ * remap file name in custom_requre.rb
8
18
  * Some small bug fixes
9
19
 
10
20
  Sept 13, 2010
data/Rakefile CHANGED
@@ -1,9 +1,6 @@
1
1
  #!/usr/bin/env rake
2
2
  # -*- Ruby -*-
3
3
  require 'rubygems'
4
- require 'rake/gempackagetask'
5
- require 'rake/rdoctask'
6
- require 'rake/testtask'
7
4
 
8
5
  ROOT_DIR = File.dirname(__FILE__)
9
6
  require File.join %W(#{ROOT_DIR} app options)
@@ -12,6 +9,7 @@ def gemspec
12
9
  @gemspec ||= eval(File.read('.gemspec'), binding, '.gemspec')
13
10
  end
14
11
 
12
+ require 'rake/gempackagetask'
15
13
  desc "Build the gem"
16
14
  task :package=>:gem
17
15
  task :gem=>:gemspec do
@@ -29,6 +27,7 @@ task :install => :gem do
29
27
  end
30
28
  end
31
29
 
30
+ require 'rake/testtask'
32
31
  desc "Test everything."
33
32
  Rake::TestTask.new(:test) do |t|
34
33
  t.libs << './lib'
@@ -60,28 +59,22 @@ task :ChangeLog do
60
59
  end
61
60
 
62
61
  desc 'Test units - the smaller tests'
63
- task :'test:unit' do |t|
64
- Rake::TestTask.new(:'test:unit') do |t|
65
- t.test_files = FileList['test/unit/**/test-*.rb']
66
- # t.pattern = 'test/**/*test-*.rb' # instead of above
67
- t.verbose = true
68
- end
62
+ Rake::TestTask.new(:'test:unit') do |t|
63
+ t.test_files = FileList['test/unit/**/test-*.rb']
64
+ # t.pattern = 'test/**/*test-*.rb' # instead of above
65
+ t.verbose = true
69
66
  end
70
67
 
71
68
  desc 'Test functional - the medium-sized tests'
72
- task :'test:functional' do |t|
73
- Rake::TestTask.new(:'test:functional') do |t|
74
- t.test_files = FileList['test/functional/**/test-*.rb']
75
- t.verbose = true
76
- end
69
+ Rake::TestTask.new(:'test:functional') do |t|
70
+ t.test_files = FileList['test/functional/**/test-*.rb']
71
+ t.verbose = true
77
72
  end
78
73
 
79
74
  desc 'Test integration - end-to-end blackbox tests'
80
- task :'test:integration' do |t|
81
- Rake::TestTask.new(:'test:integration') do |t|
82
- t.test_files = FileList['test/integration/**/test-*.rb']
83
- t.verbose = true
84
- end
75
+ Rake::TestTask.new(:'test:integration') do |t|
76
+ t.test_files = FileList['test/integration/**/test-*.rb']
77
+ t.verbose = true
85
78
  end
86
79
 
87
80
  desc 'Test everything - unit tests for now.'
@@ -148,6 +141,7 @@ task :gemspec do
148
141
  end
149
142
 
150
143
  # --------- RDoc Documentation ------
144
+ require 'rake/rdoctask'
151
145
  desc "Generate rdoc documentation"
152
146
  Rake::RDocTask.new("rdoc") do |rdoc|
153
147
  rdoc.rdoc_dir = 'doc'
data/app/frame.rb CHANGED
@@ -255,7 +255,7 @@ if __FILE__ == $0
255
255
  print_stack_trace(RubyVM::ThreadFrame::current)
256
256
  end
257
257
  x.call(1,2)
258
- class C
258
+ class C # :nodoc
259
259
  def initialize(a)
260
260
  print_stack_trace(RubyVM::ThreadFrame::current)
261
261
  end
data/app/irb.rb CHANGED
@@ -60,7 +60,7 @@ module IRB # :nodoc:
60
60
  # New irb Commands which are the slightly different from their
61
61
  # debugger counterpart
62
62
  [['cont', :Continue],
63
- ['n', :Next],
63
+ ['ne', :Next],
64
64
  ['q', :Quit]].each do |command, sym|
65
65
  ExtendCommandBundle.def_extend_command command, sym
66
66
  end
data/app/util.rb CHANGED
@@ -1,18 +1,11 @@
1
1
  # Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
2
+
2
3
  class Trepan
3
4
  module Util
4
5
 
5
- def safe_repr(str, max, suffix='...')
6
+ def safe_repr(str, max, elipsis='... ')
6
7
  if str.is_a?(String) && str.size > max && !str.index("\n")
7
- char = str[0..0]
8
- opt_quote =
9
- if '"' == char || "'" == char
10
- max -= 1
11
- char
12
- else
13
- ''
14
- end
15
- "%s%s%s" % [ str[0...max], opt_quote, suffix ]
8
+ "%s%s%s" % [ str[0...max/2], elipsis, str[str.size-max/2..str.size]]
16
9
  else
17
10
  str
18
11
  end
data/data/irbrc CHANGED
@@ -18,7 +18,7 @@ IRB.conf[:PROMPT][:SIMPLE] =
18
18
  # dbgr info program # wrong!
19
19
  #
20
20
  puts "You are in a trepan session. You should have access to program scope."
21
- puts "'dbgr', 'step', 'n', 'q', 'cont' commands have been added."
21
+ puts "'dbgr', 'step', 'ne', 'q', 'cont' commands have been added."
22
22
 
23
23
  if defined?($trepan) && $trepan
24
24
  puts 'You should have access to debugger state via global variable $trepan'
data/lib/trepanning.rb CHANGED
@@ -20,7 +20,7 @@ ISEQS__ = {} unless
20
20
  defined?(ISEQS__) && ISEQS__.is_a?(Hash)
21
21
 
22
22
  class Trepan
23
- VERSION = '0.0.4'
23
+ VERSION = '0.0.6'
24
24
 
25
25
  attr_accessor :core # access to Trepan::Core instance
26
26
  attr_accessor :intf # Array. The way the outside world
@@ -248,7 +248,7 @@ module Kernel
248
248
  end
249
249
 
250
250
  if __FILE__ == $0
251
- def square(x)
251
+ def square(x) # :nodoc
252
252
  x * x
253
253
  end
254
254
  puts 'block debugging...'
@@ -4,17 +4,17 @@ require_relative 'base/cmd'
4
4
  class Trepan::Command::AliasCommand < Trepan::Command
5
5
 
6
6
  unless defined?(HELP)
7
- HELP =
8
- "alias ALIAS COMMAND
7
+ NAME = File.basename(__FILE__, '.rb')
8
+ HELP = <<-HELP
9
+ #{NAME} ALIAS COMMAND
9
10
 
10
11
  Add an alias for a COMMAND
11
12
 
12
13
  See also 'unalias'.
13
- "
14
+ HELP
14
15
 
15
16
  CATEGORY = 'support'
16
17
  MAX_ARGS = 2 # Need at most this many
17
- NAME = File.basename(__FILE__, '.rb')
18
18
  NEED_STACK = true
19
19
  SHORT_HELP = 'Add an alias for a debugger command'
20
20
  end
@@ -24,7 +24,7 @@ See also 'unalias'.
24
24
  if args.size == 1
25
25
  @proc.commands['show'].run(%w(show alias))
26
26
  elsif args.size == 2
27
- @proc.commands['show'].run(%W(show alias #{args[1]}))
27
+ @proc.commands['show'].run(['show', 'alias', args[1]])
28
28
  else
29
29
  junk, al, command = args
30
30
  old_command = @proc.aliases[al]
@@ -46,10 +46,9 @@ end
46
46
  if __FILE__ == $0
47
47
  # Demo it.
48
48
  require_relative '../mock'
49
- name = File.basename(__FILE__, '.rb')
50
- dbgr, cmd = MockDebugger::setup(name)
51
- cmd.run %w(alias yy foo)
52
- cmd.run %w(alias yy step)
53
- cmd.run %w(alias)
54
- cmd.run %w(alias yy next)
49
+ dbgr, cmd = MockDebugger::setup
50
+ cmd.run %W(cmd.name yy foo)
51
+ cmd.run %W(cmd.name yy step)
52
+ cmd.run %W(cmd.name)
53
+ cmd.run %W(cmd.name yy next)
55
54
  end
@@ -33,7 +33,7 @@ Examples:
33
33
  include Trepan::Frame
34
34
 
35
35
  # This method runs the command
36
- def run(args) # :nodoc
36
+ def run(args)
37
37
  unless @proc.frame
38
38
  errmsg 'No frame.'
39
39
  return false
@@ -54,7 +54,7 @@ Examples:
54
54
  opts[:count] =
55
55
  if args.size > 1
56
56
  opts[:maxstack] = @proc.get_int(args[1],
57
- :cmdname => 'where',
57
+ :cmdname => self.name,
58
58
  :max_value => stack_size)
59
59
  else
60
60
  stack_size
@@ -73,23 +73,22 @@ if __FILE__ == $0
73
73
  # Demo it.
74
74
  require 'thread_frame'
75
75
  require_relative '../mock'
76
- name = File.basename(__FILE__, '.rb')
77
- dbgr, cmd = MockDebugger::setup(name)
76
+ dbgr, cmd = MockDebugger::setup
78
77
 
79
78
  def run_cmd(cmd, args)
80
79
  cmd.run(args)
81
80
  puts '=' * 40
82
81
  end
83
82
 
84
- run_cmd(cmd, [name])
83
+ run_cmd(cmd, [cmd.name])
85
84
 
86
- %w(1 100).each {|count| run_cmd(cmd, [name, count])}
85
+ %w(1 100).each {|count| run_cmd(cmd, [cmd.name, count])}
87
86
  cmd.settings[:basename] = true
88
87
  def foo(cmd, name)
89
88
  cmd.proc.frame_setup(RubyVM::ThreadFrame::current)
90
- run_cmd(cmd, [name])
89
+ run_cmd(cmd, [cmd.name])
91
90
  end
92
- foo(cmd, name)
91
+ foo(cmd, cmd.name)
93
92
  cmd.settings[:show_pc] = true
94
- 1.times {run_cmd(cmd, [name])}
93
+ 1.times {run_cmd(cmd, [cmd.name])}
95
94
  end
@@ -77,6 +77,10 @@ class Trepan
77
77
  self.class.const_get(name)
78
78
  end
79
79
 
80
+ def name
81
+ self.class.const_get(:NAME)
82
+ end
83
+
80
84
  # The method that implements the debugger command.
81
85
  def run(*args)
82
86
  raise RuntimeError, 'You need to define this method elsewhere'