diff --git a/ext/debug/debug.c b/ext/debug/debug.c index 9eaac2bbd..241f2c0f0 100644 --- a/ext/debug/debug.c +++ b/ext/debug/debug.c @@ -180,13 +180,17 @@ iseq_last_line(VALUE iseqw) } #endif +#ifdef CRUBY void Init_iseq_collector(void); +#endif void Init_debug(void) { +#ifdef CRUBY VALUE rb_mRubyVM = rb_const_get(rb_cObject, rb_intern("RubyVM")); VALUE rb_cISeq = rb_const_get(rb_mRubyVM, rb_intern("InstructionSequence")); +#endif rb_mDebugger = rb_const_get(rb_cObject, rb_intern("DEBUGGER__")); rb_cFrameInfo = rb_const_get(rb_mDebugger, rb_intern("FrameInfo")); @@ -210,5 +214,7 @@ Init_debug(void) rb_define_method(rb_cISeq, "last_line", iseq_last_line, 0); #endif +#ifdef CRUBY Init_iseq_collector(); +#endif } diff --git a/ext/debug/extconf.rb b/ext/debug/extconf.rb index b4e78fbe3..dc2964d2c 100644 --- a/ext/debug/extconf.rb +++ b/ext/debug/extconf.rb @@ -4,6 +4,7 @@ $distcleanfiles << "debug_version.h" if defined? RubyVM + $defs << '-DCRUBY' $defs << '-DHAVE_RB_ISEQ_PARAMETERS' $defs << '-DHAVE_RB_ISEQ_CODE_LOCATION' diff --git a/ext/debug/iseq_collector.c b/ext/debug/iseq_collector.c index f87c4f978..3504dee6d 100644 --- a/ext/debug/iseq_collector.c +++ b/ext/debug/iseq_collector.c @@ -1,3 +1,4 @@ +#ifdef CRUBY #include VALUE rb_iseqw_new(VALUE v); @@ -89,3 +90,4 @@ Init_iseq_collector(void) rb_define_singleton_method(rb_mObjSpace, "each_iseq", each_iseq, 0); rb_define_singleton_method(rb_mObjSpace, "count_iseq", count_iseq, 0); } +#endif