diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
commit | 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch) | |
tree | e5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/boost/libs/stacktrace/example/user_config.cpp | |
parent | Initial commit. (diff) | |
download | ceph-upstream.tar.xz ceph-upstream.zip |
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/stacktrace/example/user_config.cpp')
-rw-r--r-- | src/boost/libs/stacktrace/example/user_config.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/boost/libs/stacktrace/example/user_config.cpp b/src/boost/libs/stacktrace/example/user_config.cpp new file mode 100644 index 00000000..f675b100 --- /dev/null +++ b/src/boost/libs/stacktrace/example/user_config.cpp @@ -0,0 +1,38 @@ +// Copyright Antony Polukhin, 2016-2019. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#define BOOST_USER_CONFIG <libs/stacktrace/example/user_config.hpp> + +#include <boost/array.hpp> +#include <exception> // std::set_terminate, std::abort +#include <boost/stacktrace.hpp> +#include <iostream> // std::cerr +BOOST_NOINLINE void foo(int i); +BOOST_NOINLINE void bar(int i); + +BOOST_NOINLINE void bar(int i) { + boost::array<int, 5> a = {{-1, -231, -123, -23, -32}}; + if (i >= 0) { + foo(a[i]); + } else { + std::cerr << "Terminate called:\n" << boost::stacktrace::stacktrace() << '\n'; + std::exit(0); + } +} + +BOOST_NOINLINE void foo(int i) { + bar(--i); +} + +int main() { + foo(5); + + return 2; +} + + + + |