From b22480aac5e8a80deddee15b65513d23f7af2d07 Mon Sep 17 00:00:00 2001 From: Richard Tucker Date: Tue, 9 Dec 1997 15:05:14 +0000 Subject: [PATCH] Add my own assertion handler for mps within easy-tramp Copied from Perforce Change: 19088 ServerID: perforce.ravenbrook.com --- mps/qa/test/testlib/testlib.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/mps/qa/test/testlib/testlib.c b/mps/qa/test/testlib/testlib.c index f95f493f991..2daf81e8947 100644 --- a/mps/qa/test/testlib/testlib.c +++ b/mps/qa/test/testlib/testlib.c @@ -154,7 +154,7 @@ void error(const char *format, ...) } static void myabort(void) { - abort(); + exit(EXIT_FAILURE); } void verror(const char *format, va_list args) @@ -190,6 +190,20 @@ void asserts(int expr, const char *format, ...) /* routines for easy use of the MPS */ +/* my own assertion handler, insalled by easy_tramp +*/ + +void my_assert_handler(const char *cond, const char *id, + const char *file, unsigned line) { + comment("MPS ASSERTION FAILURE"); + report("assert", "true"); + report("assertid", id); + report("assertfile", file); + report("assertline", "%u", line); + report("assertcond", cond); + myabort(); +} + /* easy_tramp simplified trampoline, for those who don't want to pass anything into or out of it -- it takes @@ -200,6 +214,8 @@ static void *call_f(void *p, size_t s) { void (**f)(void) = p; + mps_assert_install(my_assert_handler); + (**f)(); return NULL; }