Skip to content

Commit 9cb00d7

Browse files
viuginick1valich
authored andcommitted
avoid using ibf_load_iseq_complete
bootsnap hack should apply for [2.5.0, 2.6.0) ruby versions
1 parent eccbd57 commit 9cb00d7

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

ext/debase_internals.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -637,14 +637,14 @@ Debase_enable_file_filtering(VALUE self, VALUE value)
637637
return value;
638638
}
639639

640-
#if RUBY_API_VERSION_CODE >= 20500 && !(RUBY_RELEASE_YEAR == 2017 && RUBY_RELEASE_MONTH == 10 && RUBY_RELEASE_DAY == 10)
640+
#if RUBY_API_VERSION_CODE >= 20500 && RUBY_API_VERSION_CODE < 20600 && !(RUBY_RELEASE_YEAR == 2017 && RUBY_RELEASE_MONTH == 10 && RUBY_RELEASE_DAY == 10)
641641
static const rb_iseq_t *
642642
my_iseqw_check(VALUE iseqw)
643643
{
644644
rb_iseq_t *iseq = DATA_PTR(iseqw);
645645

646646
if (!iseq->body) {
647-
ibf_load_iseq_complete(iseq);
647+
return NULL;
648648
}
649649

650650
if (!iseq->body->location.label) {
@@ -657,15 +657,21 @@ Debase_enable_file_filtering(VALUE self, VALUE value)
657657
Debase_set_trace_flag_to_iseq(VALUE self, VALUE rb_iseq) {
658658
if (!SPECIAL_CONST_P(rb_iseq) && RBASIC_CLASS(rb_iseq) == rb_cISeq) {
659659
rb_iseq_t *iseq = my_iseqw_check(rb_iseq);
660-
rb_iseq_trace_set(iseq, RUBY_EVENT_TRACEPOINT_ALL);
660+
661+
if(iseq) {
662+
rb_iseq_trace_set(iseq, RUBY_EVENT_TRACEPOINT_ALL);
663+
}
661664
}
662665
}
663666

664667
static void
665668
Debase_unset_trace_flags(VALUE self, VALUE rb_iseq) {
666669
if (!SPECIAL_CONST_P(rb_iseq) && RBASIC_CLASS(rb_iseq) == rb_cISeq) {
667670
rb_iseq_t *iseq = my_iseqw_check(rb_iseq);
668-
rb_iseq_trace_set(iseq, RUBY_EVENT_NONE);
671+
672+
if(iseq) {
673+
rb_iseq_trace_set(iseq, RUBY_EVENT_NONE);
674+
}
669675
}
670676
}
671677
#else

lib/debase.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def monkey_patch_prepend
3030
class << RubyVM::InstructionSequence
3131
def self.prepend(mod, *smth)
3232
super
33-
if mod.to_s.include?('Bootsnap') && RUBY_VERSION >= "2.5"
33+
if mod.to_s.include?('Bootsnap') && RUBY_VERSION >= '2.5' && RUBY_VERSION < '2.6'
3434
prepend InstructionSequenceMixin
3535
end
3636
end

test/test_load.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class << RubyVM::InstructionSequence
6565
bt = Debugger.debug_load(prog_script, true)
6666
assert_equal(nil, bt)
6767
assert_not_nil(@@at_line)
68-
if RUBY_VERSION >= '2.5'
68+
if RUBY_VERSION >= '2.5' && RUBY_VERSION < '2.6'
6969
assert_equal(['debase.rb', 101], @@at_line)
7070
end
7171

0 commit comments

Comments
 (0)