Hi Rene, Thiago pointed you to QObject functions, those only work on instances of QObject. QString does not subclass QString and hence you cannot call those functions on a QString.
For QString debugging there's QString::toUtf8().data() which will give you a temporary C string that can be printed. And yes there are gdb extensions (its just a python script) that teach gdb something about qt containers and qstring (and some other types) so you can see them in the debugger with a simple 'p' or access their children. I'm not sure right now wether Qt ships such a file for gdb or wether QtCreator contains them, or maybe both. Andreas On Tue, May 26, 2015 at 11:40 AM, René J.V. <[email protected]> wrote: > 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. > _______________________________________________ > Interest mailing list > [email protected] > http://lists.qt-project.org/mailman/listinfo/interest >
_______________________________________________ Interest mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/interest
