Skip to content

Commit 8d71eca

Browse files
viuginick1valich
authored andcommitted
revert old Bootsnap hack
(will fix at least #69 #66 #64 ruby-debug/ruby-debug-ide#146 )
1 parent 006d334 commit 8d71eca

3 files changed

Lines changed: 0 additions & 104 deletions

File tree

ext/debase_internals.c

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -637,47 +637,6 @@ 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)
641-
static const rb_iseq_t *
642-
my_iseqw_check(VALUE iseqw)
643-
{
644-
rb_iseq_t *iseq = DATA_PTR(iseqw);
645-
646-
if (!iseq->body) {
647-
ibf_load_iseq_complete(iseq);
648-
}
649-
650-
if (!iseq->body->location.label) {
651-
rb_raise(rb_eTypeError, "uninitialized InstructionSequence");
652-
}
653-
return iseq;
654-
}
655-
656-
static void
657-
Debase_set_trace_flag_to_iseq(VALUE self, VALUE rb_iseq) {
658-
if (!SPECIAL_CONST_P(rb_iseq) && RBASIC_CLASS(rb_iseq) == rb_cISeq) {
659-
rb_iseq_t *iseq = my_iseqw_check(rb_iseq);
660-
rb_iseq_trace_set(iseq, RUBY_EVENT_TRACEPOINT_ALL);
661-
}
662-
}
663-
664-
static void
665-
Debase_unset_trace_flags(VALUE self, VALUE rb_iseq) {
666-
if (!SPECIAL_CONST_P(rb_iseq) && RBASIC_CLASS(rb_iseq) == rb_cISeq) {
667-
rb_iseq_t *iseq = my_iseqw_check(rb_iseq);
668-
rb_iseq_trace_set(iseq, RUBY_EVENT_NONE);
669-
}
670-
}
671-
#else
672-
static void
673-
Debase_set_trace_flag_to_iseq(VALUE self, VALUE rb_iseq) {
674-
}
675-
676-
static void
677-
Debase_unset_trace_flags(VALUE self, VALUE rb_iseq) {
678-
}
679-
#endif
680-
681640
static VALUE
682641
Debase_init_variables()
683642
{
@@ -721,10 +680,6 @@ Init_debase_internals()
721680
rb_define_module_function(mDebase, "enable_trace_points", Debase_enable_trace_points, 0);
722681
rb_define_module_function(mDebase, "prepare_context", Debase_prepare_context, 0);
723682
rb_define_module_function(mDebase, "init_variables", Debase_init_variables, 0);
724-
rb_define_module_function(mDebase, "set_trace_flag_to_iseq", Debase_set_trace_flag_to_iseq, 1);
725-
726-
//use only for tests
727-
rb_define_module_function(mDebase, "unset_iseq_flags", Debase_unset_trace_flags, 1);
728683

729684
idAlive = rb_intern("alive?");
730685
idAtLine = rb_intern("at_line");

lib/debase.rb

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,9 @@ def start(options={}, &block)
2121
Debugger.const_set('PROG_SCRIPT', $0) unless defined? Debugger::PROG_SCRIPT
2222
Debugger.const_set('INITIAL_DIR', Dir.pwd) unless defined? Debugger::INITIAL_DIR
2323

24-
monkey_patch_prepend
25-
2624
Debugger.started? ? block && block.call(self) : Debugger.start_(&block)
2725
end
2826

29-
def monkey_patch_prepend
30-
class << RubyVM::InstructionSequence
31-
def self.prepend(mod, *smth)
32-
super
33-
if mod.to_s.include?('Bootsnap') && RUBY_VERSION >= "2.5"
34-
prepend InstructionSequenceMixin
35-
end
36-
end
37-
end
38-
end
39-
4027
# @param [String] file
4128
# @param [Fixnum] line
4229
# @param [String] expr
@@ -95,21 +82,6 @@ def last_context
9582
def file_filter
9683
@file_filter ||= FileFilter.new
9784
end
98-
99-
module InstructionSequenceMixin
100-
def load_iseq(path)
101-
iseq = super(path)
102-
103-
do_set_flags(iseq)
104-
105-
iseq
106-
end
107-
108-
def do_set_flags(iseq)
109-
Debugger.set_trace_flag_to_iseq(iseq)
110-
iseq.each_child { |child_iseq| do_set_flags(child_iseq) } if iseq.respond_to? :each_child
111-
end
112-
end
11385
end
11486

11587
class FileFilter

test/test_load.rb

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -44,35 +44,4 @@ def test_debug_load
4444
ensure
4545
Debugger.stop if Debugger.started?
4646
end
47-
48-
module MyBootsnap
49-
def load_iseq(path)
50-
iseq = RubyVM::InstructionSequence.compile_file(path)
51-
52-
Debugger.unset_iseq_flags(iseq)
53-
iseq
54-
end
55-
end
56-
57-
def test_bootsnap
58-
@@at_line = nil
59-
src_dir = File.dirname(__FILE__)
60-
prog_script = File.join(src_dir, 'example', 'bootsnap', 'bootsnap.rb')
61-
62-
class << RubyVM::InstructionSequence
63-
prepend MyBootsnap
64-
end
65-
bt = Debugger.debug_load(prog_script, true)
66-
assert_equal(nil, bt)
67-
assert_not_nil(@@at_line)
68-
if RUBY_VERSION >= '2.5'
69-
assert_equal(['debase.rb', 101], @@at_line)
70-
end
71-
72-
assert(Debugger.started?)
73-
Debugger.stop
74-
75-
class << RubyVM::InstructionSequence; self end.class_eval { undef_method :load_iseq }
76-
77-
end
7847
end

0 commit comments

Comments
 (0)