trepanning 0.1.1 → 0.1.2

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.
data/ChangeLog CHANGED
@@ -1,3 +1,45 @@
1
+ 2011-03-23 rocky <rockyb@rubyforge.org>
2
+
3
+ * app/core.rb, app/frame.rb, processor/command/edit.rb,
4
+ processor/command/info_subcmd/files.rb: Add frame.file. Fix up
5
+ "edit" command demo code.
6
+
7
+ 2011-03-23 rocky <rockyb@rubyforge.org>
8
+
9
+ * processor/command/edit.rb, processor/command/eval.rb: Add "edit"
10
+ command
11
+
12
+ 2011-03-17 rocky <rockyb@rubyforge.org>
13
+
14
+ Merge branch 'master' of github.com:rocky/rb-trepanning
15
+
16
+ 2011-03-17 rocky <rockyb@rubyforge.org>
17
+
18
+ * Rakefile, app/options.rb, app/run.rb, bin/trepan,
19
+ test/integration/helper.rb, test/unit/test-app-run.rb,
20
+ test/unit/test-bin-trepan.rb: Trepan::ruby_path -> RbConfig.ruby
21
+
22
+ 2011-03-15 rocky <rockyb@rubyforge.org>
23
+
24
+ Dependency administrivia
25
+
26
+ 2011-03-15 rocky <rockyb@rubyforge.org>
27
+
28
+ * trepanning.gemspec: Remove mention of intermediate dev's in
29
+ dependency.
30
+
31
+ 2011-03-15 rocky <rockyb@rubyforge.org>
32
+
33
+ Merge branch 'master' of github.com:rocky/rb-trepanning
34
+
35
+ 2011-03-15 rocky <rockyb@rubyforge.org>
36
+
37
+ * app/options.rb, trepanning.gemspec: Get ready for release 1.1
38
+
39
+ 2011-03-15 rocky <rockyb@rubyforge.org>
40
+
41
+ * ChangeLog, NEWS: Get ready for release.
42
+
1
43
  2011-03-12 rocky <rockyb@rubyforge.org>
2
44
 
3
45
  * processor/command/help/command.txt, trepanning.gemspec: tabke ->
@@ -101,6 +143,10 @@
101
143
  All functional, integration and unit tests work again after KPEG
102
144
  refactoring
103
145
 
146
+ 2011-03-07 rocky <rockyb@rubyforge.org>
147
+
148
+ * processor/main.rb: Handle error when errmsg is borked
149
+
104
150
  2011-03-07 rocky <rockyb@rubyforge.org>
105
151
 
106
152
  * app/file.rb, app/iseq.rb, processor/command/break.rb,
data/NEWS CHANGED
@@ -1,4 +1,8 @@
1
- March 15, 2011 (0.0.6)
1
+ March 28, 2011 (0.1.2)
2
+ - Release to correct threadrame and trace package dependencies
3
+ - add "edit" command
4
+
5
+ March 15, 2011 (0.1.1)
2
6
  - Revise breakpoint location parsing
3
7
  * Add: break <location> if/unless <condition>
4
8
  * Add: step until <condition>
@@ -12,8 +16,6 @@ March 15, 2011 (0.0.6)
12
16
  * trailing "then", "do"
13
17
  - Save and restore some debugger state across a restart
14
18
  - Redo command completion
15
-
16
- Feb 15, 2011 (0.0.5)
17
19
  - "disassemble" command: allow disassembly of specified line numbers
18
20
  - GNU Readline:
19
21
  * Start GNU readline tab (command) completion.
data/Rakefile CHANGED
@@ -41,13 +41,11 @@ desc "same as test"
41
41
  task :check => :test
42
42
 
43
43
  require 'rbconfig'
44
- RUBY_PATH = File.join(RbConfig::CONFIG['bindir'],
45
- RbConfig::CONFIG['RUBY_INSTALL_NAME'])
46
44
 
47
45
  def run_standalone_ruby_files(list)
48
46
  puts '*' * 40
49
47
  list.each do |ruby_file|
50
- system(RUBY_PATH, ruby_file)
48
+ system(RbConfig.ruby, ruby_file)
51
49
  p $?.exitstatus
52
50
  break if $?.exitstatus != 0 && !opts[:continue]
53
51
  end
@@ -58,7 +56,7 @@ def run_standalone_ruby_file(directory, opts={})
58
56
  Dir.chdir(directory) do
59
57
  Dir.glob('*.rb').each do |ruby_file|
60
58
  puts(('-' * 20) + ' ' + ruby_file + ' ' + ('-' * 20))
61
- system(RUBY_PATH, ruby_file)
59
+ system(RbConfig.ruby, ruby_file)
62
60
  break if $?.exitstatus != 0 && !opts[:continue]
63
61
  end
64
62
  end
@@ -170,7 +168,7 @@ end
170
168
 
171
169
  task :check => %w(check:lib check:processor check:commands).map{|c| c.to_sym}
172
170
 
173
- desc "Test everything - same as test."
171
+ desc "Default action is same as 'test'."
174
172
  task :default => :test
175
173
 
176
174
  desc "Generate the gemspec"
data/app/cmd_parse.rb CHANGED
@@ -131,7 +131,7 @@ class Trepan
131
131
  parse ? parse.result : nil
132
132
  end
133
133
 
134
- def parse_list(str)
134
+ def parse_list_cmd(str)
135
135
  parse = parse_terminal(:_list_stmt, str)
136
136
  parse ? parse.result : nil
137
137
  end
data/app/core.rb CHANGED
@@ -114,7 +114,7 @@ class Trepan
114
114
  @hook_arg = arg
115
115
 
116
116
  ### debug:
117
- ### puts "#{frame.source_container[1]}:#{frame.source_location[0]}:in `#{frame.method}' #{event}" # if %w(line).member?(event)
117
+ ### puts "#{frame.file[1]}:#{frame.source_location[0]}:in `#{frame.method}' #{event}" # if %w(line).member?(event)
118
118
  @processor.process_commands(@frame)
119
119
 
120
120
  # FIXME: There should be a Trace.event_mask which should return the first
data/app/frame.rb CHANGED
@@ -16,6 +16,8 @@ class Trepan
16
16
 
17
17
  include Trepan::Util
18
18
 
19
+ module_function
20
+
19
21
  def all_param_names(iseq, delineate=true)
20
22
  return '' unless iseq
21
23
  params = param_names(iseq, 0, iseq.argc-1, '')
@@ -75,7 +77,10 @@ class Trepan
75
77
  retval = $1 if retval =~ /^\(eval "(.+)"\)/
76
78
  retval
77
79
  end
78
- module_function :eval_string
80
+
81
+ def file
82
+ source_container[1]
83
+ end
79
84
 
80
85
  def format_stack_call(frame, opts)
81
86
  # FIXME: prettify
data/app/options.rb CHANGED
@@ -8,7 +8,7 @@ require 'optparse'
8
8
  class Trepan
9
9
  require_relative 'default'
10
10
 
11
- Trepan::VERSION = '0.1.1'
11
+ Trepan::VERSION = '0.1.2'
12
12
  Trepan::PROGRAM = 'trepan'
13
13
 
14
14
  def self.show_version
data/app/run.rb CHANGED
@@ -14,7 +14,7 @@ module Trepanning
14
14
  # Make sure Ruby script syntax checks okay.
15
15
  # Otherwise we get a load message that looks like trepanning has
16
16
  # a problem.
17
- output = `#{ruby_path} -c #{program_to_debug.inspect} 2>&1`
17
+ output = `#{RbConfig.ruby} -c #{program_to_debug.inspect} 2>&1`
18
18
  if $?.exitstatus != 0 and RUBY_PLATFORM !~ /mswin/
19
19
  puts output
20
20
  exit $?.exitstatus
@@ -49,11 +49,6 @@ module Trepanning
49
49
  untrace_var(:$0, dollar_0_tracker)
50
50
  end
51
51
 
52
- # Path name of Ruby interpreter we were invoked with.
53
- def ruby_path
54
- File.join(%w(bindir RUBY_INSTALL_NAME).map{|k| RbConfig::CONFIG[k]})
55
- end
56
-
57
52
  # Do a shell-like path lookup for prog_script and return the results.
58
53
  # If we can't find anything return prog_script.
59
54
  def whence_file(prog_script)
@@ -75,5 +70,4 @@ if __FILE__ == $0
75
70
  include Trepanning
76
71
  puts whence_file('irb')
77
72
  puts whence_file('probably-does-not-exist')
78
- puts ruby_path
79
73
  end
data/bin/trepan CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
3
3
  # Invoke debugger from the command line.
4
+ require 'rbconfig' # For RbConfig.ruby
4
5
  require_relative '../app/run'
5
6
  require_relative '../app/options'
6
7
  require_relative '../app/client'
@@ -33,7 +34,6 @@ if File.basename(__FILE__) == File.basename($0)
33
34
 
34
35
  # FIXME: do we need to test defined?
35
36
  # FIXME: Should (some of) these be instance variables?
36
- Trepan::RUBY_PATH = ruby_path
37
37
  Trepan::TREPAN_PATH = trepan_path
38
38
 
39
39
  if ARGV.empty?
@@ -61,7 +61,7 @@ if File.basename(__FILE__) == File.basename($0)
61
61
 
62
62
  # Set global so others may use this debugger.
63
63
  $trepan = Trepan.new(opts)
64
- debug_program($trepan, Trepan::RUBY_PATH,
64
+ debug_program($trepan, RbConfig.ruby,
65
65
  File.expand_path(program_to_debug))
66
66
  end
67
67
  end
@@ -0,0 +1,52 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
3
+ require_relative './base/cmd'
4
+
5
+ class Trepan::Command::EditCommand < Trepan::Command
6
+
7
+ old_verbose = $VERBOSE
8
+ $VERBOSE = nil
9
+ NAME = File.basename(__FILE__, '.rb')
10
+ HELP = <<-HELP
11
+ #{NAME} [LOCATION]
12
+
13
+ With no argument, edits file containing most recent line listed.
14
+
15
+ Editing targets can also be specified.
16
+ HELP
17
+
18
+ ALIASES = %w(e)
19
+ CATEGORY = 'files'
20
+ NEED_STACK = false
21
+ SHORT_HELP = 'Edit specified file or function'
22
+ $VERBOSE = old_verbose
23
+
24
+ def run(args)
25
+ if args.size == 1
26
+
27
+ unless true # @state.context
28
+ errmsg "We are not in a state that has an associated file.\n"
29
+ return
30
+ end
31
+ else
32
+ text = @proc.cmd_argstr
33
+ end
34
+ editor = ENV['EDITOR'] || '/bin/ex'
35
+ file = @proc.frame.file
36
+ if File.readable?(file)
37
+ edit_cmd = "#{editor} +#{@proc.frame.line} \"#{file}\""
38
+ msg "Running #{edit_cmd}..."
39
+ system(edit_cmd)
40
+ msg "Warning: return code was #{$?.exitstatus}" if $?.exitstatus != 0
41
+ else
42
+ errmsg "File \"#{file}\" is not readable.\n"
43
+ end
44
+ end
45
+ end
46
+
47
+ if __FILE__ == $0
48
+ require_relative '../mock'
49
+ dbgr, cmd = MockDebugger::setup
50
+ dbgr, cmd = MockDebugger::setup
51
+ cmd.run [cmd.name] if ARGV.size > 0
52
+ end
@@ -6,7 +6,7 @@ class Trepan::Command::EvalCommand < Trepan::Command
6
6
 
7
7
  old_verbose = $VERBOSE
8
8
  $VERBOSE = nil
9
- NAME = File.basename(__FILE__, '.rb')
9
+ NAME = File.basename(__FILE__, '.rb')
10
10
  HELP = <<-HELP
11
11
  #{NAME} [STRING]
12
12
 
@@ -84,7 +84,7 @@ EOH
84
84
  return false
85
85
  nil
86
86
  else
87
- frame_file = @proc.frame.source_container[1]
87
+ frame_file = @proc.frame.file
88
88
  LineCache::map_file(frame_file) || File.expand_path(frame_file)
89
89
  end
90
90
  else
@@ -281,7 +281,7 @@ class Trepan
281
281
  get_method(meth)
282
282
  end
283
283
 
284
- # parse_position(self, arg)->(meth, filename, offset, offset_type)
284
+ # parse_position(self)->(meth, filename, offset, offset_type)
285
285
  # See app/cmd_parser.kpeg for the syntax of a position which
286
286
  # should include things like:
287
287
  # Parse arg as [filename:]lineno | function | module
@@ -1,6 +1,5 @@
1
1
  require 'diff/lcs'
2
2
  require 'fileutils'
3
- require_relative '../../app/run' # for ruby_path
4
3
 
5
4
  DEFAULT_DEBUGGER_OPTS = {
6
5
  :args => '',
@@ -36,10 +35,10 @@ def run_debugger(testname, ruby_file, opts={})
36
35
  cmd +=
37
36
  if opts[:standalone]
38
37
  "%s %s %s >%s 2>&1" %
39
- [Trepanning::ruby_path, programfile, opts[:args], outfile]
38
+ [RbConfig.ruby, programfile, opts[:args], outfile]
40
39
  else
41
40
  "%s %s --nx --command %s %s '%s' %s >%s 2>&1" %
42
- [Trepanning::ruby_path, dbgr_path, cmdfile, opts[:dbgr],
41
+ [RbConfig.ruby, dbgr_path, cmdfile, opts[:dbgr],
43
42
  programfile, opts[:args], outfile]
44
43
  end
45
44
  puts cmd if opts[:verbose]
@@ -8,8 +8,6 @@ class TestAppRun < Test::Unit::TestCase
8
8
  assert_equal(true, File.executable?(whence_file('irb')))
9
9
  ng = whence_file('probably-does-not-exist')
10
10
  assert_equal(true, File.executable?(ng) || ng == 'probably-does-not-exist')
11
- rp = ruby_path
12
- assert_equal(true, File.executable?(rp))
13
11
  end
14
12
 
15
13
  end
@@ -8,23 +8,6 @@ class TestBinTrepan < Test::Unit::TestCase
8
8
 
9
9
  include Trepanning
10
10
 
11
- def test_ruby_path
12
- rb_path = ruby_path
13
- assert_equal(true, File.executable?(rb_path),
14
- "#{rb_path} should be an executable Ruby interpreter")
15
-
16
- # Let us test that we get *exactly* the same configuration as we
17
- # have in this. I'm a ball buster.
18
- cmd = "#{rb_path} -rrbconfig -e 'puts Marshal.dump(RbConfig::CONFIG)'"
19
- rb_config = Marshal.load(`#{cmd}`)
20
- assert_equal(RbConfig::CONFIG, rb_config,
21
- "#{rb_path} config doesn't match got:
22
- #{rb_config.pretty_inspect}
23
- expected:
24
- #{RbConfig::CONFIG.pretty_inspect}
25
- ")
26
- end
27
-
28
11
  def test_whence_file
29
12
  abs_path_me = File.expand_path(__FILE__)
30
13
  assert_equal(abs_path_me, whence_file(abs_path_me),
data/trepanning.gemspec CHANGED
@@ -18,9 +18,9 @@ This version works only with a patched version of Ruby 1.9.2 and rb-threadframe.
18
18
 
19
19
  See also rbx-trepanning for a version that works with Rubinius.
20
20
  EOF
21
- spec.add_dependency('rb-threadframe', '~> 0.38')
21
+ spec.add_dependency('rb-threadframe', '>= 0.38')
22
22
  spec.add_dependency('rb-trace', '>= 0.4')
23
- spec.add_dependency('linecache-tf', '~> 1.0.dev')
23
+ spec.add_dependency('linecache-tf', '>= 1.0')
24
24
  spec.add_dependency('columnize')
25
25
  spec.add_dependency('diff-lcs') # For testing only
26
26
  spec.author = 'R. Bernstein'
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 1
9
- version: 0.1.1
8
+ - 2
9
+ version: 0.1.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - R. Bernstein
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-03-15 00:00:00 -04:00
17
+ date: 2011-03-28 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -23,7 +23,7 @@ dependencies:
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
24
  none: false
25
25
  requirements:
26
- - - ~>
26
+ - - ">="
27
27
  - !ruby/object:Gem::Version
28
28
  segments:
29
29
  - 0
@@ -51,13 +51,12 @@ dependencies:
51
51
  requirement: &id003 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
- - - ~>
54
+ - - ">="
55
55
  - !ruby/object:Gem::Version
56
56
  segments:
57
57
  - 1
58
58
  - 0
59
- - dev
60
- version: 1.0.dev
59
+ version: "1.0"
61
60
  type: :runtime
62
61
  version_requirements: *id003
63
62
  - !ruby/object:Gem::Dependency
@@ -182,6 +181,7 @@ files:
182
181
  - processor/command/disassemble.rb
183
182
  - processor/command/display.rb
184
183
  - processor/command/down.rb
184
+ - processor/command/edit.rb
185
185
  - processor/command/enable.rb
186
186
  - processor/command/eval.rb
187
187
  - processor/command/exit.rb
@@ -424,7 +424,7 @@ rdoc_options:
424
424
  - --main
425
425
  - README
426
426
  - --title
427
- - Trepan 0.1.1 Documentation
427
+ - Trepan 0.1.2 Documentation
428
428
  require_paths:
429
429
  - lib
430
430
  required_ruby_version: !ruby/object:Gem::Requirement