[patch] Add libstdc++ type printers for class templates

Jonathan Wakely jwakely@redhat.com
Mon Jul 14 23:50:00 GMT 2014


On 14/07/14 14:11 -0600, Tom Tromey wrote:
>Jonathan> I forgot to say that with these type recognizers we might want to
>Jonathan> revisit the output of the existing printers for the containers, so
>Jonathan> that instead of:
>Jonathan>  std::map with 3 elements = { ... }
>Jonathan> GDB could print the map type:
>Jonathan>  std::map<int, int> with 3 elements = { ... }
>
>I think the reason for the brevity right now is just that, even eliding
>the defaults, the type names can get rather long.  It's not absurd
>though, just maybe not always desirable.  One possible approach would be
>to make a new gdb.Parameter in the libstdc++ code to control it.

I think a parameter would make sense. I can look into that some time.

One part of the patch I wasn't sure about was this, where 'mgr' is a
function pointer:

  func = gdb.block_for_pc(int(mgr.cast(gdb.lookup_type('intptr_t'))))

Is there a better way to get a pc from the function pointer?
I tried simply int(mgr) but it didn't work.



More information about the Libstdc++ mailing list