Call rb_bug_without_die when ASAN error reported

This will give us the Ruby stack trace when an ASAN error is reported.
This commit is contained in:
Peter Zhu 2024-12-11 14:40:40 -05:00
parent 2da70aac25
commit 79d90e7351
Notes: git 2024-12-12 19:08:14 +00:00

12
gc.c
View File

@ -936,6 +936,14 @@ ruby_modular_gc_init(void)
# define rb_gc_impl_copy_attributes rb_gc_functions.copy_attributes
#endif
#ifdef RUBY_ASAN_ENABLED
static void
asan_death_callback(void)
{
rb_bug_without_die("ASAN error");
}
#endif
static VALUE initial_stress = Qfalse;
void *
@ -951,6 +959,10 @@ rb_objspace_alloc(void)
rb_gc_impl_objspace_init(objspace);
rb_gc_impl_stress_set(objspace, initial_stress);
#ifdef RUBY_ASAN_ENABLED
__sanitizer_set_death_callback(asan_death_callback);
#endif
return objspace;
}