mirror of
https://github.com/boostorg/stacktrace.git
synced 2026-01-28 19:52:08 +00:00
Compare commits
27 Commits
feature/gh
...
apolukhin-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
762b4916fc | ||
|
|
3c756ad478 | ||
|
|
005bcbad7d | ||
|
|
b105972fbc | ||
|
|
c624479813 | ||
|
|
3f79aee92f | ||
|
|
da94896d2d | ||
|
|
0a1f8ac9a0 | ||
|
|
7c79d84614 | ||
|
|
e95c2723d8 | ||
|
|
9028c8a413 | ||
|
|
b37fc77b5d | ||
|
|
aa97b1a34c | ||
|
|
23e1213f54 | ||
|
|
ad121dbed0 | ||
|
|
981e37c218 | ||
|
|
cbf0df774d | ||
|
|
34e56c4e90 | ||
|
|
f32bd5a543 | ||
|
|
79fc075655 | ||
|
|
6624a0aaeb | ||
|
|
ca76415503 | ||
|
|
4352901d19 | ||
|
|
2820ed36b5 | ||
|
|
1a389747a3 | ||
|
|
1db160d566 | ||
|
|
1b16c5d6ae |
46
.github/workflows/ci.yml
vendored
46
.github/workflows/ci.yml
vendored
@@ -171,7 +171,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ ubuntu-20.04, ubuntu-22.04, macos-12, macos-13, macos-14 ]
|
||||
shared: [ ON ] # https://github.com/boostorg/stacktrace/issues/169
|
||||
shared: [ OFF, ON ]
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
@@ -215,7 +215,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ ubuntu-20.04, ubuntu-22.04, macos-12, macos-13, macos-14 ]
|
||||
shared: [ ON ] # https://github.com/boostorg/stacktrace/issues/169
|
||||
shared: [ OFF, ON ]
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
@@ -275,7 +275,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ ubuntu-20.04, ubuntu-22.04, macos-12, macos-13, macos-14 ]
|
||||
shared: [ ON ] # https://github.com/boostorg/stacktrace/issues/169
|
||||
shared: [ OFF, ON ]
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
@@ -306,20 +306,20 @@ jobs:
|
||||
git submodule update --init tools/boostdep
|
||||
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
|
||||
|
||||
- name: Configure
|
||||
- name: Configure (Debug)
|
||||
run: |
|
||||
cd ../boost-root
|
||||
mkdir __build__ && cd __build__
|
||||
cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON -DBUILD_SHARED_LIBS=${{matrix.shared}} ..
|
||||
mkdir __build_debug__ && cd __build_debug__
|
||||
cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON -DBUILD_SHARED_LIBS=${{matrix.shared}} -DCMAKE_BUILD_TYPE=Debug ..
|
||||
|
||||
- name: Build tests
|
||||
- name: Build tests (Debug)
|
||||
run: |
|
||||
cd ../boost-root/__build__
|
||||
cd ../boost-root/__build_debug__
|
||||
cmake --build . --target tests
|
||||
|
||||
- name: Run tests
|
||||
- name: Run tests (Debug)
|
||||
run: |
|
||||
cd ../boost-root/__build__
|
||||
cd ../boost-root/__build_debug__
|
||||
ctest --output-on-failure --no-tests=error
|
||||
|
||||
windows-cmake-subdir:
|
||||
@@ -363,12 +363,12 @@ jobs:
|
||||
cmake --build . --config Debug
|
||||
ctest --output-on-failure --no-tests=error -C Debug
|
||||
|
||||
- name: Use library with add_subdirectory (Release)
|
||||
- name: Use library with add_subdirectory (RelWithDebInfo)
|
||||
shell: cmd
|
||||
run: |
|
||||
cd ../boost-root/libs/%LIBRARY%/test/cmake_subdir_test/__build__
|
||||
cmake --build . --config Release
|
||||
ctest --output-on-failure --no-tests=error -C Release
|
||||
cmake --build . --config RelWithDebInfo
|
||||
ctest --output-on-failure --no-tests=error -C RelWithDebInfo
|
||||
|
||||
windows-cmake-install:
|
||||
strategy:
|
||||
@@ -415,11 +415,11 @@ jobs:
|
||||
cd ../boost-root/__build__
|
||||
cmake --build . --target install --config Debug
|
||||
|
||||
- name: Install (Release)
|
||||
- name: Install (RelWithDebInfo)
|
||||
shell: cmd
|
||||
run: |
|
||||
cd ../boost-root/__build__
|
||||
cmake --build . --target install --config Release
|
||||
cmake --build . --target install --config RelWithDebInfo
|
||||
|
||||
- name: Use the installed library (Debug)
|
||||
shell: cmd
|
||||
@@ -430,20 +430,20 @@ jobs:
|
||||
PATH C:\cmake-prefix\bin;%PATH%
|
||||
ctest --output-on-failure --no-tests=error -C Debug
|
||||
|
||||
- name: Use the installed library (Release)
|
||||
- name: Use the installed library (RelWithDebInfo)
|
||||
shell: cmd
|
||||
run: |
|
||||
cd ../boost-root/libs/%LIBRARY%/test/cmake_install_test/__build__
|
||||
cmake --build . --config Release
|
||||
cmake --build . --config RelWithDebInfo
|
||||
PATH C:\cmake-prefix\bin;%PATH%
|
||||
ctest --output-on-failure --no-tests=error -C Release
|
||||
ctest --output-on-failure --no-tests=error -C RelWithDebInfo
|
||||
|
||||
windows-cmake-test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ windows-2019, windows-2022 ]
|
||||
shared: [ ON ] # https://github.com/boostorg/stacktrace/issues/169
|
||||
shared: [ OFF, ON ]
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
@@ -489,14 +489,14 @@ jobs:
|
||||
cd ../boost-root/__build__
|
||||
ctest --output-on-failure --no-tests=error -C Debug
|
||||
|
||||
- name: Build tests (Release)
|
||||
- name: Build tests (RelWithDebInfo)
|
||||
shell: cmd
|
||||
run: |
|
||||
cd ../boost-root/__build__
|
||||
cmake --build . --target tests --config Release
|
||||
cmake --build . --target tests --config RelWithDebInfo
|
||||
|
||||
- name: Run tests (Release)
|
||||
- name: Run tests (RelWithDebInfo)
|
||||
shell: cmd
|
||||
run: |
|
||||
cd ../boost-root/__build__
|
||||
ctest --output-on-failure --no-tests=error -C Release
|
||||
ctest --output-on-failure --no-tests=error -C RelWithDebInfo
|
||||
|
||||
@@ -96,20 +96,37 @@ stacktrace_add_library(basic ${BOOST_STACKTRACE_ENABLE_BASIC} "${CMAKE_DL_LIBS}"
|
||||
stacktrace_add_library(windbg ${BOOST_STACKTRACE_ENABLE_WINDBG} "dbgeng;ole32" "_GNU_SOURCE=1")
|
||||
stacktrace_add_library(windbg_cached ${BOOST_STACKTRACE_ENABLE_WINDBG_CACHED} "dbgeng;ole32" "_GNU_SOURCE=1")
|
||||
|
||||
# boost_stacktrace, default library
|
||||
|
||||
add_library(boost_stacktrace INTERFACE)
|
||||
add_library(Boost::stacktrace ALIAS boost_stacktrace)
|
||||
|
||||
target_include_directories(boost_stacktrace INTERFACE include)
|
||||
|
||||
if(BOOST_STACKTRACE_ENABLE_WINDBG)
|
||||
|
||||
target_link_libraries(boost_stacktrace INTERFACE Boost::stacktrace_windbg)
|
||||
|
||||
elseif(BOOST_STACKTRACE_ENABLE_BACKTRACE)
|
||||
|
||||
target_link_libraries(boost_stacktrace INTERFACE Boost::stacktrace_backtrace)
|
||||
|
||||
elseif(BOOST_STACKTRACE_ENABLE_ADDR2LINE)
|
||||
|
||||
target_link_libraries(boost_stacktrace INTERFACE Boost::stacktrace_addr2line)
|
||||
|
||||
elseif(BOOST_STACKTRACE_ENABLE_BASIC)
|
||||
|
||||
target_link_libraries(boost_stacktrace INTERFACE Boost::stacktrace_basic)
|
||||
|
||||
elseif(BOOST_STACKTRACE_ENABLE_NOOP)
|
||||
|
||||
target_link_libraries(boost_stacktrace INTERFACE Boost::stacktrace_noop)
|
||||
|
||||
# Alias target for platform defaults (only if they enabled).
|
||||
if(WIN32)
|
||||
if(BOOST_STACKTRACE_ENABLE_WINDBG)
|
||||
add_library(Boost::stacktrace ALIAS boost_stacktrace_windbg)
|
||||
endif()
|
||||
else()
|
||||
if(BOOST_STACKTRACE_ENABLE_BACKTRACE)
|
||||
add_library(Boost::stacktrace ALIAS boost_stacktrace_backtrace)
|
||||
elseif(BOOST_STACKTRACE_ENABLE_BASIC)
|
||||
add_library(Boost::stacktrace ALIAS boost_stacktrace_basic)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#
|
||||
|
||||
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
|
||||
|
||||
add_subdirectory(test)
|
||||
|
||||
50
build.jam
Normal file
50
build.jam
Normal file
@@ -0,0 +1,50 @@
|
||||
# Copyright René Ferdinand Rivera Morell 2023-2024
|
||||
# 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)
|
||||
|
||||
require-b2 5.2 ;
|
||||
|
||||
constant boost_dependencies :
|
||||
<library>/boost/config//boost_config
|
||||
<library>/boost/container_hash//boost_container_hash
|
||||
<library>/boost/core//boost_core
|
||||
<library>/boost/predef//boost_predef
|
||||
<target-os>windows:<library>/boost/winapi//boost_winapi ;
|
||||
|
||||
project /boost/stacktrace
|
||||
: common-requirements
|
||||
<include>include
|
||||
;
|
||||
|
||||
explicit
|
||||
[ alias boost_stacktrace_addr2line : build//boost_stacktrace_addr2line ]
|
||||
[ alias boost_stacktrace_backtrace : build//boost_stacktrace_backtrace ]
|
||||
[ alias boost_stacktrace_basic : build//boost_stacktrace_basic ]
|
||||
[ alias boost_stacktrace_from_exception : build//boost_stacktrace_from_exception ]
|
||||
[ alias boost_stacktrace_noop : build//boost_stacktrace_noop ]
|
||||
[ alias boost_stacktrace_windbg : build//boost_stacktrace_windbg ]
|
||||
[ alias boost_stacktrace_windbg_cached : build//boost_stacktrace_windbg_cached ]
|
||||
[ alias boost_stacktrace : boost_stacktrace_noop ]
|
||||
[ alias all :
|
||||
boost_stacktrace_addr2line
|
||||
boost_stacktrace_backtrace
|
||||
boost_stacktrace_basic
|
||||
boost_stacktrace_from_exception
|
||||
boost_stacktrace_noop
|
||||
boost_stacktrace_windbg
|
||||
boost_stacktrace_windbg_cached
|
||||
test
|
||||
]
|
||||
;
|
||||
|
||||
call-if : boost-library stacktrace
|
||||
: install
|
||||
boost_stacktrace_addr2line
|
||||
boost_stacktrace_backtrace
|
||||
boost_stacktrace_basic
|
||||
boost_stacktrace_from_exception
|
||||
boost_stacktrace_noop
|
||||
boost_stacktrace_windbg
|
||||
boost_stacktrace_windbg_cached
|
||||
;
|
||||
@@ -5,14 +5,21 @@
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
#
|
||||
|
||||
require-b2 5.0.1 ;
|
||||
import-search /boost/config/checks ;
|
||||
import config : requires ;
|
||||
import feature ;
|
||||
import property ;
|
||||
import ../../config/checks/config : requires ;
|
||||
|
||||
constant boost_dependencies_private :
|
||||
<library>/boost/assert//boost_assert
|
||||
;
|
||||
|
||||
project
|
||||
: source-location .
|
||||
: common-requirements $(boost_dependencies)
|
||||
: requirements
|
||||
[ requires cxx11_rvalue_references ]
|
||||
$(boost_dependencies_private)
|
||||
: default-build
|
||||
<visibility>hidden
|
||||
;
|
||||
@@ -26,10 +33,10 @@ feature.feature boost.stacktrace.from_exception : on off : optional propagated ;
|
||||
|
||||
local LIBBACKTRACE_PATH = [ modules.peek : LIBBACKTRACE_PATH ] ;
|
||||
lib backtrace
|
||||
:
|
||||
:
|
||||
: <search>$(LIBBACKTRACE_PATH)/lib <link>static
|
||||
:
|
||||
: <include>$(LIBBACKTRACE_PATH)/include
|
||||
: <include>$(LIBBACKTRACE_PATH)/include
|
||||
;
|
||||
|
||||
actions mp_simple_run_action
|
||||
@@ -67,6 +74,7 @@ lib boost_stacktrace_noop
|
||||
: # default build
|
||||
: # usage-requirements
|
||||
#<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
|
||||
<define>BOOST_STACKTRACE_NO_LIB=1
|
||||
;
|
||||
|
||||
lib boost_stacktrace_backtrace
|
||||
@@ -77,10 +85,11 @@ lib boost_stacktrace_backtrace
|
||||
<target-os>linux:<library>dl
|
||||
<library>backtrace
|
||||
<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
|
||||
[ check-target-builds ../build//libbacktrace : : <build>no ]
|
||||
[ check-target-builds libbacktrace : : <build>no ]
|
||||
: # default build
|
||||
: # usage-requirements
|
||||
#<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
|
||||
<define>BOOST_STACKTRACE_NO_LIB=1
|
||||
;
|
||||
|
||||
lib boost_stacktrace_addr2line
|
||||
@@ -90,10 +99,11 @@ lib boost_stacktrace_addr2line
|
||||
<warnings>all
|
||||
<target-os>linux:<library>dl
|
||||
<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
|
||||
[ check-target-builds ../build//addr2line : : <build>no ]
|
||||
[ check-target-builds addr2line : : <build>no ]
|
||||
: # default build
|
||||
: # usage-requirements
|
||||
#<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
|
||||
<define>BOOST_STACKTRACE_NO_LIB=1
|
||||
;
|
||||
|
||||
lib boost_stacktrace_basic
|
||||
@@ -103,10 +113,11 @@ lib boost_stacktrace_basic
|
||||
<warnings>all
|
||||
<target-os>linux:<library>dl
|
||||
<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
|
||||
[ check-target-builds ../build//WinDbg : <build>no ]
|
||||
[ check-target-builds WinDbg : <build>no ]
|
||||
: # default build
|
||||
: # usage-requirements
|
||||
#<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
|
||||
<define>BOOST_STACKTRACE_NO_LIB=1
|
||||
;
|
||||
|
||||
lib boost_stacktrace_windbg
|
||||
@@ -116,10 +127,11 @@ lib boost_stacktrace_windbg
|
||||
<warnings>all
|
||||
<library>Dbgeng <library>ole32
|
||||
<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
|
||||
[ check-target-builds ../build//WinDbg : : <build>no ]
|
||||
[ check-target-builds WinDbg : : <build>no ]
|
||||
: # default build
|
||||
: # usage-requirements
|
||||
#<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
|
||||
<define>BOOST_STACKTRACE_NO_LIB=1
|
||||
;
|
||||
|
||||
lib boost_stacktrace_windbg_cached
|
||||
@@ -129,10 +141,11 @@ lib boost_stacktrace_windbg_cached
|
||||
<warnings>all
|
||||
<library>Dbgeng <library>ole32
|
||||
<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
|
||||
[ check-target-builds ../build//WinDbgCached : : <build>no ]
|
||||
[ check-target-builds WinDbgCached : : <build>no ]
|
||||
: # default build
|
||||
: # usage-requirements
|
||||
#<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
|
||||
<define>BOOST_STACKTRACE_NO_LIB=1
|
||||
;
|
||||
|
||||
rule build-stacktrace-from-exception ( props * )
|
||||
@@ -162,10 +175,10 @@ lib boost_stacktrace_from_exception
|
||||
<conditional>@build-stacktrace-from-exception
|
||||
|
||||
# Require usable libbacktrace on other platforms
|
||||
#[ check-target-builds ../build//libbacktrace : : <build>no ]
|
||||
# [ check-target-builds libbacktrace : : <build>no ]
|
||||
: # default build
|
||||
: # usage-requirements
|
||||
#<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
|
||||
<define>BOOST_STACKTRACE_NO_LIB=1
|
||||
<define>BOOST_STACKTRACE_LINKED_WITH_FROM_EXCEPTION=1
|
||||
;
|
||||
|
||||
boost-install boost_stacktrace_noop boost_stacktrace_backtrace boost_stacktrace_addr2line boost_stacktrace_basic boost_stacktrace_windbg boost_stacktrace_windbg_cached boost_stacktrace_from_exception ;
|
||||
|
||||
@@ -9,9 +9,9 @@ import doxygen ;
|
||||
|
||||
doxygen autodoc
|
||||
:
|
||||
[ glob ../../../boost/stacktrace.hpp ]
|
||||
[ glob ../../../boost/stacktrace/*.hpp ]
|
||||
[ glob ../../../boost/stacktrace/detail/frame_decl.hpp ]
|
||||
[ glob ../include/boost/stacktrace.hpp ]
|
||||
[ glob ../include/boost/stacktrace/*.hpp ]
|
||||
[ glob ../include/boost/stacktrace/detail/frame_decl.hpp ]
|
||||
:
|
||||
<doxygen:param>EXTRACT_ALL=NO
|
||||
<doxygen:param>HIDE_UNDOC_MEMBERS=YES
|
||||
|
||||
@@ -163,7 +163,7 @@ int main() {
|
||||
foo("test1");
|
||||
bar("test2");
|
||||
} catch (const std::exception& exc) {
|
||||
boost::stacktrace::stacktrace trace = boost::stacktrace::from_current_exception(); // <---
|
||||
boost::stacktrace::stacktrace trace = boost::stacktrace::stacktrace::from_current_exception(); // <---
|
||||
std::cerr << "Caught exception: " << exc.what() << ", trace:\n" << trace;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// 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>
|
||||
#define BOOST_USER_CONFIG <example/user_config.hpp>
|
||||
|
||||
#include <boost/array.hpp>
|
||||
#include <exception> // std::set_terminate, std::abort
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <boost/stacktrace/detail/try_dec_convert.hpp>
|
||||
#include <boost/core/demangle.hpp>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
@@ -116,12 +117,14 @@ inline std::string addr2line(const char* flag, const void* addr) {
|
||||
std::string res;
|
||||
|
||||
boost::stacktrace::detail::location_from_symbol loc(addr);
|
||||
if (!loc.empty()) {
|
||||
// For programs started through $PATH loc.name() is not absolute and
|
||||
// addr2line will fail.
|
||||
if (!loc.empty() && std::strchr(loc.name(), '/') != nullptr) {
|
||||
res = loc.name();
|
||||
} else {
|
||||
res.resize(16);
|
||||
int rlin_size = ::readlink("/proc/self/exe", &res[0], res.size() - 1);
|
||||
while (rlin_size == static_cast<int>(res.size() - 1)) {
|
||||
ssize_t rlin_size = ::readlink("/proc/self/exe", &res[0], res.size() - 1);
|
||||
while (rlin_size == static_cast<ssize_t>(res.size() - 1)) {
|
||||
res.resize(res.size() * 4);
|
||||
rlin_size = ::readlink("/proc/self/exe", &res[0], res.size() - 1);
|
||||
}
|
||||
@@ -129,7 +132,7 @@ inline std::string addr2line(const char* flag, const void* addr) {
|
||||
res.clear();
|
||||
return res;
|
||||
}
|
||||
res.resize(rlin_size);
|
||||
res.resize(static_cast<std::size_t>(rlin_size));
|
||||
}
|
||||
|
||||
addr2line_pipe p(flag, res.c_str(), to_hex_array(addr).data());
|
||||
|
||||
@@ -88,7 +88,7 @@ std::size_t this_thread_frames::collect(native_frame_ptr_t* out_frames, std::siz
|
||||
#else
|
||||
boost::stacktrace::detail::unwind_state state = { skip, out_frames, out_frames + max_frames_count };
|
||||
::_Unwind_Backtrace(&boost::stacktrace::detail::unwind_callback, &state);
|
||||
frames_count = state.current - out_frames;
|
||||
frames_count = static_cast<std::size_t>(state.current - out_frames);
|
||||
#endif //defined(BOOST_STACKTRACE_USE_LIBC_BACKTRACE_FUNCTION)
|
||||
|
||||
if (frames_count && out_frames[frames_count - 1] == 0) {
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
#include <mutex>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#if defined(__clang__) || defined(BOOST_MSVC)
|
||||
# pragma comment(lib, "ole32.lib")
|
||||
# pragma comment(lib, "Dbgeng.lib")
|
||||
#endif
|
||||
|
||||
@@ -52,7 +52,7 @@ inline int libbacktrace_full_callback(void *data, uintptr_t /*pc*/, const char *
|
||||
if (d.function && function) {
|
||||
*d.function = function;
|
||||
}
|
||||
d.line = lineno;
|
||||
d.line = static_cast<std::size_t>(lineno);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,11 @@
|
||||
# define BOOST_STACKTRACE_LINK
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_STACKTRACE_LINK) && !defined(BOOST_STACKTRACE_DYN_LINK) && defined(BOOST_ALL_DYN_LINK)
|
||||
#if !defined(BOOST_STACKTRACE_LINK) && defined(BOOST_STACKTRACE_STATIC_LINK)
|
||||
# define BOOST_STACKTRACE_LINK
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_STACKTRACE_LINK) && !defined(BOOST_STACKTRACE_DYN_LINK) && !defined(BOOST_STACKTRACE_STATIC_LINK) && defined(BOOST_ALL_DYN_LINK)
|
||||
# define BOOST_STACKTRACE_DYN_LINK
|
||||
#endif
|
||||
|
||||
|
||||
@@ -37,12 +37,18 @@
|
||||
|
||||
extern "C" {
|
||||
|
||||
BOOST_SYMBOL_EXPORT inline void* boost_stacktrace_impl_return_nullptr() { return nullptr; }
|
||||
const char* boost_stacktrace_impl_current_exception_stacktrace();
|
||||
bool* boost_stacktrace_impl_ref_capture_stacktraces_at_throw();
|
||||
|
||||
}
|
||||
|
||||
#ifndef BOOST_STACKTRACE_LINKED_WITH_FROM_EXCEPTION
|
||||
|
||||
extern "C" {
|
||||
BOOST_SYMBOL_EXPORT
|
||||
inline void* boost_stacktrace_impl_return_nullptr() { return nullptr; }
|
||||
}
|
||||
|
||||
#ifdef _M_IX86
|
||||
# pragma comment(linker, "/ALTERNATENAME:_boost_stacktrace_impl_current_exception_stacktrace=_boost_stacktrace_impl_return_nullptr")
|
||||
# pragma comment(linker, "/ALTERNATENAME:_boost_stacktrace_impl_ref_capture_stacktraces_at_throw=_boost_stacktrace_impl_return_nullptr")
|
||||
@@ -51,6 +57,8 @@ bool* boost_stacktrace_impl_ref_capture_stacktraces_at_throw();
|
||||
# pragma comment(linker, "/ALTERNATENAME:boost_stacktrace_impl_ref_capture_stacktraces_at_throw=boost_stacktrace_impl_return_nullptr")
|
||||
#endif
|
||||
|
||||
#endif // #ifndef BOOST_STACKTRACE_LINKED_WITH_FROM_EXCEPTION
|
||||
|
||||
#endif
|
||||
|
||||
namespace boost { namespace stacktrace {
|
||||
|
||||
@@ -157,6 +157,7 @@ BOOST_SYMBOL_EXPORT void assert_no_pending_traces() noexcept {
|
||||
#include <boost/stacktrace/safe_dump_to.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <exception>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#if !BOOST_STACKTRACE_ALWAYS_STORE_IN_PADDING
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
#define BOOST_STACKTRACE_INTERNAL_BUILD_LIBS
|
||||
#define BOOST_STACKTRACE_LINK
|
||||
#include <boost/stacktrace/detail/frame_msvc.ipp>
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
#define BOOST_STACKTRACE_INTERNAL_BUILD_LIBS
|
||||
#define BOOST_STACKTRACE_LINK
|
||||
#define BOOST_STACKTRACE_USE_WINDBG_CACHED
|
||||
|
||||
@@ -8,8 +8,7 @@ if(NOT HAVE_BOOST_TEST)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# This test doesn't work with stacktrace_basic
|
||||
# boost_test(TYPE run SOURCES test.cpp test_impl.cpp Boost::stacktrace_basic Boost::core)
|
||||
|
||||
boost_test(TYPE run SOURCES test.cpp test_impl.cpp LINK_LIBRARIES Boost::stacktrace Boost::core)
|
||||
boost_test(TYPE run SOURCES test_noop.cpp test_impl.cpp LINK_LIBRARIES Boost::stacktrace_noop Boost::core)
|
||||
boost_test(TYPE run SOURCES test_trivial.cpp LINK_LIBRARIES Boost::stacktrace_basic Boost::core)
|
||||
|
||||
boost_test(TYPE run SOURCES test_trivial.cpp LINK_LIBRARIES Boost::stacktrace Boost::core)
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
#
|
||||
|
||||
import ../../config/checks/config : requires ;
|
||||
import-search /boost/config/checks ;
|
||||
import config : requires ;
|
||||
import testing ;
|
||||
|
||||
lib dl : : <link>shared ;
|
||||
lib gcc_s ;
|
||||
@@ -31,6 +33,8 @@ project
|
||||
<warnings>all
|
||||
<test-info>always_show_run_output
|
||||
<visibility>hidden
|
||||
<include>..
|
||||
<library>/boost/optional//boost_optional
|
||||
;
|
||||
|
||||
local FORCE_SYMBOL_EXPORT = <target-os>freebsd:<linkflags>"-rdynamic" <target-os>solaris:<linkflags>"-Bdynamic" <target-os>aix:<linkflags>"-rdynamic"
|
||||
@@ -122,15 +126,19 @@ test-suite stacktrace_tests
|
||||
[ run thread_safety_checking.cpp
|
||||
: : : <debug-symbols>on <library>.//test_impl_lib_backtrace $(LINKSHARED_BT)
|
||||
<define>BOOST_STACKTRACE_BACKTRACE_FORCE_STATIC
|
||||
<library>/boost/optional//boost_optional
|
||||
: backtrace_lib_threaded_static ]
|
||||
[ run thread_safety_checking.cpp
|
||||
: : : <debug-symbols>on <library>.//test_impl_lib_windbg $(LINKSHARED_WIND)
|
||||
<library>/boost/optional//boost_optional
|
||||
: windbg_lib_threaded ]
|
||||
[ run thread_safety_checking.cpp
|
||||
: : : <debug-symbols>on <library>.//test_impl_lib_windbg_cached $(LINKSHARED_WIND_CACHED)
|
||||
<library>/boost/optional//boost_optional
|
||||
: windbg_cached_lib_threaded ]
|
||||
[ run thread_safety_checking.cpp
|
||||
: : : <debug-symbols>on <library>.//test_impl_lib_basic $(LINKSHARED_BASIC)
|
||||
<library>/boost/optional//boost_optional
|
||||
: basic_lib_threaded ]
|
||||
|
||||
##### Tests with disabled debug symbols #####
|
||||
@@ -158,6 +166,7 @@ test-suite stacktrace_tests
|
||||
[ run thread_safety_checking.cpp
|
||||
: : : <debug-symbols>off
|
||||
<library>.//test_impl_lib_backtrace_no_dbg
|
||||
<library>/boost/optional//boost_optional
|
||||
$(LINKSHARED_BT)
|
||||
: backtrace_lib_no_dbg_threaded ]
|
||||
[ run thread_safety_checking.cpp
|
||||
@@ -212,15 +221,15 @@ test-suite stacktrace_tests
|
||||
for local p in [ glob ../example/*.cpp ]
|
||||
{
|
||||
local target_name = $(p[1]:B) ;
|
||||
local additional_dependency = ;
|
||||
local additional_dependency = <library>/boost/array//boost_array ;
|
||||
if $(target_name) = "terminate_handler"
|
||||
{
|
||||
additional_dependency = <library>/boost/filesystem//boost_filesystem <library>/boost/system//boost_system <target-os>linux:<library>rt ;
|
||||
additional_dependency += <library>/boost/filesystem//boost_filesystem <library>/boost/system//boost_system <target-os>linux:<library>rt ;
|
||||
}
|
||||
|
||||
if $(target_name) = "throwing_st"
|
||||
{
|
||||
additional_dependency = [ requires rtti ] ;
|
||||
additional_dependency += [ requires rtti ] <library>/boost/exception//boost_exception ;
|
||||
}
|
||||
|
||||
stacktrace_tests += [ run $(p) : : : <debug-symbols>on $(LINKSHARED_BT) $(additional_dependency) : backtrace_$(p2[1]:B) ] ;
|
||||
|
||||
@@ -66,6 +66,7 @@ before_build:
|
||||
libs/filesystem libs/atomic libs/system libs/interprocess libs/array
|
||||
libs/iterator libs/detail libs/exception libs/smart_ptr libs/mpl
|
||||
libs/align libs/container libs/tuple libs/intrusive libs/scope
|
||||
libs/variant2 libs/preprocessor libs/io
|
||||
|
||||
- rm -rf %BOOST%/libs/%BOOST_LIBS_FOLDER%
|
||||
- mv -f %APPVEYOR_BUILD_FOLDER% %BOOST%/libs/%BOOST_LIBS_FOLDER%
|
||||
|
||||
BIN
test/backtrace.dump
Normal file
BIN
test/backtrace.dump
Normal file
Binary file not shown.
@@ -6,10 +6,10 @@ cmake_minimum_required(VERSION 3.5...3.20)
|
||||
|
||||
project(cmake_install_test LANGUAGES CXX)
|
||||
|
||||
find_package(boost_stacktrace_basic REQUIRED)
|
||||
find_package(boost_stacktrace REQUIRED)
|
||||
|
||||
add_executable(main main.cpp)
|
||||
target_link_libraries(main Boost::stacktrace_basic)
|
||||
target_link_libraries(main Boost::stacktrace)
|
||||
|
||||
enable_testing()
|
||||
add_test(main main)
|
||||
|
||||
@@ -40,7 +40,7 @@ foreach(dep IN LISTS deps)
|
||||
endforeach()
|
||||
|
||||
add_executable(main main.cpp)
|
||||
target_link_libraries(main Boost::stacktrace_basic)
|
||||
target_link_libraries(main Boost::stacktrace)
|
||||
|
||||
enable_testing()
|
||||
add_test(main main)
|
||||
|
||||
@@ -257,6 +257,12 @@ void test_empty_basic_stacktrace() {
|
||||
BOOST_TEST(!(st > st_t(0, 0)));
|
||||
}
|
||||
|
||||
void test_stacktrace_limits()
|
||||
{
|
||||
BOOST_TEST_EQ(boost::stacktrace::stacktrace(0, 1).size(), 1);
|
||||
BOOST_TEST_EQ(boost::stacktrace::stacktrace(1, 1).size(), 1);
|
||||
}
|
||||
|
||||
int main() {
|
||||
test_deeply_nested_namespaces();
|
||||
test_frames_string_data_validity();
|
||||
@@ -275,8 +281,8 @@ int main() {
|
||||
test_comparisons_base(make_some_stacktrace1(), make_some_stacktrace2());
|
||||
|
||||
test_nested<260>(false);
|
||||
BOOST_TEST(boost::stacktrace::stacktrace(0, 1).size() == 1);
|
||||
BOOST_TEST(boost::stacktrace::stacktrace(1, 1).size() == 1);
|
||||
|
||||
test_stacktrace_limits();
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user