> To also provide the added capability of accessing Proc's iseq's [and > disassembling it, etc.--currently unavailable] > > except I am having trouble creating Proc#iseq [Method#iseq is here[1]]. > > Any pointers on how to accomplish this? :) Thanks to Paul Brannan for his pointers. I have included here a patch with a prototype VM::InstructionSequence.disassemble_proc method with the functionality that I was hoping could be added. I was unsure how to rewrite VM::InstructionSequence.disassemble to handle both methods and procs, so just wrote a separate method. Thoughts? -=R Index: iseq.c =================================================================== --- iseq.c (revision 19392) +++ iseq.c (working copy) @@ -928,6 +928,21 @@ return ret; } +static VALUE +iseq_s_disasm_proc(VALUE klass, VALUE proc) +{ + VALUE ret = Qnil; + rb_proc_t *proc_pointer; + GetProcPtr(proc, proc_pointer); + VALUE iseqval = (VALUE) proc_pointer->block.iseq->self; + if (RUBY_VM_NORMAL_ISEQ_P(iseqval)) + ret = ruby_iseq_disasm(iseqval); + + return ret; +} + + + const char * ruby_node_name(int node) { @@ -1339,5 +1354,6 @@ rb_define_singleton_method(rb_cISeq, "compile_option=", iseq_s_compile_option_set, 1); rb_define_singleton_method(rb_cISeq, "disasm", iseq_s_disasm, 1); rb_define_singleton_method(rb_cISeq, "disassemble", iseq_s_disasm, 1); + rb_define_singleton_method(rb_cISeq, "disassemble_proc", iseq_s_disasm_proc, 1); }