Bug 331044 - Make our pretty-printers fully compatible with Qt5
Summary: Make our pretty-printers fully compatible with Qt5
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: CPP Debugger (show other bugs)
Version: 4.6.60
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2014-02-12 12:09 UTC by Kevin Funk
Modified: 2016-03-07 20:40 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Funk 2014-02-12 12:09:17 UTC
This is a nicely self-contained task for newcomers. It requires some knowledge about GDB's pretty-printing infrastructure, which is relatively easy to learn, though.

There are tests in KDevelop.git/debuggers/gdb/printers/ which should be compiled against Qt5 and then invoked via the 'qtprinters' test.

I don't know the exact state of the pretty-printers' support regarding Qt5, but the printer for QMap for example is definitely not working (QMap got rewritten during the Qt4->Qt5 transition).

Reproducible: Always
Comment 1 Kevin Funk 2014-02-14 08:44:18 UTC
Git commit 05cf7a8d5eb7b8baea7646910eea17059e5a75e4 by Kevin Funk.
Committed on 12/02/2014 at 14:10.
Pushed by kfunk into branch 'master'.

Pretty-printers: Quickfix for QMap from Qt5

Unfortunately if one of the printers for a member fails, the complete
class cannot be displayed in the debugger. So let's just fall back to
the default printer in case we do not support the type (here: QMap from
Qt5)

M  +12   -0    debuggers/gdb/printers/helper.py
M  +6    -1    debuggers/gdb/printers/qt4.py

http://commits.kde.org/kdevelop/05cf7a8d5eb7b8baea7646910eea17059e5a75e4
Comment 2 Kevin Funk 2014-02-14 09:34:43 UTC
Current status:
********* Start testing of GDBDebugger::QtPrintersTest *********
Config: Using QtTest library 5.2.0, Qt 5.2.0
PASS   : GDBDebugger::QtPrintersTest::initTestCase()
PASS   : GDBDebugger::QtPrintersTest::testQString()
QDEBUG : GDBDebugger::QtPrintersTest::testQByteArray() "Python Exception <class 'gdb.error'> cannot resolve overloaded method `data': no arguments supplied: 
$1 = " 
FAIL!  : GDBDebugger::QtPrintersTest::testQByteArray() Unexpected Python Exception
   Loc: [/home/krf/devel/src/kf5/kdevelop/debuggers/gdb/printers/tests/qtprinters.cpp(87)]
FAIL!  : GDBDebugger::QtPrintersTest::testQByteArray() 'out.contains("\"test byte array\"")' returned FALSE. ()
   Loc: [/home/krf/devel/src/kf5/kdevelop/debuggers/gdb/printers/tests/qtprinters.cpp(115)]
FAIL!  : GDBDebugger::QtPrintersTest::testQListContainer(QList) 'out.contains("[0] = {\n    first = 1, \n    second = 2\n  }")' returned FALSE. ()
   Loc: [/home/krf/devel/src/kf5/kdevelop/debuggers/gdb/printers/tests/qtprinters.cpp(241)]
FAIL!  : GDBDebugger::QtPrintersTest::testQListContainer(QQueue) 'out.contains("[0] = {\n    first = 1, \n    second = 2\n  }")' returned FALSE. ()
   Loc: [/home/krf/devel/src/kf5/kdevelop/debuggers/gdb/printers/tests/qtprinters.cpp(241)]
QDEBUG : GDBDebugger::QtPrintersTest::testQListContainer(QVector) "Python Exception <class 'gdb.error'> There is no member or method named p.: 
$1 = empty QVector<int>" 
FAIL!  : GDBDebugger::QtPrintersTest::testQListContainer(QVector) Unexpected Python Exception
   Loc: [/home/krf/devel/src/kf5/kdevelop/debuggers/gdb/printers/tests/qtprinters.cpp(87)]
QDEBUG : GDBDebugger::QtPrintersTest::testQListContainer(QVector) "Python Exception <class 'gdb.error'> There is no member or method named p.: 
$2 = QVector<int>" 
FAIL!  : GDBDebugger::QtPrintersTest::testQListContainer(QVector) Unexpected Python Exception
   Loc: [/home/krf/devel/src/kf5/kdevelop/debuggers/gdb/printers/tests/qtprinters.cpp(87)]
FAIL!  : GDBDebugger::QtPrintersTest::testQListContainer(QVector) 'out.contains("[0] = 10")' returned FALSE. ()
   Loc: [/home/krf/devel/src/kf5/kdevelop/debuggers/gdb/printers/tests/qtprinters.cpp(150)]
QDEBUG : GDBDebugger::QtPrintersTest::testQListContainer(QStack) "Python Exception <class 'gdb.error'> There is no member or method named p.: 
$1 = empty QStack<int>" 
FAIL!  : GDBDebugger::QtPrintersTest::testQListContainer(QStack) Unexpected Python Exception
   Loc: [/home/krf/devel/src/kf5/kdevelop/debuggers/gdb/printers/tests/qtprinters.cpp(87)]
QDEBUG : GDBDebugger::QtPrintersTest::testQListContainer(QStack) "Python Exception <class 'gdb.error'> There is no member or method named p.: 
$2 = QStack<int>" 
FAIL!  : GDBDebugger::QtPrintersTest::testQListContainer(QStack) Unexpected Python Exception
   Loc: [/home/krf/devel/src/kf5/kdevelop/debuggers/gdb/printers/tests/qtprinters.cpp(87)]
FAIL!  : GDBDebugger::QtPrintersTest::testQListContainer(QStack) 'out.contains("[0] = 10")' returned FALSE. ()
   Loc: [/home/krf/devel/src/kf5/kdevelop/debuggers/gdb/printers/tests/qtprinters.cpp(150)]
PASS   : GDBDebugger::QtPrintersTest::testQListContainer(QLinkedList)
PASS   : GDBDebugger::QtPrintersTest::testQListContainer(QSet)
FAIL!  : GDBDebugger::QtPrintersTest::testQMapInt() 'out.contains("[10] = 100")' returned FALSE. ()
   Loc: [/home/krf/devel/src/kf5/kdevelop/debuggers/gdb/printers/tests/qtprinters.cpp(259)]
FAIL!  : GDBDebugger::QtPrintersTest::testQMapString() 'out.contains("[\"10\"] = \"100\"")' returned FALSE. ()
   Loc: [/home/krf/devel/src/kf5/kdevelop/debuggers/gdb/printers/tests/qtprinters.cpp(273)]
FAIL!  : GDBDebugger::QtPrintersTest::testQMapStringBool() 'out.contains("[\"10\"] = true")' returned FALSE. ()
   Loc: [/home/krf/devel/src/kf5/kdevelop/debuggers/gdb/printers/tests/qtprinters.cpp(287)]
PASS   : GDBDebugger::QtPrintersTest::testQDate()
PASS   : GDBDebugger::QtPrintersTest::testQTime()
FAIL!  : GDBDebugger::QtPrintersTest::testQDateTime() 'out.contains("2010-01-20 15:31:13")' returned FALSE. ()
   Loc: [/home/krf/devel/src/kf5/kdevelop/debuggers/gdb/printers/tests/qtprinters.cpp(319)]
QDEBUG : GDBDebugger::QtPrintersTest::testQUrl() "Python Exception <class 'gdb.error'> cannot resolve overloaded method `data': no arguments supplied: 
$1 = " 
FAIL!  : GDBDebugger::QtPrintersTest::testQUrl() Unexpected Python Exception
   Loc: [/home/krf/devel/src/kf5/kdevelop/debuggers/gdb/printers/tests/qtprinters.cpp(87)]
FAIL!  : GDBDebugger::QtPrintersTest::testQUrl() 'out.contains("http://www.kdevelop.org/foo")' returned FALSE. ()
   Loc: [/home/krf/devel/src/kf5/kdevelop/debuggers/gdb/printers/tests/qtprinters.cpp(328)]
PASS   : GDBDebugger::QtPrintersTest::testQHashInt()
FAIL!  : GDBDebugger::QtPrintersTest::testQHashString() 'out.contains("[\"20\"] = \"200\"")' returned FALSE. ()
   Loc: [/home/krf/devel/src/kf5/kdevelop/debuggers/gdb/printers/tests/qtprinters.cpp(351)]
PASS   : GDBDebugger::QtPrintersTest::testQSetInt()
FAIL!  : GDBDebugger::QtPrintersTest::testQSetString() 'out.contains("] = \"20\"")' returned FALSE. ()
   Loc: [/home/krf/devel/src/kf5/kdevelop/debuggers/gdb/printers/tests/qtprinters.cpp(377)]
PASS   : GDBDebugger::QtPrintersTest::testQChar()
PASS   : GDBDebugger::QtPrintersTest::testQListPOD()
PASS   : GDBDebugger::QtPrintersTest::testQUuid()
PASS   : GDBDebugger::QtPrintersTest::testKTextEditorTypes()
FAIL!  : GDBDebugger::QtPrintersTest::testKDevelopTypes() 'gdb.execute("print path1").contains("(\"tmp\", \"foo\")")' returned FALSE. ()
   Loc: [/home/krf/devel/src/kf5/kdevelop/debuggers/gdb/printers/tests/qtprinters.cpp(438)]
PASS   : GDBDebugger::QtPrintersTest::cleanupTestCase()
Totals: 13 passed, 19 failed, 0 skipped
********* Finished testing of GDBDebugger::QtPrintersTest *********
Comment 3 Prabhakar Misra 2014-06-25 14:29:51 UTC
I am new here but would like to take this on. Could you please let me know where to begin.
Comment 4 Kevin Funk 2014-06-25 16:24:13 UTC
There's some ongoing discussion on https://codereview.qt-project.org/#/c/87052/. Using the files provided by this patch would actually fix this.

I suggest having a look at another junior job in KDevelop land: https://bugs.kde.org/buglist.cgi?cmdtype=runnamed&namedcmd=KDevelop%20junior%20jobs

Feel free to join #kdevelop at Freenode, so we can discuss.
Comment 5 Peter Wu 2015-08-01 22:10:06 UTC
Alex Merry postponed work on the Qt 5 pretty printers. Those printers are also partially (?) incompatible with Qt 4.

For convenience I have quickly put the three needed files in a single repo at https://github.com/Lekensteyn/qt5printers (I have no intention to work further on these printers for now).

Don't forget to update the wiki at https://techbase.kde.org/Development/Tutorials/Debugging/Debugging_with_GDB!
Comment 6 Rishabh gupta 2015-09-24 10:17:57 UTC
What stills need to be done in this? and what already has been done?I would like to take this up if there is any work that needs to be done here
Comment 7 Milian Wolff 2016-03-07 20:40:56 UTC
Git commit 60230b74acfcaa0428d3405352c4b069e94a9609 by Milian Wolff.
Committed on 07/03/2016 at 20:40.
Pushed by mwolff into branch '5.0'.

Port pretty printers to Qt 5 and reenable unit test.

This probably won't work perfectly on stripped builds where
we don't have any debug symbols, but at least we can now print
stuff in debug builds.

M  +1    -1    debuggers/gdb/printers/CMakeLists.txt
M  +4    -4    debuggers/gdb/printers/gdbinit
R  +3    -3    debuggers/gdb/printers/kde.py [from: debuggers/gdb/printers/kde4.py - 094% similarity]
R  +101  -31   debuggers/gdb/printers/qt.py [from: debuggers/gdb/printers/qt4.py - 081% similarity]
M  +5    -6    debuggers/gdb/printers/tests/CMakeLists.txt
M  +23   -12   debuggers/gdb/printers/tests/qtprinters.cpp

http://commits.kde.org/kdevelop/60230b74acfcaa0428d3405352c4b069e94a9609