Skip to content

Instantly share code, notes, and snippets.

@headius
Created June 18, 2009 01:04
Show Gist options
  • Save headius/131637 to your computer and use it in GitHub Desktop.
Save headius/131637 to your computer and use it in GitHub Desktop.
~/projects/jruby ➔ cat Foo.java
public class Foo {
public static void printit(String it) {
String it2 = it + "goodbye";
String it3 = it + "monkey";
System.out.println(it2);
System.out.println(it3);
}
}
~/projects/jruby ➔ cat bar.rb
require 'java'
import Java::Foo
Foo.printit("yumyum")
puts "done"
~/projects/jruby ➔ jruby --jdb bar.rb
Initializing jdb ...
> stop at bar:1
Deferring breakpoint bar:1.
It will be set after the class is loaded.
> stop in Foo::printit
Usage: stop at <class>:<line_number> or
stop in <class>.<method_name>[(argument_type,...)]
> stop in Foo.printit
Deferring breakpoint Foo.printit.
It will be set after the class is loaded.
> run
run org.jruby.Main bar.rb
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
>
VM Started: Set deferred breakpoint bar:1
Breakpoint hit: "thread=main", bar.__file__(), line=1 bci=12
1 require 'java'
main[1] list
1 => require 'java'
2
3 import Java::Foo
4
5 Foo.printit("yumyum")
6
7 puts "done"
main[1] next
>
Step completed: "thread=main", bar.__file__(), line=3 bci=34
3 import Java::Foo
main[1] list
1 require 'java'
2
3 => import Java::Foo
4
5 Foo.printit("yumyum")
6
7 puts "done"
main[1] next
> Set deferred breakpoint Foo.printit
Step completed: "thread=main", bar.__file__(), line=5 bci=68
5 Foo.printit("yumyum")
main[1] list
1 require 'java'
2
3 import Java::Foo
4
5 => Foo.printit("yumyum")
6
7 puts "done"
main[1] cont
>
Breakpoint hit: "thread=main", Foo.printit(), line=3 bci=0
3 String it2 = it + "goodbye";
main[1] list
1 public class Foo {
2 public static void printit(String it) {
3 => String it2 = it + "goodbye";
4 String it3 = it + "monkey";
5
6 System.out.println(it2);
7 System.out.println(it3);
8 }
9 }
main[1] next
>
Step completed: "thread=main", Foo.printit(), line=4 bci=20
4 String it3 = it + "monkey";
main[1] next
>
Step completed: "thread=main", Foo.printit(), line=6 bci=40
6 System.out.println(it2);
main[1] next
> yumyumgoodbye
Step completed: "thread=main", Foo.printit(), line=7 bci=47
7 System.out.println(it3);
main[1] list
3 String it2 = it + "goodbye";
4 String it3 = it + "monkey";
5
6 System.out.println(it2);
7 => System.out.println(it3);
8 }
9 }
main[1] step up
yumyummonkey
>
Step completed: "thread=main", sun.reflect.NativeMethodAccessorImpl.invoke(), line=39 bci=90
main[1] step up
>
Step completed: "thread=main", sun.reflect.DelegatingMethodAccessorImpl.invoke(), line=25 bci=9
main[1] step up
>
Step completed: "thread=main", java.lang.reflect.Method.invoke(), line=597 bci=166
main[1] step up
>
Step completed: "thread=main", org.jruby.javasupport.JavaMethod.invokeWithExceptionHandling(), line=302 bci=6
main[1] step up
>
Step completed: "thread=main", org.jruby.javasupport.JavaMethod.invoke_static(), line=282 bci=33
main[1] step up
>
Step completed: "thread=main", org.jruby.java.invokers.StaticMethodInvoker.call(), line=47 bci=55
main[1] step up
>
Step completed: "thread=main", org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(), line=278 bci=60
main[1] step up
>
Step completed: "thread=main", org.jruby.runtime.callsite.CachingCallSite.call(), line=117 bci=53
main[1] step up
>
Step completed: "thread=main", bar.__file__(), line=5 bci=95
5 Foo.printit("yumyum")
main[1] list
1 require 'java'
2
3 import Java::Foo
4
5 => Foo.printit("yumyum")
6
7 puts "done"
main[1] next
>
Step completed: "thread=main", bar.__file__(), line=7 bci=96
7 puts "done"
main[1] list
3 import Java::Foo
4
5 Foo.printit("yumyum")
6
7 => puts "done"
main[1] next
> done
Step completed: "thread=main", bar.load(), line=-1 bci=17
main[1] cont
>
The application exited
~/projects/jruby ➔
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment