rb-threadframe 0.39 → 0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ext/thread_frame.h DELETED
@@ -1,4 +0,0 @@
1
- VALUE thread_frame_sp(VALUE klass, VALUE index) ;
2
- VALUE thread_frame_prev(int argc, VALUE *argv, VALUE klass);
3
-
4
-
data/ext/thread_pthread.h DELETED
@@ -1,24 +0,0 @@
1
- /**********************************************************************
2
-
3
- thread_pthread.h -
4
-
5
- $Author$
6
-
7
- Copyright (C) 2004-2007 Koichi Sasada
8
-
9
- **********************************************************************/
10
-
11
- #ifndef RUBY_THREAD_PTHREAD_H
12
- #define RUBY_THREAD_PTHREAD_H
13
-
14
- #include <pthread.h>
15
- typedef pthread_t rb_thread_id_t;
16
- typedef pthread_mutex_t rb_thread_lock_t;
17
- typedef pthread_cond_t rb_thread_cond_t;
18
-
19
- typedef struct native_thread_data_struct {
20
- void *signal_thread_list;
21
- pthread_cond_t sleep_cond;
22
- } native_thread_data_t;
23
-
24
- #endif /* RUBY_THREAD_PTHREAD_H */
@@ -1,60 +0,0 @@
1
- require 'test/unit'
2
-
3
- class TestISeqBrkpt < Test::Unit::TestCase
4
-
5
- def setup
6
- @original_compile_option = RubyVM::InstructionSequence.compile_option
7
- RubyVM::InstructionSequence.compile_option = {
8
- :trace_instruction => false,
9
- :specialized_instruction => false
10
- }
11
- end
12
-
13
- def teardown
14
- set_trace_func(nil)
15
- RubyVM::InstructionSequence.compile_option = @original_compile_option
16
- end
17
-
18
- def test_iseq_brkpt
19
- iseq = RubyVM::InstructionSequence.compile('x=1; y=2')
20
- assert iseq
21
- assert_equal(nil, iseq.brkpts)
22
- assert_equal(true, iseq.brkpt_alloc)
23
- assert_equal([], iseq.brkpts)
24
- assert_equal(false, iseq.brkpt_alloc)
25
-
26
- assert_equal(true, iseq.brkpt_set(0))
27
- assert_equal(1, iseq.brkpts.size)
28
- assert_equal(true, iseq.brkpt_get(0), 'Offset 0 should be set')
29
- assert_equal(true, iseq.brkpt_unset(0),'Offset 0 should be unset')
30
- assert_equal(false, iseq.brkpt_get(0), 'Offset 0 should be unset now')
31
- assert_equal(true, iseq.brkpt_unset(0),
32
- 'Offset 0 should be unset again')
33
- assert_raises TypeError do iseq.brkpt_get(100) end
34
- assert_equal(true, iseq.brkpt_dealloc)
35
- assert_equal(false, iseq.brkpt_dealloc)
36
- assert_equal(true, iseq.brkpt_unset(0),
37
- 'Offset 0 should be unset even when deallocated')
38
-
39
- assert_raises TypeError do iseq.brkpt_set('a') end
40
-
41
- iseq.brkpt_set(2)
42
- iseq.brkpt_set(4)
43
- events = []
44
- eval <<-EOF.gsub(/^.*?: /, "")
45
- 1: set_trace_func(Proc.new { |event, file, lineno, mid, binding, klass|
46
- 2: events << [event, lineno, mid, klass]
47
- 3: })
48
- 4: iseq.eval
49
- 5: set_trace_func(nil)
50
- EOF
51
- # puts iseq.disassemble
52
- brkpt_events = events.select{|item| item[0] == 'brkpt'}
53
- assert_equal(2, brkpt_events.size,
54
- "Expecting to see 2 brkpts in #{events}.inspect")
55
- assert_equal(true, iseq.brkpt_dealloc)
56
- end
57
- end
58
-
59
- # We want to double-check we didn't mess up any pointers somewhere.
60
- at_exit { GC.start }
@@ -1,17 +0,0 @@
1
- # Some simple tests of RubyVM::InstructionSequence#disasm, and
2
- # #disasm_nochildren
3
- require 'test/unit'
4
-
5
- class TestDisasmClass < Test::Unit::TestCase
6
-
7
- def test_basic
8
- assert_equal(RubyVM::InstructionSequence.compile('1+2').disassemble,
9
- RubyVM::InstructionSequence.compile('1+2').disasm)
10
-
11
- p='def five; 5 end; five'
12
- s1=RubyVM::InstructionSequence.compile(p).disasm
13
- assert_equal String, s1.class, 'disasm output should be a string'
14
- s2=RubyVM::InstructionSequence.compile(p).disasm_nochildren
15
- assert_equal true, s1.size > s2.size
16
- end
17
- end
@@ -1,50 +0,0 @@
1
- # See that setting ISEQS__ and SCRIPT_ISEQS__ saves
2
- # RubyVM::Instruction_sequenses
3
- require 'test/unit'
4
-
5
- class TestIseqAccess < Test::Unit::TestCase
6
- def setup
7
- old_verbosity = $VERBOSE
8
- $VERBOSE = nil
9
- Kernel.const_set(:ISEQS__, {})
10
- Kernel.const_set(:SCRIPT_ISEQS__, {})
11
- $VERBOSE = old_verbosity
12
- end
13
-
14
- def teardown
15
- old_verbosity = $VERBOSE
16
- $VERBOSE = nil
17
- Kernel.const_set(:ISEQS__, nil)
18
- Kernel.const_set(:SCRIPT_ISEQS__, nil)
19
- $VERBOSE = old_verbosity
20
- end
21
-
22
- def test_basic
23
- sizes=[]
24
- [ISEQS__, SCRIPT_ISEQS__].each do |iseq_hash|
25
- sizes << iseq_hash.size
26
- end
27
- # defining five should trigger five instruction sequence additions
28
- # to ISEQS__ and SCRIPT_ISEQS__
29
- #
30
- eval 'def five; 5 end'
31
- assert_equal sizes[0], sizes[1]
32
- [SCRIPT_ISEQS__, ISEQS__].each do |iseq_hash|
33
- assert_equal true, iseq_hash.size > sizes.pop
34
- assert_equal Hash, iseq_hash.class
35
- a = iseq_hash.first
36
- assert_equal Array, a.class
37
- assert_equal RubyVM::InstructionSequence, iseq_hash.values[0][0].class
38
- end
39
- end
40
-
41
- # Check RubyVM::InstructionSequence#arity
42
- def test_arity
43
- eval 'def five; 5 end'
44
- eval 'def add(a,b); a+b end'
45
- eval 'def splat(*a); 5 end'
46
- [['five', 0,], ['add', 2], ['splat', -1]].each do |meth, expect|
47
- assert_equal(expect, ISEQS__[meth][0].arity)
48
- end
49
- end
50
- end
@@ -1,26 +0,0 @@
1
- require 'test/unit'
2
-
3
- # tests that we a trace hook has access to the runtime exception Object
4
- # when it is called through a raise event
5
-
6
- class TestTracefuncRaise < Test::Unit::TestCase
7
-
8
- def test_basic
9
- tuples = []
10
- p = Proc.new {
11
- |event, file, lineno, mid, binding, klass|
12
- tuples << klass
13
- }
14
- msg = 'this is a message'
15
- set_trace_func(p, 0x0080)
16
- begin ; x = 1/0; rescue; end
17
- begin ; raise RuntimeError, msg; rescue; end
18
- clear_trace_func
19
- assert_equal(2, tuples.size,
20
- "Wrong number of tuples captured #{tuples.inspect}")
21
- assert_equal msg, tuples[1].message
22
- assert_equal([ZeroDivisionError, RuntimeError], tuples.map{|t| t.class},
23
- "Mismatched tuples classes in #{tuples.inspect}")
24
-
25
- end
26
- end