ruby_memcheck 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 01e474f34ff993ba99b7c554d54bf850c49b8fc8f73fdec8702639373673a088
4
- data.tar.gz: a1413639549cc0493adf456b8f38e6dc6463975dab3ef508459809f3b8307031
3
+ metadata.gz: fca269c41420864e19c468ac6d8c0101624f7c8638b603f2cf6975acbcc9f6b6
4
+ data.tar.gz: ea928aef070c76ab183cc80592e0ad8ecf3cbb2c5550f4dacd4ea143c0096d5a
5
5
  SHA512:
6
- metadata.gz: ade6759ab00942eb4dc1ebd5f5e3578d316c49cdf69e979e42ec5d37a8215d139d9765bca26f519158764613d51ed58f01bed055ba70b17860e0d15d7b1c9a89
7
- data.tar.gz: 46b92557fbf9dca12a6b3a9f5196d95d54d44b886f06d46beb7b6afe7768476decc921c0f893864e9417328453f45346a4bf91159df8fe3bd529091b19637b90
6
+ metadata.gz: e7049b31e3177ab265ae4f67318cb3c95ef9332091eea013af93a636662e4350190d02a0f6a8d571755e0df9031ba20a59624c133b07dbf57a3af04929da374e
7
+ data.tar.gz: 8e210f743656f5c604103f113574f2957f37666b2ba52ba350ee94680a34fbb61ade1ccd535b6145f268c280c29082b50c2133b3d1b4c32a9ba19c83c9b1af65
@@ -4,11 +4,13 @@ jobs:
4
4
  test:
5
5
  runs-on: ubuntu-latest
6
6
  strategy:
7
+ fail-fast: false
7
8
  matrix:
8
9
  entry:
9
10
  - { ruby: '2.7', allowed-failure: false }
10
11
  - { ruby: '3.0', allowed-failure: false }
11
12
  - { ruby: '3.1', allowed-failure: false }
13
+ - { ruby: '3.2', allowed-failure: false }
12
14
  - { ruby: ruby-head, allowed-failure: false }
13
15
  name: ruby ${{ matrix.entry.ruby }}
14
16
  steps:
@@ -16,7 +18,18 @@ jobs:
16
18
  - uses: ruby/setup-ruby@v1
17
19
  with:
18
20
  ruby-version: ${{ matrix.entry.ruby }}
19
- - run: sudo apt-get install -y valgrind
21
+ # - run: sudo apt-get install -y valgrind
22
+ # We cannot use Valgrind from apt because we need at least Valgrind 3.20.0
23
+ # to support DWARF 5
24
+ - run: sudo apt-get install -y libc6-dbg
25
+ - name: Install Valgrind from source
26
+ run: |
27
+ wget https://sourceware.org/pub/valgrind/valgrind-3.20.0.tar.bz2
28
+ tar xvf valgrind-3.20.0.tar.bz2
29
+ cd valgrind-3.20.0
30
+ ./configure
31
+ make
32
+ sudo make install
20
33
  - run: bundle install --jobs=3 --retry=3
21
34
  - run: bundle exec rake
22
35
  continue-on-error: ${{ matrix.entry.allowed-failure }}
data/README.md CHANGED
@@ -50,6 +50,25 @@ gem install ruby_memcheck
50
50
 
51
51
  ## Setup
52
52
 
53
+ > **Note**
54
+ > If you encounter errors from Valgrind that looks like this:
55
+ > ```
56
+ > ### unhandled dwarf2 abbrev form code 0x25
57
+ > ```
58
+ > Then you need a newer version of Valgrind (>= 3.20.0) with DWARF5 support.
59
+ > The current versions of Valgrind in Ubuntu Packages is not new enough.
60
+ >
61
+ > You can install Valgrind from source using the following commands:
62
+ > ```
63
+ > sudo apt-get install -y libc6-dbg
64
+ > wget https://sourceware.org/pub/valgrind/valgrind-3.20.0.tar.bz2
65
+ > tar xvf valgrind-3.20.0.tar.bz2
66
+ > cd valgrind-3.20.0
67
+ > ./configure
68
+ > make
69
+ > sudo make install
70
+ > ```
71
+
53
72
  The easiest way to use this gem is to use it on your test suite (minitest or RSpec) using rake.
54
73
 
55
74
  0. Install Valgrind.
@@ -139,6 +158,7 @@ When you run `RubyMemcheck.config`, you are creating a default `RubyMemcheck::Co
139
158
  - `skipped_ruby_functions`: Optional. Ruby functions that are ignored because they are considered a call back into Ruby. This is only present as an escape hatch, so avoid using it. If you find another Ruby function that is a false positive because it calls back into Ruby, please send a patch into this repo. Otherwise, use a Valgrind suppression file.
140
159
  - `valgrind_xml_dir`: Optional. The directory to store temporary XML files for Valgrind. It defaults to a temporary directory. This is present for development debugging, so you shouldn't have to use it.
141
160
  - `output_io`: Optional. The `IO` object to output Valgrind errors to. Defaults to standard error.
161
+ - `filter_all_errors`: Optional. Whether to filter all kinds of Valgrind errors (not just memory leaks). This feature should only be used if you're encountering a large number of illegal memory accesses coming from Ruby. If you need to use this feature, you may have found a bug inside of Ruby. Consider reporting it to the [Ruby bug tracker](https://bugs.ruby-lang.org/projects/ruby-master/issues/new). Defaults to `false`.
142
162
 
143
163
  ## Suppression files
144
164
 
@@ -31,9 +31,19 @@ module RubyMemcheck
31
31
  /\Arb_yield/,
32
32
  ].freeze
33
33
 
34
- attr_reader :binary_name, :ruby, :valgrind, :valgrind_options, :valgrind_suppression_files,
35
- :valgrind_generate_suppressions, :skipped_ruby_functions, :valgrind_xml_dir, :output_io
34
+ attr_reader :binary_name
35
+ attr_reader :ruby
36
+ attr_reader :valgrind
37
+ attr_reader :valgrind_options
38
+ attr_reader :valgrind_suppression_files
39
+ attr_reader :valgrind_generate_suppressions
40
+ attr_reader :skipped_ruby_functions
41
+ attr_reader :valgrind_xml_dir
42
+ attr_reader :output_io
43
+ attr_reader :filter_all_errors
44
+
36
45
  alias_method :valgrind_generate_suppressions?, :valgrind_generate_suppressions
46
+ alias_method :filter_all_errors?, :filter_all_errors
37
47
 
38
48
  def initialize(
39
49
  binary_name:,
@@ -44,7 +54,8 @@ module RubyMemcheck
44
54
  valgrind_generate_suppressions: false,
45
55
  skipped_ruby_functions: DEFAULT_SKIPPED_RUBY_FUNCTIONS,
46
56
  valgrind_xml_dir: Dir.mktmpdir,
47
- output_io: $stderr
57
+ output_io: $stderr,
58
+ filter_all_errors: false
48
59
  )
49
60
  @binary_name = binary_name
50
61
  @ruby = ruby
@@ -56,6 +67,7 @@ module RubyMemcheck
56
67
  @valgrind_generate_suppressions = valgrind_generate_suppressions
57
68
  @skipped_ruby_functions = skipped_ruby_functions
58
69
  @output_io = output_io
70
+ @filter_all_errors = filter_all_errors
59
71
 
60
72
  if valgrind_xml_dir
61
73
  valgrind_xml_dir = File.expand_path(valgrind_xml_dir)
@@ -14,17 +14,18 @@ module RubyMemcheck
14
14
  end
15
15
 
16
16
  def in_ruby?
17
+ return false unless obj
18
+
17
19
  obj == configuration.ruby ||
18
20
  # Hack to fix Ruby built with --enabled-shared
19
21
  File.basename(obj) == "libruby.so.#{RUBY_VERSION}"
20
22
  end
21
23
 
22
24
  def in_binary?
23
- if obj
24
- File.basename(obj, ".*") == configuration.binary_name
25
- else
26
- false
27
- end
25
+ return false unless obj
26
+
27
+ binary_name_without_ext = File.join(File.dirname(obj), File.basename(obj, ".*"))
28
+ binary_name_without_ext.end_with?(File.join("", configuration.binary_name))
28
29
  end
29
30
 
30
31
  def to_s
@@ -47,7 +47,7 @@ module RubyMemcheck
47
47
  private
48
48
 
49
49
  def should_filter?
50
- kind_leak?
50
+ @configuration.filter_all_errors? || kind_leak?
51
51
  end
52
52
 
53
53
  def kind_leak?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyMemcheck
4
- VERSION = "1.2.0"
4
+ VERSION = "1.3.0"
5
5
  end
@@ -28,3 +28,9 @@
28
28
  fun:exec_recursive
29
29
  ...
30
30
  }
31
+ {
32
+ "Invalid read of size 8" when marking the stack of fibers
33
+ Memcheck:Addr8
34
+ fun:each_location*
35
+ ...
36
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_memcheck
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Zhu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-20 00:00:00.000000000 Z
11
+ date: 2023-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -170,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
170
  - !ruby/object:Gem::Version
171
171
  version: '0'
172
172
  requirements: []
173
- rubygems_version: 3.3.7
173
+ rubygems_version: 3.4.1
174
174
  signing_key:
175
175
  specification_version: 4
176
176
  summary: Use Valgrind memcheck without going crazy