From kde-finance-apps Wed Jun 02 13:15:35 2021 From: Ralf Habacker Date: Wed, 02 Jun 2021 13:15:35 +0000 To: kde-finance-apps Subject: Re: GSOC - Provide Qt pretty printer for command line gdb Message-Id: <365f18cb-21ed-f6fb-ca7c-b04a66e30851 () freenet ! de> X-MARC-Message: https://marc.info/?l=kde-finance-apps&m=162263973121485 Am 31.05.21 um 16:22 schrieb Ralf Habacker: Hi Ebuka, > As we stated together, the first goal is to provide QtCore - pretty > printers for gdb on the command line to debug the console program > klauncher5 I presented yesterday on Windows with Qt5 information. I want to give you a real world example about what I'm taking about: I downloaded a portable kmymoney package from https://kmymoney.org/snapshots.php and unpacked it. Then I got gdb for Windows and downloaded it. I entered the kmymoney bin dir e.g. cd \bin and did run \bin\gdb klauncher5.exe r In the explorer then I started kmymoney.exe, opened a kmymoney file (if not present a new file needs to be created and saved). Then I closed kmymoney. After a few minutes gdb received a Segmentation fault as reported at https://bugs.kde.org/show_bug.cgi?id=426387. Then I showed the backtrace (gdb)bt Thread 1 received signal SIGSEGV, Segmentation fault. QWeakPointer::data (this=0x28b8620, this=0x28b8620) at /usr/i686-w64-mingw32/sys-root/mingw/include/qt5/QtCore/qsharedpointer_impl.h:569 569 in /usr/i686-w64-mingw32/sys-root/mingw/include/qt5/QtCore/qsharedpointer_impl.h (gdb) bt #0 QWeakPointer::data (this=0x28b8620, this=0x28b8620) at /usr/i686-w64-mingw32/sys-root/mingw/include/qt5/QtCore/qsharedpointer_impl.h:569 #1 QPointer::data (this=0x28b8620) at /usr/i686-w64-mingw32/sys-root/mingw/include/qt5/QtCore/qpointer.h:86 #2 QPointer::operator KIO::IdleSlave* (this=0x28b8620) at /usr/i686-w64-mingw32/sys-root/mingw/include/qt5/QtCore/qpointer.h:92 #3 KLauncher::idleTimeout (this=this@entry=0x28b71d8) at /home/abuild/rpmbuild/BUILD/kinit-5.65.0/src/klauncher/klauncher.cpp:1142 #4 0x0040a37a in KLauncher::qt_static_metacall (_o=_o@entry=0x28b71d8, _id=_id@entry=7, _a=_a@entry=0x61db28, _c=QMetaObject::InvokeMetaMethod) ... Inspecting the current object: (gdb) p this $1 = (const QWeakPointer * const) 0x28b8620 (gdb) p *this $2 = {d = 0xfeeefeee, value = 0xfeeefeee} shows that the private object, the QWeakpointer instance contains, has been free'd for unknown reasons. Access to the private object raised the crash. More information were available from showing frame 3 (gdb) frame 3 #3 KLauncher::idleTimeout (this=this@entry=0x28b71d8) at /home/abuild/rpmbuild/BUILD/kinit-5.65.0/src/klauncher/klauncher.cpp:1142 1142 for (IdleSlave *slave : qAsConst(mSlaveList)) { Now I wanted to inspect mSlaveList (gdb) p mSlaveList $4 = {{wp = {d = 0x28e4b40, value = 0x28c82f8}}, {wp = {d = 0x28e66f8, value = 0x28dc628}}} (gdb) p *mSlaveList->d $5 = {ref = {atomic = {_q_value = {> = {static _S_alignment = 4, _M_i = 1}, }}}, alloc = 12, begin = 0, end = 2, array = {0x28e9a50}} but I did not see anything useful because of the missing qt5 printers. Regards Ralf