mirror of
https://github.com/boostorg/stacktrace.git
synced 2026-01-28 19:52:08 +00:00
Compare commits
11 Commits
feature/gh
...
boost-1.86
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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)
|
||||
|
||||
@@ -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,7 +117,9 @@ 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);
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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