[Qt-interest] VS 2005 unable to debug QList when not pointer orint

Tony Rietwyk tony.rietwyk at rightsoft.com.au
Thu Feb 5 10:50:23 CET 2009


Thiago wrote:

> Tony Rietwyk wrote:
> >Hi Everybody,
> >
> >Qt 4.4.3 commercial
> >VS 2005 SP1
> >
> >When debugging, I can hover over a QList variable, and it shows the
> > count and first item contents. Clicking on the + drops down 
> to display
> > a scrolling list of the elements.
> >
> >This works well for pointers and integers, but for anything 
> else (like
> > classes and enums), the count is correct, but the item 
> values display
> > junk.
> 
> That's what I would expect.
> 
> QList contains an internal array of void*. When the item is 
> small enough 
> to fit inside that and it can be memcpy()ed around, QList 
> stores the value 
> inside the void* directly. This means all small integers and 
> any type of 
> pointers.
> 
> Unfortunately, the template magic required to recognise an enum are 
> *still* not widely available today. So enums are handled just 
> like opaque 
> classes.
> 
> In their case, the void* array is used as a pointer list. 
> That is, if you 
> have QList<MyClass>, the array is actually a MyClass*. This 
> is why you're 
> seeing "junk": in fact, you're seeing pointers to your elements.
> 
> >Is there an easy way to fix this? Previous emails on this 
> list, suggest
> > there may be a debugger configuration file somewhere that may be
> > incorrect and can be tweaked?
> 
> Do you have the Visual Studio integration installed?

Yes, it's version 1.4.3. 

Tony.




More information about the Qt-interest-old mailing list