Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added example + rake task for c exception interception

  • Loading branch information...
commit fdddd25c4497be8e68d76c66e78bcc5c4a05bd34 1 parent 5f943bf
@banister authored
Showing with 41 additions and 0 deletions.
  1. +14 −0 Rakefile
  2. +27 −0 examples/example_c_inline.rb
View
14 Rakefile
@@ -53,6 +53,20 @@ task :example_inline do
sh "ruby -I#{direc}/lib/ #{direc}/examples/example_inline.rb "
end
+desc "Run example C inline"
+task :example_c_inline do
+ require 'pry-exception_explorer/shim_builder'
+ binary_name = "lib_overrides.#{PryExceptionExplorer::ShimBuilder::Dyname}"
+ if RUBY_PLATFORM =~ /darwin/
+ ENV['DYLD_FORCE_FLAT_NAMESPACE'] = "1"
+ ENV['DYLD_INSERT_LIBRARIES'] = File.join PryExceptionExplorer::ShimBuilder.dir, binary_name
+ else
+ ENV['LD_PRELOAD'] = File.join PryExceptionExplorer::ShimBuilder.dir, binary_name
+ end
+
+ sh "ruby -I#{direc}/lib/ #{direc}/examples/example_c_inline.rb "
+end
+
task :default => :test
desc "Show version"
View
27 examples/example_c_inline.rb
@@ -0,0 +1,27 @@
+unless Object.const_defined? :PryExceptionExplorer
+ $:.unshift File.expand_path '../../lib', __FILE__
+ require 'pry'
+end
+
+require 'pry-exception_explorer'
+
+PryExceptionExplorer.enabled = true
+PryExceptionExplorer.intercept(NameError)
+
+def alpha
+ name = "john"
+ beta
+ puts name
+end
+
+def beta
+ x = 20
+ gamma
+ puts x
+end
+
+def gamma
+ UnknownConstant
+end
+
+alpha
Please sign in to comment.
Something went wrong with that request. Please try again.