gdb pretty-printers for libstdc++
Jonathan Wakely
jwakely.gcc@gmail.com
Sun Mar 8 02:27:00 GMT 2009
Oops, this didn't go to the list the first time I sent it ...
2009/3/8 Jonathan Wakely:
> 2009/3/2 Phil Muldoon:
>>
>> I fixed that, and all the other issues mentioned in the email. I also did
>> some other small comment clean-ups. I've included a new copy of the file,
>> and also a patch. What do you think?
>
> I finally got a chance to build gdb and apply the patch - very nice
> work! Although it needs something like the attached to handle empty
> pointers. I also think the names should be correct for the std::tr1
> types.
>
> std::shared_ptr and std::tr1::shared_ptr are distinct types and both
> can exist in the same program. The attached patch means gdb can print
> everything in this testcase:
>
>
> #include <memory>
> #include <tr1/memory>
> #include <vector>
>
> int main()
> {
> {
> using namespace std;
> shared_ptr<int> p(new int(2));
> std::vector<weak_ptr<void> > v(1, p);
> p.reset();
> v[0].reset();
> }
> {
> using namespace std::tr1;
> shared_ptr<int> p(new int(2));
> std::vector<weak_ptr<void> > v(1, p);
> p.reset();
> v[0].reset();
> }
> return 0;
> }
>
> compile with g++ -std=c++0x
>
> The same is true of the unordered containers, but I haven't done the
> same for them in this patch.
>
> Jonathan
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: printers.patch
Type: text/x-patch
Size: 2053 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20090308/024fb0e5/attachment.bin>
More information about the Libstdc++
mailing list