SUMMARY The class MyMoneyMoney is an elementary class and is used very often in the source code. Since the contained value is hidden inside, it cannot be displayed directly in debuggers such as gdb, kdevelop or QtCreator, which makes debugging more difficult. Outputs must therefore be generated manually by adding debug outputs, e.g. with `qDebug() << instance.toDouble()` or in the gdb window with `p instance.toDouble()`. It would speed up debugging if there is corresponding support for debuggers. STEPS TO REPRODUCE 1. build kmymoney from source (git master branch) with debug information included 2. run ``` gdb <builddir>/bin/kmymoney (gdb) b main (gdb) r (gdb) b MyMoneyMoney::One ``` 3. inspect debugger output OBSERVED RESULT The debugger displays a lot of data, but not the relevant value: ``` (gdb) p MyMoneyMoney::ONE $1 = {<AlkValue> = {d = {d = 0x87f300}}, _vptr.MyMoneyMoney = 0x7ffff78b18c0 <vtable for MyMoneyMoney+16>, static maxValue = {<AlkValue> = {d = {d = 0x8807e0}}, _vptr.MyMoneyMoney = 0x7ffff78b18c0 <vtable for MyMoneyMoney+16>, static maxValue = <same as static member of an already seen type>, static minValue = {<AlkValue> = {d = {d = 0x880810}}, _vptr.MyMoneyMoney = 0x7ffff78b18c0 <vtable for MyMoneyMoney+16>, static maxValue = <same as static member of an already seen type>, static minValue = <same as static member of an already seen type>, static autoCalc = {<AlkValue> = {d = {d = 0x8807b0}}, _vptr.MyMoneyMoney = 0x7ffff78b18c0 <vtable for MyMoneyMoney+16>, static maxValue = <same as static member of an already seen type>, static minValue = <same as static member of an already seen type>, static autoCalc = <same as static member of an already seen type>, static ONE = {<AlkValue> = {d = {d = 0x87f300}}, _vptr.MyMoneyMoney = 0x7ffff78b18c0 <vtable for MyMoneyMoney+16>, static maxValue = <same as static member of an already seen type>, static minValue = <same as static member of an already seen type>, static autoCalc = <same as static member of an already seen type>, static ONE = <same as static member of an already seen type>, static MINUS_ONE = {<AlkValue> = {d = {d = 0x87f3f0}}, _vptr.MyMoneyMoney = 0x7ffff78b18c0 <vtable for MyMoneyMoney+16>, static maxValue = <same as static member of an already seen type>, static minValue = <same as static member of an already seen type>, static autoCalc = <same as static member of an already seen type>, static ONE = <same as static member of an already seen type>, static MINUS_ONE = <same as static member of an already seen type>}}, static MINUS_ONE = <same as static member of an already seen type>}, static ONE = <same as static member of an already seen type>, static MINUS_ONE = <same as static member of an already seen type>}, static autoCalc = <same as static member of an already seen type>, static ONE = <same as static member of an already seen type>, static MINUS_ONE = <same as static member of an already seen type>}, static minValue = <same as static member of an already seen type>, static autoCalc = <same as static member of an already seen type>, static ONE = <same as static member of an already seen type>, static MINUS_ONE = <same as static member of an already seen type>} ``` EXPECTED RESULT Instead, the debugger should display the value contained in the named instance ``` (gdb) p MyMoneyMoney::ONE $1 = 1 ``` SOFTWARE/OS VERSIONS Operating System: openSUSE Leap 15.6 KDE Plasma Version: 5.27.11 KDE Frameworks Version: 5.115.0 Qt Version: 5.15.12
Git commit cac6330c8062930452b06b552474c8c76b31caef by Ralf Habacker. Committed on 10/02/2025 at 11:15. Pushed by habacker into branch 'master'. Add gdb pretty printer for MyMoneyMoney class With Windows/gdb, 'set auto-load safe-path /' must be used before starting an executable file to activate the loading of a pretty printer. Gdb pretty printers work in kdevelop and the gdb window in QtCreator with the 'p' command, but currently not in the symbol display due to a bug in the QtCreator gdb bridge (https://bugreports.qt.io/browse/QTCREATORBUG-32480). FIXED-IN:5.2 M +6 -0 kmymoney/mymoney/CMakeLists.txt A +28 -0 kmymoney/mymoney/kmm_mymoney-gdb.py https://invent.kde.org/office/kmymoney/-/commit/cac6330c8062930452b06b552474c8c76b31caef
(In reply to Ralf Habacker from comment #1) ... > Gdb pretty printers work in kdevelop and the gdb window in > QtCreator with the 'p' command, but currently not in the > symbol display due to a bug in the QtCreator gdb bridge > (https://bugreports.qt.io/browse/QTCREATORBUG-32480). A merge request has been opened at https://codereview.qt-project.org/c/qt-creator/qt-creator/+/624064 with a corresponding correction for QtCreator.
Created attachment 178319 [details] Patch fixing the issue (In reply to Ralf Habacker from comment #2) > A merge request has been opened at > https://codereview.qt-project.org/c/qt-creator/qt-creator/+/624064 with a > corresponding correction for QtCreator. A corresponding correction will be included in Qt Creator 16.0.0-rc1. For older versions, the patch has been appended to this ticket and can be applied to /usr/share/qtcreator/debugger/gdbbridge.py.
Git commit ef21565070fa0325693ab579f9318eea341610e3 by Ralf Habacker. Committed on 15/02/2025 at 08:57. Pushed by habacker into branch 'master'. Add gdb pretty printer for MyMoneyPrice, MyMoneySecurity and MyMoneySplit classes These pretty printers significantly improve the debugging capabilities of KMyMoney. M +118 -6 kmymoney/mymoney/kmm_mymoney-gdb.py https://invent.kde.org/office/kmymoney/-/commit/ef21565070fa0325693ab579f9318eea341610e3