156 Commits

Author SHA1 Message Date
Antony Polukhin
902537345a Update copyright years 2026-01-04 11:21:08 +03:00
Antony Polukhin
b2f10f7efd More tests and docs on CMake installation (#213) 2025-12-24 20:05:46 +03:00
Antony Polukhin
9e7a98a61a Update copyright years 2025-01-08 19:54:11 +03:00
Maciej Czarnecki
b170b28479 Use Relative Virtual Addresses to allow their decoding without knowing the base address (#200)
Instead of printing absolute addresses use relative ones so they can be used later to decode the stack trace.

## Motivation

It’s quite common to release apps without debug symbols while keeping them internally. Currently the lib prints absolute addresses which require the base address to decode them using symbols. With this change, the base address won’t be needed as values are relative to the beginning of the loaded module/binary.

The implementation for unix is **straightforward** as the existing code is used. For Windows, I’ve implemented similar logic using Windows API.

## Manual testing of Windows implementation

Here are 2 runs of `trivial_windbg_lib.exe` with .pdb and without .pdb file:

```jsx
>./trivial_windbg_lib.exe
 0# boost::stacktrace::basic_stacktrace<std::allocator<boost::stacktrace::frame> >::init at C:\Users\czarneckim\repositories\boost\boost\stacktrace\stacktrace.hpp:110
 1# main at C:\Users\czarneckim\repositories\boost\libs\stacktrace\test\test_trivial.cpp:14
 2# __scrt_common_main_seh at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
 3# BaseThreadInitThunk in C:\WINDOWS\System32\KERNEL32.DLL
 4# RtlUserThreadStart in C:\WINDOWS\SYSTEM32\ntdll.dll

> mv ./trivial_windbg_lib.pdb{,_} 
> ./trivial_windbg_lib.exe
 0# 0x0000000000001DE3 in C:\Users\czarneckim\repositories\boost\bin.v2\libs\stacktrace\test\trivial_windbg_lib.test\msvc-14.3\release\x86_64\asynch-exceptions-on\cxxstd-latest-iso\debug-symbols-on\threading-multi\trivial_windbg_lib.exe
 1# 0x0000000000001FEE in C:\Users\czarneckim\repositories\boost\bin.v2\libs\stacktrace\test\trivial_windbg_lib.test\msvc-14.3\release\x86_64\asynch-exceptions-on\cxxstd-latest-iso\debug-symbols-on\threading-multi\trivial_windbg_lib.exe
 2# 0x000000000000246C in C:\Users\czarneckim\repositories\boost\bin.v2\libs\stacktrace\test\trivial_windbg_lib.test\msvc-14.3\release\x86_64\asynch-exceptions-on\cxxstd-latest-iso\debug-symbols-on\threading-multi\trivial_windbg_lib.exe
 3# BaseThreadInitThunk in C:\WINDOWS\System32\KERNEL32.DLL
 4# RtlUserThreadStart in C:\WINDOWS\SYSTEM32\ntdll.dll

> mv ./trivial_windbg_lib.pdb{_,}
> winaddr2line.exe -f -e trivial_windbg_lib.pdb 0x0000000000001DE3
boost::stacktrace::basic_stacktrace<std::allocator<boost::stacktrace::frame> >::init
C:\Users\czarneckim\repositories\boost\boost\stacktrace\stacktrace.hpp:110
```

I’ve also decoded the returned address using x64dbg running `trivial_windbg_lib.exe+0x0000000000001DE3`:

![image](https://github.com/user-attachments/assets/a36d3306-488d-4610-9f04-7888b98c2b75)

## Control

As it was suggested in #180, the new logic is enabled by default, but can be disabled with `BOOST_STACKTRACE_DISABLE_OFFSET_ADDR_BASE` (With non header-only mode, it requires rebuilding the lib)
2025-01-07 23:59:16 +03:00
Antony Polukhin
5ec45912da Autodetect stacktrace dependencies in Appveyor CI runs (#199) 2024-12-22 18:47:19 +03:00
Antony Polukhin
679bd845aa Add libs/function_types dependency for Appveyor tests 2024-12-22 16:40:11 +03:00
Antony Polukhin
0bcc382ab5 Add libs/concept_check dependency for Appveyor tests 2024-12-22 16:25:09 +03:00
Antony Polukhin
a778e3d223 cleanup 2024-09-15 19:03:09 +03:00
huangqinjin
464e224c2f Don't export boost_stacktrace_impl_return_nullptr for static build (#186)
Now `boost_stacktrace.lib` provides the symbol `boost_stacktrace_impl_return_nullptr` for static and shared build.

For header only library, to make the symbol available **automatically**, the only way AFAIK is to export it. We may also consider provide a configuration macro to opt-out the exported symbol, and user need to manually define the non-exported symbol somewhere in their binaries.

Closes #177 .
2024-09-13 20:42:31 +03:00
Antony Polukhin
0a1f8ac9a0 Fix Appveyor CI runs (#183) 2024-09-12 18:26:16 +03:00
Antony Polukhin
7c79d84614 fix attempt for Appveyor 2024-09-12 11:31:04 +03:00
René Ferdinand Rivera Morell
ad121dbed0 Add support for modular build structure. (#172)
This is part of the effort to make the Boost libraries "modular" for build and consumption. See https://lists.boost.org/Archives/boost/2024/01/255704.php and https://github.com/grafikrobot/boost-b2-modular/blob/b2-modular/README.adoc for more information.
2024-09-01 17:23:26 +03:00
Peter Dimov
4352901d19 Move tests to their own function to ensure two stack frames 2024-06-21 21:42:05 +03:00
Peter Dimov
1a389747a3 Change test/CMakeLists.txt to use Boost::stacktrace 2024-06-21 20:01:34 +03:00
Peter Dimov
1db160d566 Change cmake_subdir_test and cmake_install_test to use Boost::stacktrace 2024-06-21 19:59:27 +03:00
Peter Dimov
a615135de0 Update test/CMakeLists.txt 2024-06-21 18:12:51 +03:00
Peter Dimov
08d4f46333 Update test/CMakeLists.txt 2024-06-21 18:04:40 +03:00
Peter Dimov
98ed11d235 Update test/CMakeLists.txt 2024-06-21 17:25:11 +03:00
Peter Dimov
f1c5cd8963 Update test/CMakeLists.txt 2024-06-21 17:19:56 +03:00
Peter Dimov
94f11c52eb Add test/CMakeLists.txt 2024-06-21 17:13:06 +03:00
Peter Dimov
f6f3623594 Update cmake_install_test/CMakeLists.txt 2024-06-21 17:09:47 +03:00
Peter Dimov
aad95c2667 Add cmake_install_test, cmake_subdir_test 2024-06-21 17:05:04 +03:00
Antony Polukhin
c093aef138 Require support for noexcept and template aliases in tests 2024-06-20 10:42:31 +03:00
huangqinjin
d1b7a61353 Implement stacktrace from current exception for MSVC (#159)
std::current_exception() makes a copy of current exception object
into returned std::exception_ptr. So the tracking of the original
exception object and its stacktrace are lost.
2024-04-16 11:39:07 +03:00
Antony Polukhin
12e07fcca1 CI fixes (#153)
* Update thread_safety_checking.cpp to use Standard Library types
* Remove MinGW runs due to https://github.com/boostorg/system/issues/116
* Delete the shared memory example sources
2024-02-22 09:12:00 +03:00
Antony Polukhin
0d8aed6bc9 Library for getting stacktraces from arbitrary exceptions (#147) 2024-02-07 11:27:45 +03:00
Antony Polukhin
0ec802df84 Update copyright years 2024-01-07 13:03:02 +03:00
Antony Polukhin
d849b145a6 disable some of the CI tests (2) 2023-08-27 18:27:41 +03:00
Antony Polukhin
760203fde5 disable some of the CI tests 2023-08-27 15:38:09 +03:00
Antony Polukhin
959b65f303 CI fix attempt (3) 2023-08-26 21:18:46 +03:00
Antony Polukhin
d6320cc5a7 CI fix attempt (2) 2023-08-26 17:10:23 +03:00
Antony Polukhin
22a2c3920b CI fix attempt 2023-08-26 10:42:57 +03:00
Antony Polukhin
fc21c82b27 do not run tests on old MSVC in appveyor 2023-08-25 14:14:40 +03:00
Antony Polukhin
ae87ac9bcf update appveyor CI setup 2023-08-25 12:36:33 +03:00
Antony Polukhin
15b12e6e95 run tests on more compilers 2023-08-25 12:09:31 +03:00
Alex
abba18524f Modernize to cpp11 (#139)
Drop support for C++03

Boost.Stacktrace 1.84 now requires C++11.
2023-08-11 21:32:41 +03:00
Antony Polukhin
4cf47389c1 Update copyright years 2023-01-19 10:21:22 +03:00
Antony Polukhin
cd4c5fe554 fix a type that was noted in https://github.com/boostorg/stacktrace/issues/118#issuecomment-1315142952 2023-01-18 17:14:49 +03:00
Antony Polukhin
308b7f6b08 allow forcing the static backtrace_state
References: https://github.com/boostorg/stacktrace/issues/118
2022-09-02 12:20:30 +03:00
Antony Polukhin
b856a99f9f fix and make sure that boost/stacktrace/stacktrace.hpp header has no unresolved references
Fixes: https://github.com/boostorg/stacktrace/issues/116
2022-09-02 10:38:17 +03:00
Antony Polukhin
e5940e7103 remove COM-initialization related tests and notes in docs 2022-09-01 17:51:22 +03:00
Antony Polukhin
75b7986f97 update copyright years 2022-01-30 14:47:24 +03:00
Antony Polukhin
a00587f4d7 update copyright years 2021-01-03 19:24:15 +03:00
Antony Polukhin
ade7d54dc7 update copyright year 2020-01-18 14:11:02 +03:00
Antony Polukhin
2fce6957d6 More CI workarounds 2019-11-16 10:51:49 +03:00
Antony Polukhin
2cfcbf4247 Update Jamfile.v2 2019-11-15 19:07:10 +03:00
Antony Polukhin
2d810e294f Try to reproduce the error from #78 in tests 2019-06-28 22:38:49 +03:00
Antony Polukhin
324a303fb0 Better diagnostics for test 2019-06-27 13:17:08 +03:00
Antony Polukhin
d9d6512743 Update copyright years 2019-01-12 22:15:16 +03:00
Antony Polukhin
4123beb4af fix memory consumption when using libbacktrace and speedup trace decoding 2018-10-07 20:08:27 +03:00