Week 10 - 11 As the end of google summer of code draws near most of the time is used to write test, fix bugs and possibly add new printers. For classes that works with OS paths, i had to make the path consisistent between operating systems see the commit below. New Printers QCommandLineOption QCborArray QJsonArray QJsonObject QCborMap QRegExp QRegularExpression New Tests QVariant QVector QBitArray QMap QFileInfo QDir QFile Although Google summer of code may have ended i would try to add or fix any issue with the current printers
There has been a lot of work on printers this week but GDB/MI GDB MI allows applications to connect to GDB without actually running it from the terminal, this is how frontends talks to GDB. Most of the time this is how users actually use GDB for debugging. Children and to_string GDB has two ways for returning pretty printing values, as children or as to_string. children method returns a tuple of two values, the name and the value ie.
Python 2 helpers module for the printers has been ported to support python2 since no mingw supports python 3 yet, as this just requires removing the variable types in function declaration and return, however in the case of the actual printers i have decided to create two separate files for python 2 and 3. Although it may be a little time consuming, it makes more sense because there are have become faster in python3 and would be restricting if still using the python2 implementation.
Setup on Windows setting up mingw on windows is PITA, at first since i am not used to backslash for filepaths, it load the gdb printers, i then realised that it does not come with python enabled. Downloaded a new one it does not come with python3 instead it is python 2.7. I could not find any mingw that is built with python3 on windows, if you do send me a link here.
Automatic Testing Currently we have a handful of core printers working correctly, the intention is to make sure they stay working after adding new printers. This is where testing comes in. before now testing had to be done manually by comparing the result from the gdb console to the expected output. This becomes inconvenient real quick if this is repeated for every class and its output. With manual testing you cannot test if the display_hint strings works correctly and if the index of a list, map or set shown correctly.
Squashing Bugs QFileInfo QFileInfo no longer causes application segmentation fault when the variable does not exist or has not been initialized. Using python yield GDB tries to print the least amount of values needed, but if you just return a list is disregards the set print elements no command. to prevent this, the python key word yield can be used to lazily compute the next needed values. relevant commit -> here here.
QPointers lets start with QWeakPointer, here our pointer template type is Animal its structure is ├── wp (weakpointer): (QWeakPointer<Animal> *) ├── d │ ├── weakref : as QAtomicInt │ └── strongref: as QAtomicInt └── value: (Animal *) QWeakpointers in GDB provide two variables. d (data) -> stores the weak and strong references of the pointer. value -> stores the type the pointer points to. what we need to print is
I think i went down a rabbit hole I decided the next printer to make is QDir, I had to understand how things works, making printers feels like construction, its like you are given a set of tools, to produce an output. The normal steps i take make a printer is to either dereference d_ptr value or the d value ( they are usuallly included in QT types) , to use ptype nameOfTheValue but in both cases the output was an incomplete type.
The first week was small steps were made, some printers for QT and KDE framework was already made,i imported those printers from here, also some from a qt merge request patch here, removing any deprecated logic as the printers are quite old, some changes where made to the QListPrinter to fix the indexing and to account for typedefs like QStringList, QVariantList. I had a problem of QListprinters not printing nested list,