Fix std::basic_string printer with custom allocator

This fixes expansion of 'std::basic_string' in the locals
view when a custom allocator is used (which previously
would result in "<not accessible>" being shown);
for example, when expanding 's' at the breakpoint
in the following example:

    #include <string>

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

    int main()
    {
        std::basic_string<char, std::char_traits<char>, myallocator<char>> s("hello");
        return 0; // break here and expand value of 's' in locals view
    }

Change-Id: I0ca98de50d83a1f6e6f019acc37a1302a05fdba8
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Michael Weghorn
2019-06-21 09:57:29 +02:00
parent 01f26bd5b7
commit 5eba3bde93

View File

@@ -1095,7 +1095,7 @@ def qdump__std____cxx11__basic_string(d, value):
(data, size) = value.split("pI")
else:
try:
data = value["_M_dataplus"]["_M_p"]
data = value["_M_dataplus"]["_M_p"].pointer()
size = int(value["_M_string_length"])
except:
d.putEmptyValue()