Manman Ren
2013-Mar-09 01:49 UTC
[LLVMdev] Question about abstract subprograms in debug info
Hi, I am working on an issue where a subprogram created here is having abstract_origin pointing to nowhere. DIE *DwarfDebug::updateSubprogramScopeDIE(CompileUnit *SPCU, const MDNode *SPNode) { DIE *SPDie = SPCU->getDIE(SPNode); assert(SPDie && "Unable to find subprogram DIE!"); DISubprogram SP(SPNode); // If we're updating an abstract DIE, then we will be adding the children and // object pointer later on. But what we don't want to do is process the // concrete DIE twice. if (DIE *AbsSPDIE = AbstractSPDies.lookup(SPNode)) { // Pick up abstract subprogram DIE. SPDie = new DIE(dwarf::DW_TAG_subprogram); SPCU->addDIEEntry(SPDie, dwarf::DW_AT_abstract_origin, dwarf::DW_FORM_ref4, AbsSPDIE); SPCU->addDie(SPDie); } … } The compile unit DIE where AbsSPDIE belongs to is different from the compile unit DIE SPCU->getCUDie(). So it is not legal to use a FORM_ref4 here. Why do we create these subprogram DIEs here? They are added to SPCU, but not inserted via insertDIE, so they are not in the MDNodeToDieMap of the CU. Another question is how to fix this if we need to create these subprograms. Should we use FORM_ref_addr here? FORM_ref_addr is not supported yet, I am wondering whether that will break any debugger. Another fix seems to be copying the attributes of the origin instead of using abstract_origin. Thanks, Manman
Manman Ren
2013-Mar-11 18:12 UTC
[LLVMdev] Question about abstract subprograms in debug info
On Mar 8, 2013, at 5:49 PM, Manman Ren <mren at apple.com> wrote:> > Hi, > > I am working on an issue where a subprogram created here is having abstract_origin pointing to nowhere. > DIE *DwarfDebug::updateSubprogramScopeDIE(CompileUnit *SPCU, > const MDNode *SPNode) { > DIE *SPDie = SPCU->getDIE(SPNode); > > assert(SPDie && "Unable to find subprogram DIE!"); > DISubprogram SP(SPNode); > > // If we're updating an abstract DIE, then we will be adding the children and > // object pointer later on. But what we don't want to do is process the > // concrete DIE twice. > if (DIE *AbsSPDIE = AbstractSPDies.lookup(SPNode)) { > // Pick up abstract subprogram DIE. > SPDie = new DIE(dwarf::DW_TAG_subprogram); > SPCU->addDIEEntry(SPDie, dwarf::DW_AT_abstract_origin, > dwarf::DW_FORM_ref4, AbsSPDIE); > SPCU->addDie(SPDie); > } > … > } > > The compile unit DIE where AbsSPDIE belongs to is different from the compile unit DIE SPCU->getCUDie(). > So it is not legal to use a FORM_ref4 here. > > Why do we create these subprogram DIEs here? They are added to SPCU, but not inserted via insertDIE, so they are not in the MDNodeToDieMap of the CU. > > Another question is how to fix this if we need to create these subprograms. > Should we use FORM_ref_addr here? FORM_ref_addr is not supported yet, I am wondering whether that will break any debugger.Sorry, FORM_ref_addr is already there under lib/DebugInfo/, it is just not used in lib/CodeGen/. I am checking whether using it instead of FORM_ref_4 will work. Thanks, Manman> Another fix seems to be copying the attributes of the origin instead of using abstract_origin. > > Thanks, > Manman
Reasonably Related Threads
- [LLVMdev] Minimizing -gmlt
- Debug info scope of explicit casting type does not seem correct
- [LLVMdev] [Debug Info PATCH] for support of ref_addr and removal of DIE duplication
- [LLVMdev] [Debug Info PATCH] for support of ref_addr and removal of DIE duplication
- [LLVMdev] [Debug Info PATCH] for support of ref_addr and removal of DIE duplication