diff options
author | Étienne Barrié <[email protected]> | 2025-06-05 17:09:47 +0200 |
---|---|---|
committer | Jean Boussier <[email protected]> | 2025-06-05 18:01:11 +0200 |
commit | 22dfa250a89d11cc138ef73d1ed6c364c15b54c7 (patch) | |
tree | 739de6c83fab12213c3de3a6f1130240085504cb /doc | |
parent | da2453c58de9b1bc6ab58296980b2b79a9213a90 (diff) |
More comprehensive debugging configuration
Diffstat (limited to 'doc')
-rw-r--r-- | doc/contributing/building_ruby.md | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/doc/contributing/building_ruby.md b/doc/contributing/building_ruby.md index c0eafe182f..a0486cb931 100644 --- a/doc/contributing/building_ruby.md +++ b/doc/contributing/building_ruby.md @@ -260,11 +260,25 @@ This will add launch configurations for debugging Ruby itself by running `test.r ### Compiling for Debugging -You should configure Ruby without optimization and other flags that may -interfere with debugging: +You can compile Ruby with the `RUBY_DEBUG` macro to enable debugging on some +features. One example is debugging object shapes in Ruby with +`RubyVM::Shape.of(object)`. + +Additionally Ruby can be compiled to support the `RUBY_DEBUG` environment +variable to enable debugging on some features. An example is using +`RUBY_DEBUG=gc_stress` to debug GC-related issues. + +There is also support for the `RUBY_DEBUG_LOG` environment variable to log a +lot of information about what the VM is doing, via the `USE_RUBY_DEBUG_LOG` +macro. + +You should also configure Ruby without optimization and other flags that may +interfere with debugging by changing the optimization flags. + +Bringing it all together: ```sh -./configure --enable-debug-env optflags="-O0 -fno-omit-frame-pointer" +./configure cppflags="-DRUBY_DEBUG=1 -DUSE_RUBY_DEBUG_LOG=1" --enable-debug-env optflags="-O0 -fno-omit-frame-pointer" ``` ### Building with Address Sanitizer |