From 8efc8fcfdca5132d55696974d31149c945d41fae Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Sat, 10 Dec 2016 22:10:56 +0300 Subject: [PATCH] Docs regenerated --- BOOST_STACKTRACE_DEFAULT_MAX_DEPTH.html | 13 +- boost/stacktrace/basic_stacktrace.html | 94 +++--- boost/stacktrace/const_iterator.html | 6 +- boost/stacktrace/frame.html | 55 ++-- boost/stacktrace/stacktrace.html | 232 -------------- boost_stacktrace/acknowledgements.html | 56 ++++ .../build_macros_and_backends.html | 6 +- boost_stacktrace/getting_started.html | 283 +++++++++++------- boost_stacktrace_header_reference.html | 40 +-- index.html | 15 +- standalone_HTML.manifest | 3 +- 11 files changed, 349 insertions(+), 454 deletions(-) delete mode 100644 boost/stacktrace/stacktrace.html create mode 100644 boost_stacktrace/acknowledgements.html diff --git a/BOOST_STACKTRACE_DEFAULT_MAX_DEPTH.html b/BOOST_STACKTRACE_DEFAULT_MAX_DEPTH.html index 9d2fa8f..8e31549 100644 --- a/BOOST_STACKTRACE_DEFAULT_MAX_DEPTH.html +++ b/BOOST_STACKTRACE_DEFAULT_MAX_DEPTH.html @@ -5,9 +5,8 @@ - - - + + @@ -20,7 +19,7 @@

-PrevUpHomeNext +PrevUpHome
@@ -29,11 +28,11 @@

BOOST_STACKTRACE_DEFAULT_MAX_DEPTH

Synopsis

-
// In header: <boost/stacktrace/stacktrace.hpp>
+
// In header: <boost/stacktrace/stacktrace_fwd.hpp>
 
 BOOST_STACKTRACE_DEFAULT_MAX_DEPTH
-

Description

+

Description

You may define this macro to some positive integer to limit the max stack frames count for the boost::stacktrace::stacktrace class. This macro does not affect the boost::stacktrace::basic_stacktrace.

Default: 100

@@ -48,7 +47,7 @@
-PrevUpHomeNext +PrevUpHome
diff --git a/boost/stacktrace/basic_stacktrace.html b/boost/stacktrace/basic_stacktrace.html index d36b0a5..723cbf2 100644 --- a/boost/stacktrace/basic_stacktrace.html +++ b/boost/stacktrace/basic_stacktrace.html @@ -7,7 +7,7 @@ - + @@ -20,7 +20,7 @@

-PrevUpHomeNext +PrevUpHomeNext
@@ -42,75 +42,75 @@ typedef std::reverse_iterator< const_iterator > const_reverse_iterator; // construct/copy/destruct - basic_stacktrace() noexcept; - basic_stacktrace(const basic_stacktrace &) noexcept; - basic_stacktrace & operator=(const basic_stacktrace &) noexcept; - ~basic_stacktrace(); + basic_stacktrace() noexcept; + basic_stacktrace(const basic_stacktrace &) noexcept; + basic_stacktrace & operator=(const basic_stacktrace &) noexcept; + ~basic_stacktrace(); - // public member functions - std::size_t size() const noexcept; - frame operator[](std::size_t) const noexcept; - const_iterator begin() const noexcept; - const_iterator cbegin() const noexcept; - const_iterator end() const noexcept; - const_iterator cend() const noexcept; - const_reverse_iterator rbegin() const noexcept; - const_reverse_iterator crbegin() const noexcept; - const_reverse_iterator rend() const noexcept; - const_reverse_iterator crend() const noexcept; - explicit operator bool() const noexcept; - bool empty() const noexcept; - bool operator<(const basic_stacktrace &) const noexcept; - bool operator==(const basic_stacktrace &) const noexcept; - std::size_t hash_code() const noexcept; + // public member functions + std::size_t size() const noexcept; + frame operator[](std::size_t) const noexcept; + const_iterator begin() const noexcept; + const_iterator cbegin() const noexcept; + const_iterator end() const noexcept; + const_iterator cend() const noexcept; + const_reverse_iterator rbegin() const noexcept; + const_reverse_iterator crbegin() const noexcept; + const_reverse_iterator rend() const noexcept; + const_reverse_iterator crend() const noexcept; + explicit operator bool() const noexcept; + bool empty() const noexcept; + bool operator<(const basic_stacktrace &) const noexcept; + bool operator==(const basic_stacktrace &) const noexcept; + std::size_t hash_code() const noexcept; // public data members static constexpr std::size_t max_depth; // Max stack frames count that this class may hold. Equal to Depth template parameter. };
-

Description

+

Description

Class that on construction copies minimal information about call stack into its internals and provides access to that information.

-

Template Parameters

+

Template Parameters

  1. std::size_t Depth

    Max stack frames count that this class may hold. Equal to basic_stacktrace::max_depth.

-

+

basic_stacktrace public construct/copy/destruct

  1. -
    basic_stacktrace() noexcept;
    Stores the current function call sequence inside the class.

    Complexity: O(N) where N is call sequence length, O(1) for noop backend.

    +
    basic_stacktrace() noexcept;
    Stores the current function call sequence inside the class.

    Complexity: O(N) where N is call sequence length, O(1) for noop backend.

    Async-Handler-Safety: Depends on backend, see "Build, Macros and Backends" section.

  2. -
    basic_stacktrace(const basic_stacktrace & st) noexcept;
    +
    basic_stacktrace(const basic_stacktrace & st) noexcept;

    Complexity: O(st.size())

    Async-Handler-Safety: Safe.

  3. -
    basic_stacktrace & operator=(const basic_stacktrace & st) noexcept;
    +
    basic_stacktrace & operator=(const basic_stacktrace & st) noexcept;

    Complexity: O(st.size())

    Async-Handler-Safety: Safe.

  4. -
    ~basic_stacktrace();
    +
    ~basic_stacktrace();

    Complexity: O(1)

    Async-Handler-Safety: Safe.

-

-basic_stacktrace public member functions

+

+basic_stacktrace public member functions

  1. -
    std::size_t size() const noexcept;
    +
    std::size_t size() const noexcept;

    Complexity: O(1)

    Async-Handler-Safety: Safe.

    @@ -123,7 +123,7 @@
  • -
    frame operator[](std::size_t frame_no) const noexcept;
    +
    frame operator[](std::size_t frame_no) const noexcept;

    Complexity: Amortized O(1), O(1) for noop backend.

    @@ -149,47 +149,47 @@
  • -
    const_iterator begin() const noexcept;
    +
    const_iterator begin() const noexcept;

    Complexity: O(1)

    Async-Handler-Safety: Safe.

  • -
    const_iterator cbegin() const noexcept;
    +
    const_iterator cbegin() const noexcept;

    Complexity: O(1)

    Async-Handler-Safety: Safe.

  • -
    const_iterator end() const noexcept;
    +
    const_iterator end() const noexcept;

    Complexity: O(1)

    Async-Handler-Safety: Safe.

  • -
    const_iterator cend() const noexcept;
    +
    const_iterator cend() const noexcept;

    Complexity: O(1)

    Async-Handler-Safety: Safe.

  • -
    const_reverse_iterator rbegin() const noexcept;
    +
    const_reverse_iterator rbegin() const noexcept;

    Complexity: O(1)

    Async-Handler-Safety: Safe.

  • -
    const_reverse_iterator crbegin() const noexcept;
    +
    const_reverse_iterator crbegin() const noexcept;

    Complexity: O(1)

    Async-Handler-Safety: Safe.

  • -
    const_reverse_iterator rend() const noexcept;
    +
    const_reverse_iterator rend() const noexcept;

    Complexity: O(1)

    Async-Handler-Safety: Safe.

  • -
    const_reverse_iterator crend() const noexcept;
    +
    const_reverse_iterator crend() const noexcept;

    Complexity: O(1)

    Async-Handler-Safety: Safe.

  • -
    explicit operator bool() const noexcept;
    Allows to check that stack trace capturing was successful.

    +

    explicit operator bool() const noexcept;
    Allows to check that stack trace capturing was successful.

    Complexity: O(1)

    Async-Handler-Safety: Safe.

    @@ -201,7 +201,7 @@
  • -
    bool empty() const noexcept;
    Allows to check that stack trace failed.

    +

    bool empty() const noexcept;
    Allows to check that stack trace failed.

    Complexity: O(1)

    Async-Handler-Safety: Safe.

    @@ -213,15 +213,15 @@
  • -
    bool operator<(const basic_stacktrace & rhs) const noexcept;
    Compares stacktraces for less, order is platform dependant.

    Complexity: Amortized O(1); worst case O(size())

    +
    bool operator<(const basic_stacktrace & rhs) const noexcept;
    Compares stacktraces for less, order is platform dependant.

    Complexity: Amortized O(1); worst case O(size())

    Async-Handler-Safety: Safe.

  • -
    bool operator==(const basic_stacktrace & rhs) const noexcept;
    Compares stacktraces for equality.

    Complexity: Amortized O(1); worst case O(size())

    +
    bool operator==(const basic_stacktrace & rhs) const noexcept;
    Compares stacktraces for equality.

    Complexity: Amortized O(1); worst case O(size())

    Async-Handler-Safety: Safe.

  • -
    std::size_t hash_code() const noexcept;
    Returns hashed code of the stacktrace.

    Complexity: O(1)

    +
    std::size_t hash_code() const noexcept;
    Returns hashed code of the stacktrace.

    Complexity: O(1)

    Async-Handler-Safety: Safe.

  • @@ -238,7 +238,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/boost/stacktrace/const_iterator.html b/boost/stacktrace/const_iterator.html index 71862b7..eebe488 100644 --- a/boost/stacktrace/const_iterator.html +++ b/boost/stacktrace/const_iterator.html @@ -6,7 +6,7 @@ - + @@ -20,7 +20,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    @@ -45,7 +45,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/boost/stacktrace/frame.html b/boost/stacktrace/frame.html index d4c7c3b..4acc5b6 100644 --- a/boost/stacktrace/frame.html +++ b/boost/stacktrace/frame.html @@ -7,6 +7,7 @@ + @@ -19,7 +20,7 @@

    -PrevUpHome +PrevUpHomeNext
    @@ -34,29 +35,29 @@ class frame { public: // construct/copy/destruct - frame() noexcept; - frame(const frame &) = default; - explicit frame(const void *) noexcept; - frame & operator=(const frame &) = default; + frame() noexcept; + frame(const frame &) = default; + explicit frame(const void *) noexcept; + frame & operator=(const frame &) = default; - // public member functions - std::string name() const; - const void * address() const noexcept; - std::string source_file() const; - std::size_t source_line() const; - explicit operator bool() const noexcept; - bool empty() const noexcept; + // public member functions + std::string name() const; + const void * address() const noexcept; + std::string source_file() const; + std::size_t source_line() const; + explicit operator bool() const noexcept; + bool empty() const noexcept; };
    -

    Description

    +

    Description

    -

    +

    frame public construct/copy/destruct

    1. -
      frame() noexcept;
      Constructs frame that references NULL address. Calls to source_file() and source_line() wil lreturn empty string. Calls to source_line() will return 0.

      Complexity: O(1).

      +
      frame() noexcept;
      Constructs frame that references NULL address. Calls to source_file() and source_line() wil lreturn empty string. Calls to source_line() will return 0.

      Complexity: O(1).

      Async-Handler-Safety: Safe.

      @@ -68,7 +69,7 @@
    2. -
      frame(const frame &) = default;
      Copy constructs frame.

      Complexity: O(1).

      +
      frame(const frame &) = default;
      Copy constructs frame.

      Complexity: O(1).

      Async-Handler-Safety: Safe.

      @@ -80,7 +81,7 @@
    3. -
      explicit frame(const void * addr) noexcept;
      Constructs frame that can extract information from addr at runtime.

      Complexity: O(1).

      +
      explicit frame(const void * addr) noexcept;
      Constructs frame that can extract information from addr at runtime.

      Complexity: O(1).

      Async-Handler-Safety: Safe.

      @@ -92,7 +93,7 @@
    4. -
      frame & operator=(const frame &) = default;
      Copy assigns frame.

      Complexity: O(1).

      +
      frame & operator=(const frame &) = default;
      Copy assigns frame.

      Complexity: O(1).

      Async-Handler-Safety: Safe.

      @@ -106,11 +107,11 @@
      -

      -frame public member functions

      +

      +frame public member functions

      1. -
        std::string name() const;
        +
        std::string name() const;

        Async-Handler-Safety: Unsafe.

        @@ -129,7 +130,7 @@
    5. -
      const void * address() const noexcept;
      +
      const void * address() const noexcept;

      Async-Handler-Safety: Safe.

      @@ -148,7 +149,7 @@
  • -
    std::string source_file() const;
    +
    std::string source_file() const;

    Async-Handler-Safety: Unsafe.

    @@ -167,7 +168,7 @@
  • -
    std::size_t source_line() const;
    +
    std::size_t source_line() const;

    Async-Handler-Safety: Unsafe.

    @@ -186,7 +187,7 @@
  • -
    explicit operator bool() const noexcept;
    Checks that frame is not references NULL address.

    +

    explicit operator bool() const noexcept;
    Checks that frame is not references NULL address.

    Complexity: O(1)

    Async-Handler-Safety: Safe.

    @@ -198,7 +199,7 @@
  • -
    bool empty() const noexcept;
    Checks that frame references NULL address.

    +

    bool empty() const noexcept;
    Checks that frame references NULL address.

    Complexity: O(1)

    Async-Handler-Safety: Safe.

    @@ -223,7 +224,7 @@

    -PrevUpHome +PrevUpHomeNext
    diff --git a/boost/stacktrace/stacktrace.html b/boost/stacktrace/stacktrace.html deleted file mode 100644 index 7370f6b..0000000 --- a/boost/stacktrace/stacktrace.html +++ /dev/null @@ -1,232 +0,0 @@ - - - -Class stacktrace - - - - - - - - - - - - - - - -
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    -
    -
    -PrevUpHomeNext -
    -
    -
    -
    -

    Class stacktrace

    -

    boost::stacktrace::stacktrace — Class that on construction copies minimal information about call stack into its internals and provides access to that information.

    -
    -

    Synopsis

    -
    // In header: <boost/stacktrace/stacktrace.hpp>
    -
    -
    -class stacktrace {
    -public:
    -  // types
    -  typedef frame                                   reference;             
    -  typedef boost::stacktrace::const_iterator       iterator;              
    -  typedef boost::stacktrace::const_iterator       const_iterator;        
    -  typedef std::reverse_iterator< iterator >       reverse_iterator;      
    -  typedef std::reverse_iterator< const_iterator > const_reverse_iterator;
    -
    -  // construct/copy/destruct
    -  stacktrace() noexcept;
    -  stacktrace(const stacktrace &) noexcept;
    -  stacktrace & operator=(const stacktrace &) noexcept;
    -  ~stacktrace();
    -
    -  // public member functions
    -  std::size_t size() const noexcept;
    -  frame operator[](std::size_t) const noexcept;
    -  const_iterator begin() const noexcept;
    -  const_iterator cbegin() const noexcept;
    -  const_iterator end() const noexcept;
    -  const_iterator cend() const noexcept;
    -  const_reverse_iterator rbegin() const noexcept;
    -  const_reverse_iterator crbegin() const noexcept;
    -  const_reverse_iterator rend() const noexcept;
    -  const_reverse_iterator crend() const noexcept;
    -  explicit operator bool() const noexcept;
    -  bool empty() const noexcept;
    -  bool operator<(const stacktrace &) const noexcept;
    -  bool operator==(const stacktrace &) const noexcept;
    -  std::size_t hash_code() const noexcept;
    -};
    -
    -

    Description

    -
    -

    -stacktrace - public - construct/copy/destruct

    -
      -
    1. -
      stacktrace() noexcept;
      Stores the current function call sequence inside the class.

      Complexity: O(N) where N is call sequence length, O(1) for noop backend.

      -

      Async-Handler-Safety: Depends on backend, see "Build, Macros and Backends" section.

      -
    2. -
    3. -
      stacktrace(const stacktrace & st) noexcept;
      -

      Complexity: O(st.size())

      -

      Async-Handler-Safety: Safe.

      -
    4. -
    5. -
      stacktrace & operator=(const stacktrace & st) noexcept;
      -

      Complexity: O(st.size())

      -

      Async-Handler-Safety: Safe.

      -
    6. -
    7. -
      ~stacktrace();
      -

      Complexity: O(1)

      -

      Async-Handler-Safety: Safe.

      -
    8. -
    -
    -
    -

    -stacktrace public member functions

    -
      -
    1. -
      std::size_t size() const noexcept;
      -

      -Complexity: O(1)

      -

      Async-Handler-Safety: Safe.

      -
      -- - - - -

      Returns:

      Number of function names stored inside the class.

      -
    2. -
    3. -
      frame operator[](std::size_t frame_no) const noexcept;
      -

      - -Complexity: Amortized O(1), O(1) for noop backend.

      -

      Async-Handler-Safety: Safe.

      -
      -- - - - - - - - - - -

      Parameters:

      -- - - - -

      frame_no

      Zero based index of frame to return. 0 is the function index where stacktrace was constructed and index close to this->size() contains function main().

      Returns:

      frame that references the actual frame info, stored inside *this.

      -
    4. -
    5. -
      const_iterator begin() const noexcept;
      -

      Complexity: O(1)

      -

      Async-Handler-Safety: Safe.

      -
    6. -
    7. -
      const_iterator cbegin() const noexcept;
      -

      Complexity: O(1)

      -

      Async-Handler-Safety: Safe.

      -
    8. -
    9. -
      const_iterator end() const noexcept;
      -

      Complexity: O(1)

      -

      Async-Handler-Safety: Safe.

      -
    10. -
    11. -
      const_iterator cend() const noexcept;
      -

      Complexity: O(1)

      -

      Async-Handler-Safety: Safe.

      -
    12. -
    13. -
      const_reverse_iterator rbegin() const noexcept;
      -

      Complexity: O(1)

      -

      Async-Handler-Safety: Safe.

      -
    14. -
    15. -
      const_reverse_iterator crbegin() const noexcept;
      -

      Complexity: O(1)

      -

      Async-Handler-Safety: Safe.

      -
    16. -
    17. -
      const_reverse_iterator rend() const noexcept;
      -

      Complexity: O(1)

      -

      Async-Handler-Safety: Safe.

      -
    18. -
    19. -
      const_reverse_iterator crend() const noexcept;
      -

      Complexity: O(1)

      -

      Async-Handler-Safety: Safe.

      -
    20. -
    21. -
      explicit operator bool() const noexcept;
      Allows to check that stack trace capturing was successful.

      -Complexity: O(1)

      -

      Async-Handler-Safety: Safe.

      -
      -- - - - -

      Returns:

      true if this->size() != 0

      -
    22. -
    23. -
      bool empty() const noexcept;
      Allows to check that stack trace failed.

      -Complexity: O(1)

      -

      Async-Handler-Safety: Safe.

      -
      -- - - - -

      Returns:

      true if this->size() == 0

      -
    24. -
    25. -
      bool operator<(const stacktrace & rhs) const noexcept;
      Compares stacktraces for less, order is platform dependant.

      Complexity: Amortized O(1); worst case O(size())

      -

      Async-Handler-Safety: Safe.

      -
    26. -
    27. -
      bool operator==(const stacktrace & rhs) const noexcept;
      Compares stacktraces for equality.

      Complexity: Amortized O(1); worst case O(size())

      -

      Async-Handler-Safety: Safe.

      -
    28. -
    29. -
      std::size_t hash_code() const noexcept;
      Returns hashed code of the stacktrace.

      Complexity: O(1)

      -

      Async-Handler-Safety: Safe.

      -
    30. -
    -
    -
    -
    - - - -
    -
    -
    -PrevUpHomeNext -
    - - diff --git a/boost_stacktrace/acknowledgements.html b/boost_stacktrace/acknowledgements.html new file mode 100644 index 0000000..d253246 --- /dev/null +++ b/boost_stacktrace/acknowledgements.html @@ -0,0 +1,56 @@ + + + +Acknowledgements + + + + + + + + + + + + + + + +
    Boost C++ LibrariesHomeLibrariesPeopleFAQMore
    +
    +
    +PrevUpHomeNext +
    +
    + +

    + In order of helping and advising: +

    +
      +
    • + Great thanks to Nat Goodspeed for requesting boost::stacktrace::frame + like class. +
    • +
    • + Great thanks to Niall Douglas for making an initial review, helping with + some platforms and giving great hints on library design. +
    • +
    +
    + + + +
    +
    +
    +PrevUpHomeNext +
    + + diff --git a/boost_stacktrace/build_macros_and_backends.html b/boost_stacktrace/build_macros_and_backends.html index 31157ea..7c0ff47 100644 --- a/boost_stacktrace/build_macros_and_backends.html +++ b/boost_stacktrace/build_macros_and_backends.html @@ -7,7 +7,7 @@ - + @@ -20,7 +20,7 @@

    -PrevUpHomeNext +PrevUpHomeNext

    @@ -315,7 +315,7 @@
    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/boost_stacktrace/getting_started.html b/boost_stacktrace/getting_started.html index 987f8d6..98b0259 100644 --- a/boost_stacktrace/getting_started.html +++ b/boost_stacktrace/getting_started.html @@ -29,16 +29,20 @@

    @@ -84,8 +88,8 @@

    Segmentation Faults and std::terminate @@ -108,11 +112,12 @@ } void my_signal_handler(int signum) { + ::signal(signum, SIG_DFL); boost::stacktrace::stacktrace bt; if (bt) { - std::cerr << "Signal " << signum << ", backtrace:\n" << boost::stacktrace::stacktrace() << '\n'; // [1] + std::cerr << "Signal " << signum << ", backtrace:\n" << boost::stacktrace::stacktrace() << '\n'; // [1] } - std::abort(); + _Exit(-1); }

    @@ -121,56 +126,44 @@

    std::set_terminate(&my_terminate_handler);
     ::signal(SIGSEGV, &my_signal_handler);
    +::signal(SIGABRT, &my_signal_handler);
     

    Now we'll get the following output on std::terminate call:

    Terminate called:
    - 0# my_terminate_handler()
    - 1# std::rethrow_exception(std::__exception_ptr::exception_ptr)
    - 2# std::terminate()
    - 3# bar(int)
    - 4# bar(int)
    - 5# foo(int)
    - 6# bar(int)
    - 7# foo(int)
    - 8# bar(int)
    - 9# foo(int)
    -10# bar(int)
    -11# foo(int)
    -12# bar(int)
    -13# foo(int)
    -14# bar(int)
    -15# foo(int)
    -16# main
    -17# __libc_start_main
    -18# _start
    -19# ??
    + 0# boost::stacktrace::detail::backend::backend(void**, unsigned long)
    + 1# my_terminate_handler() at /data/boost/libs/stacktrace/example/terminate_handler.cpp:37
    + 2# 0x7f624107a6b6
    + 3# 0x7f624107a701
    + 4# bar(int) at /data/boost/libs/stacktrace/example/terminate_handler.cpp:18
    + 5# foo(int) at /data/boost/libs/stacktrace/example/terminate_handler.cpp:22
    + 6# bar(int) at /data/boost/libs/stacktrace/example/terminate_handler.cpp:18
    + 7# foo(int) at /data/boost/libs/stacktrace/example/terminate_handler.cpp:22
    + 8# main at /data/boost/libs/stacktrace/example/terminate_handler.cpp:64
    + 9# __libc_start_main
    +10# _start
     

    - And the following output on Segmentation Fault: + And the following output on Abort:

    -
    Signal 11, backtrace:
    - 0# my_signal_handler(int)
    - 1# killpg
    - 2# ??
    - 3# bar(int)
    - 4# foo(int)
    - 5# bar(int)
    - 6# foo(int)
    - 7# bar(int)
    - 8# foo(int)
    - 9# bar(int)
    -10# foo(int)
    -11# bar(int)
    -12# foo(int)
    -13# bar(int)
    -14# foo(int)
    -15# main
    -16# __libc_start_main
    -17# _start
    -18# ??
    +
    Signal 6, backtrace:
    + 0# boost::stacktrace::detail::backend::backend(void**, unsigned long)
    + 1# my_signal_handler(int)
    + 2# 0x7f6240a3a4b0
    + 3# gsignal
    + 4# abort
    + 5# my_terminate_handler()
    + 6# 0x7f624107a6b6
    + 7# 0x7f624107a701
    + 8# bar(int) at /data/boost/libs/stacktrace/example/terminate_handler.cpp:18
    + 9# foo(int) at /data/boost/libs/stacktrace/example/terminate_handler.cpp:22
    +10# bar(int) at /data/boost/libs/stacktrace/example/terminate_handler.cpp:18
    +11# foo(int) at /data/boost/libs/stacktrace/example/terminate_handler.cpp:22
    +12# main at /data/boost/libs/stacktrace/example/terminate_handler.cpp:64
    +13# __libc_start_main
    +14# _start
     

    The output stacktrace may be corrupted by previous actions. But now at least @@ -200,13 +193,13 @@ #include <boost/stacktrace.hpp> namespace boost { - void assertion_failed_msg(char const* expr, char const* msg, char const* function, char const* file, long line) { + inline void assertion_failed_msg(char const* expr, char const* msg, char const* function, char const* file, long line) { std::cerr << "Expression '" << expr << "' is false in function '" << function << "': " << (msg ? msg : "<...>") << ".\n" << "Backtrace:\n" << boost::stacktrace::stacktrace() << '\n'; - throw std::logic_error("assertion"); + std::abort(); } - void assertion_failed(char const* expr, char const* function, char const* file, long line) { + inline void assertion_failed(char const* expr, char const* function, char const* file, long line) { ::boost::assertion_failed_msg(expr, 0 /*nullptr*/, function, file, line); } } // namespace boost @@ -220,27 +213,18 @@ in case of failure. In assertion_failed_msg we output information that was provided by the assertion macro and boost::stacktrace::stacktrace:

    -
    Expression 'i < N' is false in function 'T& boost::array<T, N>::operator[](boost::array<T, N>::size_type) [with T = int; long unsigned int N = 5ul]': out of range.
    +
    Expression 'i < N' is false in function 'T& boost::array<T, N>::operator[](boost::array<T, N>::size_type) [with T = int; long unsigned int N = 5ul; boost::array<T, N>::reference = int&; boost::array<T, N>::size_type = long unsigned int]': out of range.
     Backtrace:
    - 0# boost::assertion_failed_msg(char const*, char const*, char const*, char const*, long)
    - 1# boost::array<int, 5ul>::operator[](unsigned long)
    - 2# oops(unsigned long)
    - 3# bar(int)
    - 4# foo(int)
    - 5# bar(int)
    - 6# foo(int)
    - 7# bar(int)
    - 8# foo(int)
    - 9# bar(int)
    -10# foo(int)
    -11# bar(int)
    -12# foo(int)
    -13# bar(int)
    -14# foo(int)
    -15# main
    -16# __libc_start_main
    -17# _start
    -18# ??
    + 0# boost::stacktrace::detail::backend::backend(void**, unsigned long)
    + 1# boost::assertion_failed_msg(char const*, char const*, char const*, char const*, long) at /data/boost/libs/stacktrace/example/assert_handler.cpp:38
    + 2# boost::array<int, 5ul>::operator[](unsigned long)
    + 3# bar(int) at /data/boost/libs/stacktrace/example/assert_handler.cpp:16
    + 4# foo(int) at /data/boost/libs/stacktrace/example/assert_handler.cpp:24
    + 5# bar(int) at /data/boost/libs/stacktrace/example/assert_handler.cpp:20
    + 6# foo(int) at /data/boost/libs/stacktrace/example/assert_handler.cpp:24
    + 7# main at /data/boost/libs/stacktrace/example/assert_handler.cpp:53
    + 8# __libc_start_main
    + 9# _start
     

    Now we do know the steps that led to the assertion and can find the error @@ -249,27 +233,21 @@

    You can provide more information along with exception by embedding stacktraces - into the exception. For that we will need: + into the exception. For that you will need to:

    • - Basic class that holds the stacktrace: + Write a basic class that holds the stacktrace:
    -
    #include <boost/stacktrace.hpp>
    -
    -struct traced {
    -    const boost::stacktrace::stacktrace trace;
    -
    -    virtual const char* what() const noexcept = 0;
    -    virtual ~traced(){}
    -};
    -
    +

    + [getting_stated_class_traced] +

    • - Helper class for appending class traced + Write a helper class for appending class traced to any exception:
    template <class Exception>
    @@ -310,32 +288,25 @@
     

    Code from above will output:

    -
    'i' must be less than 4 in oops()
    +
    'i' must not be greater than zero in oops()
     Backtrace:
    - 0# with_trace<std::out_of_range>::with_trace<char const (&) [34]>(char const (&) [34])
    - 1# oops(unsigned long)
    - 2# bar(int)
    - 3# foo(int)
    - 4# bar(int)
    - 5# foo(int)
    - 6# bar(int)
    - 7# foo(int)
    - 8# bar(int)
    - 9# foo(int)
    -10# bar(int)
    -11# foo(int)
    -12# bar(int)
    -13# foo(int)
    -14# main
    -15# __libc_start_main
    -16# _start
    -17# ??
    + 0# boost::stacktrace::detail::backend::backend(void**, unsigned long)
    + 1# traced::traced() at /data/boost/libs/stacktrace/example/throwing_st.cpp:20
    + 2# with_trace<std::logic_error>::with_trace<char const (&) [44]>(char const (&) [44]) at /data/boost/libs/stacktrace/example/throwing_st.cpp:33
    + 3# oops(int)
    + 4# bar(int) at /data/boost/libs/stacktrace/example/throwing_st.cpp:70
    + 5# foo(int) at /data/boost/libs/stacktrace/example/throwing_st.cpp:75
    + 6# bar(int) at /data/boost/libs/stacktrace/example/throwing_st.cpp:65
    + 7# foo(int) at /data/boost/libs/stacktrace/example/throwing_st.cpp:75
    + 8# main at /data/boost/libs/stacktrace/example/throwing_st.cpp:93
    + 9# __libc_start_main
    +10# _start
     

    At some point arises a requirement to easily enable/disable stacktraces for @@ -387,12 +358,106 @@

    Code from above will output:

    -
    0x401a25,0x401a25,0x401a25,0x401a25,0x401a25,0x401a25,0x4019cb,0x401a7f,0x7f9da8a46e50,0x4013e0,0,
    +
    0x7fbcfd17f6b5,0x400d4a,0x400d61,0x400d61,0x400d61,0x400d61,0x400d77,0x400cbf,0x400dc0,0x7fbcfc82d830,0x400a79,
    +
    +
    +
    + +

    + boost::stacktrace::frame + provides information about functions. You may construct that class from function + pointer and get the function name at runtime: +

    +
    #include <signal.h>     // ::signal
    +#include <boost/stacktrace/frame.hpp>
    +#include <iostream>     // std::cerr
    +
    +void print_signal_handler_and_exit() {
    +    void* p = reinterpret_cast<void*>(::signal(SIGSEGV, SIG_DFL));
    +    boost::stacktrace::frame f(p);
    +    std::cout << f << std::endl;
    +    std::exit(0);
    +}
    +
    +

    + Code from above will output: +

    +
    my_signal_handler(int) at /data/boost/libs/stacktrace/example/debug_function.cpp:21
    +
    +
    +
    + +

    + You may control maximal stacktrace length using BOOST_STACKTRACE_DEFAULT_MAX_DEPTH + and even override the behavior of default stacktrace output operator by defining + the macro from Boost.Config BOOST_USER_CONFIG + to point to a file like following: +

    +
    #ifndef USER_CONFIG_HPP
    +#define USER_CONFIG_HPP
    +
    +#define BOOST_STACKTRACE_DEFAULT_MAX_DEPTH 5
    +#include <boost/stacktrace/stacktrace_fwd.hpp>
    +
    +#include <iosfwd>
    +
    +namespace boost { namespace stacktrace {
    +
    +template <class CharT, class TraitsT, std::size_t Depth>
    +std::basic_ostream<CharT, TraitsT>& do_stream_st(std::basic_ostream<CharT, TraitsT>& os, const basic_stacktrace<Depth>& bt);
    +
    +template <class CharT, class TraitsT>
    +std::basic_ostream<CharT, TraitsT>& operator<<(std::basic_ostream<CharT, TraitsT>& os, const stacktrace& bt) {
    +    return do_stream_st(os, bt);
    +}
    +
    +}}  // namespace boost::stacktrace
    +#endif // USER_CONFIG_HPP
    +
    +

    + Implementation of do_stream_st + may be the following: +

    +
    namespace boost { namespace stacktrace {
    +
    +template <class CharT, class TraitsT, std::size_t Depth>
    +std::basic_ostream<CharT, TraitsT>& do_stream_st(std::basic_ostream<CharT, TraitsT>& os, const basic_stacktrace<Depth>& bt) {
    +    const std::streamsize w = os.width();
    +    const std::size_t frames = bt.size();
    +    for (std::size_t i = 0; i < frames; ++i) {
    +        os.width(2);
    +        os << i;
    +        os.width(w);
    +        os << "# ";
    +        os << bt[i].name();
    +        os << '\n';
    +    }
    +
    +    return os;
    +}
    +
    +}}  // namespace boost::stacktrace
    +
    +

    + Code from above will output: +

    +
    Terminate called:
    + 0# boost::stacktrace::detail::backend::backend(void**, unsigned long)
    + 1# bar(int)
    + 2# foo(int)
    + 3# bar(int)
    + 4# foo(int)
     


    -

    [1] Strictly speaking this code is not async-signal-safe, because it uses std::cerr. Section "Build, Macros and Backends" describes async-signal-safe backends, so if you will use the noop backend code becomes absolutely valid as that backens always returns 0 frames and operator<< will be never called.

    +

    [1] Strictly speaking this code is not async-signal-safe, because it uses std::cerr. Section "Build, Macros and Backends" describes async-signal-safe backends, so if you will use the noop backend code becomes absolutely valid as that backens always returns 0 frames and operator<< will be never called.

    diff --git a/boost_stacktrace_header_reference.html b/boost_stacktrace_header_reference.html index c623a3f..b80f8fe 100644 --- a/boost_stacktrace_header_reference.html +++ b/boost_stacktrace_header_reference.html @@ -6,7 +6,7 @@ - + @@ -20,7 +20,7 @@

    -PrevUpHomeNext +PrevUpHomeNext

    @@ -34,9 +34,6 @@
    -
    -
    -BOOST_STACKTRACE_DEFAULT_MAX_DEPTH
    namespace boost {
       namespace stacktrace {
         template<std::size_t Depth> class basic_stacktrace;
    @@ -45,26 +42,26 @@
     
         // Comparison operators that provide platform dependant ordering and have amortized O(1) complexity; O(size()) worst case complexity; are Async-Handler-Safe. 
         template<std::size_t Depth> 
    -      bool operator>(const basic_stacktrace< Depth > & lhs, 
    +      bool operator>(const basic_stacktrace< Depth > & lhs, 
                          const basic_stacktrace< Depth > & rhs);
         template<std::size_t Depth> 
    -      bool operator<=(const basic_stacktrace< Depth > & lhs, 
    +      bool operator<=(const basic_stacktrace< Depth > & lhs, 
                           const basic_stacktrace< Depth > & rhs);
         template<std::size_t Depth> 
    -      bool operator>=(const basic_stacktrace< Depth > & lhs, 
    +      bool operator>=(const basic_stacktrace< Depth > & lhs, 
                           const basic_stacktrace< Depth > & rhs);
         template<std::size_t Depth> 
    -      bool operator!=(const basic_stacktrace< Depth > & lhs, 
    +      bool operator!=(const basic_stacktrace< Depth > & lhs, 
                           const basic_stacktrace< Depth > & rhs);
     
         // Hashing support, O(1) complexity; Async-Handler-Safe. 
         template<std::size_t Depth> 
    -      std::size_t hash_value(const basic_stacktrace< Depth > & st);
    +      std::size_t hash_value(const basic_stacktrace< Depth > & st);
     
         // Outputs stacktrace in a human readable format to output stream; unsafe to use in async handlers. 
         template<typename CharT, typename TraitsT, std::size_t Depth> 
           std::basic_ostream< CharT, TraitsT > & 
    -      operator<<(std::basic_ostream< CharT, TraitsT > & os, 
    +      operator<<(std::basic_ostream< CharT, TraitsT > & os, 
                      const basic_stacktrace< Depth > & bt);
       }
     }
    @@ -86,27 +83,30 @@ class frame; // Comparison operators that provide platform dependant ordering and have O(1) complexity; are Async-Handler-Safe. - bool operator<(const frame & lhs, const frame & rhs); - bool operator>(const frame & lhs, const frame & rhs); - bool operator<=(const frame & lhs, const frame & rhs); - bool operator>=(const frame & lhs, const frame & rhs); + bool operator<(const frame & lhs, const frame & rhs); + bool operator>(const frame & lhs, const frame & rhs); + bool operator<=(const frame & lhs, const frame & rhs); + bool operator>=(const frame & lhs, const frame & rhs); bool operator==(const frame & lhs, const frame & rhs); - bool operator!=(const frame & lhs, const frame & rhs); + bool operator!=(const frame & lhs, const frame & rhs); // Hashing support, O(1) complexity; Async-Handler-Safe. - std::size_t hash_value(const frame & f); + std::size_t hash_value(const frame & f); // Outputs stacktrace::frame in a human readable format to output stream; unsafe to use in async handlers. template<typename CharT, typename TraitsT> std::basic_ostream< CharT, TraitsT > & - operator<<(std::basic_ostream< CharT, TraitsT > & os, const frame & f); + operator<<(std::basic_ostream< CharT, TraitsT > & os, const frame & f); } }
    -

    This header contains only forward declarations of boost::stacktrace::frame, boost::stacktrace::const_iterator, boost::stacktrace::basic_stacktrace and does not include any other headers.

    +

    This header contains only forward declarations of boost::stacktrace::frame, boost::stacktrace::const_iterator, boost::stacktrace::basic_stacktrace and does not include any other Boost headers.

    +
    +
    +BOOST_STACKTRACE_DEFAULT_MAX_DEPTH

    @@ -119,7 +119,7 @@

    -PrevUpHomeNext +PrevUpHomeNext
    diff --git a/index.html b/index.html index 1507205..f7c67d4 100644 --- a/index.html +++ b/index.html @@ -38,19 +38,24 @@
    How to print current call stack
    -
    Handle - Terminates and Segmentation Faults
    +
    Handle + terminates, aborts and Segmentation Faults
    Better asserts
    Exceptions - with Stacktrace
    + with stacktrace
    Enabling - and Disabling stacktraces
    + and disabling stacktraces
    Saving stacktraces by specified format
    +
    Getting + function information from pointer
    +
    Global + control over stacktrace output format
    Build, Macros and Backends
    +
    Acknowledgements
    Boost.Stacktrace Header Reference
    Header <boost/stacktrace/stacktrace.hpp>
    @@ -87,7 +92,7 @@
    - +

    Last revised: December 08, 2016 at 07:02:44 GMT

    Last revised: December 10, 2016 at 19:10:35 GMT


    diff --git a/standalone_HTML.manifest b/standalone_HTML.manifest index 61b7487..aa9463a 100644 --- a/standalone_HTML.manifest +++ b/standalone_HTML.manifest @@ -1,8 +1,9 @@ index.html boost_stacktrace/getting_started.html boost_stacktrace/build_macros_and_backends.html +boost_stacktrace/acknowledgements.html boost_stacktrace_header_reference.html boost/stacktrace/basic_stacktrace.html -BOOST_STACKTRACE_DEFAULT_MAX_DEPTH.html boost/stacktrace/const_iterator.html boost/stacktrace/frame.html +BOOST_STACKTRACE_DEFAULT_MAX_DEPTH.html