Permalink
Browse files

Merge branch 'ruby-2.1'

  • Loading branch information...
2 parents 0a64e2b + 2990ff1 commit dab44a65144dcad3b9529bc1b8df6b3683f61ec2 @rocky committed Mar 6, 2015
View
@@ -1,7 +1,37 @@
+2015-03-05 rocky <rockyb@rubyforge.org>
+
+ * Rakefile, app/options.rb, trepanning.gemspec: Get ready for
+ release 2.15.3
+
+2015-03-05 rocky <rockyb@rubyforge.org>
+
+ * trepanning.gemspec: Bang on 2.1.5 packaging a little.
+
+2015-03-05 rocky <rockyb@rubyforge.org>
+
+ * processor/command/source.rb, processor/command/step.rb,
+ test/integration/test-debug.rb: Small bugs, add step markdown.
+
+2015-03-04 rocky <rockyb@rubyforge.org>
+
+ * test/data/debug.cmd, test/data/debug.right,
+ test/integration/test-debug.rb: Add "debug" command test
+
+2015-03-03 rocky <rockyb@rubyforge.org>
+
+ * processor/command/debug.rb: Reinstate debug command. Runtime
+ support will go in next ruby-debugger-runtime patch update.
+
+2015-03-03 rocky <rockyb@rubyforge.org>
+
+ * processor/validate.rb, trepanning.gemspec: validate: got test
+ backwards gemspec: need to list dependencies even if they are in
+ patched tarball
+
2015-03-03 rocky <rockyb@rubyforge.org>
- * NEWS, README.md, Rakefile, trepanning.gemspec: Get ready for
- release 0.3.0
+ * ChangeLog, NEWS, README.md, Rakefile, trepanning.gemspec: Get
+ ready for release 0.3.0
2015-02-14 rocky <rockyb@rubyforge.org>
View
18 NEWS
@@ -1,6 +1,20 @@
-(0.2.0) Mar 3, 2015
+(2.15.3) Mar 5, 2015
+- Make it work on a patched Ruby 2.1.5 with runtime debugger support
+ This means:
+ * high-speed breakpoints, "step over" (next), and "step out" (finish)
+ * when stopped in a C function, we can get parameter values
+ * the source location of C functions is memory address (gdb can
+ use this)
+ * VM inspection, including sp, pc, instruction sequences,
+ and local table
+ * can change return values in Ruby code, often
+ * can see/set the runtime event masks debugger triggers on
+ * can get the eval string when stopped in an eval()
+- Help text is rendered via redcloth/markdown
+- When we are in a raise event which is non-local, indicate that
+- Remove aliases 'd' and 'u' for "down" and "up"; gdb has different meanings for
+ these letters
-- Make it work on Ruby 2.1.5
(0.1.6) Nov 25, 2012
- Make it work on Ruby 1.9.3 p327
- Incompatible change: Remove aliases 'd' and 'u' for down and up
View
@@ -2,16 +2,32 @@
# -*- Ruby -*-
require 'rubygems'
require 'rbconfig'
-raise RuntimeError,
-'This package is for MRI Ruby 2.1.5 with debugger runtime support!\nDownload from ' +
-'http://downloads.sourceforge.net/project/ruby-debugger-runtime/ruby-2.1/ruby-2.1.5-p273-debugger-1.0.tar.gz' unless
- defined? RubyVM::Frame and RbConfig::CONFIG.member?('rb-threadframe')
-ROOT_DIR = File.dirname(__FILE__)
GEM_PROG = ENV['GEM_PROG'] || 'gem'
+ROOT_DIR = File.dirname(__FILE__)
Gemspec_filename='trepanning.gemspec'
require_relative './app/options'
+unless defined? RubyVM::Frame and RbConfig::CONFIG.member?('rb-threadframe')
+ raise RuntimeError,
+ 'This package is for MRI Ruby 2.1.5 with debugger runtime support!\nDownload from ' +
+ 'http://downloads.sourceforge.net/project/ruby-debugger-runtime/ruby-2.1/'
+end
+
+ruby_version = RbConfig::CONFIG['RUBY_PROGRAM_VERSION']
+if ruby_version == '1.9.3'
+ raise RuntimeError,
+ "This is version trepanning #{Trepan::VERSION}. " +
+ "Ruby #{ruby_version} you want version 1.93..."
+elsif ruby_version == '1.9.2'
+ raise RuntimeError,
+ "This is version trepanning #{Trepan::VERSION}. " +
+ "Ruby #{ruby_version} you want version 1.92..."
+elsif ruby_version != '2.1.5'
+ raise RuntimeError,
+ "This package only works on version Ruby version 2.1.5. You have #{ruby_version}."
+end
+
def gemspec
@gemspec ||= eval(File.read(Gemspec_filename), binding, Gemspec_filename)
end
View
@@ -8,7 +8,7 @@
class Trepan
require_relative 'default'
- VERSION = '0.3'
+ VERSION = '2.15.30'
PROGRAM = 'trepan'
def self.show_version
View
@@ -28,44 +28,26 @@ def run(args)
stack_diff = RubyVM::Frame.stack_size - frame.stack_size
- # Ignore tracing in support routines:
- # FIXME remvoe 1.9.3 hack
- if '1.9.3' != RUBY_VERSION
- tf = @proc.dbgr.trace_filter
- [self.method(:run), @proc.method(:debug_eval),
- @proc.method(:debug_eval_with_exception),
- @proc.method(:get_binding_and_filename),
- @proc.method(:fake_eval_filename)].each do |m|
- tf << m unless tf.member?(m)
- end
- end
-
@proc.hidelevels[th] += stack_diff + EXTRA_DEBUG_SETUP_CALLS
# Values we need to save before munging them
- old_tracing = th.tracing
- old_exec_event_tracing = th.exec_event_tracing?
old_mutex = @proc.core.mutex
old_next_level = @proc.next_level
old_step_count = @proc.core.step_count
- section 'ENTERING NESTED DEBUGGER'
# Things we need to do to allow entering the debugger again
@proc.debug_nest += 1
@proc.core.mutex = Mutex.new
- th.tracing = false
- th.exec_event_tracing = false
@proc.next_level = 32000
- RubyVM::Frame.current.trace_off = false
@proc.core.step_count = 0
- retval = @proc.debug_eval(arg_str, 15,
- RUBY_VERSION == '1.9.3') # FIXME
+ section 'ENTERING NESTED DEBUGGER'
+ old_trace_arg = RubyVM::TraceArg.save
+ retval = @proc.debug_eval(arg_str, 15)
# Restore munged values
- th.exec_event_tracing = old_exec_event_tracing
- th.tracing = old_tracing
+ RubyVM::TraceArg.restore(old_trace_arg)
@proc.core.mutex = old_mutex
@proc.frame_setup(frame)
@proc.hidelevels[th] = hidelevels
@@ -12,7 +12,7 @@ class Trepan::Command::SourceCommand < Trepan::Command
unless defined?(HELP)
NAME = File.basename(__FILE__, '.rb')
HELP = <<-HELP
-8*#{NAME}** [*options*] *file*
+**#{NAME}** [*options*] *file*
options:
View
@@ -1,67 +1,75 @@
# -*- coding: utf-8 -*-
-# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
+# Copyright (C) 2010, 2015 Rocky Bernstein <rockyb@rubyforge.net>
require_relative '../command'
require_relative '../../app/condition'
class Trepan::Command::StepCommand < Trepan::Command
unless defined?(HELP)
NAME = File.basename(__FILE__, '.rb')
HELP = <<-HELP
-#{NAME}[+|=|-|<|>|!|<>] [into] [EVENT-NAME...] [count]
-#{NAME} until EXPRESSION
-#{NAME} thread
-#{NAME} to METHOD-NAME
-#{NAME} over
-#{NAME} out
+**#{NAME}**[**+**|**=**|**-**|**<**|**>**|**!**|**<>**] [**into**] [*event-name*...] [*count*]
+
+**#{NAME} until** *expression*
+
+**#{NAME} thread**
+
+**#{NAME} to** *method-name*
+
+**#{NAME} over**
+
+**#{NAME} out**
Execute the current line, stopping at the next event. Sometimes this
is called 'step into'.
-With an integer argument, step that many times. With an 'until'
+With an integer argument, step that many times. With an *until*
expression that expression is evaluated and we stop the first time it
is true.
-EVENT-NAME... is list of an event name which is one on 'call',
-'return', 'line', 'exception' 'c-call', 'c-return' or 'c-exception'.
+*event-name*... is list of an event name which is one on *call*,
+*return*, *line*, *exception* *c-call*, *c-return* or *c-exception*.
If specified, only those stepping events will be considered. If no
list of event names is given, then any event triggers a stop when the
count is 0.
-There is however another way to specify an *single* EVENT-NAME, by
-suffixing one of the symbols '<', '>', or '!' after the command or on
-an alias of that. A suffix of '+' on a command or an alias forces a
-move to another position, while a suffix of '-' disables this
-requirement. A suffix of '>' will continue until the next
-call. ('finish' will run run until the return for that call.)
+There is however another way to specify an single *event-name*, by
+suffixing one of the symbols `<`, `>`, or `!` after the command or on
+an alias of that. A suffix of `+` on a command or an alias forces a
+move to another position, while a suffix of `-` disables this
+requirement. A suffix of `>'`will continue until the next
+call. (`finish` will run run until the return for that call.)
If no suffix is given, the debugger setting 'different' determines
this behavior.
Examples:
- #{NAME} # step 1 event, *any* event obeying 'set different' setting
- #{NAME} 1 # same as above
- #{NAME}+ # same but force stopping on a new line
- #{NAME}= # same but force stopping on a new line a new frame added
- #{NAME}- # same but force stopping on a new line a new frame added
- #{NAME} 5/5+0 # same as above
- #{NAME} line # step only line events
- #{NAME} call # step only call call events
- #{NAME}> # step call and c-call events
- #{NAME}< # step only return and c-return events
- #{NAME} call line # step line *and* call events
- #{NAME}<> # same as step call c-call return c-return
- #{NAME} until a > b
- #{NAME} over # same as 'next'
- #{NAME} out # same as 'finish'
- #{NAME} thread # step stopping only in the current thread. Is the same
- # as step until Thread.current.object_id == #object_id
-
-Related and similar is the 'next' (step over) and 'finish' (step out)
+--------
+
+ #{NAME} # step 1 event, *any* event obeying 'set different' setting
+ #{NAME} 1 # same as above
+ #{NAME}+ # same but force stopping on a new line
+ #{NAME}= # same but force stopping on a new line a new frame added
+ #{NAME}- # same but force stopping on a new line a new frame added
+ #{NAME} 5/5+0 # same as above
+ #{NAME} line # step only line events
+ #{NAME} call # step only call call events
+ #{NAME}> # step call and c-call events
+ #{NAME}< # step only return and c-return events
+ #{NAME} call line # step line *and* call events
+ #{NAME}<> # same as step call c-call return c-return
+ #{NAME} until a > b
+ #{NAME} over # same as 'next'
+ #{NAME} out # same as 'finish'
+ #{NAME} thread # step stopping only in the current thread. Is the same
+ # as step until Thread.current.object_id == #object_id
+
+Related and similar is the `next` (step over) and `finish` (step out)
commands. All of these are slower than running to a breakpoint.
-See also the commands:
-'skip', 'jump' (there's no 'hop' yet), 'continue', 'return' and
-'finish' for other ways to progress execution.
+See also:
+---------
+`skip`, `jump` (there's no 'hop' yet), `continue`, `return` and
+`finish` for other ways to progress execution.
HELP
ALIASES = %w(s step+ step- step< step> step<> step! s> s< s+ s-
View
@@ -39,7 +39,7 @@ def text_file?(file)
bytes = 4096 if bytes > 4096
s = (File.read(file, bytes) || "")
s = s.encode('US-ASCII', :undef => :replace).split(//)
- return ((s.size - s.grep(" ".."~").size) / s.size.to_f) > 0.90
+ return (s.grep(" ".."~").size.to_f / s.size.to_f) > 0.85
end
# Check that arg is an Integer between opts[:min_value] and
View
@@ -0,0 +1,8 @@
+# ***************************************************
+# Test debug command. To be used with gcd.rb
+# ***************************************************
+next
+debug gcd(2,2)
+info locals
+quit!
+quit!
View
@@ -0,0 +1,13 @@
+line (gcd.rb:4 @2)
+def gcd(a, b)
+line (gcd.rb:18 @15)
+a, b = ARGV[0..1].map {|arg| arg.to_i}
+ENTERING NESTED DEBUGGER
+------------------------
+call (gcd.rb:6 @2)
+if a > b
+Local variables for METHOD Object#gcd(a, b):
+--------------------------------------------
+2: b = 2 (Fixnum)
+3: a = 2 (Fixnum)
+trepan: That's all, folks...
@@ -0,0 +1,12 @@
+#!/usr/bin/env ruby
+require 'test/unit'
+require_relative 'helper'
+require 'rbconfig'
+
+class TestDebug < Test::Unit::TestCase
+ @@NAME = File.basename(__FILE__, '.rb')[5..-1]
+ def test_trepan_debug
+ opts = {:args => '3 5', :verbose=>true}
+ assert_equal(true, run_debugger(@@NAME, 'gcd.rb', opts))
+ end
+end
View
@@ -10,13 +10,19 @@ Gem::Specification.new do |spec|
spec.authors = ['R. Bernstein']
spec.date = Time.now
spec.description = <<-EOF
-A modular, testable, Ruby debugger using some of the best ideas from ruby-debug, other debuggers, and Ruby Rails.
+A Ruby debugger with both high and low-level debugging support.
-Some of the core debugger concepts have been rethought.
+To provide the advanced features this version works only with a
+patched MRI Ruby 2.1.5 runtime.
-This version works only with a patched version of Ruby 2.1.
+This version works only with a patched version of Ruby 2.1.5
+For a version that works with Ruby 1.9.3 look install a version
+starting with 1.93.
EOF
spec.add_dependency('redcarpet', '~> 3.2')
+ spec.add_dependency('columnize', '~> 0.9')
+ spec.add_dependency('rb-threadframe', '~> 0.50')
+ spec.add_dependency('linecache-tf', '~> 1.2')
spec.add_development_dependency('diff-lcs', '~> 0') # For testing only
spec.author = 'R. Bernstein'
spec.bindir = 'bin'
@@ -30,7 +36,7 @@ EOF
spec.platform = Gem::Platform::RUBY
spec.required_ruby_version = '~> 2.1.5'
spec.require_path = 'lib'
- spec.summary = 'Ruby Debugger for enhanced Ruby runtime'
+ spec.summary = 'Enhanced Ruby 2.1 Debugger'
spec.version = Trepan::VERSION
# Make the readme file the start page for the generated html

0 comments on commit dab44a6

Please sign in to comment.