rbtrace 0.4.8 → 0.4.9
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/ext/extconf.rb +1 -1
- data/ext/rbtrace.c +3 -5
- data/lib/rbtrace/cli.rb +26 -3
- data/lib/rbtrace/interactive/irb.rb +22 -0
- data/lib/rbtrace/interactive/rib.rb +22 -0
- data/lib/rbtrace/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8cd3dd5d2826625fbf017e93f76f52edbaa0b83
|
4
|
+
data.tar.gz: 50b49986ffdeab614a9076c5f861738c9d4e4a70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab75bcf6469ae23f80ec62e520e840710ef912e7080ef69474821e38077a9893a1a16d812048d3d47d990ffbe79e4d2dc075ed9367484835e240b35257f22dee
|
7
|
+
data.tar.gz: 9a2ce4b26b191f1064ba30601a37f4b0f8e6490bb1dec9776720bbcd4935653c823db45f1381d09d0f00b9735a8c0bab31e772985da0524c7f72b7ed17d4ebf1
|
data/ext/extconf.rb
CHANGED
@@ -30,7 +30,7 @@ unless File.exists?("#{CWD}/dst/#{libdir}/libmsgpackc.a")
|
|
30
30
|
Dir.chdir('src') do
|
31
31
|
FileUtils.rm_rf(dir) if File.exists?(dir)
|
32
32
|
|
33
|
-
sys("tar
|
33
|
+
sys("tar zxvfo #{msgpack}")
|
34
34
|
Dir.chdir(dir) do
|
35
35
|
if RUBY_PLATFORM =~ /i686/ and gcc = `gcc -v 2>&1` and gcc =~ /gcc version (\d\.\d)/ and $1.to_f <= 4.1
|
36
36
|
ENV['CFLAGS'] = " #{ENV['CFLAGS']} -march=i686 "
|
data/ext/rbtrace.c
CHANGED
@@ -46,10 +46,8 @@
|
|
46
46
|
|
47
47
|
#ifdef __FreeBSD__
|
48
48
|
#define PLATFORM_FREEBSD
|
49
|
-
#
|
50
|
-
|
51
|
-
#ifdef __linux__
|
52
|
-
#define PLATFORM_LINUX
|
49
|
+
#elif __OpenBSD__
|
50
|
+
#define PLATFORM_OPENBSD
|
53
51
|
#endif
|
54
52
|
|
55
53
|
|
@@ -967,7 +965,7 @@ rbtrace__process_event(msgpack_object cmd)
|
|
967
965
|
if (outer == 0) {
|
968
966
|
rb_eval_string_protect("$0 = \"[DEBUG] #{Process.ppid}\"", 0);
|
969
967
|
|
970
|
-
#
|
968
|
+
#if defined(PLATFORM_FREEBSD) || defined(PLATFORM_OPENBSD)
|
971
969
|
// The call setpgrp() is equivalent to setpgid(0,0).
|
972
970
|
setpgid(0,0);
|
973
971
|
#else
|
data/lib/rbtrace/cli.rb
CHANGED
@@ -3,6 +3,8 @@ require 'rbtrace/rbtracer'
|
|
3
3
|
require 'rbtrace/version'
|
4
4
|
|
5
5
|
class RBTraceCLI
|
6
|
+
singleton_class.send(:attr_accessor, :tracer)
|
7
|
+
|
6
8
|
# Suggest increasing the maximum number of bytes allowed on
|
7
9
|
# a message queue to 1MB.
|
8
10
|
#
|
@@ -189,6 +191,12 @@ EOS
|
|
189
191
|
:type => String,
|
190
192
|
:short => '-e'
|
191
193
|
|
194
|
+
opt :interactive,
|
195
|
+
"interactive",
|
196
|
+
:type => String,
|
197
|
+
:default => 'irb',
|
198
|
+
:short => '-i'
|
199
|
+
|
192
200
|
opt :backtrace,
|
193
201
|
"get lines from the current backtrace in the process",
|
194
202
|
:type => :int
|
@@ -216,8 +224,8 @@ EOS
|
|
216
224
|
ARGV.clear
|
217
225
|
end
|
218
226
|
|
219
|
-
unless %w[ fork eval backtrace slow slowcpu firehose methods config gc ].find{ |n| opts[:"#{n}_given"] }
|
220
|
-
$stderr.puts "Error: --slow, --slowcpu, --gc, --firehose, --methods or --config required."
|
227
|
+
unless %w[ fork eval interactive backtrace slow slowcpu firehose methods config gc ].find{ |n| opts[:"#{n}_given"] }
|
228
|
+
$stderr.puts "Error: --slow, --slowcpu, --gc, --firehose, --methods, --interactive or --config required."
|
221
229
|
$stderr.puts "Try --help for help."
|
222
230
|
exit(-1)
|
223
231
|
end
|
@@ -384,7 +392,7 @@ EOS
|
|
384
392
|
|
385
393
|
begin
|
386
394
|
begin
|
387
|
-
tracer = RBTracer.new(tracee)
|
395
|
+
self.tracer = RBTracer.new(tracee)
|
388
396
|
rescue ArgumentError => e
|
389
397
|
parser.die :pid, "(#{e.message})"
|
390
398
|
end
|
@@ -411,6 +419,21 @@ EOS
|
|
411
419
|
tracer.puts "=> #{res}"
|
412
420
|
end
|
413
421
|
|
422
|
+
elsif opts[:interactive_given]
|
423
|
+
require "rbtrace/interactive/#{opts[:interactive]}"
|
424
|
+
|
425
|
+
bin = Gem::Specification.find do |spec|
|
426
|
+
bin_file = spec.bin_file(opts[:interactive])
|
427
|
+
break bin_file if File.exist?(bin_file)
|
428
|
+
end || ENV['PATH'].split(':').find do |path|
|
429
|
+
found = Dir["#{path}/*"].find do |file|
|
430
|
+
break file if File.basename(file) == opts[:interactive]
|
431
|
+
end
|
432
|
+
break found if found
|
433
|
+
end
|
434
|
+
|
435
|
+
load(bin)
|
436
|
+
|
414
437
|
else
|
415
438
|
tracer.out = output if output
|
416
439
|
tracer.timeout = opts[:timeout] if opts[:timeout] > 0
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
require 'irb'
|
3
|
+
|
4
|
+
class IRB::Context
|
5
|
+
def puts(arg=nil)
|
6
|
+
RBTraceCLI.tracer.puts(arg)
|
7
|
+
end
|
8
|
+
|
9
|
+
def print(arg=nil)
|
10
|
+
RBTraceCLI.tracer.print(arg)
|
11
|
+
end
|
12
|
+
|
13
|
+
def inspect_last_value
|
14
|
+
@last_value
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class IRB::WorkSpace
|
19
|
+
def evaluate(context, statements, file=__FILE__, line=__LINE__)
|
20
|
+
RBTraceCLI.tracer.eval(statements)
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
require 'rib/config'
|
3
|
+
|
4
|
+
module Rib::Rbtrace
|
5
|
+
def puts(arg=nil)
|
6
|
+
RBTraceCLI.tracer.puts(arg)
|
7
|
+
end
|
8
|
+
|
9
|
+
def print(arg=nil)
|
10
|
+
RBTraceCLI.tracer.print(arg)
|
11
|
+
end
|
12
|
+
|
13
|
+
def format_result(result)
|
14
|
+
result_prompt + result
|
15
|
+
end
|
16
|
+
|
17
|
+
def loop_eval(input)
|
18
|
+
RBTraceCLI.tracer.eval(input)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
Rib::Shell.send(:include, Rib::Rbtrace)
|
data/lib/rbtrace/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbtrace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aman Gupta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -73,6 +73,8 @@ files:
|
|
73
73
|
- ext/src/msgpack-1.1.0.tar.gz
|
74
74
|
- lib/rbtrace/cli.rb
|
75
75
|
- lib/rbtrace/core_ext.rb
|
76
|
+
- lib/rbtrace/interactive/irb.rb
|
77
|
+
- lib/rbtrace/interactive/rib.rb
|
76
78
|
- lib/rbtrace/msgq.rb
|
77
79
|
- lib/rbtrace/rbtracer.rb
|
78
80
|
- lib/rbtrace/version.rb
|
@@ -106,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
108
|
version: '0'
|
107
109
|
requirements: []
|
108
110
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.
|
111
|
+
rubygems_version: 2.6.13
|
110
112
|
signing_key:
|
111
113
|
specification_version: 4
|
112
114
|
summary: 'rbtrace: like strace but for ruby code'
|