diff options
author | Chris Seaton <[email protected]> | 2022-06-14 16:08:36 +0100 |
---|---|---|
committer | Alan Wu <[email protected]> | 2022-06-20 17:18:29 -0400 |
commit | 31b2cd38c5dcf4a0c51ca56ecdddf7461b8ac86c (patch) | |
tree | d282ecaade8561f335ea1cbb1cc0246909b897e8 /version.c | |
parent | 5ca2335802b281f9a38b1d9b73b146b94ed0eed3 (diff) |
Include JIT information in crash reports
Since enabling YJIT or MJIT drastically changes what could go wrong at
runtime, it's good to be front and center about whether they are enabled
when dumping a crash report. Previously, `RUBY_DESCRIPTION` and the
description printed when crashing can be different when a JIT is on.
Introduce a new internal data global, `rb_dynamic_description`, and set
it to be the same as `RUBY_DESCRIPTION` during initialization; use it
when crashing.
* version.c: Init_ruby_description(): Initialize and use
`rb_dynamic_description`.
* error.c: Change crash reports to use `rb_dynamic_description`.
* ruby.c: Call `Init_ruby_description()` earlier. Slightly more work
for when we exit right after printing the description but that
was deemed acceptable.
* include/ruby/version.h: Talk about how JIT info is not in
`ruby_description`.
* test/-ext-/bug_reporter/test_bug_reporter.rb: Remove handling for
crash description being different from `RUBY_DESCRIPTION`.
* test/ruby/test_rubyoptions.rb: ditto
Co-authored-by: Nobuyoshi Nakada <[email protected]>
Co-authored-by: Alan Wu <[email protected]>
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5872
Diffstat (limited to 'version.c')
-rw-r--r-- | version.c | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -47,6 +47,9 @@ static const char ruby_description_with_yjit[] = RUBY_DESCRIPTION_WITH(" +YJIT") const char ruby_copyright[] = RUBY_COPYRIGHT; const char ruby_engine[] = "ruby"; +// Might change after initialization +const char *rb_dynamic_description = ruby_description; + /*! Defines platform-depended Ruby-level constants */ void Init_version(void) @@ -104,9 +107,11 @@ Init_ruby_description(void) VALUE description; if (MJIT_OPTS_ON) { + rb_dynamic_description = ruby_description_with_mjit; description = MKSTR(description_with_mjit); } else if (rb_yjit_enabled_p()) { + rb_dynamic_description = ruby_description_with_yjit; description = MKSTR(description_with_yjit); } else { @@ -122,15 +127,7 @@ Init_ruby_description(void) void ruby_show_version(void) { - if (MJIT_OPTS_ON) { - PRINT(description_with_mjit); - } - else if (rb_yjit_enabled_p()) { - PRINT(description_with_yjit); - } - else { - PRINT(description); - } + puts(rb_dynamic_description); #ifdef RUBY_LAST_COMMIT_TITLE fputs("last_commit=" RUBY_LAST_COMMIT_TITLE, stdout); |