aboutsummaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2019-06-21 09:18:14 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2019-06-26 07:16:42 +0000
commit0313cdbd87a6726194ec25ddff707a6b74389c88 (patch)
treedc860b0e44d1105161db9fdd99438f0487444286 /share
parent38685de8942d35e7fe24cc3b32dfab85392eeac0 (diff)
gdbbridge: Convert children to gdb.Value
'Dumper::fromNativeValue' expects an object of type 'gdb.Value'. However, the 'pretty_printer.children()' iterator may return values that first need to be converted to this, as documented for function 'pretty_printer.children' at [1]: > This method must return an object conforming to the Python iterator > protocol. Each item returned by the iterator must be a tuple holding two > elements. The first element is the “name” of the child; the second > element is the child’s value. The value can be any Python object which > is convertible to a GDB value. Therefore, explicitly convert the value to a GDB value first. This fixes the expansion of 'std::vector<bool>' when system GDB pretty printers are enabled which previously led to "<not accessible>" being shown e.g. for the following example (expand 'v' in the local variable view at the breakpoint): #include <vector> int main() { std::vector<bool> v; v.push_back(true); return 0; // insert breakpoint here } Side note: GCC's pretty printer for 'std::vector<bool>' previously returned either '0' or '1' for the element values, thus leading to the problem described above. With this patch in place, the elements are shown when the vector is expanded, but the shown type is 'long long' (since that's the type that GDB seems to automatically assign when constructing a 'gdb.Value' from these integers, at least with GDB 8.2.1 on amd64). This will work as expected ('bool' shown as type) from GCC commit [2] on ("Have std::vector printer's iterator return bool for vector<bool>"). [1] https://sourceware.org/gdb/onlinedocs/gdb/Pretty-Printing-API.html [2] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=6c7d761a3f5fd7d19795d1d4b9b027a04b3fe88b Change-Id: I9047affa5b4369befd2e2386c8a6b04c66c4b632 Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'share')
-rw-r--r--share/qtcreator/debugger/gdbbridge.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/share/qtcreator/debugger/gdbbridge.py b/share/qtcreator/debugger/gdbbridge.py
index fdfb39746e..2f056c7a93 100644
--- a/share/qtcreator/debugger/gdbbridge.py
+++ b/share/qtcreator/debugger/gdbbridge.py
@@ -153,7 +153,7 @@ class PlainDumper:
if d.isExpanded():
with Children(d):
for child in children:
- d.putSubItem(child[0], d.fromNativeValue(child[1]))
+ d.putSubItem(child[0], d.fromNativeValue(gdb.Value(child[1])))
def importPlainDumpers(args):
if args == 'off':