Permalink
Browse files

added Rakefile etc

  • Loading branch information...
1 parent 8caffee commit a46e76b0336ad3f5f168b0680a8825738047531b @banister committed Nov 7, 2011
Showing with 34 additions and 5 deletions.
  1. +8 −1 INSTRUCTIONS
  2. +12 −0 Rakefile
  3. +11 −0 g.rb
  4. +3 −4 raise_shim.c
View
@@ -1 +1,8 @@
-gcc -Wall -O2 -fpic -shared -ldl -I/home/john/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/i686-linux -I/home/john/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/backward -I/home/john/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1 -o raise_shim.so raise_shim.c
+how to get working with gdb?
+do the following:
+
+gdb ruby
+in gdb type: set exec-wrapper env 'LD_PRELOAD=./raise_shim.so'
+then: r g.rb (or whatever the bugged ruby file is called)
+
+
View
@@ -0,0 +1,12 @@
+task :default do
+ sh 'gcc -Wall -O2 -fpic -shared -ldl -g -I/home/john/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/i686-linux -I/home/john/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/home/john/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1 -o raise_shim.so raise_shim.c'
+end
+
+task :pry do
+ sh "LD_PRELOAD=./raise_shim.so pry"
+end
+
+task :gdb do
+ sh "gdb LD_PRELOAD=./raise_shim.so gdb --args ruby"
+end
+
View
11 g.rb
@@ -0,0 +1,11 @@
+require 'pry_time'
+
+PryTime.capture do |c|
+ c.exception_type << ZeroDivisionError
+end
+
+def a
+ 1 / 0
+end
+
+a
View
@@ -14,7 +14,7 @@ rb_raise(unsigned long exc, const char *fmt, ...)
char * error;
if (!libruby_rb_raise) {
- handle = dlopen("/home/john/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so",
+ handle = dlopen("/home/john/.rvm/rubies/ruby-1.9.2-p290/lib/libruby.so",
RTLD_LAZY);
if (!handle) {
fputs(dlerror(), stderr);
@@ -28,10 +28,9 @@ rb_raise(unsigned long exc, const char *fmt, ...)
}
//printf("calling old rb_raise()");
- fflush(stdout);
// libruby_rb_raise(exc, "i want to see you naked, especially from the back.");
rb_funcall(rb_cObject, rb_intern("raise"), 2, exc, rb_str_new2("hello baby"));
-// printf("finished calling old rb_raise()\n");
- fflush(stdout);
+ // printf("finished calling old rb_raise()\n");
+ // return Qnil;
}

0 comments on commit a46e76b

Please sign in to comment.