Created
December 18, 2009 22:06
-
-
Save jruby/259795 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ~/projects/jruby ➔ jruby -J-Xrunjdwp:transport=dt_socket,server=y,address=12345,suspend=n -S jirb | |
| Listening for transport dt_socket at address: 12345 | |
| irb(main):001:0> require 'java' | |
| => true | |
| irb(main):002:0> vmm = com.sun.jdi.Bootstrap.virtual_machine_manager | |
| => com.sun.tools.jdi.VirtualMachineManagerImpl@67fc9fee | |
| irb(main):003:0> vmm.attaching_connectors | |
| => [com.sun.jdi.SocketAttach (defaults: timeout=, hostname=charles-nutters-macbook-pro.local, port=), com.sun.jdi.ProcessAttach (defaults: pid=, timeout=)] | |
| irb(main):004:0> sock_attach = vmm.attaching_connectors[0] | |
| => com.sun.jdi.SocketAttach (defaults: timeout=, hostname=charles-nutters-macbook-pro.local, port=) | |
| irb(main):005:0> sock_attach.default_arguments | |
| => {timeout=timeout=, hostname=hostname=charles-nutters-macbook-pro.local, port=port=} | |
| irb(main):006:0> args = _ | |
| => {timeout=timeout=, hostname=hostname=charles-nutters-macbook-pro.local, port=port=} | |
| irb(main):007:0> args['port'].value = "12345" | |
| => "12345" | |
| irb(main):008:0> vm = sock_attach.attach(args) | |
| => com.sun.tools.jdi.VirtualMachineImpl@1f183871 | |
| irb(main):009:0> my_struct = Struct.new(:blah) | |
| => #<Class:01x67ce08c7> | |
| irb(main):010:0> structs = Array.new(10) {my_struct.new('hello')} | |
| => [#<struct #<Class:01x67ce08c7> blah="hello">, #<struct #<Class:01x67ce08c7> blah="hello">, #<struct #<Class:01x67ce08c7> blah="hello">, #<struct #<Class:01x67ce08c7> blah="hello">, #<struct #<Class:01x67ce08c7> blah="hello">, #<struct #<Class:01x67ce08c7> blah="hello">, #<struct #<Class:01x67ce08c7> blah="hello">, #<struct #<Class:01x67ce08c7> blah="hello">, #<struct #<Class:01x67ce08c7> blah="hello">, #<struct #<Class:01x67ce08c7> blah="hello">] | |
| irb(main):011:0> struct_ref = vm.classes_by_name("org.jruby.RubyStruct") | |
| => [class org.jruby.RubyStruct (no class loader)] | |
| irb(main):012:0> struct_ref = struct_ref[0] | |
| => class org.jruby.RubyStruct (no class loader) | |
| irb(main):013:0> struct_ref.class | |
| => Java::ComSunToolsJdi::ClassTypeImpl | |
| irb(main):014:0> struct_ref.instances(20) | |
| => [instance of org.jruby.RubyStruct(id=57), instance of org.jruby.RubyStruct(id=58), instance of org.jruby.RubyStruct(id=59), instance of org.jruby.RubyStruct(id=60), instance of org.jruby.RubyStruct(id=61), instance of org.jruby.RubyStruct(id=62), instance of org.jruby.RubyStruct(id=63), instance of org.jruby.RubyStruct(id=64), instance of org.jruby.RubyStruct(id=65), instance of org.jruby.RubyStruct(id=66)] | |
| irb(main):015:0> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment