Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
Qt Creator 4.9.0-beta2
-
None
-
41da97fb2cfb88baa7872d370e1e9665c85432d2
Description
If you define a string with a custom allocator, the dumper shows garbage instead of the string.
On some occasions (could not figure out an exact example), the basic_string member is expandable, and if you expand it, the debugger hangs forever (must be aborted twice).
#include <string> namespace ns { template<class T> struct alloc { public: typedef size_t size_type; typedef T* pointer; typedef const T* const_pointer; typedef T value_type; typedef T& reference; typedef const T& const_reference; typedef ptrdiff_t difference_type; inline bool operator==(const alloc<T>&) const { return true; } inline bool operator!=(const alloc<T>&) const { return false; } pointer allocate(size_t n) { return (pointer)allocator.allocate(n*sizeof(T)); } void deallocate(pointer p, size_t n) { allocator.deallocate(p, n); } std::allocator<T> allocator; }; using allocat = alloc<char>; class string : public std::basic_string<char, std::char_traits<char>, allocat> { using base = std::basic_string<char, std::char_traits<char>, allocat>; using base::basic_string; }; } int main() { std::string str1("test"); ns::string str2("test"); return 0; // Break here }
Attachments
For Gerrit Dashboard: QTCREATORBUG-22040 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
254315,5 | Debugger: Do not make std::string layout assumptions | 4.9 | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
262105,4 | Debugger: Do not make std::vector layout assumptions | master | qt-creator/qt-creator | Status: MERGED | +2 | 0 |