Skip to content

Releases: jeremy-rifkin/cpptrace

Version 1.0.4

25 Jul 16:26
3db8da8

Choose a tag to compare

Added

  • Added filtering for C++ exception handling internals during printing. This cleans up output from current exceptions
    and std::terminate traces.

Fixed:

  • Fixed reported version number for cpptrace

Other:

  • Bumped default libdwarf to 2.1.0
  • Updated stacktrace output for the cpptrace terminate handler
  • Updated demo program

Version 1.0.3

16 Jul 00:17
babec96

Choose a tag to compare

Added:

  • Added line indicator to make source code snippets in case colors aren't being used
  • Added column indicator to source code snippets
  • Added 32-bit ARM support for StackWalk64 #271 (@Xottab-DUTY)

Version 1.0.2

25 Jun 04:57
4cf9dc6

Choose a tag to compare

Added:

Fixes:

  • Fixed 32-bit clang-cl build
  • Fixed build on gcc 4.8.5
  • Fixed StackWalk64 for 64-bit arm #270 (@mcourteaux)
  • Fixed compatibility issue with cmake versions before 3.23

Other:

  • Added a couple notes to the README

Version 1.0.1

18 Jun 18:43
de17802

Choose a tag to compare

Added:

  • Added from-current-exception utility for SEH on windows (CPPTRACE_SEH_TRY/CPPTRACE_SEH_EXCEPT)

Fixes:

  • Fixed a static assert without a message causing issues on some C++11 builds
  • Fixed build 32-bit build on linux
  • Fixed from-current-exception system for 32-bit windows where SEH behaves much differently
  • Fixed clang-cl build

Version 1.0.0

12 Jun 17:44
74051bb

Choose a tag to compare

Major changes:

  • Overhauled how the from-current-exception system and CPPTRACE_TRY/CPPTRACE_CATCH macros work. They now check the
    thrown exception type against the type the catch accepts to decide whether or not to collect a trace. This eliminates
    the need for The TRYZ/CATCHZ variants of the macros as now the normal macro is equally zero-overhead. As such, the
    Z variants have been removed.

Breaking changes:

  • CPPTRACE_TRYZ and CPPTRACE_CATCHZ have been removed, change uses to CPPTRACE_TRY/CPPTRACE_CATCH

  • CPPTRACE_TRY/CPPTRACE_CATCH macros no longer support multiple handlers and CPPTRACE_CATCH_ALT has been removed.
    Instead, use cpptrace::try_catch.

    Details

    Author's note: I apologize for this non-trivial breaking change, however, it allows for a much improved
    implementation of the from-current-exception system. The impact should be very minimal
    for most codebases.

    Transitioning to cpptrace::try_catch is straightforward:

    Before Now
    CPPTRACE_TRY {
        foo();
    } CPPTRACE_CATCH(const std::logic_error& e) {
        handle_logic_error(e);
    } CPPTRACE_CATCH_ALT(const std::exception& e) {
        handle_exception(e);
    } CPPTRACE_CATCH_ALT(...) {
        handle_unknown_exception();
    }
    cpptrace::try_catch(
        [&] { // try block
            foo();
        },
        [&] (const std::runtime_error& e) {
            handle_logic_error(e);
        },
        [&] (const std::exception& e) {
            handle_exception(e);
        },
        [&] () { // `catch(...)`
            handle_unknown_exception();
        }
    );

    Please note as well that code such as the following, which was valid before, will still compile now but may report a
    misleading trace. The second catch handler will work but it cpptrace won't know about the handler's type and won't
    collect a trace that doesn't match the first handler's type, std::logic_error.

    CPPTRACE_TRY {
        foo();
    } CPPTRACE_CATCH(const std::logic_error& e) {
        ...
    } catch(const std::exception& e) {
        ...
    }

Potentially-breaking changes:

  • This version of cpptrace reworks the public interface to use an inline ABI versioning namespace. All symbols in the
    public interface are now secretly in the cpptrace::v1 namespace. This is an ABI break, but any ABI mismatch will
    result in linker errors instead of silent bugs. This change is an effort to allow future evolution of cpptrace in a
    way that respects ABI.
  • This version fixes a problem with returns from CPPTRACE_TRY blocks on windows. Unfortunately, this macro has to use
    an IILE on windows and as such return statements won't properly return from the enclosing function. This was a
    footgun and now return statements in CPPTRACE_TRY blocks are prevented from compiling on windows.

Added

  • Added cpptrace::try_catch for handling multiple alternatives with access to current exception traces
  • Added cpptrace::rethrow utility for rethrowing exceptions from CPPTRACE_CATCH while preserving the stacktrace #214
  • Added utilities for getting the current trace from the last rethrow point
    (cpptrace::raw_trace_from_current_exception_rethrow, cpptrace::from_current_exception_rethrow,
    cpptrace::current_exception_was_rethrown)
  • Added a logger system to allow cpptrace to report errors in a configurable manner. By default, cpptrace doesn't log
    anything. The following functions can be used to change this: (cpptrace::set_log_level,
    cpptrace::set_log_callback, and cpptrace::use_default_stderr_logger)
  • Added cpptrace::basename utility
  • Added cpptrace::prettify_type utility
  • Added cpptrace::prune_symbol utility
  • Added formatter option for symbol formatting (cpptrace::formatter::symbols)
  • Added cpptrace::detail::lazy_trace_holder::is_resolved
  • Added support for C++20 modules #248
  • Added cpptrace::load_symbols_for_file to support DLLs loaded at runtime when using dbghelp #247

Removed

  • Removed CPPTRACE_TRYZ and CPPTRACE_CATCHZ macros
  • Removed the CPPTRACE_CATCH_ALT macro

Fixed

  • Fixed a problem where CPPTRACE_TRY blocks could contain return statements but not return on windows due to an IILE. This is now an error. #245
  • Fixed cases where cpptrace could print to stderr on internal errors without the user desiring so #234
  • Fixed a couple internal locking mistakes
  • Fixed a couple of code paths that could be susceptible to static init order issues
  • Fixed bug with loading elf symbol tables that contain zero-sized entries
  • Fixed an incorrect assertion regarding looking up symbols at program counters that reside before any seen subprogram DIE #250
  • Fixed issue with cpptrace::stacktrace::to_string() ending with a newline on empty traces

Other

  • Marked some paths in CPPTRACE_CATCH and CPPTRACE_CATCHZ as unreachable to improve usability in cases where the
    compiler may warn about missing returns.
  • Improved resilience to libdwarf errors #251
  • Removed internal use of std::is_trivial which is deprecated in C++26 #236
  • Bumped libdwarf to 2.0.0
  • Added --address flag for internal symbol table tool
  • Various internal work to improve the codebase and reduce complexity

Version 0.8.3

08 Apr 14:34
ce639eb

Choose a tag to compare

Added:

  • Added basic JIT support #226
  • Added cpptrace::formatter::transform #227
  • Added support for gcc 4.8.5 #220

Fixed:

  • Fixed bug related to calling dwarf_dealloc on strings from dwarf_formstring and dwarf_diename davea42/libdwarf-code#279
  • Fixed incorrect cmake version variable #231
  • Fixed address_mode::none not working #221
  • Fixed use of -Wall for clang-cl

Other:

  • Added ARM CI
  • Miscellaneous work on supporting old compilers
  • Updated cpptrace cmake target configuration to not add public compile definitions
  • Internal refactoring, cleanup, and code improvements

Version 0.8.2

23 Feb 20:26
c37b5ed

Choose a tag to compare

Fixed:

  • Fixed printing of internal error messages when an object file can't be loaded, mainly affecting MacOS #217

Other:

  • Bumped zstd via FetchContent to 1.5.7

Version 0.8.1

21 Feb 05:17
1940dc6

Choose a tag to compare

Fixed:

  • Fixed compile error on msvc #215

Added:

  • Added cpptrace::can_get_safe_object_frame()

Breaking changes:

  • Renamed ctrace's can_signal_safe_unwind to ctrace_can_signal_safe_unwind. This was an oversight. Apologies for
    including a breaking change in a patch release. Github code search suggests this API isn't used in public code, at
    least.

Other:

  • Added CI workflow to test on old msvc
  • Made some internal improvements on robustness and cleanliness

Version 0.8.0

20 Feb 05:32
34ea957

Choose a tag to compare

Added:

  • Added support for resolving symbols from elf and mach-o symbol tables, allowing function names to be resolved even in
    a build that doesn't include debug information #201
  • Added a configurable stack trace formatter #164
  • Added configuration options for the libdwarf back-end that can be used to lower memory usage on memory-constrained
    systems #193
  • Added cpptrace::nullable<T>::null_value
  • Made cpptrace::nullable<T> member functions conditionally constexpr where possible

Fixed:

  • Fixed handling of SymInitialize when other code has already called SymInitialize. SymInitialize must only be
    called once per handle and cpptrace now attempts to duplicate the current process handle to avoid conflicts.
    #204
  • Fixed a couple of locking edge cases surrounding dbghelp functions
  • Fixed improper deallocation of dwarf_errmsg in the libdwarf back-end

Breaking changes:

  • cpptrace::get_snippet previously included a newline at the end but it now does not. This also affects the behavior
    of trace formatting with snippets enabled.

Other:

  • Significantly improved memory usage and performance of the libdwarf back-end
  • Improved implementation and organization of internal utility types, such as optional and Result
  • Improved trace printing and formatting implementation
  • Added unit tests for library internal utilities
  • Added logic to the cxxabi demangler to ensure external names begin with _Z or __Z before attempting to demangle
  • Added various internal tools and abstractions to improve maintainability and clarity
  • Various internal improvements for robustness
  • Added a small handful of utility tool programs that are useful for continued development, maintenance, and debugging
  • Improved library CI setup
  • Marked the CPPTRACE_BUILD_BENCHMARK option as advanced

Version 0.7.5

05 Jan 05:46
6689d14

Choose a tag to compare

Fixed:

  • Fixed missing <typeinfo> include #202
  • Added __cdecl to a terminate handler to appease MSVC under some configurations #197
  • Set C++ standard for cmake support checks #200
  • Changed hyphens to underscores for cmake component names due to cpack issue #203