Skip to content

Commit

Permalink
Merge pull request #3 from rocky/ruby-2.1
Browse files Browse the repository at this point in the history
Ruby 2.1
  • Loading branch information
rocky committed Feb 7, 2015
2 parents def5366 + 0b38b08 commit 7e36141
Show file tree
Hide file tree
Showing 160 changed files with 4,564 additions and 3,983 deletions.
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,4 +1,4 @@
Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.org>
Copyright (C) 2010, 2015 Rocky Bernstein <rockyb@rubyforge.org>
All rights reserved.
*
Redistribution and use in source and binary forms, with or without
Expand Down
27 changes: 5 additions & 22 deletions README.md
@@ -1,4 +1,4 @@
The trepanning debugger gdb-like debugger. As such, it is both a high-level and low-level debugger. It is a also a rewrite of *ruby-debug*. But to provide all of the functionality that it has, it requires a patched version of MRI Ruby 1.9.3 or 1.9.2 found the [rb-threadframe project](https://rocky/rb-threadframe). The additional run-time support in the MRI is what gives this some debugger power that you won't find in other MRI 1.9 debuggers.
The trepanning debugger gdb-like debugger. As such, it is both a high-level and low-level debugger. It is a also a rewrite of *ruby-debug*. But to provide all of the functionality that it has, it requires a patched version of MRI Ruby 2,1, 1.9.3 or 1.9.2 found the [ruby-debugger-runtime project](https://sourceforge.net/projects/ruby-debugger-runtime/). The additional run-time support in the MRI is what gives this powerful features that you won't find in other MRI 2.1 or 1.9 debuggers that don't use this runtime.

See the [installation instructions](https://github.com/rocky/rb-trepanning/wiki/How-to-Install-rb-trepanning).

Expand Down Expand Up @@ -36,27 +36,10 @@ The return value from Trepan is the return value of the block, i.e. the final va
You can run the same thing inside your Ruby program, but probably you don't want to give a block. Instead, you may want to have debugging start on the next statement in the code:

```ruby
require 'trepan'
Trepan.debug # Don't stop here...
work # but stop here.
require 'trepanning'
...
debugger # stop here
```

The above is really shorthand for something like:

```ruby
$trepan = Trepan.new
$trepan.debugger
```

The global variable *$trepan* set holds debugger settings, such as `autolist` or `autoeval` settings and breakpoint information.

Due to the line-event orientation in ruby-debug, it occasionally was convenient to add a synchronous stop in your program. I don't think that will be necessary here, but if you do call to the debugger at the point of the call rather than the subsequent stopping point, set opts[:immediate] to true. Example:

```ruby

# ... work, work, work
mydbg.debugger(:immediate=>true) # enter debugger here
# ... work, work, work
```

There is extensive on-line help. Run `help` inside the debugger.
There is extensive on-line help, much in markdown format that displays nicely in a terminal. Run `help` inside the debugger.
24 changes: 15 additions & 9 deletions Rakefile
Expand Up @@ -3,6 +3,7 @@
require 'rubygems'

ROOT_DIR = File.dirname(__FILE__)
GEM_PROG = ENV['GEM_PROG'] || 'gem'
Gemspec_filename='trepanning.gemspec'
require_relative './app/options'

Expand All @@ -15,7 +16,7 @@ desc "Build the gem"
task :package=>:gem
task :gem=>:gemspec do
Dir.chdir(ROOT_DIR) do
sh "gem build #{Gemspec_filename}"
sh "#{GEM_PROG} build #{Gemspec_filename}"
FileUtils.mkdir_p 'pkg'
FileUtils.mv gemspec.file_name, 'pkg'
end
Expand All @@ -24,7 +25,7 @@ end
desc 'Install the gem locally'
task :install => :gem do
Dir.chdir(ROOT_DIR) do
sh %{gem install --local pkg/#{gemspec.file_name}}
sh %{#{GEM_PROG} install --local pkg/#{gemspec.file_name}}
end
end

Expand Down Expand Up @@ -96,7 +97,7 @@ task :test do
e
end
end.compact

exceptions.each {|e| puts e;puts e.backtrace }
raise 'Test failures' unless exceptions.empty?
end
Expand Down Expand Up @@ -145,6 +146,11 @@ task :'check:functional' do
run_standalone_ruby_file(File.join(%W(#{ROOT_DIR} test functional)))
end

desc 'Run integration tests in standalone mode.'
task :'check:functional' do
run_standalone_ruby_file(File.join(%W(#{ROOT_DIR} test ingtegration)))
end

desc 'Run command parser grammar.'
task :'check:cmd_parse' do
sh "kpeg --test --debug #{File.join(ROOT_DIR, %w(app cmd_parse.kpeg))}"
Expand All @@ -153,12 +159,12 @@ end
desc 'Generate command parser.'
task :'cmd_parse' do
require 'tmpdir'
temp_file =
File.join(Dir.tmpdir,
temp_file =
File.join(Dir.tmpdir,
Dir::Tmpname.make_tmpname(['cmd_parser_', '.rb'], nil))

sh("kpeg --name CmdParse --verbose --stand-alone " +
"#{File.join(ROOT_DIR, %w(app cmd_parse.kpeg))} " +
sh("kpeg --name CmdParse --verbose --stand-alone " +
"#{File.join(ROOT_DIR, %w(app cmd_parse.kpeg))} " +
"--output #{temp_file}")
end

Expand Down Expand Up @@ -188,7 +194,7 @@ Rake::RDocTask.new("rdoc") do |rdoc|
rdoc.rdoc_dir = 'doc'
rdoc.title = "Trepanning #{Trepan::VERSION} Documentation"

rdoc.rdoc_files.include(%w(lib/*.rb
rdoc.rdoc_files.include(%w(lib/*.rb
app/*.rb intf/*.rb io/*.rb
bin/trepan
))
Expand Down Expand Up @@ -216,5 +222,5 @@ task :rm_tilde_backups do
end

desc 'Remove built files'
task :clean => [:clobber_package, :clobber_rdoc, :rm_patch_residue,
task :clean => [:clobber_package, :clobber_rdoc, :rm_patch_residue,
:rm_tilde_backups]
6 changes: 3 additions & 3 deletions app/breakpoint.rb
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2011, 2013 Rocky Bernstein <rockyb@rubyforge.net>
require 'thread_frame'
# Copyright (C) 2010-2011, 2013,2015 Rocky Bernstein <rockyb@rubyforge.net>

# Breakpoint objects
class Trepan
Expand Down Expand Up @@ -64,8 +63,9 @@ def initialize(iseq, offset, opts = {})
@id = @@next_id
@@next_id += 1
end

raise RuntimeError,
"Unable to set breakpoint in #{iseq.name} at offset #{offset}" unless set
"Unable to set breakpoint in #{iseq.name} at offset #{@offset}" unless set
end

def condition?(bind)
Expand Down

0 comments on commit 7e36141

Please sign in to comment.