[lldb-dev] How to deal with STL type names in C++ code?

Siva Chandra via lldb-dev lldb-dev at lists.llvm.org
Thu Aug 20 16:00:41 PDT 2015

On Thu, Aug 6, 2015 at 4:17 PM, Siva Chandra <sivachandra at google.com> wrote:
> On Thu, Aug 6, 2015 at 3:58 PM, Enrico Granata <egranata at apple.com> wrote:
>> The obvious mechanism is that the compiler has knowledge of the structure
>> of the type - so it can make printing decisions based on that type structure
>> In this case, I imagine a viable approach would be having rules like
>> omitting the values of template arguments that have a default value, omit
>> inlined namespaces, ...
> OK. I will be on vacation next week. Will give this idea a shot after
> getting back.

I have spent time yesterday and today looking into how this can be
done. I still could not come up with a way to make the compiler/clang
replace a name like "basic_string" with "string" by using a print

About inlined namespaces: None of the compilers I tested with
(clang-3.5, clang ToT, gcc-4.8) emit the "inline" attribute for an
inlined namespace in the DWARF. So, we will have to first "fix" this
in the compilers before we can build an option around this.

About default template arguments: Again, none of the compilers I
tested with emit an attribute in the DWARF to convey that a template
argument is taking the default value. I am not sure there is an
attribute available here that we can use readily. I could think of
DW_AT_artificial, but default template arguments are really not
artificial. Another is DW_AT_explicit. However, this could potentially
lead to an increase in DWARF size as each and every template argument
should now carry this attribute.

Am I thinking about this "feature" correctly? As in, in the same way
as you are thinking about it?

More information about the lldb-dev mailing list