[llvm] [AsmPrinter][DebugNames] Implement DW_IDX_parent entries (PR #77457)

Felipe de Azevedo Piovezan via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 9 15:27:41 PST 2024


felipepiovezan wrote:


> I think the DWARF spec does allow for adding un-indexed entries to the index, and specifically for unnamed entries having an entry like "(anonymous namespace)" for instance (or other anonymous names) - maybe? H

One pedantic but important distinction here is that anonymous namespaces are not quite part of the "un-indexed" debate, as the spec treats them as if they had a name:

> DW_TAG_namespace debugging information entries without a DW_AT_name attribute are included with the name “(anonymous namespace)”.

So they are indexed like any other named namespace.

> > It is possible that an indexed debugging information entry has a parent that is not indexed (for example, if its parent does not have a name attribute). In such a case, a parent attribute may point to a nameless index entry (that is, one that cannot be reached from any entry in the name table), or it may point to the nearest ancestor that does have an index entry
> 
> Not suggesting we want to/need to do that, just clarifying that it's explicitly allowed by the standard - if that's useful.
> 
> Smaller encoding's are better, so I'm not exactly complaining about the use of `present`, but just in case that has unfortunate tradeoffs in some other way, there are other options.

Yup, this is a great point! The original implementation was doing what the spec suggested (pointing to a "fake" entry), but honestly the code is a bit more complicated and uses a lot more space. For now, this seems to be a win-win situation, but if some other trade-off comes up, we can totally explore the other paths.

https://github.com/llvm/llvm-project/pull/77457


More information about the llvm-commits mailing list