Hi Jasaon, Thanks so much for reviewing this patch. I realize it is a lot to see.
The motivation and new dwarf attributes and tags all stem from the debug fission project as described at http://gcc.gnu.org/wiki/DebugFission. I have several more patches dealing with fission coming. Fission has been discussed in the Dwarf standardization meetings. Thanks again, I am happy to make the changes you deem necessary. http://codereview.appspot.com/6197069/diff/1/gcc/dwarf2out.c File gcc/dwarf2out.c (left): http://codereview.appspot.com/6197069/diff/1/gcc/dwarf2out.c#oldcode22231 gcc/dwarf2out.c:22231: FOR_EACH_VEC_ELT (pubname_entry, pubtype_table, i, p) On 2012/05/18 22:39:18, Jason Merrill wrote:
You don't seem to have added anything to output_pubnames to avoid
emitting
entries for pruned types.
The code I removed doesn't deal with omitting individual entries. Instead, it decides whether to emit the pubtypes section at all--if it is empty, then don't emit it. Pruned entries are handled as they always were in output_pubnames. What this code did was to check if the pubtypes section was emptied via pruning. If it was, then don't emit it. However, now that there is the DW_AT_GNU_pubtypes attribute that points to the section, we need to emit the label no matter what. The presence of this attribute helps the consumer know the difference between "No pubtypes were present in the source" and "The compiler didn't generate pubtypes." http://codereview.appspot.com/6197069/diff/1/gcc/dwarf2out.c File gcc/dwarf2out.c (right): http://codereview.appspot.com/6197069/diff/1/gcc/dwarf2out.c#newcode8070 gcc/dwarf2out.c:8070: add_AT_lineptr (die, DW_AT_GNU_pubnames, debug_pubnames_section_label); On 2012/05/18 22:39:18, Jason Merrill wrote:
What are these attributes for? Is there a proposal to add them?
pubnames/types
are used for lookup from a name to a DIE, so there seems to be no
reason to have
a pointer the other way.
The entire motivation for this patch, including the proposed new attributes is at: http://gcc.gnu.org/wiki/DebugFission In particular, the section titled, "Building a GDB Index". (Unfortunately, there isn't an anchor to that section easily linkable.) This was discussed at the past couple of dwarf standardization meetings. http://codereview.appspot.com/6197069/diff/1/gcc/dwarf2out.c#newcode8162 gcc/dwarf2out.c:8162: || is_cu_die (die->die_parent) || is_namespace_die (die->die_parent)) On 2012/05/18 22:39:18, Jason Merrill wrote:
The DWARF standard says that pubnames is for names with global scope;
this
change would add namespace-scope statics as well.
I am matching what gold and gdb do when building the gdb index. I suppose Cary will need to add this subtle change to the proposal, and I can also guard it with "dwarf_split_debug_info". http://codereview.appspot.com/6197069/diff/1/gcc/dwarf2out.c#newcode9177 gcc/dwarf2out.c:9177: add_pubtype (type, base_type_result); On 2012/05/18 22:39:18, Jason Merrill wrote:
Why do we need pubtype entries for base types?
Same as above--to make these addable to the index, which in turn makes gdb faster. I'll add this to the note to Cary. http://codereview.appspot.com/6197069/diff/1/gcc/dwarf2out.c#newcode19010 gcc/dwarf2out.c:19010: /* Bypass dwarf2_name's check for DECL_NAMELESS. */ On 2012/05/18 22:39:18, Jason Merrill wrote:
Why bypass the DECL_NAMELESS check?
So objects within anonymous namespaces get pubnames: namespace { void some_function...
Can you point me at discussion about adding enumerators and namespaces
to
pubnames? Historically it has just been for things with addresses
(the standard
says "objects and functions").
This is all about making every name gdb might need public. Yet another note to add to the proposal, I suppose. I will see to it that Cary does. http://codereview.appspot.com/6197069/