mirror of
https://github.com/boostorg/stacktrace.git
synced 2026-07-22 13:43:49 +00:00
e93f50def8
Support build with `import std;`. Add Github CI pipeline --------- Co-authored-by: Fedor Osetrov <fdr400@Fedors-MacBook-Pro.local>
36 lines
733 B
C++
36 lines
733 B
C++
// Copyright Antony Polukhin, 2025-2026.
|
|
// Copyright Fedor Osetrov, 2025-2026.
|
|
//
|
|
// 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)
|
|
|
|
#include <iostream>
|
|
#include <map>
|
|
|
|
#include <boost/config.hpp>
|
|
|
|
#include <boost/stacktrace.hpp>
|
|
|
|
namespace {
|
|
|
|
BOOST_NOINLINE void foo() {
|
|
std::map<int, int> m;
|
|
std::ignore = m.at(1);
|
|
}
|
|
|
|
BOOST_NOINLINE void bar() {
|
|
foo();
|
|
}
|
|
|
|
}
|
|
|
|
int main() {
|
|
try {
|
|
bar();
|
|
} catch (const std::exception& ex) {
|
|
const auto trace = boost::stacktrace::stacktrace::from_current_exception();
|
|
std::cerr << "Exception: " << ex.what() << ", trace:\n" << trace << '\n';
|
|
}
|
|
}
|