From e2e96cab52948b4404cac343bb3ad7c36ca9fafd Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Sun, 13 Oct 2019 01:53:57 +0200 Subject: GDB: Handle 'pretty_printer.to_string()' returning None The documentation for the GDB pretty printer function 'pretty_printer.to_string' says [1]: > [...] > Finally, if this method returns None then no further > operations are peformed in this method and nothing is printed. > [...] Therefore, skip this part if the printer's 'to_string' method returns 'None' and only fall back to assuming LazyString otherwise. This e.g. fixes the std::pair pretty printer (for gcc-9 libstdc++6) for which "" was shown previously in the debugger's locals/expression view. Now it shows the object's address and allows expansion to see the values for the 'first' and 'second' members. [1] https://sourceware.org/gdb/onlinedocs/gdb/Pretty-Printing-API.html Change-Id: I33b1af82f731c347314af76c533b096b8a5afe21 Reviewed-by: Christian Stenger Reviewed-by: hjk --- share/qtcreator/debugger/gdbbridge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/qtcreator/debugger/gdbbridge.py b/share/qtcreator/debugger/gdbbridge.py index 2f056c7a93..858b56c5c1 100644 --- a/share/qtcreator/debugger/gdbbridge.py +++ b/share/qtcreator/debugger/gdbbridge.py @@ -145,7 +145,7 @@ class PlainDumper: d.putValue(d.hexencode(val), 'utf8:1:0') elif sys.version_info[0] <= 2 and isinstance(val, unicode): d.putValue(val) - else: # Assuming LazyString + elif val is not None: # Assuming LazyString d.putCharArrayValue(val.address, val.length, val.type.target().sizeof) -- cgit v1.2.1