From be400457316933d607550580aa68f33e01ce16a3 Mon Sep 17 00:00:00 2001 From: Matt Schwager Date: Mon, 25 Mar 2024 09:35:22 -0400 Subject: [PATCH] Fix #14, support for Ruby back to 3.0.0 --- CHANGELOG.md | 4 ++++ README.md | 2 +- ext/cruzzy/cruzzy.c | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4709987..ac615c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 5eef201..706018b 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/ext/cruzzy/cruzzy.c b/ext/cruzzy/cruzzy.c index 248ac1a..3a460dc 100644 --- a/ext/cruzzy/cruzzy.c +++ b/ext/cruzzy/cruzzy.c @@ -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: @@ -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)