rbtrace 0.4.13 → 0.4.14

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 942f750987d2faf32e6d104d097bb8dfa68dda43644750259a1bc0d3a23a47d6
4
- data.tar.gz: 1fb44c1bbf4936871cef319331d27f9743debe12d28ca05235fc1750e70aa261
3
+ metadata.gz: 78fc8aa96b3b20a4663ceaef1253f41443689e85f344a9efecb60c240e85183b
4
+ data.tar.gz: 2f2ab561dfe12096dcbe28ff188d07e34af48bbed936f09bbc0dd23309132bea
5
5
  SHA512:
6
- metadata.gz: df57be716aff5cc91cd2ce54e3bb55015b76a4390fe86b7f68b91a63794364387cd9edae630f6f83584c5288f8d2fcdd3a191c6c43e75a1cdabfb064ae5cd0be
7
- data.tar.gz: 60cf530a8271c124dd1cd8df54761812e951aa9a722df89da12c5be163a87838b7fcce03b12244699df732424a5eeaf26e6ac80270f4afaa79f756875654521a
6
+ metadata.gz: 1710793189ea23b9048c68ff61c1c7f52202b4e7770991e4c049f9b1b069dbbe4fd71f59e2e79a06d34c4c15628073d0498175fcbb64572152c22b9636557a09
7
+ data.tar.gz: 315c8c2bc040cf790e4964a93ee9f50b97f9b2b7718f71790e8af36cb2d1fe01d529da06fd6b346747e45fc82b52b2fde6fd62bf9053010e8e93d38f76e575fe
@@ -13,7 +13,7 @@ require 'fileutils'
13
13
 
14
14
  libdir = File.basename RbConfig::CONFIG['libdir']
15
15
 
16
- unless File.exists?("#{CWD}/dst/#{libdir}/libmsgpackc.a")
16
+ unless File.exist?("#{CWD}/dst/#{libdir}/libmsgpackc.a")
17
17
  Logging.message "Building msgpack\n"
18
18
 
19
19
  msgpack = File.basename('msgpack-1.1.0.tar.gz')
@@ -28,7 +28,7 @@ unless File.exists?("#{CWD}/dst/#{libdir}/libmsgpackc.a")
28
28
  end
29
29
 
30
30
  Dir.chdir('src') do
31
- FileUtils.rm_rf(dir) if File.exists?(dir)
31
+ FileUtils.rm_rf(dir) if File.exist?(dir)
32
32
 
33
33
  sys("tar zxvfo #{msgpack}")
34
34
  Dir.chdir(dir) do
@@ -22,6 +22,7 @@
22
22
 
23
23
  #include <msgpack.h>
24
24
  #include <ruby.h>
25
+ #include <ruby/debug.h>
25
26
 
26
27
  #ifndef RUBY_VM
27
28
  #include <env.h>
@@ -51,6 +52,11 @@
51
52
  #endif
52
53
 
53
54
 
55
+ // The SUN_LEN macro is not available on Android
56
+ #ifndef SUN_LEN
57
+ #define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) + strlen((ptr)->sun_path))
58
+ #endif
59
+
54
60
  static uint64_t
55
61
  ru_utime_usec()
56
62
  {
@@ -688,7 +694,7 @@ rbtracer_add(char *query, bool is_slow)
688
694
  *idx = NULL,
689
695
  *method = NULL;
690
696
 
691
- if (NULL != (idx = rindex(query, '.'))) {
697
+ if (NULL != (idx = strrchr(query, '.'))) {
692
698
  klass_begin = 0;
693
699
  klass_end = idx - query;
694
700
  is_singleton = true;
@@ -700,7 +706,7 @@ rbtracer_add(char *query, bool is_slow)
700
706
 
701
707
  method = idx+1;
702
708
 
703
- } else if (NULL != (idx = rindex(query, '#'))) {
709
+ } else if (NULL != (idx = strrchr(query, '#'))) {
704
710
  klass_begin = 0;
705
711
  klass_end = idx - query;
706
712
  is_singleton = false;
@@ -12,7 +12,7 @@ class RBTraceCLI
12
12
  #
13
13
  # Returns nothing.
14
14
  def self.check_msgmnb
15
- if File.exists?(msgmnb = "/proc/sys/kernel/msgmnb")
15
+ if File.exist?(msgmnb = "/proc/sys/kernel/msgmnb")
16
16
  curr = File.read(msgmnb).to_i
17
17
  max = 1024*1024
18
18
  cmd = "sysctl kernel.msgmnb=#{max}"
@@ -273,7 +273,7 @@ EOS
273
273
  file = [
274
274
  config,
275
275
  File.expand_path("../../../tracers/#{config}.tracer", __FILE__)
276
- ].find{ |f| File.exists?(f) }
276
+ ].find{ |f| File.exist?(f) }
277
277
 
278
278
  unless file
279
279
  parser.die :config, '(file does not exist)'
@@ -96,7 +96,7 @@ class RBTracer
96
96
  end
97
97
 
98
98
  def clean_socket_path
99
- FileUtils.rm(socket_path) if File.exists?(socket_path)
99
+ FileUtils.rm(socket_path) if File.exist?(socket_path)
100
100
  end
101
101
 
102
102
  # Watch for method calls slower than a threshold.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class RBTracer
4
- VERSION = '0.4.13'
4
+ VERSION = '0.4.14'
5
5
  end
data/server.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'ext/rbtrace'
2
+ require 'tmpdir'
2
3
 
3
4
  class String
4
5
  def multiply_vowels(num)
@@ -26,19 +27,21 @@ end
26
27
 
27
28
  while true
28
29
  proc {
29
- Dir.chdir("/tmp") do
30
- Dir.pwd
31
- Process.pid
32
- 'hello'.multiply_vowels(3){ :ohai }
33
- sleep rand*0.5
30
+ Dir.mktmpdir do |tmp|
31
+ Dir.chdir(tmp) do
32
+ Dir.pwd
33
+ Process.pid
34
+ 'hello'.multiply_vowels(3){ :ohai }
35
+ sleep rand*0.5
34
36
 
35
- ENV['blah']
36
- GC.start
37
+ ENV['blah']
38
+ GC.start
37
39
 
38
- reload_test.call
39
- Test.run
40
+ reload_test.call
41
+ Test.run
40
42
 
41
- #fib(1024*100)
43
+ #fib(1024*100)
44
+ end
42
45
  end
43
46
  }.call
44
47
  end
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.13
4
+ version: 0.4.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aman Gupta
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-19 00:00:00.000000000 Z
11
+ date: 2020-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -107,7 +107,7 @@ homepage: http://github.com/tmm1/rbtrace
107
107
  licenses:
108
108
  - MIT
109
109
  metadata: {}
110
- post_install_message:
110
+ post_install_message:
111
111
  rdoc_options: []
112
112
  require_paths:
113
113
  - lib
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  version: '0'
125
125
  requirements: []
126
126
  rubygems_version: 3.0.3
127
- signing_key:
127
+ signing_key:
128
128
  specification_version: 4
129
129
  summary: 'rbtrace: like strace but for ruby code'
130
130
  test_files: []