summaryrefslogtreecommitdiffstats
path: root/libcxx/www/debug_mode.html
Commit message (Collapse)AuthorAgeFilesLines
* Implement a throwing version of _LIBCPP_ASSERT.Eric Fiselier2016-12-281-162/+0
| | | | | | | | | | | | | | | | | | | | | | | | | This patch implements changes to allow _LIBCPP_ASSERT to throw on failure instead of aborting. The main changes needed to do this are: 1. Change _LIBCPP_ASSERT to call a handler via a replacable function pointer instead of calling abort directly. Additionally this patch implements two handler functions, one which aborts and another that throws an exception. 2. Add _NOEXCEPT_DEBUG macro for disabling noexcept spec on function which contain _LIBCPP_ASSERT. This is required in order to prevent assertion failures throwing through a noexcept function. This macro has no effect unless _LIBCPP_DEBUG_USE_EXCEPTIONS is defined. Having a non-aborting _LIBCPP_ASSERT is very important to allow sane testing of debug mode. Currently we can only have one test case per file, since the test case will cause the program to abort. Testing debug mode this way would require thousands of test files, most of which would be 95% boiler plate. I don't think this is a feasible strategy. Fortunately using a throwing debug handler solves these issues. Additionally this patch rewrites the documentation for debug mode. llvm-svn: 290651
* Add a note about debug mode being non-functionalMarshall Clow2014-06-041-0/+6
| | | | llvm-svn: 210162
* Rename _LIBCPP_DEBUG2 to _LIBCPP_DEBUG.Howard Hinnant2013-08-231-1/+1
| | | | llvm-svn: 189140
* debug mode for unordered_map. Also picked up a missing check and test in ↵Howard Hinnant2013-08-021-1/+1
| | | | | | unordered_multimap. This wraps up debug mode for the unordered containers. llvm-svn: 187659
* Ok, 3 major changes for debug mode in one commit:Howard Hinnant2013-08-021-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. I had been detecting and trapping iterator == and \!= among iterators in different containers as an error. But the trapping itself is actually an error. Consider: #include <iostream> #include <vector> #include <algorithm> template <class C> void display(const C& c) { std::cout << "{"; bool first = true; for (const auto& x : c) { if (\!first) std::cout << ", "; first = false; std::cout << x; } std::cout << "}\n"; } int main() { typedef std::vector<int> V; V v1 = {1, 3, 5}; V v2 = {2, 4, 6}; display(v1); display(v2); V::iterator i = std::find(v1.begin(), v1.end(), 1); V::iterator j = std::find(v2.begin(), v2.end(), 2); if (*i == *j) i = j; // perfectly legal // ... if (i \!= j) // the only way to check v2.push_back(*i); display(v1); display(v2); } It is legal to assign an iterator from one container to another of the same type. This is required to work. One might want to test whether or not such an assignment had been made. The way one performs such a check is using the iterator's ==, \!= operator. This is a logical and necessary function and does not constitute an error. 2. I had a header circular dependence bug when _LIBCPP_DEBUG2 is defined. This caused a problem in several of the libc++ tests. Fixed. 3. There is a serious problem when _LIBCPP_DEBUG2=1 at the moment in that std::basic_string is inoperable. std::basic_string uses __wrap_iterator to implement its iterators. __wrap_iterator has been rigged up in debug mode to support vector. But string hasn't been rigged up yet. This means that one gets false positives when using std::string in debug mode. I've upped std::string's priority in www/debug_mode.html. llvm-svn: 187636
* Debug mode for unordered_multiset. The exercise spotted a few places I had ↵Howard Hinnant2013-07-291-1/+1
| | | | | | | | | | | | | | missed on unordered_set, so I picked those up as well. There are actually two debug modes: 1. -D_LIBCPP_DEBUG2 or -D_LIBCPP_DEBUG2=1 This is a relatively expensive debug mode, but very thorough. This is normally what you want to debug with, but may turn O(1) operations into O(N) operations. 2. -D_LIBCPP_DEBUG2=0 This is "debug lite." Only preconditions that can be checked with O(1) expense are checked. For example range checking on an indexing operation. But not iterator validity. llvm-svn: 187369
* I believe this finishes up debug mode for list. The testing is a little ↵Howard Hinnant2013-04-161-1/+1
| | | | | | weak, but I believe all of the functionality is there. Certainly enough for people to checkout and start beating up on. llvm-svn: 179632
* I believe debug mode for vector<T> (T != bool) is complete. If anyone sees ↵Howard Hinnant2013-03-281-1/+1
| | | | | | anything more they would like to see on it, please let me know. Debug mode is activated by compiling with -D_LIBCPP_DEBUG2=1. Eventually _LIBCPP_DEBUG2 will be renamed to just _LIBCPP_DEBUG. llvm-svn: 178288
* Some forward-looking and optimistic documentation.Howard Hinnant2013-03-141-0/+156
llvm-svn: 177093
OpenPOWER on IntegriCloud