Richard Heck
2014-08-27 22:20:30 UTC
On 08/27/2014 01:52 PM, Peter Kümmel wrote:
> commit ada262a78b2ec12e9697783b27523b8c13b51066
> Author: Peter Kümmel <***@lyx.org>
> Date: Wed Aug 27 19:40:40 2014 +0200
>
> print callstack on assert
>
> diff --git a/src/support/lassert.cpp b/src/support/lassert.cpp
> index 281330e..fa2ffb0 100644
> --- a/src/support/lassert.cpp
> +++ b/src/support/lassert.cpp
> @@ -10,6 +10,7 @@
> */
>
> #include <config.h>
> +#include <lassert.h>
>
> #include "support/convert.h"
> #include "support/debug.h"
> @@ -35,13 +36,21 @@ namespace lyx {
> using namespace std;
> using namespace support;
>
> -// TODO Should we try to print the call stack in the course of these?
> +
> +void doAssertWithCallstack(bool value)
> +{
> + if (!value) {
> + printCallStack();
> + BOOST_ASSERT(false);
> + }
> +}
> +
>
What about:
printCallStack();
BOOST_ASSERT(value);
It seems worth printing the call stack whether we are going to abort or not.
Richard
> commit ada262a78b2ec12e9697783b27523b8c13b51066
> Author: Peter Kümmel <***@lyx.org>
> Date: Wed Aug 27 19:40:40 2014 +0200
>
> print callstack on assert
>
> diff --git a/src/support/lassert.cpp b/src/support/lassert.cpp
> index 281330e..fa2ffb0 100644
> --- a/src/support/lassert.cpp
> +++ b/src/support/lassert.cpp
> @@ -10,6 +10,7 @@
> */
>
> #include <config.h>
> +#include <lassert.h>
>
> #include "support/convert.h"
> #include "support/debug.h"
> @@ -35,13 +36,21 @@ namespace lyx {
> using namespace std;
> using namespace support;
>
> -// TODO Should we try to print the call stack in the course of these?
> +
> +void doAssertWithCallstack(bool value)
> +{
> + if (!value) {
> + printCallStack();
> + BOOST_ASSERT(false);
> + }
> +}
> +
>
What about:
printCallStack();
BOOST_ASSERT(value);
It seems worth printing the call stack whether we are going to abort or not.
Richard