diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2018-08-14 14:02:00 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2018-08-15 19:23:52 +0000 |
commit | ec5e70eedadc659aeea7458e1989fded8f9bd03e (patch) | |
tree | a82da63a5bb7477a0659daebdaf5eb4c06439415 /share/qtcreator/debugger/dumper.py | |
parent | db9837fa6c9401e898ac8e7492081a6e21c71790 (diff) | |
download | qt-creator-ec5e70eedadc659aeea7458e1989fded8f9bd03e.tar.gz |
Make pretty-printing GDB's LazyString work
Qt Creator failed to properly display GDB's LazyString.
The problem was that GDB's 'PlainDumper::__call__' passed a 'gdb.Type',
while 'DumperBase::putCharArrayHelper' called methods that are only
defined for the custom and more abstract 'Type' type defined in 'dumper.py'.
As described at [1], GDB's 'LazyString.type' "holds the type that is
represented by the lazy string’s type. For a lazy string this is a pointer
or array type. To resolve this to the lazy string’s character type,
use the type’s target method."
In addition, 'gdb.Type' does not have a 'size()' method, just a 'sizeof'
member, s. [2].
Since all other uses of 'DumperBase::putCharArrayHelper' are passed
a "proper" type, extract the code common to the GDB case and all others
into a separate method and directly call this one for the GDB LazyString
case.
[1] https://sourceware.org/gdb/onlinedocs/gdb/Lazy-Strings-In-Python.html#Lazy-Strings-In-Python
[2] https://sourceware.org/gdb/onlinedocs/gdb/Types-In-Python.html#Types-In-Python
Task-number: QTCREATORBUG-20939
Change-Id: I16608668c9403b6d8e509dab17eb1788586f453e
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'share/qtcreator/debugger/dumper.py')
-rw-r--r-- | share/qtcreator/debugger/dumper.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/share/qtcreator/debugger/dumper.py b/share/qtcreator/debugger/dumper.py index 4805545d24..7e46132096 100644 --- a/share/qtcreator/debugger/dumper.py +++ b/share/qtcreator/debugger/dumper.py @@ -703,10 +703,8 @@ class DumperBase: elided, shown = self.computeLimit(size, limit) return elided, self.readMemory(data, shown) - def putCharArrayHelper(self, data, size, charType, - displayFormat = AutomaticFormat, - makeExpandable = True): - charSize = charType.size() + def putCharArrayValue(self, data, size, charSize, + displayFormat = AutomaticFormat): bytelen = size * charSize elided, shown = self.computeLimit(bytelen, self.displayStringLimit) mem = self.readMemory(data, shown) @@ -729,6 +727,12 @@ class DumperBase: elided, shown = self.computeLimit(bytelen, 100000) self.putDisplay(encodingType + ':separate', self.readMemory(data, shown)) + def putCharArrayHelper(self, data, size, charType, + displayFormat = AutomaticFormat, + makeExpandable = True): + charSize = charType.size() + self.putCharArrayValue(data, size, charSize, displayFormat = displayFormat) + if makeExpandable: self.putNumChild(size) if self.isExpanded(): |