From cb7dc69cd5d8af806d4c94e78b5e91cb8fb8f44d Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 2 Jul 2014 10:17:07 +0100 Subject: [PATCH] Flush the telemetry stream before aborting. Copied from Perforce Change: 186782 ServerID: perforce.ravenbrook.com --- mps/code/mpsliban.c | 1 + mps/manual/source/release.rst | 4 ++++ mps/manual/source/topic/plinth.rst | 8 +++++--- mps/manual/source/topic/telemetry.rst | 3 +-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/mps/code/mpsliban.c b/mps/code/mpsliban.c index 5e7cfdddc8b..38600537f87 100644 --- a/mps/code/mpsliban.c +++ b/mps/code/mpsliban.c @@ -74,6 +74,7 @@ static void mps_lib_assert_fail_default(const char *file, unsigned line, file, line, condition); /* Ensure the message is output even if stderr is buffered. */ (void)fflush(stderr); + mps_telemetry_flush(); ASSERT_ABORT(); /* see config.h */ } diff --git a/mps/manual/source/release.rst b/mps/manual/source/release.rst index c025ad75a40..079dd7d7e3d 100644 --- a/mps/manual/source/release.rst +++ b/mps/manual/source/release.rst @@ -139,6 +139,10 @@ Other changes around 25% faster (in our benchmarks) than they were in release 1.113.0. +#. The default assertion handler in the ANSI plinth now flushes the + telemetry stream before aborting. See + :c:func:`mps_lib_assert_fail`. + .. _release-notes-1.113: diff --git a/mps/manual/source/topic/plinth.rst b/mps/manual/source/topic/plinth.rst index daba2ad62de..95a5ffa72c9 100644 --- a/mps/manual/source/topic/plinth.rst +++ b/mps/manual/source/topic/plinth.rst @@ -247,9 +247,11 @@ Library module .. note:: In the ANSI Library module, ``mpsliban.c``, this reports the - failure using ``fprintf(stderr, "...%s...", message)`` and, in - the :term:`cool` :term:`variety`, terminates the program by - calling :c:func:`abort`. You can change this behaviour with + failure by calling ``fprintf(stderr, "...%s...", message)``, + flushes the :term:`telemetry` stream by calling + :c:func:`mps_telemetry_flush`, and, in the :term:`cool` + :term:`variety`, terminates the program by calling + :c:func:`abort`. You can change this behaviour with :c:func:`mps_lib_assert_fail_install`. For a discussion of the default behaviour, see :ref:`topic-error-assertion-handling`. diff --git a/mps/manual/source/topic/telemetry.rst b/mps/manual/source/topic/telemetry.rst index a665aaf4b07..edbc1182379 100644 --- a/mps/manual/source/topic/telemetry.rst +++ b/mps/manual/source/topic/telemetry.rst @@ -431,8 +431,7 @@ Telemetry interface stream itself. This ensures that even the latest events are now properly recorded, should the :term:`client program` terminate (uncontrollably as a result of a bug, for example) or some - interactive tool require access to the telemetry stream. You could - even try calling this from a debugger after a problem. + interactive tool require access to the telemetry stream. .. note::