Fix std::vector<bool> printer with custom allocator

This fixes the std::vector<bool> pretty printer, which
previously just showed "<not accessible>" for variable
'v' for the following sample code (with system GDB
pretty printer disabled so that the custom
pretty printers are used):

    #include <vector>

    template<class T>
    class myallocator : public std::allocator<T> {
    };

    int main()
    {
        std::vector<bool, myallocator<bool>> v;
        v.push_back(true);
        return 0; // break here and check value of 'v'
    }

Change-Id: Ia9883aa0b06a396cb3546ac2594a82c1b2062b80
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Michael Weghorn
2019-06-21 09:44:53 +02:00
parent 0313cdbd87
commit 01f26bd5b7

View File

@@ -973,9 +973,9 @@ def qdumpHelper__std__vector(d, value, isLibCpp):
(start, soffset, pad, finish, foffset, pad, alloc) = value.split("pI@pI@p")
else:
start = value["_M_start"]["_M_p"].pointer()
soffset = value["_M_start"]["_M_offset"]
soffset = value["_M_start"]["_M_offset"].integer()
finish = value["_M_finish"]["_M_p"].pointer()
foffset = value["_M_finish"]["_M_offset"]
foffset = value["_M_finish"]["_M_offset"].integer()
alloc = value["_M_end_of_storage"].pointer()
size = (finish - start) * 8 + foffset - soffset # 8 is CHAR_BIT.
else: