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

Thiago Macieira thiago.macieira at trolltech.com
Thu Feb 5 08:54:46 CET 2009


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?

-- 
Thiago Macieira - thiago.macieira (AT) nokia.com
  Senior Product Manager - Nokia, Qt Software
      Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090205/88853565/attachment.bin 


More information about the Qt-interest-old mailing list