[llvm-commits] [llvm] r167524 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Eric Christopher
echristo at gmail.com
Tue Nov 6 21:06:49 PST 2012
Test and comments please.
-eric
On Tue, Nov 6, 2012 at 8:42 PM, Bill Wendling <isanbard at gmail.com> wrote:
> Author: void
> Date: Tue Nov 6 22:42:18 2012
> New Revision: 167524
>
> URL: http://llvm.org/viewvc/llvm-project?rev=167524&view=rev
> Log:
> When we're updating the subprogram scope DIE, we want to determine if we're
> updating an abstract DIE or not. If we are, then we use that. Its children
> will
> be added on later, as well as the object pointer attribute. Otherwise, this
> function may be called with a concrete DIE twice and adding the children
> and
> object pointer attribute to it twice.
> <rdar://problem/12401423&12600340>
>
> Modified:
> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=167524&r1=167523&r2=167524&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Nov 6 22:42:18
> 2012
> @@ -307,47 +307,48 @@
> assert(SPDie && "Unable to find subprogram DIE!");
> DISubprogram SP(SPNode);
>
> - DISubprogram SPDecl = SP.getFunctionDeclaration();
> - if (!SPDecl.isSubprogram()) {
> - // There is not any need to generate specification DIE for a function
> - // defined at compile unit level. If a function is defined inside
> another
> - // function then gdb prefers the definition at top level and but does
> not
> - // expect specification DIE in parent function. So avoid creating
> - // specification DIE for a function defined inside a function.
> - if (SP.isDefinition() && !SP.getContext().isCompileUnit() &&
> - !SP.getContext().isFile() &&
> - !isSubprogramContext(SP.getContext())) {
> - SPCU->addFlag(SPDie, dwarf::DW_AT_declaration);
> -
> - // Add arguments.
> - DICompositeType SPTy = SP.getType();
> - DIArray Args = SPTy.getTypeArray();
> - unsigned SPTag = SPTy.getTag();
> - if (SPTag == dwarf::DW_TAG_subroutine_type)
> - for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) {
> - DIE *Arg = new DIE(dwarf::DW_TAG_formal_parameter);
> - DIType ATy = DIType(Args.getElement(i));
> - SPCU->addType(Arg, ATy);
> - if (ATy.isArtificial())
> - SPCU->addFlag(Arg, dwarf::DW_AT_artificial);
> - if (ATy.isObjectPointer())
> - SPCU->addDIEEntry(SPDie, dwarf::DW_AT_object_pointer,
> - dwarf::DW_FORM_ref4, Arg);
> - SPDie->addChild(Arg);
> - }
> - DIE *SPDeclDie = SPDie;
> - SPDie = new DIE(dwarf::DW_TAG_subprogram);
> - SPCU->addDIEEntry(SPDie, dwarf::DW_AT_specification,
> dwarf::DW_FORM_ref4,
> - SPDeclDie);
> - SPCU->addDie(SPDie);
> - }
> - }
> // Pick up abstract subprogram DIE.
> if (DIE *AbsSPDIE = AbstractSPDies.lookup(SPNode)) {
> SPDie = new DIE(dwarf::DW_TAG_subprogram);
> SPCU->addDIEEntry(SPDie, dwarf::DW_AT_abstract_origin,
> dwarf::DW_FORM_ref4, AbsSPDIE);
> SPCU->addDie(SPDie);
> + } else {
> + DISubprogram SPDecl = SP.getFunctionDeclaration();
> + if (!SPDecl.isSubprogram()) {
> + // There is not any need to generate specification DIE for a
> function
> + // defined at compile unit level. If a function is defined inside
> another
> + // function then gdb prefers the definition at top level and but
> does not
> + // expect specification DIE in parent function. So avoid creating
> + // specification DIE for a function defined inside a function.
> + if (SP.isDefinition() && !SP.getContext().isCompileUnit() &&
> + !SP.getContext().isFile() &&
> + !isSubprogramContext(SP.getContext())) {
> + SPCU->addFlag(SPDie, dwarf::DW_AT_declaration);
> +
> + // Add arguments.
> + DICompositeType SPTy = SP.getType();
> + DIArray Args = SPTy.getTypeArray();
> + unsigned SPTag = SPTy.getTag();
> + if (SPTag == dwarf::DW_TAG_subroutine_type)
> + for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) {
> + DIE *Arg = new DIE(dwarf::DW_TAG_formal_parameter);
> + DIType ATy = DIType(Args.getElement(i));
> + SPCU->addType(Arg, ATy);
> + if (ATy.isArtificial())
> + SPCU->addFlag(Arg, dwarf::DW_AT_artificial);
> + if (ATy.isObjectPointer())
> + SPCU->addDIEEntry(SPDie, dwarf::DW_AT_object_pointer,
> + dwarf::DW_FORM_ref4, Arg);
> + SPDie->addChild(Arg);
> + }
> + DIE *SPDeclDie = SPDie;
> + SPDie = new DIE(dwarf::DW_TAG_subprogram);
> + SPCU->addDIEEntry(SPDie, dwarf::DW_AT_specification,
> dwarf::DW_FORM_ref4,
> + SPDeclDie);
> + SPCU->addDie(SPDie);
> + }
> + }
> }
>
> SPCU->addLabel(SPDie, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr,
> @@ -803,7 +804,7 @@
> LexicalScope *Scope =
> new LexicalScope(NULL, DIDescriptor(SP), NULL, false);
> DeadFnScopeMap[SP] = Scope;
> -
> +
> // Construct subprogram DIE and add variables DIEs.
> CompileUnit *SPCU = CUMap.lookup(TheCU);
> assert(SPCU && "Unable to find Compile Unit!");
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121106/429827b8/attachment.html>
More information about the llvm-commits
mailing list