Decl/def matching with templates without template parameters in the DW_AT_name

David Blaikie dblaikie@gmail.com
Fri Jan 6 17:37:41 GMT 2023


I've been working on reducing debug info size, especially for
expression-template heavy code like in Tensorflow and Eigen.

To that end, I've implemented the flag -gsimple-template-names in
Clang that simplifies the DW_AT_name for templates by omitting
template parameters (eg: "vector" instead of "vector<int,
std::allocator<int>>") when the DW_TAG_template_*_parameters contain
sufficient information to reconstruct the original name.

This generally seems to work in GDB - that looks intentional (perhaps
because someone else implemented this feature elsewhere, or just for
canonicalization reasons (the full string with template parameters
might have different whitespace, parentheses, other formatting)), it
seems unlikely that GDB would accidentally be able to connect two
"vector" declarations up to the right "vector" definitions based on
the template parameters without intentional code to support this
scenario.

But one place I found a problem was in pretty printers. I have
situations where a type declaration isn't resolved to a definition
when working within a pretty printer (resulting in the pretty printer
being unable to find member variables in the object/of that type) -
but if I print out the variable/member it works correctly - or if I
"list" the source of the file where the definition of the type is,
then the pretty printer works correctly.

Does this ring a bell for anyone/sound like something sufficient to
file a bug, or would I need to dig in further to create an isolated
reproduction to help communicate the issue I'm seeing?


More information about the Gdb mailing list