summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2019-06-08 04:59:41 +0000
committerEric Fiselier <eric@efcs.ca>2019-06-08 04:59:41 +0000
commit99dfd7084d628457c459c3c74159d2122f759d2c (patch)
treedea7818962ab42baac5fb356499615ca2e220cd3
parentd63dd874ecbdcbc9bdcfc4fde4e372ad2f605ba5 (diff)
downloadbcm5719-llvm-99dfd7084d628457c459c3c74159d2122f759d2c.tar.gz
bcm5719-llvm-99dfd7084d628457c459c3c74159d2122f759d2c.zip
update debugging docs to be less out of date
llvm-svn: 362866
-rw-r--r--libcxx/docs/DesignDocs/DebugMode.rst37
1 files changed, 14 insertions, 23 deletions
diff --git a/libcxx/docs/DesignDocs/DebugMode.rst b/libcxx/docs/DesignDocs/DebugMode.rst
index 1ce438d5316..e4d4e5b2d90 100644
--- a/libcxx/docs/DesignDocs/DebugMode.rst
+++ b/libcxx/docs/DesignDocs/DebugMode.rst
@@ -28,41 +28,32 @@ they can be enabled using the ``_LIBCPP_DEBUG`` macro.
which provides additional assertions about the validity of iterators used by
the program.
- Note that this option has no effect on libc++'s ABI
-
-**_LIBCPP_DEBUG_USE_EXCEPTIONS**:
- When this macro is defined ``_LIBCPP_ASSERT`` failures throw
- ``__libcpp_debug_exception`` instead of aborting. Additionally this macro
- disables exception specifications on functions containing ``_LIBCPP_ASSERT``
- checks. This allows assertion failures to correctly throw through these
- functions.
+ Note that this option has no effect on libc++'s ABI; but it does have broad
+ ODR implications. Users should compile their whole program at the same
+ debugging level.
Handling Assertion Failures
---------------------------
When a debug assertion fails the assertion handler is called via the
``std::__libcpp_debug_function`` function pointer. It is possible to override
-this function pointer using a different handler function. Libc++ provides two
-different assertion handlers, the default handler
-``std::__libcpp_abort_debug_handler`` which aborts the program, and
-``std::__libcpp_throw_debug_handler`` which throws an instance of
-``std::__libcpp_debug_exception``. Libc++ can be changed to use the throwing
-assertion handler as follows:
+this function pointer using a different handler function. Libc++ provides a
+the default handler, ``std::__libcpp_abort_debug_handler``, which aborts the
+program. The handler may not return. Libc++ can be changed to use a custom
+assertion handler as follows.
.. code-block:: cpp
#define _LIBCPP_DEBUG 1
#include <string>
+ void my_handler(std::__libcpp_debug_info const&);
int main(int, char**) {
- std::__libcpp_debug_function = std::__libcpp_throw_debug_function;
- try {
- std::string::iterator bad_it;
- std::string str("hello world");
- str.insert(bad_it, '!'); // causes debug assertion
- } catch (std::__libcpp_debug_exception const&) {
- return EXIT_SUCCESS;
- }
- return EXIT_FAILURE;
+ std::__libcpp_debug_function = &my_handler;
+
+ std::string::iterator bad_it;
+ std::string str("hello world");
+ str.insert(bad_it, '!'); // causes debug assertion
+ // control flow doesn't return
}
Debug Mode Checks
OpenPOWER on IntegriCloud