PDA

View Full Version : qt with debugging symbols



valerianst
18th September 2013, 12:25
Hi there!

I have installed the qt libraries with the debugging info with my package manager (I'm on linux).

I have also added in the .pro file the command: CONFIG+= debug

and I have cleaned the solution, done a qmake and recompiled.


The problem is that nothing has changed with the last configuration.

I just want to inspect the qt objects.. for instance, seeing what there is inside a qtreewidget or see the various fields of a QPushButton and so on..


Is there anything I've missed?

Cheers

amleto
18th September 2013, 22:42
what debugger?

wysota
18th September 2013, 22:44
If you're not doing a shadow build into different directories for debug and release, do a full rebuild.

valerianst
19th September 2013, 09:39
I'm using GDB

Yes I haven't a shadow build.. I have already tried several times to rebuild but no changes

wysota
19th September 2013, 10:46
By "no changes" you mean make refuses to do a rebuild? If not, what exactly is the problem?

valerianst
19th September 2013, 11:34
Hi, by no changes I mean that the debugging data are the same, there's no additional data that I can see. I was expecting to be able to inspect the qt objects, all their fields

wysota
19th September 2013, 12:04
What do you see then?

valerianst
19th September 2013, 12:44
I told you.. I can inspect just inside my code not in the Qt one

wysota
19th September 2013, 13:43
Do you mean that you cannot step into Qt functions? Or what exactly? You are not being clear, don't be surprised I can't understand you.

valerianst
19th September 2013, 14:16
You're right, I apologise. It just seemed obvious to me but actually it is not.

I'll try with an example.

Let assume we have this code:




// myclass.h

MyClass
{
public:
int x;
int y;
}


// main.cpp
#include "myclass.h"

// .. other stuff
MyClass foo;

foo.a = 4;

QPushButton *button = new QPushButton(this);
button->setText("hello");




when I start the debugger and my code reaches a breakpoint, in qt-creator, on the right, there's a window where there are the variable names and their content.

In the case of "foo" I can see that the "a" field contains the value 4 and I can see the whole structure of MyClass.

The same cannot be said about "button". In that case, I cannot see the QPushButton structure neither I can see the internal fields..

What I'm trying to do is to be able to inspect these internal fields as I do for all the other classes



Edit: It wouldn't be bad to be able to inspect the Qt code as well :)

wysota
19th September 2013, 15:15
QPushButton does not have a structure. It just has a d pointer which you probably see. If not then maybe you're using a different Qt kit than the one you installed debugging symbols for.

valerianst
19th September 2013, 15:26
I just see an address.. the same for QTreeWidget

I just see: @0x50e5a90 as value so it's just it is a pointer..

is it not possible to inspect the structure pointed by that address?

amleto
19th September 2013, 22:05
given,
QPushbutton* button;

what happens if you try to inspect (*button), instead of button ?

valerianst
20th September 2013, 16:11
I cannot inspect that, there's just the button field and it is a pointer..

Unfortunately, these Qt classes have a private copy contructor so it's not possible to copy them and inspect the copied element (unless you copy all the fields, value by value).

amleto
22nd September 2013, 12:30
you can normally add a 'watch variable' in any self respecting debugger. Just add one that is the button dereferenced.

looking here suggests that pointer data is expandable.
https://qt-project.org/doc/qtcreator-2.8/creator-debugging-example.html

valerianst
23rd September 2013, 09:09
the watch variable stuff should work, thanks.

About the pointer... yes, it should be expandable.. I can see all the stuff of the "this" pointer.. I don't know why I can't do it with others..

wysota
23rd September 2013, 09:23
About the pointer... yes, it should be expandable.. I can see all the stuff of the "this" pointer.. I don't know why I can't do it with others..
It could be that the debugger needs to be able to access Qt source code to be able to resolve the private pointer's structure.

valerianst
23rd September 2013, 10:37
uhm.. yep, but now I've installed the Qt debug info packages so it should work..