Details
-
Bug
-
Resolution: Fixed
-
P3: Somewhat important
-
Qt Creator 4.6.1
-
fca70aa95 (15.0)
Description
{{
Can't debug standard containers when using _GLIBCXX_DEBUG.
Tested with: Qt-Creator 4.6.1, gcc 8.0.1, gdb 7.7.1
Short example:
============
#include <vector>
#include <iostream>
int main(int,char**) {
std::vector<int> nums =
;
// read past the end:
for(unsigned int i=0;i<=10;++i)
std::cout << nums[i] << " ";
std::cout << std::endl;
return 0; // breakpoint here
}
============
Prints (happily reads past the end):
1 2 3 4 5 6 7 8 9 10 132033
Debugging – locals window (correct):
Name | Value | Type
========================
nums | <10 items> | std::vector<int>
... the 10 values listed correctly.
---------------------------------------------------------------------------------
With
DEFINES += _GLIBCXX_DEBUG
in .pro file (Rebuild All !!!), this will print the following errors:
====
The inferior stopped because it received a signal from the operating system.
Signal name :
SIGABRT
Signal meaning :
Aborted
/usr/include/c++/8/debug/vector:417:
Error: attempt to subscript container with out-of-bounds index 10, but
container only holds 10 elements.
Objects involved in the operation:
sequence "this" @ 0x0x7ffd63d89800
1 2 3 4 5 6 7 8 9 10
====
However, when debugging (breakpoint before the loop):
Name | Value | Type
========================
nums | <0 items> | std::vector<int>
(Internal Type: std::__debug::vector<int,std::allocator<int> >
Debugging of STL-containers now isn't possible anymore.
_GLIBCXX_DEBUG enables checks for invalid iterators, use-after-free, deadlocks (std locks only, obviously) and much more. It uses specific 'debug containers' for doing so. When debugging, it is usually preferable to turn this on.
I believe this bug had already been fixed in the past (Qt-Creator 2-somthing)...
}}
Attachments
Issue Links
- mentioned in
-
Page Loading...
For Gerrit Dashboard: QTCREATORBUG-20476 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
594808,6 | Fix STL container dumpers with _GLIBCXX_DEBUG | 15.0 | qt-creator/qt-creator | Status: MERGED | +2 | +1 |
598178,1 | Fix STL container dumpers with _GLIBCXX_DEBUG | master | qt-creator/qt-creator | Status: ABANDONED | 0 | 0 |
598179,1 | Debugger: STL container dumpers and _GLIBCXX_DEBUG | master | qt-creator/qt-creator | Status: ABANDONED | 0 | 0 |