casting in gdb

David Carlton carlton@math.stanford.edu
Wed Jan 15 18:47:00 GMT 2003


On Sat, 14 Dec 2002 23:47:42 -0600, Michael Elizabeth Chastain <mec@shout.net> said:

> I'm playing with the idea that gdb should know more about the C++
> standard library types, in the same spirit that gdb knows that a C
> "char *" usually points to a string terminated with '\0'.  I would
> like gdb to understood more about std::string, std::vector, std:map,
> and so on.

I was going through my old messages, and I noticed this one.  For what
it's worth, Apple has implemented something like this for strings in
Objective C, where they actually print out the string in question, and
they say it works pretty well.  Apparently the implementation of
strings is complicated enough that they really didn't want to tie it
to the implementation; so GDB prints out Objective C strings by
actually doing the method call.

Of course, the above message was part of a thread that noted that, in
C++, the appropriate methods might not be compiled in.  That's a real
problem; I'm not sure what to do about that.

David Carlton
carlton@math.stanford.edu



More information about the Gdb mailing list