rbtrace 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/bin/rbtrace +11 -21
- data/rbtrace.gemspec +1 -1
- metadata +2 -2
data/Gemfile.lock
CHANGED
data/bin/rbtrace
CHANGED
@@ -24,7 +24,7 @@ end
|
|
24
24
|
|
25
25
|
module MsgQ
|
26
26
|
extend FFI::Library
|
27
|
-
ffi_lib
|
27
|
+
ffi_lib FFI::CURRENT_PROCESS
|
28
28
|
|
29
29
|
class EventMsg < FFI::Struct
|
30
30
|
BUF_SIZE = RUBY_PLATFORM =~ /linux/ ? 256 : 120
|
@@ -43,7 +43,7 @@ module MsgQ
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def self.recv_cmd(q, block=true)
|
46
|
-
MsgQ.
|
46
|
+
MsgQ.rb_enable_interrupt if RUBY_VERSION > '1.9'
|
47
47
|
|
48
48
|
msg = EventMsg.new
|
49
49
|
ret = MsgQ.msgrcv(q, msg, BUF_SIZE, 0, block ? 0 : IPC_NOWAIT)
|
@@ -57,28 +57,18 @@ module MsgQ
|
|
57
57
|
|
58
58
|
msg[:buf].to_ptr.read_string_length(BUF_SIZE)
|
59
59
|
ensure
|
60
|
-
MsgQ.
|
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
|
60
|
+
MsgQ.rb_disable_interrupt if RUBY_VERSION > '1.9'
|
76
61
|
end
|
77
62
|
end
|
78
63
|
|
79
64
|
attach_function :msgget, [:int, :int], :int
|
80
65
|
attach_function :msgrcv, [:int, EventMsg.ptr, :size_t, :long, :int], :int
|
81
66
|
attach_function :msgsnd, [:int, EventMsg.ptr, :size_t, :int], :int
|
67
|
+
|
68
|
+
if RUBY_VERSION > '1.9'
|
69
|
+
attach_function :rb_enable_interrupt, [], :void
|
70
|
+
attach_function :rb_disable_interrupt, [], :void
|
71
|
+
end
|
82
72
|
end
|
83
73
|
|
84
74
|
class RBTracer
|
@@ -318,8 +308,8 @@ class RBTracer
|
|
318
308
|
rescue Errno::EINVAL, Errno::EIDRM
|
319
309
|
newline
|
320
310
|
STDERR.puts "*** process #{pid} is gone"
|
321
|
-
STDERR.puts "*** #{$!.inspect}"
|
322
|
-
STDERR.puts $!.backtrace.join("\n ")
|
311
|
+
# STDERR.puts "*** #{$!.inspect}"
|
312
|
+
# STDERR.puts $!.backtrace.join("\n ")
|
323
313
|
rescue Interrupt, SignalException
|
324
314
|
retry
|
325
315
|
end
|
@@ -635,7 +625,7 @@ class RBTracer
|
|
635
625
|
parser = Trollop::Parser.new do
|
636
626
|
version <<-EOS
|
637
627
|
rbtrace: like strace, but for ruby code
|
638
|
-
version 0.3.
|
628
|
+
version 0.3.8
|
639
629
|
(c) 2011 Aman Gupta (tmm1)
|
640
630
|
http://github.com/tmm1/rbtrace
|
641
631
|
EOS
|
data/rbtrace.gemspec
CHANGED