From 439224a5904411b288e441096e21a41244ddd1d6 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 22 Jan 2016 08:33:55 +0000 Subject: RUBY_ASSERT * error.c (rb_assert_failure): assertion with stack dump. * ruby_assert.h (RUBY_ASSERT): new header for the assertion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- error.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'error.c') diff --git a/error.c b/error.c index a86485d558..f88c19a328 100644 --- a/error.c +++ b/error.c @@ -11,6 +11,7 @@ #include "internal.h" #include "ruby/st.h" +#include "ruby_assert.h" #include "vm_core.h" #include @@ -499,6 +500,18 @@ rb_compile_bug_str(VALUE file, int line, const char *fmt, ...) abort(); } +void +rb_assert_failure(const char *file, int line, const char *name, const char *expr) +{ + FILE *out = stderr; + fprintf(out, "Assertion Failed: %s:%d:", file, line); + if (name) fprintf(out, "%s:", name); + fprintf(out, "%s\n%s\n\n", expr, ruby_description); + rb_vm_bugreport(NULL); + bug_report_end(out); + die(); +} + static const char builtin_types[][10] = { "", /* 0x00, */ "Object", -- cgit v1.2.3