add typedef printers to libstdc++

Magnus Fromreide magfr@lysator.liu.se
Sat Sep 22 08:54:00 GMT 2012


On Fri, 2012-09-21 at 14:59 -0600, Tom Tromey wrote:
> This patch adds some typedef printers to libstdc++.
> 
> This relies on a gdb patch that hasn't yet gone in (pending on the list).
> If the gdb patch changes, I'll change these printers as well.
> 
> The basic idea is that you can now have gdb substitute a name of your
> choice when printing a type's name.  This lets a library pretend that
> some typedefs are canonical.
> 
> This includes a fairly comprehensive test case for the new type
> printers.

I have not tested it, but when looking at the test case and also on the
code I couldn't help but ask myself how it handles other derivations.

How does it display the types of the variables us, s and ss in the
following code:
---
#include <string>

typedef std::basic_string<unsigned char> ustring;

ustring us;
std::string s;
std::basic_string<signed char> ss;
---

I would expect it to say std::basic_string<unsigned char,...>,
std::string and std::basic_string<signed char,...>, but I thought a test
case here couldn't hurt?

/MF



More information about the Libstdc++ mailing list