[Qt-creator] Qt creator, gdb and anonymous unions.

paulo paulo.jnkml at gmail.com
Tue Feb 16 03:11:44 CET 2010


André Pönitz wrote:
> On Sunday 14 February 2010 19:08:35 ext Andre Poenitz wrote:
>   
>> On Sun, Feb 14, 2010 at 09:38:26PM +0900, paulo wrote:
>>     
>>> Hi friends at the qt-creator mailing list.
>>>
>>> I'm wondering if it's possible to get qt-creator debugger view to show 
>>> some anonymous unions the same way gdb does.
>>>
>>> That is, for something like:
>>> struct A {
>>>     union {
>>>         struct { float b; };
>>>         struct { float c; };
>>>     };
>>> } a;
>>>
>>> a.b = 0;
>>>
>>> gdb will print p a:
>>> $1 = {{b = 0},{c = 0}}
>>>
>>> on the other hand qt-creator just says it's an anonymous union and will 
>>> refuse to print visualize anything, making me add it by hand to the 
>>> watchers window (very annoying).
>>>       
>> I works for a 'plain' anonymous union, but you have nested anonymous
>> structs, too. This is an oversight on my part, I'll have a look tomorrow.
>>     
>
> Ok. This is fixed now for "python enabled" versions of gdb, both for
> display and editing.
>
> For non-python gdb there's no direct solution. gdb/MI does not seem
> to give access to the necessary data in this case. I can work around
> and manually extract data from gdb/CLI output, but I am not sure this
> is worth the trouble. Do you use such nested anon structures often?
>
> Andre'
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-creator
>
>   
Hi, thanks.
Actually I don't like to use this kind of construct, cuse it's not 
"-Wall -ansi --pedantic" friendly.
But for the particular application that I'm developing now it's really 
handy since it allows the aliasing of member  variable names.

Anyway, I'll try to see if I can get this working with the python version.

Thank you,
Paulo



More information about the Qt-creator-old mailing list