[Interest] debugging: how to get meaningful QObject information in a command line session

René J.V. Bertin rjvbertin at gmail.com
Tue May 26 11:40:37 CEST 2015


On Monday May 25 2015 17:11:02 Thiago Macieira wrote:

Thanks for the feedback:

>Make the debugger call the QObject::dumpObjectInfo() and 
>QObject::dumpObjectTree() in the objects you want to get information from.

I presume that would entail calling the actual function with the object pointer as its first argument (or something of the sort) or do you actually mean to compile in those calls (guess not, would be just as easy to use a simple qDebug() in that case)? Usually when I look at a QObject instance in lldb (or gdb) it knows to show so little about them that I wouldn't know how to call a method. A quick test under Linux with gdb and a debuggable executable I had lying around (built with -O3 -g) told me that "No symbol "QObject" in current context".

On OS X:
(lldb) p QObject::dumpObjectInfo(&fileName)
error: call to non-static member function without an object argument
error: 1 errors parsing expression
(lldb) p fileName.dumpObjectInfo()
error: no member named 'dumpObjectInfo' in 'QString'
error: 1 errors parsing expression
(lldb) p ((QObject*)&fileName)->dumpObjectInfo()
(lldb) 


I seem to recall having seen a package (for Ubuntu) that suggested it installed some gdb extension that would enable gdb to print meaningful information, but I didn't have the time then to investigate immediately and now I cannot even remember if it was Qt specific or a more generic extension for C++ debugging.

Thanks again,

R.



More information about the Interest mailing list