Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Pretty Printing STL Container in debugger

Hi Lukas,

Most likely your debug launch does not use DSF, but CDI. This can be switched in the launch configuration. In the launch configuration dialog, select your configuration. At the bottom it must say "Using GDB (DSF) ..."

Please also note that there is an ugly bug in gdb for strings. There is no fix for it available in gdb yet. However, you can put a workaround into your pretty printers: In StdStringPrinter#to_string, insert the following code right behing the line the calculates len

        if len > 100:
            len = 100

This will clip the maximum length of a string and gdb will not commit suicide on uninitialized strings.

I'll update the wiki.

Greetings, Jens.

> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On
> Behalf Of Lukas Felber
> Sent: Mittwoch, 7. Dezember 2011 11:26
> To: CDT General developers list.
> Subject: [cdt-dev] Pretty Printing STL Container in debugger
> 
> Hi,
> 
> I just tried to "see" contents of stl containers in the cdt debugger
> (using gdb). I used the instructions from
> http://wiki.eclipse.org/CDT/User/FAQ#How_can_I_inspect_the_contents_of_STL
> _containers.3F
> 
> To some the lower part of the Variables view I can now see container
> content (e.g. "std::vector of length 3, capacity 4 = {2, 12, 0}").
> However, in the upper part, I cannot expand the vector to see its three
> child elements as shown in the second picture in
> http://wiki.eclipse.org/CDT/User/FAQ#How_can_I_inspect_the_contents_of_STL
> _containers.3F
> 
> I'm using CDT 8.0 and gdb 7.3-2011.08.
> 
> Is this a cdt bug or is there something wrong with my setup or the
> description at above link?
> 
> 
> Thanks for pointing me to the right direction.
> 
> Lukas
> 
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top