This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: debug information
Benjamin Kosnik wrote:
>
> > In GDB, functions that accept std::string as argument are shown as
> > `function_name(std::string)', not as `function_name(std::basic_string<char,...>)'.
> > As far as I can see, this is written like this in the debug information, not just
> > simplified by GDB. So it is a feature of GNU libstdc++ or GCC itself. Is there
> > a way to do the same for my own code? This way debugging would be much easier...
>
> Sadly, std::string is a special case for many things, as it has a
> unique mangling as part of the IA 64 C++ ABI. It'd probably be better
> to discusses this more generally, without std::string's tricks.
>
> If you look at the following example:
>
> [...]
>
> And compile it with -g3 -O0 on linux, you'll see this in the debug info:
>
> <1><f011>: Abbrev Number: 2 (DW_TAG_typedef)
> DW_AT_name : ipod
>
> then, the type on bar as above in gdb is:
>
> (gdb) ptype bar
> type = void (ipod)
>
> and
>
> (gdb) ptype ipod
> type = struct basic_pod<int> {
> int _M_data;
> }
>
> So, I guess I would have to tell you to use a DWARF debuginfo
> toolchain, and use the above flags with typedefs?
>
> Not quite sure what you are getting at, but hopefully this answers your
> question.
But still function names include full type name: `b 'bar(basic_pod<int>)''.
Not much of a problem in this case, but sometimes the full name is very
long...
Paul