rbtrace 0.3.6 → 0.3.7
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/Gemfile.lock +1 -1
- data/bin/rbtrace +20 -1
- data/ext/rbtrace.c +11 -7
- data/rbtrace.gemspec +1 -1
- data/server.rb +1 -0
- data/tracers/mongo.tracer +1 -0
- metadata +5 -10
data/Gemfile.lock
CHANGED
data/bin/rbtrace
CHANGED
@@ -43,6 +43,8 @@ module MsgQ
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def self.recv_cmd(q, block=true)
|
46
|
+
MsgQ.enable_interrupt if RUBY_VERSION > '1.9'
|
47
|
+
|
46
48
|
msg = EventMsg.new
|
47
49
|
ret = MsgQ.msgrcv(q, msg, BUF_SIZE, 0, block ? 0 : IPC_NOWAIT)
|
48
50
|
if ret == -1
|
@@ -54,6 +56,23 @@ module MsgQ
|
|
54
56
|
end
|
55
57
|
|
56
58
|
msg[:buf].to_ptr.read_string_length(BUF_SIZE)
|
59
|
+
ensure
|
60
|
+
MsgQ.disable_interrupt if RUBY_VERSION > '1.9'
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
if RUBY_VERSION > '1.9'
|
65
|
+
require 'fiddle'
|
66
|
+
|
67
|
+
handle = DL::Handle.new
|
68
|
+
@enable_interrupt = Fiddle::Function.new(handle['rb_enable_interrupt'], [], DL::TYPE_VOID)
|
69
|
+
@disable_interrupt = Fiddle::Function.new(handle['rb_disable_interrupt'], [], DL::TYPE_VOID)
|
70
|
+
|
71
|
+
def self.enable_interrupt
|
72
|
+
@enable_interrupt.call
|
73
|
+
end
|
74
|
+
def self.disable_interrupt
|
75
|
+
@disable_interrupt.call
|
57
76
|
end
|
58
77
|
end
|
59
78
|
|
@@ -616,7 +635,7 @@ class RBTracer
|
|
616
635
|
parser = Trollop::Parser.new do
|
617
636
|
version <<-EOS
|
618
637
|
rbtrace: like strace, but for ruby code
|
619
|
-
version 0.3.
|
638
|
+
version 0.3.7
|
620
639
|
(c) 2011 Aman Gupta (tmm1)
|
621
640
|
http://github.com/tmm1/rbtrace
|
622
641
|
EOS
|
data/ext/rbtrace.c
CHANGED
@@ -27,9 +27,6 @@
|
|
27
27
|
#define rb_sourceline() (ruby_current_node ? nd_line(ruby_current_node) : 0)
|
28
28
|
#else
|
29
29
|
#include <ruby/st.h>
|
30
|
-
// this is a nasty hack, and will probably break on anything except 1.9.2p136
|
31
|
-
int rb_thread_method_id_and_class(void *th, ID *idp, VALUE *klassp);
|
32
|
-
RUBY_EXTERN void *ruby_current_thread;
|
33
30
|
#endif
|
34
31
|
|
35
32
|
#ifndef RSTRING_PTR
|
@@ -293,11 +290,10 @@ event_hook(rb_event_t event, NODE *node, VALUE self, ID mid, VALUE klass)
|
|
293
290
|
if (mid == ID_ALLOCATOR) goto out;
|
294
291
|
|
295
292
|
#ifdef RUBY_VM
|
296
|
-
|
297
|
-
if (mid == 0 && ruby_current_thread) {
|
293
|
+
if (mid == 0) {
|
298
294
|
ID _mid;
|
299
295
|
VALUE _klass;
|
300
|
-
|
296
|
+
rb_frame_method_id_and_class(&_mid, &_klass);
|
301
297
|
|
302
298
|
mid = _mid;
|
303
299
|
klass = _klass;
|
@@ -305,12 +301,20 @@ event_hook(rb_event_t event, NODE *node, VALUE self, ID mid, VALUE klass)
|
|
305
301
|
#endif
|
306
302
|
|
307
303
|
// normalize klass and check for class-level methods
|
308
|
-
bool singleton =
|
304
|
+
bool singleton = false;
|
309
305
|
if (klass) {
|
310
306
|
if (TYPE(klass) == T_ICLASS) {
|
311
307
|
klass = RBASIC(klass)->klass;
|
312
308
|
}
|
309
|
+
|
313
310
|
singleton = FL_TEST(klass, FL_SINGLETON);
|
311
|
+
|
312
|
+
#ifdef RUBY_VM
|
313
|
+
if (singleton &&
|
314
|
+
!(TYPE(self) == T_CLASS ||
|
315
|
+
TYPE(self) == T_MODULE))
|
316
|
+
singleton = false;
|
317
|
+
#endif
|
314
318
|
}
|
315
319
|
|
316
320
|
rbtracer_t *tracer = NULL;
|
data/rbtrace.gemspec
CHANGED
data/server.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
Mongo::DB#command(selector, opts)
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbtrace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
4
|
+
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
8
|
+
- 7
|
9
|
+
version: 0.3.7
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Aman Gupta
|
@@ -26,7 +25,6 @@ dependencies:
|
|
26
25
|
requirements:
|
27
26
|
- - ">="
|
28
27
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 29
|
30
28
|
segments:
|
31
29
|
- 1
|
32
30
|
- 0
|
@@ -42,7 +40,6 @@ dependencies:
|
|
42
40
|
requirements:
|
43
41
|
- - ">="
|
44
42
|
- !ruby/object:Gem::Version
|
45
|
-
hash: 83
|
46
43
|
segments:
|
47
44
|
- 1
|
48
45
|
- 16
|
@@ -58,7 +55,6 @@ dependencies:
|
|
58
55
|
requirements:
|
59
56
|
- - ">="
|
60
57
|
- !ruby/object:Gem::Version
|
61
|
-
hash: 9
|
62
58
|
segments:
|
63
59
|
- 0
|
64
60
|
- 4
|
@@ -90,6 +86,7 @@ files:
|
|
90
86
|
- tracers/activerecord.tracer
|
91
87
|
- tracers/eventmachine.tracer
|
92
88
|
- tracers/io.tracer
|
89
|
+
- tracers/mongo.tracer
|
93
90
|
- tracers/redis.tracer
|
94
91
|
- tracers/unicorn.tracer
|
95
92
|
has_rdoc: true
|
@@ -106,7 +103,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
106
103
|
requirements:
|
107
104
|
- - ">="
|
108
105
|
- !ruby/object:Gem::Version
|
109
|
-
hash: 3
|
110
106
|
segments:
|
111
107
|
- 0
|
112
108
|
version: "0"
|
@@ -115,14 +111,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
111
|
requirements:
|
116
112
|
- - ">="
|
117
113
|
- !ruby/object:Gem::Version
|
118
|
-
hash: 3
|
119
114
|
segments:
|
120
115
|
- 0
|
121
116
|
version: "0"
|
122
117
|
requirements: []
|
123
118
|
|
124
119
|
rubyforge_project:
|
125
|
-
rubygems_version: 1.
|
120
|
+
rubygems_version: 1.3.7
|
126
121
|
signing_key:
|
127
122
|
specification_version: 3
|
128
123
|
summary: "rbtrace: like strace but for ruby code"
|