Compare commits

...

10 Commits

Author SHA1 Message Date
Antony Polukhin
902537345a Update copyright years 2026-01-04 11:21:08 +03:00
dependabot[bot]
3db7d98f0e Bump actions/checkout from 4 to 6 (#222)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-26 20:37:08 +03:00
Antony Polukhin
e54be17b87 Add dependabot 2025-12-24 20:08:15 +03:00
Antony Polukhin
b2f10f7efd More tests and docs on CMake installation (#213) 2025-12-24 20:05:46 +03:00
Antony Polukhin
77647f8b06 Check for potential memory leak at runtime rather than at compile time (#220)
Closes: https://github.com/boostorg/stacktrace/pull/217
2025-12-24 20:05:06 +03:00
David McFarland
b36c55b3d9 Disable from_exception on cygwin. (#219)
Cygwin doesn't have RTDL_NEXT, which causes a compile error with the
non-windows implementation.  I'm not sure which implementation would be
better to use, so just disable it for now.
2025-12-23 18:51:13 +03:00
Antony Polukhin
6ef20c3ab7 Simplify has_addr2line check to not link with C++ Standard Library (#216)
Fixes: https://github.com/boostorg/stacktrace/issues/209
2025-12-11 22:15:19 +03:00
Jonathan Wakely
cec57009ef Fix URL in libbacktrace_impls.hpp (#214)
The double slash in the URL redirects to the bugzilla main page.
2025-10-29 22:44:29 +03:00
Antony Polukhin
cf5992230b Update CI runners and minor fixes (#210) 2025-09-09 12:01:23 +03:00
Orgad Shaneh
07bc960cfe Add missing cstdint header (#207)
Fixes https://github.com/boostorg/boost/issues/1044
2025-06-01 09:38:06 +03:00
66 changed files with 186 additions and 120 deletions

11
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"

View File

@@ -27,6 +27,7 @@ jobs:
- toolset: gcc-9 - toolset: gcc-9
cxxstd: "03,11,14,17,2a" cxxstd: "03,11,14,17,2a"
os: ubuntu-22.04 os: ubuntu-22.04
install: g++-9
- toolset: clang-15 - toolset: clang-15
cxxstd: "03,11,14,17,2a" cxxstd: "03,11,14,17,2a"
os: ubuntu-22.04 os: ubuntu-22.04
@@ -40,7 +41,7 @@ jobs:
runs-on: ${{matrix.os}} runs-on: ${{matrix.os}}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- name: Install packages - name: Install packages
if: matrix.install if: matrix.install
@@ -69,7 +70,7 @@ jobs:
python tools/boostdep/depinst/depinst.py --include benchmark --include example --include examples --include tools --git_args "--depth 10 --jobs 3" $LIBRARY python tools/boostdep/depinst/depinst.py --include benchmark --include example --include examples --include tools --git_args "--depth 10 --jobs 3" $LIBRARY
./bootstrap.sh ./bootstrap.sh
./b2 -d0 headers ./b2 -d0 headers
./b2 -j4 variant=debug tools/inspect/build ./b2 -j4 variant=debug tools/inspect
- name: Run tests - name: Run tests
run: | run: |
@@ -114,10 +115,10 @@ jobs:
cxxstd: "14,17,latest" cxxstd: "14,17,latest"
addrmd: 64 addrmd: 64
os: windows-2022 os: windows-2022
- toolset: msvc-14.2 - toolset: msvc
cxxstd: "14,17,latest" cxxstd: "14,17,20,latest"
addrmd: 64 addrmd: 64
os: windows-2019 os: windows-2025
#- toolset: gcc #- toolset: gcc
# cxxstd: "03,11,14,17,2a" # cxxstd: "03,11,14,17,2a"
# addrmd: 64 # addrmd: 64
@@ -126,7 +127,7 @@ jobs:
runs-on: ${{matrix.os}} runs-on: ${{matrix.os}}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- name: Setup Boost - name: Setup Boost
shell: cmd shell: cmd
@@ -170,13 +171,13 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ ubuntu-20.04, ubuntu-22.04, macos-13, macos-14 ] os: [ ubuntu-24.04, ubuntu-22.04, macos-latest, macos-14 ]
shared: [ OFF, ON ] shared: [ OFF, ON ]
runs-on: ${{matrix.os}} runs-on: ${{matrix.os}}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- name: Install packages - name: Install packages
if: matrix.install if: matrix.install
@@ -214,13 +215,13 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ ubuntu-20.04, ubuntu-22.04, macos-13, macos-14 ] os: [ ubuntu-24.04, ubuntu-22.04, macos-latest, macos-14 ]
shared: [ OFF, ON ] shared: [ OFF, ON ]
runs-on: ${{matrix.os}} runs-on: ${{matrix.os}}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- name: Install packages - name: Install packages
if: matrix.install if: matrix.install
@@ -265,22 +266,33 @@ jobs:
- name: Use the installed library - name: Use the installed library
run: | run: |
cd ../boost-root/libs/$LIBRARY/test/cmake_install_test && mkdir __build__ && cd __build__ cd ../boost-root/libs/$LIBRARY/test/cmake_install_test && mkdir __build__ && cd __build__
cmake -DCMAKE_INSTALL_PREFIX=~/.local ..
cmake --build .
export LD_LIBRARY_PATH=$HOME/.local/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=$HOME/.local/lib:$LD_LIBRARY_PATH
ctest --output-on-failure --no-tests=error
set -e
if [[ "$OSTYPE" == "darwin"* ]]; then
BACKENDS_ARRAY=(stacktrace stacktrace_noop stacktrace_basic)
else
BACKENDS_ARRAY=(stacktrace stacktrace_noop stacktrace_basic stacktrace_backtrace)
fi
for BACKEND in ${BACKENDS_ARRAY[@]}; do
rm -rf *
cmake -DCMAKE_INSTALL_PREFIX=~/.local -DBOOST_STACKTRACE_IMPL_BACKEND=${BACKEND} ..
cmake --build .
ctest --output-on-failure --no-tests=error -V
done
posix-cmake-test: posix-cmake-test:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ ubuntu-20.04, ubuntu-22.04, macos-13, macos-14 ] os: [ ubuntu-24.04, ubuntu-22.04, macos-latest, macos-14 ]
shared: [ OFF, ON ] shared: [ OFF, ON ]
runs-on: ${{matrix.os}} runs-on: ${{matrix.os}}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- name: Install packages - name: Install packages
if: matrix.install if: matrix.install
@@ -326,13 +338,13 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ windows-2019, windows-2022 ] os: [ windows-2025, windows-2022 ]
shared: [ OFF, ON ] shared: [ OFF, ON ]
runs-on: ${{matrix.os}} runs-on: ${{matrix.os}}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- name: Setup Boost - name: Setup Boost
shell: cmd shell: cmd
@@ -374,13 +386,13 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ windows-2019, windows-2022 ] os: [ windows-2025, windows-2022 ]
shared: [ OFF, ON ] shared: [ OFF, ON ]
runs-on: ${{matrix.os}} runs-on: ${{matrix.os}}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- name: Setup Boost - name: Setup Boost
shell: cmd shell: cmd
@@ -425,10 +437,20 @@ jobs:
shell: cmd shell: cmd
run: | run: |
cd ../boost-root/libs/%LIBRARY%/test/cmake_install_test && mkdir __build__ && cd __build__ cd ../boost-root/libs/%LIBRARY%/test/cmake_install_test && mkdir __build__ && cd __build__
cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix .. cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix -DBOOST_STACKTRACE_IMPL_BACKEND=stacktrace ..
cmake --build . --config Debug cmake --build . --config Debug
PATH C:\cmake-prefix\bin;%PATH% PATH C:\cmake-prefix\bin;%PATH%
ctest --output-on-failure --no-tests=error -C Debug ctest --output-on-failure --no-tests=error -C Debug -V
cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix -DBOOST_STACKTRACE_IMPL_BACKEND=stacktrace_windbg ..
cmake --build . --config Debug
PATH C:\cmake-prefix\bin;%PATH%
ctest --output-on-failure --no-tests=error -C Debug -V
cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix -DBOOST_STACKTRACE_IMPL_BACKEND=stacktrace_windbg_cached ..
cmake --build . --config Debug
PATH C:\cmake-prefix\bin;%PATH%
ctest --output-on-failure --no-tests=error -C Debug -V
- name: Use the installed library (RelWithDebInfo) - name: Use the installed library (RelWithDebInfo)
shell: cmd shell: cmd
@@ -442,13 +464,13 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ windows-2019, windows-2022 ] os: [ windows-2025, windows-2022 ]
shared: [ OFF, ON ] shared: [ OFF, ON ]
runs-on: ${{matrix.os}} runs-on: ${{matrix.os}}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- name: Setup Boost - name: Setup Boost
shell: cmd shell: cmd

View File

@@ -2,7 +2,7 @@
# Distributed under the Boost Software License, Version 1.0. # Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt # https://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.5...3.16) cmake_minimum_required(VERSION 3.8...4.20)
project(boost_stacktrace VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) project(boost_stacktrace VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
@@ -72,7 +72,7 @@ stacktrace_check(BOOST_STACKTRACE_HAS_WINDBG has_windbg.cpp "" "dbgeng;ole32" ""
stacktrace_check(BOOST_STACKTRACE_HAS_WINDBG_CACHED has_windbg_cached.cpp "${CMAKE_CURRENT_SOURCE_DIR}/../config/include" "dbgeng;ole32" "") stacktrace_check(BOOST_STACKTRACE_HAS_WINDBG_CACHED has_windbg_cached.cpp "${CMAKE_CURRENT_SOURCE_DIR}/../config/include" "dbgeng;ole32" "")
set(_default_from_exception ON) set(_default_from_exception ON)
if (NOT CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64|amd64|i386|i686|x86") if (CMAKE_CXX_PLATFORM_ID MATCHES "Cygwin")
set(_default_from_exception OFF) set(_default_from_exception OFF)
endif() endif()
@@ -142,8 +142,6 @@ stacktrace_add_library(from_exception ${BOOST_STACKTRACE_ENABLE_FROM_EXCEPTION}
# #
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt") if(BUILD_TESTING)
add_subdirectory(test) add_subdirectory(test)
endif() endif()

View File

@@ -249,8 +249,7 @@ rule build-stacktrace-from-exception ( props * )
case "off" : return <build>no ; case "off" : return <build>no ;
} }
local arch = [ property.select <architecture> : $(props) ] ; if ( <target-os>cygwin in $(props) )
if $(arch) && ( $(arch:G=) != x86 )
{ {
configure.log-library-search-result "boost.stacktrace.from_exception" : "no" ; configure.log-library-search-result "boost.stacktrace.from_exception" : "no" ;
return <build>no ; return <build>no ;

View File

@@ -1,11 +1,10 @@
// Copyright Antony Polukhin, 2016-2020. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
#include <cstdlib> #include <cstdlib>
#include <string>
#include <boost/config.hpp> #include <boost/config.hpp>
#include <unwind.h> #include <unwind.h>
@@ -15,11 +14,10 @@
int main() { int main() {
#ifdef BOOST_STACKTRACE_ADDR2LINE_LOCATION #ifdef BOOST_STACKTRACE_ADDR2LINE_LOCATION
std::string s = BOOST_STRINGIZE( BOOST_STACKTRACE_ADDR2LINE_LOCATION ); const char* s = BOOST_STRINGIZE( BOOST_STACKTRACE_ADDR2LINE_LOCATION ) " -h";
s += " -h";
#else #else
std::string s = "/usr/bin/addr2line -h"; const char* s = "/usr/bin/addr2line -h";
#endif #endif
return std::system(s.c_str()); return std::system(s);
} }

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2020. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2020. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
# Copyright Antony Polukhin, 2016-2025. # Copyright Antony Polukhin, 2016-2026.
# Use, modification, and distribution are # Use, modification, and distribution are
# subject to the Boost Software License, Version 1.0. (See accompanying # subject to 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) # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -334,6 +334,17 @@ target_link_libraries(${PROJECT} # your project
) )
``` ```
If Boost is installed into the system the best way to get it for your project
is via `find_package`:
```
find_package(
Boost
REQUIRED stacktrace stacktrace_from_exception
CONFIG
)
```
[endsect] [endsect]
[section CMake build notes] [section CMake build notes]

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at
@@ -13,6 +13,7 @@
#endif #endif
#include <cstdio> #include <cstdio>
#include <cstdint>
#include <memory> #include <memory>
#ifdef WIN32_LEAN_AND_MEAN #ifdef WIN32_LEAN_AND_MEAN

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at
@@ -83,7 +83,7 @@ BOOST_SYMBOL_VISIBLE inline ::backtrace_state* construct_state(const program_loc
// //
// Unfortunately, that solution segfaults when `construct_state()` function is in .so file // Unfortunately, that solution segfaults when `construct_state()` function is in .so file
// and multiple threads concurrently work with state. I failed to localize the root cause: // and multiple threads concurrently work with state. I failed to localize the root cause:
// https://gcc.gnu.org/bugzilla//show_bug.cgi?id=87653 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87653
#define BOOST_STACKTRACE_DETAIL_IS_MT 1 #define BOOST_STACKTRACE_DETAIL_IS_MT 1

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,5 +1,5 @@
// Copyright 2014 Renato Tegon Forti, Antony Polukhin. // Copyright 2014 Renato Tegon Forti, Antony Polukhin.
// Copyright Antony Polukhin, 2015-2025. // Copyright Antony Polukhin, 2015-2026.
// //
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt // (See accompanying file LICENSE_1_0.txt

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2023-2025. // Copyright Antony Polukhin, 2023-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,6 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- <!--
Copyright (c) Antony Polukhin, 2014-2024 Copyright (c) Antony Polukhin, 2014-2026
antoshkka at gmail dot com antoshkka at gmail dot com
Distributed under the Boost Software License, Distributed under the Boost Software License,
@@ -31,7 +31,7 @@ boost-no-inspect
<a href="../../doc/html/stacktrace.html">../../doc/html/stacktrace.html</a> <a href="../../doc/html/stacktrace.html">../../doc/html/stacktrace.html</a>
</p> </p>
<p> <p>
&copy; Antony Polukhin, 2014-2024 &copy; Antony Polukhin, 2014-2026
</p> </p>
</body> </body>
</html> </html>

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2020. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2020. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2020. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2023-2025. // Copyright Antony Polukhin, 2023-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2023-2025. // Copyright Antony Polukhin, 2023-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at
@@ -160,29 +160,14 @@ BOOST_SYMBOL_EXPORT void assert_no_pending_traces() noexcept {
#include <exception> #include <exception>
#include <dlfcn.h> #include <dlfcn.h>
#if !BOOST_STACKTRACE_ALWAYS_STORE_IN_PADDING #if !BOOST_STACKTRACE_ALWAYS_STORE_IN_PADDING
#include <cstdlib>
#include <cstring>
#include <mutex> #include <mutex>
#include <unordered_map> #include <unordered_map>
#ifndef BOOST_STACKTRACE_LIBCXX_RUNTIME_MAY_CAUSE_MEMORY_LEAK #include <unistd.h>
#ifdef BOOST_HAS_THREADS
#error On this platform memory leaks are possible if capturing stacktrace from \
exceptions is enabled and exceptions are thrown concurrently \
and libc++ runtime is used. \
\
Define `BOOST_STACKTRACE_LIBCXX_RUNTIME_MAY_CAUSE_MEMORY_LEAK` to \
suppress this error if the library would not be used with libc++ \
runtime (for example, it would be only used with GCC runtime). \
\
Otherwise, disable the boost_stacktrace_from_exception library build \
(for example by `./b2 boost.stacktrace.from_exception=off` option).
#endif
#endif
#endif #endif
namespace { namespace {
@@ -297,6 +282,32 @@ void* __cxa_allocate_exception(size_t thrown_size) throw() {
extern "C" BOOST_SYMBOL_EXPORT extern "C" BOOST_SYMBOL_EXPORT
void __cxa_decrement_exception_refcount(void *thrown_object) throw() { void __cxa_decrement_exception_refcount(void *thrown_object) throw() {
BOOST_ASSERT(is_libcpp_runtime()); BOOST_ASSERT(is_libcpp_runtime());
#if !defined(BOOST_STACKTRACE_LIBCXX_RUNTIME_MAY_CAUSE_MEMORY_LEAK) && defined(BOOST_HAS_THREADS)
static const char* leaks_are_fine = std::getenv("BOOST_STACKTRACE_LIBCXX_RUNTIME_MAY_CAUSE_MEMORY_LEAK");
if (!leaks_are_fine || leaks_are_fine[0] != '1') {
const char* const warning =
"\n\n"
"=======================================================================================\n"
"\n"
"On this platform, memory leaks may occur if capturing stacktrace from exceptions is\n"
"enabled and exceptions are thrown concurrently by libc++ runtime (libc++abi).\n"
"\n"
"A proper workaround is to use libstdc++ runtime (libgcc_s) instead.\n"
"\n"
"Alternatively, if you are willing to accept potential MEMORY LEAKS, set the environment\n"
"variable `BOOST_STACKTRACE_LIBCXX_RUNTIME_MAY_CAUSE_MEMORY_LEAK=1` to proceed. You can\n"
"also define the `BOOST_STACKTRACE_LIBCXX_RUNTIME_MAY_CAUSE_MEMORY_LEAK` macro when\n"
"building the `boost_stacktrace_from_exception` library to disable this warning and to\n"
"get the MEMORY LEAKS silently on libc++ runtime.\n"
"\n"
"=======================================================================================\n"
;
write(STDERR_FILENO, warning, std::strlen(warning));
std::abort();
}
#endif
if (!thrown_object) { if (!thrown_object) {
return; return;
} }

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2020. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2020. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2020. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -2,7 +2,7 @@
# subject to the Boost Software License, Version 1.0. (See accompanying # subject to 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) # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
# #
# Copyright Antony Polukhin, 2016-2025. # Copyright Antony Polukhin, 2016-2026.
# #
# See https://svn.boost.org/trac/boost/wiki/TravisCoverals for description of this file # See https://svn.boost.org/trac/boost/wiki/TravisCoverals for description of this file

View File

@@ -1,15 +1,24 @@
# Copyright 2018-2021 Peter Dimov # Copyright 2018-2021 Peter Dimov
# Copyright Antony Polukhin, 2025-2026
#
# Distributed under the Boost Software License, Version 1.0. # Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt # https://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.5...3.20) cmake_minimum_required(VERSION 3.8...4.20)
project(cmake_install_test LANGUAGES CXX) project(cmake_install_test LANGUAGES CXX)
find_package(boost_stacktrace REQUIRED) find_package(
Boost
REQUIRED stacktrace ${BOOST_STACKTRACE_IMPL_BACKEND} stacktrace_from_exception
CONFIG
)
add_executable(main main.cpp) add_executable(main main.cpp)
target_link_libraries(main Boost::stacktrace) target_link_libraries(main Boost::${BOOST_STACKTRACE_IMPL_BACKEND})
add_executable(main_from_exception main.cpp)
target_link_libraries(main_from_exception Boost::stacktrace_from_exception Boost::${BOOST_STACKTRACE_IMPL_BACKEND})
enable_testing() enable_testing()
add_test(main main) add_test(main main)
add_test(main_from_exception main_from_exception)

View File

@@ -1,5 +1,6 @@
// Copyright 2019 Peter Dimov // Copyright 2019 Peter Dimov
// Copyright 2022-2025 Antony Polukhin // Copyright Antony Polukhin, 2025-2026
//
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt // https://www.boost.org/LICENSE_1_0.txt
@@ -9,4 +10,9 @@
int main() int main()
{ {
std::cout << boost::stacktrace::stacktrace() << std::endl; std::cout << boost::stacktrace::stacktrace() << std::endl;
try {
throw 42;
} catch (...) {
std::cout << "From current excption:\n" << boost::stacktrace::stacktrace::from_current_exception() << std::endl;
}
} }

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2023-2025. // Copyright Antony Polukhin, 2023-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2023-2025. // Copyright Antony Polukhin, 2023-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2022-2025. // Copyright Antony Polukhin, 2022-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,4 +1,4 @@
// Copyright Antony Polukhin, 2016-2025. // Copyright Antony Polukhin, 2016-2026.
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at