Skip to content

Commit

Permalink
Merge pull request #15 from trailofbits/mschwager-ruby-300
Browse files Browse the repository at this point in the history
Fix #14, support for Ruby back to 3.0.0
  • Loading branch information
mschwager authored Mar 26, 2024
2 parents 0f554e6 + be40045 commit b88b214
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `Ruzzy.c_trace_branch` to `Ruzzy.trace` to simplify interface
- Support for `clang` back to `14.0.6`, and system `clang`, e.g. from `apt` ([#12](https://github.com/trailofbits/ruzzy/pull/12))

### Fixed

- Support for Ruby back to `3.0.0` (Ubuntu 22.04) ([#14](https://github.com/trailofbits/ruzzy/issues/14))

## [0.6.0] - 2024-02-13

### Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Table of contents:

# Installing

Currently, Ruzzy only supports Linux x86-64 and AArch64/ARM64. If you'd like to run Ruzzy on a Mac or Windows, you can build the [`Dockerfile`](https://github.com/trailofbits/ruzzy/blob/main/Dockerfile) and/or use the [development environment](#developing). Ruzzy requires a recent version of `clang` (tested back to `14.0.6`), preferably the [latest release](https://github.com/llvm/llvm-project/releases).
Currently, Ruzzy only supports Linux x86-64 and AArch64/ARM64. If you'd like to run Ruzzy on a Mac or Windows, you can build the [`Dockerfile`](https://github.com/trailofbits/ruzzy/blob/main/Dockerfile) and/or use the [development environment](#developing). Ruzzy requires a recent version of `clang` (tested back to `14.0.0`), preferably the [latest release](https://github.com/llvm/llvm-project/releases).

Install Ruzzy with the following command:

Expand Down
6 changes: 3 additions & 3 deletions ext/cruzzy/cruzzy.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ static void event_hook_branch(VALUE counter_hash, rb_trace_arg_t *tracearg) {

static void enable_branch_coverage_hooks()
{
// Call Coverage.setup(branches: true) to activate branch coverage hooks.
// Call Coverage.start(branches: true) to activate branch coverage hooks.
// Branch coverage hooks will not be activated without this call despite
// adding the event hooks. I suspect rb_set_coverages must be called
// first, which initializes some global state that we do not have direct
// access to. Calling setup initializes coverage state here:
// access to. Calling start initializes coverage state here:
// https://github.com/ruby/ruby/blob/v3_3_0/ext/coverage/coverage.c#L112-L120
// If rb_set_coverages is not called, then rb_get_coverages returns a NULL
// pointer, which appears to effectively disable coverage collection here:
Expand All @@ -207,7 +207,7 @@ static void enable_branch_coverage_hooks()
VALUE coverage_mod = rb_const_get(rb_cObject, rb_intern("Coverage"));
VALUE hash_arg = rb_hash_new();
rb_hash_aset(hash_arg, ID2SYM(rb_intern("branches")), Qtrue);
rb_funcall(coverage_mod, rb_intern("setup"), 1, hash_arg);
rb_funcall(coverage_mod, rb_intern("start"), 1, hash_arg);
}

static VALUE c_trace(VALUE self, VALUE harness_path)
Expand Down

0 comments on commit b88b214

Please sign in to comment.