debase 0.2.3.beta4 → 0.2.3.beta5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/debase_internals.c +48 -0
- data/lib/debase.rb +28 -0
- data/lib/debase/version.rb +1 -1
- data/test/test_load.rb +31 -0
- metadata +4 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 682d6984f0e5b33479f3c5138c7af974e59597cf
|
4
|
+
data.tar.gz: ed9e19b600656cbd66f46c29673c1f557db8e51b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c128d2bfbc14ba0078f5605fbd9b2213eb77fcee710621efb9938d86923b1159707ea743a322e89f6b084089b7c6d1d1b3aec59acbd786578a8b6a0f2a739db6
|
7
|
+
data.tar.gz: df4677f7266bdee7fe11fbb9157544a01233c65707dcb312927962591897a9187a412a976d8e98686a53645228313077c769f91a5e5b519ff72f9716b80aaae5
|
data/ext/debase_internals.c
CHANGED
@@ -637,6 +637,50 @@ Debase_enable_file_filtering(VALUE self, VALUE value)
|
|
637
637
|
return value;
|
638
638
|
}
|
639
639
|
|
640
|
+
#if RUBY_API_VERSION_CODE >= 20500 && RUBY_API_VERSION_CODE < 20600 && !(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
|
+
return NULL;
|
648
|
+
}
|
649
|
+
|
650
|
+
return iseq;
|
651
|
+
}
|
652
|
+
|
653
|
+
static void
|
654
|
+
Debase_set_trace_flag_to_iseq(VALUE self, VALUE rb_iseq) {
|
655
|
+
if (!SPECIAL_CONST_P(rb_iseq) && RBASIC_CLASS(rb_iseq) == rb_cISeq) {
|
656
|
+
rb_iseq_t *iseq = my_iseqw_check(rb_iseq);
|
657
|
+
|
658
|
+
if(iseq) {
|
659
|
+
rb_iseq_trace_set(iseq, RUBY_EVENT_TRACEPOINT_ALL);
|
660
|
+
}
|
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
|
+
|
669
|
+
if(iseq) {
|
670
|
+
rb_iseq_trace_set(iseq, RUBY_EVENT_NONE);
|
671
|
+
}
|
672
|
+
}
|
673
|
+
}
|
674
|
+
#else
|
675
|
+
static void
|
676
|
+
Debase_set_trace_flag_to_iseq(VALUE self, VALUE rb_iseq) {
|
677
|
+
}
|
678
|
+
|
679
|
+
static void
|
680
|
+
Debase_unset_trace_flags(VALUE self, VALUE rb_iseq) {
|
681
|
+
}
|
682
|
+
#endif
|
683
|
+
|
640
684
|
static VALUE
|
641
685
|
Debase_init_variables()
|
642
686
|
{
|
@@ -680,6 +724,10 @@ Init_debase_internals()
|
|
680
724
|
rb_define_module_function(mDebase, "enable_trace_points", Debase_enable_trace_points, 0);
|
681
725
|
rb_define_module_function(mDebase, "prepare_context", Debase_prepare_context, 0);
|
682
726
|
rb_define_module_function(mDebase, "init_variables", Debase_init_variables, 0);
|
727
|
+
rb_define_module_function(mDebase, "set_trace_flag_to_iseq", Debase_set_trace_flag_to_iseq, 1);
|
728
|
+
|
729
|
+
//use only for tests
|
730
|
+
rb_define_module_function(mDebase, "unset_iseq_flags", Debase_unset_trace_flags, 1);
|
683
731
|
|
684
732
|
idAlive = rb_intern("alive?");
|
685
733
|
idAtLine = rb_intern("at_line");
|
data/lib/debase.rb
CHANGED
@@ -21,9 +21,22 @@ module Debase
|
|
21
21
|
Debugger.const_set('PROG_SCRIPT', $0) unless defined? Debugger::PROG_SCRIPT
|
22
22
|
Debugger.const_set('INITIAL_DIR', Dir.pwd) unless defined? Debugger::INITIAL_DIR
|
23
23
|
|
24
|
+
monkey_patch_prepend
|
25
|
+
|
24
26
|
Debugger.started? ? block && block.call(self) : Debugger.start_(&block)
|
25
27
|
end
|
26
28
|
|
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' && RUBY_VERSION < '2.6'
|
34
|
+
prepend InstructionSequenceMixin
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
27
40
|
# @param [String] file
|
28
41
|
# @param [Fixnum] line
|
29
42
|
# @param [String] expr
|
@@ -82,6 +95,21 @@ module Debase
|
|
82
95
|
def file_filter
|
83
96
|
@file_filter ||= FileFilter.new
|
84
97
|
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
|
85
113
|
end
|
86
114
|
|
87
115
|
class FileFilter
|
data/lib/debase/version.rb
CHANGED
data/test/test_load.rb
CHANGED
@@ -44,4 +44,35 @@ class TestDebugLoad < Test::Unit::TestCase
|
|
44
44
|
ensure
|
45
45
|
Debugger.stop if Debugger.started?
|
46
46
|
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' && RUBY_VERSION < '2.6'
|
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
|
47
78
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: debase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.3.
|
4
|
+
version: 0.2.3.beta5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dennis Ushakov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: debase-ruby_core_source
|
@@ -137,35 +137,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
137
|
version: 1.3.1
|
138
138
|
requirements: []
|
139
139
|
rubyforge_project: debase
|
140
|
-
rubygems_version: 2.
|
140
|
+
rubygems_version: 2.6.10
|
141
141
|
signing_key:
|
142
142
|
specification_version: 4
|
143
143
|
summary: debase is a fast implementation of the standard Ruby debugger debug.rb for
|
144
144
|
Ruby 2.0
|
145
|
-
test_files:
|
146
|
-
- test/example/a/example.rb
|
147
|
-
- test/example/at-exit.rb
|
148
|
-
- test/example/b/example.rb
|
149
|
-
- test/example/bootsnap/a.rb
|
150
|
-
- test/example/bootsnap/bootsnap.rb
|
151
|
-
- test/example/bp_loop_issue.rb
|
152
|
-
- test/example/breakpoints-basename.rb
|
153
|
-
- test/example/brkpt-class-bug.rb
|
154
|
-
- test/example/classes.rb
|
155
|
-
- test/example/dollar-0.rb
|
156
|
-
- test/example/except-bug1.rb
|
157
|
-
- test/example/file with space.rb
|
158
|
-
- test/example/gcd.rb
|
159
|
-
- test/example/info-var-bug.rb
|
160
|
-
- test/example/info-var-bug2.rb
|
161
|
-
- test/example/null.rb
|
162
|
-
- test/example/output.rb
|
163
|
-
- test/example/pm-bug.rb
|
164
|
-
- test/example/pm.rb
|
165
|
-
- test/example/raise.rb
|
166
|
-
- test/helper.rb
|
167
|
-
- test/test_base.rb
|
168
|
-
- test/test_breakpoints.rb
|
169
|
-
- test/test_catchpoint.rb
|
170
|
-
- test/test_load.rb
|
171
|
-
- test/test_reload_bug.rb
|
145
|
+
test_files: []
|