rbtrace 0.5.2 → 0.5.4
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.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +1 -1
- data/CHANGELOG +6 -1
- data/Rakefile +11 -4
- data/lib/rbtrace/interactive/irb.rb +7 -3
- data/lib/rbtrace/version.rb +1 -1
- data/rbtrace.gemspec +3 -0
- data/test/interactive_irb_test.rb +39 -0
- data/test.sh +5 -0
- metadata +18 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ffdcce16c0cb92399ccb6684be8b23628703d420786b53ed035164d184e72488
|
|
4
|
+
data.tar.gz: 987b982955f4af23e247d4155a9ff134bdf2231e5443024a5357c7df14f581ef
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 536787701408f0763ccf9345e6e4715cc2bf057e99f6be69d00ad431dc7685898267a2a76235d29875128711c87192d91e1b281dbe889579779321da66b3c1ca
|
|
7
|
+
data.tar.gz: 1fc1fd4f82e5ac0808e7f95f518a2f989902c7fe424a9a67f63632aca41e6a47a405a46a77022b618f32664b476a5b550e8e4d0aa1c27fe630e3916d82b27c84
|
data/.github/workflows/ci.yml
CHANGED
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
require "bundler/gem_tasks"
|
|
2
2
|
|
|
3
|
+
CLEAN.include("ext/Makefile", "ext/*.o", "ext/*.so", "ext/*.bundle", "ext/mkmf.log")
|
|
4
|
+
|
|
3
5
|
desc "Compile the c extension"
|
|
4
6
|
task :compile do
|
|
5
7
|
if File.exist?("ext/Makefile")
|
|
6
|
-
|
|
8
|
+
sh "cd ext && make clean"
|
|
7
9
|
end
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
sh "cd ext && ruby extconf.rb"
|
|
11
|
+
sh "cd ext && make"
|
|
10
12
|
end
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
desc "Run the integration test suite"
|
|
15
|
+
task :test do
|
|
16
|
+
sh "./test.sh"
|
|
17
|
+
end
|
|
13
18
|
|
|
19
|
+
task :default => :test
|
|
14
20
|
|
|
21
|
+
task :build => :compile
|
|
@@ -10,13 +10,17 @@ class IRB::Context
|
|
|
10
10
|
RBTraceCLI.tracer.print(arg)
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
# IRB renders a result by calling this and printing the +output+ buffer it
|
|
14
|
+
# hands in: since 1.15 it streams the inspected value into +output+ rather
|
|
15
|
+
# than using the return value. @last_value is the already-inspected String
|
|
16
|
+
# returned by the remote eval, so we write it straight into the buffer.
|
|
17
|
+
def inspect_last_value(output = +"")
|
|
18
|
+
output << @last_value.to_s
|
|
15
19
|
end
|
|
16
20
|
end
|
|
17
21
|
|
|
18
22
|
class IRB::WorkSpace
|
|
19
|
-
def evaluate(
|
|
23
|
+
def evaluate(statements, file=__FILE__, line=__LINE__)
|
|
20
24
|
RBTraceCLI.tracer.eval(statements)
|
|
21
25
|
end
|
|
22
26
|
end
|
data/lib/rbtrace/version.rb
CHANGED
data/rbtrace.gemspec
CHANGED
|
@@ -25,6 +25,9 @@ Gem::Specification.new do |s|
|
|
|
25
25
|
|
|
26
26
|
s.add_development_dependency "rake"
|
|
27
27
|
|
|
28
|
+
# needed by test/interactive_irb_test.rb
|
|
29
|
+
s.add_development_dependency "irb", ">= 1.15"
|
|
30
|
+
|
|
28
31
|
s.license = "MIT"
|
|
29
32
|
s.summary = 'rbtrace: like strace but for ruby code'
|
|
30
33
|
s.description = 'rbtrace shows you method calls happening inside another ruby process in real time.'
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
#
|
|
3
|
+
# behavioral regression test for `rbtrace --interactive irb` (see PR #108).
|
|
4
|
+
#
|
|
5
|
+
# evaluating an expression should print its value back to the terminal; we had
|
|
6
|
+
# a bug that made it print nothing. The bug only surfaces on a TTY.
|
|
7
|
+
#
|
|
8
|
+
# usage: ruby test/interactive_irb_test.rb <pid-to-trace>
|
|
9
|
+
|
|
10
|
+
require "pty"
|
|
11
|
+
require "timeout"
|
|
12
|
+
|
|
13
|
+
pid = Integer(ARGV.fetch(0))
|
|
14
|
+
cmd = "bundle exec ./bin/rbtrace -p #{pid} --interactive irb"
|
|
15
|
+
|
|
16
|
+
output = +""
|
|
17
|
+
printed_result = false
|
|
18
|
+
|
|
19
|
+
begin
|
|
20
|
+
PTY.spawn({ "TERM" => "xterm" }, cmd) do |reader, writer, _child_pid|
|
|
21
|
+
Timeout.timeout(30) do
|
|
22
|
+
output << reader.readpartial(4096) until output.include?(">") # wait for prompt
|
|
23
|
+
writer.puts "1 + 1"
|
|
24
|
+
output << reader.readpartial(4096) until output.include?("=> 2")
|
|
25
|
+
printed_result = true
|
|
26
|
+
writer.puts "exit"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
rescue Timeout::Error, Errno::EIO, EOFError
|
|
30
|
+
# printed_result stays false unless we saw "=> 2" above
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
if printed_result
|
|
34
|
+
puts "PASS: `--interactive irb` printed the eval result"
|
|
35
|
+
else
|
|
36
|
+
warn "FAIL: `--interactive irb` did not print `=> 2`"
|
|
37
|
+
warn output.gsub(/\e\[[0-9;?]*[A-Za-z]/, "")
|
|
38
|
+
exit 1
|
|
39
|
+
end
|
data/test.sh
CHANGED
|
@@ -48,4 +48,9 @@ trace --gc -m Dir. --slow=250
|
|
|
48
48
|
trace -m Process. Dir.pwd "Proc#call"
|
|
49
49
|
trace --firehose
|
|
50
50
|
|
|
51
|
+
echo ------------------------------------------
|
|
52
|
+
echo interactive irb output
|
|
53
|
+
echo ------------------------------------------
|
|
54
|
+
bundle exec ruby test/interactive_irb_test.rb $PID
|
|
55
|
+
|
|
51
56
|
cleanup
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rbtrace
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Aman Gupta
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: ffi
|
|
@@ -66,6 +65,20 @@ dependencies:
|
|
|
66
65
|
- - ">="
|
|
67
66
|
- !ruby/object:Gem::Version
|
|
68
67
|
version: '0'
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: irb
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '1.15'
|
|
75
|
+
type: :development
|
|
76
|
+
prerelease: false
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '1.15'
|
|
69
82
|
description: rbtrace shows you method calls happening inside another ruby process
|
|
70
83
|
in real time.
|
|
71
84
|
email: aman@tmm1.net
|
|
@@ -99,6 +112,7 @@ files:
|
|
|
99
112
|
- rbtrace.gemspec
|
|
100
113
|
- server.rb
|
|
101
114
|
- test.sh
|
|
115
|
+
- test/interactive_irb_test.rb
|
|
102
116
|
- tracers/activerecord.tracer
|
|
103
117
|
- tracers/eventmachine.tracer
|
|
104
118
|
- tracers/io.tracer
|
|
@@ -110,7 +124,6 @@ homepage: http://github.com/tmm1/rbtrace
|
|
|
110
124
|
licenses:
|
|
111
125
|
- MIT
|
|
112
126
|
metadata: {}
|
|
113
|
-
post_install_message:
|
|
114
127
|
rdoc_options: []
|
|
115
128
|
require_paths:
|
|
116
129
|
- lib
|
|
@@ -126,8 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
126
139
|
- !ruby/object:Gem::Version
|
|
127
140
|
version: '0'
|
|
128
141
|
requirements: []
|
|
129
|
-
rubygems_version:
|
|
130
|
-
signing_key:
|
|
142
|
+
rubygems_version: 4.0.6
|
|
131
143
|
specification_version: 4
|
|
132
144
|
summary: 'rbtrace: like strace but for ruby code'
|
|
133
145
|
test_files: []
|