summaryrefslogtreecommitdiffstats
path: root/libcxx/src/debug.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix debug mode build w/o exceptionsEric Fiselier2016-12-281-0/+4
| | | | llvm-svn: 290652
* Implement a throwing version of _LIBCPP_ASSERT.Eric Fiselier2016-12-281-1/+60
| | | | | | | | | | | | | | | | | | | | | | | | | 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 an _LIBCPP_NORETURN inline function named __throw_XXX for each exception ↵Marshall Clow2016-08-251-25/+10
| | | | | | type we define. They either construct and throw the exception, or abort() (if exceptions are disabled). Use these functions everywhere instead of assert()ing when exceptions are disabled. WARNING: This is a behavior change - but only with exceptions disabled. Reviewed as: https://reviews.llvm.org/D23855. llvm-svn: 279744
* Fix use after free and calls to operator comma in debug modeEric Fiselier2015-03-191-1/+1
| | | | llvm-svn: 232703
* Allow libc++ to be built on systems without POSIX threadsJonathan Roelofs2014-09-051-0/+40
| | | | | | | | | | If you're crazy enough to want this sort of thing, then add -D_LIBCPP_HAS_NO_THREADS to your CXXFLAGS and --param=additiona_features=libcpp-has-no-threads to your lit commnad line. http://reviews.llvm.org/D3969 llvm-svn: 217271
* Rename _LIBCPP_DEBUG2 to _LIBCPP_DEBUG.Howard Hinnant2013-08-231-1/+1
| | | | llvm-svn: 189140
* Debug mode for string. This commit also marks the first time libc++ ↵Howard Hinnant2013-08-231-41/+65
| | | | | | debug-mode has found a bug (found one in regex). Had to play with extern templates a bit to get this to work since string is heavily used within libc++.dylib. llvm-svn: 189114
* Ok, 3 major changes for debug mode in one commit:Howard Hinnant2013-08-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Use static_cast.Joerg Sonnenberger2013-04-271-5/+8
| | | | llvm-svn: 180680
* Fix bug in __libcpp_db::__iterator_copy. Add debug test for swaping lists.Howard Hinnant2013-04-051-3/+2
| | | | llvm-svn: 178892
* No functionality change at this time. I've split _LIBCPP_VISIBLE up into ↵Howard Hinnant2013-03-061-2/+2
| | | | | | two flags: _LIBCPP_TYPE_VIS and _LIBCPP_FUNC_VIS. This is in preparation for taking advantage of clang's new __type_visibility__ attribute. llvm-svn: 176593
* Saleem Abdulrasool: This just rounds up a few compile warnings emitted by ↵Howard Hinnant2012-12-271-1/+1
| | | | | | GCC (4.7.2). llvm-svn: 171165
* Wrap throw in _LIBCPP_NO_EXCEPTIONS in debug.cpp. Calls abort if can't ↵Howard Hinnant2012-08-241-0/+20
| | | | | | throw an exception. Fixes http://llvm.org/bugs/show_bug.cgi?id=13082. llvm-svn: 162613
* Quash a whole bunch of warningsHoward Hinnant2011-12-011-17/+17
| | | | llvm-svn: 145624
* Another installment on debug mode. This addresses list. However this ↵Howard Hinnant2011-09-271-31/+42
| | | | | | should be considered a temporary state. The API of the debug database and how vector and list use it, is unsatisfactory at the moment. It is both inefficient and overly verbose. I wanted to get this functionality checked in though. In the next day or so I'll refactor what is there in an attempt to streamline things. llvm-svn: 140660
* Doug Gregor pointed out some problems with debug mode enabled in one TU and ↵Howard Hinnant2011-09-161-4/+19
| | | | | | not another. This patch helps detect those situations and offers improved error messages to help get debug mode enabled in more TU's when it is absolutely necessary to do so. Thanks Doug. llvm-svn: 139933
* Create multilevel debug modeHoward Hinnant2011-09-161-6/+2
| | | | llvm-svn: 139913
* Initial checkin for debug mode (version 2)Howard Hinnant2011-09-141-0/+462
llvm-svn: 139711
OpenPOWER on IntegriCloud