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.

After a little search, thanks to this answer from stackoverflow i was able to get the debugging symbols needed to view the internals of the QDir class.

next problem was getting the list of files in the directory show consistently, the files list only show up in gdb when either the method QDir->entryList() or QDir->count() has been called previously, i then decided to call the entryList method when the printer is initialized that way the file list is always shown when QDir is called in GDB.

But the entire application would crash if the QDir has not yet been initialized in memory, because the method i am trying to call does not exist. since none of Qt classes have any fields named something like initialiized, could not find anything for sometime. I was able to figure out that most advanced Qt classes usually have a field named QSharedData.

In QShareddata there is usually a field named ref that only has the value of one when the variable has been initialized, i was able to use that to make a condition statement to print the filelist of the directory if it is iniitalized.

  • A Pretty printer for QFileInfo was added.

  • A Pretty Printer for QstringRef was added.

the repo can be found here

Next week would be Pointers Printer Goodbye