DwarfDebug.cpp (195098) | DwarfDebug.cpp (195340) |
---|---|
1//===-- llvm/CodeGen/DwarfDebug.cpp - Dwarf Debug Framework ---------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 207 unchanged lines hidden (view full) --- 216 delete Variables[j]; 217 for (unsigned k = 0, O = ConcreteInsts.size(); k < O; ++k) 218 delete ConcreteInsts[k]; 219} 220 221} // end llvm namespace 222 223DwarfDebug::DwarfDebug(raw_ostream &OS, AsmPrinter *A, const TargetAsmInfo *T) | 1//===-- llvm/CodeGen/DwarfDebug.cpp - Dwarf Debug Framework ---------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 207 unchanged lines hidden (view full) --- 216 delete Variables[j]; 217 for (unsigned k = 0, O = ConcreteInsts.size(); k < O; ++k) 218 delete ConcreteInsts[k]; 219} 220 221} // end llvm namespace 222 223DwarfDebug::DwarfDebug(raw_ostream &OS, AsmPrinter *A, const TargetAsmInfo *T) |
224 : Dwarf(OS, A, T, "dbg"), MainCU(0), | 224 : Dwarf(OS, A, T, "dbg"), ModuleCU(0), |
225 AbbreviationsSet(InitAbbreviationsSetSize), Abbreviations(), 226 ValuesSet(InitValuesSetSize), Values(), StringPool(), SectionMap(), 227 SectionSourceLines(), didInitial(false), shouldEmit(false), 228 FunctionDbgScope(0), DebugTimer(0) { 229 if (TimePassesIsEnabled) 230 DebugTimer = new Timer("Dwarf Debug Writer", 231 getDwarfTimerGroup()); 232} --- 440 unchanged lines hidden (view full) --- 673 674 // Add elements to structure type. 675 for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) { 676 DIDescriptor Element = Elements.getElement(i); 677 DIE *ElemDie = NULL; 678 if (Element.getTag() == dwarf::DW_TAG_subprogram) 679 ElemDie = CreateSubprogramDIE(DW_Unit, 680 DISubprogram(Element.getGV())); | 225 AbbreviationsSet(InitAbbreviationsSetSize), Abbreviations(), 226 ValuesSet(InitValuesSetSize), Values(), StringPool(), SectionMap(), 227 SectionSourceLines(), didInitial(false), shouldEmit(false), 228 FunctionDbgScope(0), DebugTimer(0) { 229 if (TimePassesIsEnabled) 230 DebugTimer = new Timer("Dwarf Debug Writer", 231 getDwarfTimerGroup()); 232} --- 440 unchanged lines hidden (view full) --- 673 674 // Add elements to structure type. 675 for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) { 676 DIDescriptor Element = Elements.getElement(i); 677 DIE *ElemDie = NULL; 678 if (Element.getTag() == dwarf::DW_TAG_subprogram) 679 ElemDie = CreateSubprogramDIE(DW_Unit, 680 DISubprogram(Element.getGV())); |
681 else if (Element.getTag() == dwarf::DW_TAG_variable) // ?? 682 ElemDie = CreateGlobalVariableDIE(DW_Unit, 683 DIGlobalVariable(Element.getGV())); | |
684 else 685 ElemDie = CreateMemberDIE(DW_Unit, 686 DIDerivedType(Element.getGV())); 687 Buffer.AddChild(ElemDie); 688 } 689 690 // FIXME: We'd like an API to register additional attributes for the 691 // frontend to use while synthesizing, and then we'd use that api in clang --- 396 unchanged lines hidden (view full) --- 1088 if (!RootScope) return; 1089 DIDescriptor Desc = RootScope->getDesc(); 1090 if (Desc.isNull()) 1091 return; 1092 1093 // Get the subprogram debug information entry. 1094 DISubprogram SPD(Desc.getGV()); 1095 | 681 else 682 ElemDie = CreateMemberDIE(DW_Unit, 683 DIDerivedType(Element.getGV())); 684 Buffer.AddChild(ElemDie); 685 } 686 687 // FIXME: We'd like an API to register additional attributes for the 688 // frontend to use while synthesizing, and then we'd use that api in clang --- 396 unchanged lines hidden (view full) --- 1085 if (!RootScope) return; 1086 DIDescriptor Desc = RootScope->getDesc(); 1087 if (Desc.isNull()) 1088 return; 1089 1090 // Get the subprogram debug information entry. 1091 DISubprogram SPD(Desc.getGV()); 1092 |
1096 // Get the compile unit context. 1097 CompileUnit *Unit = MainCU; 1098 if (!Unit) 1099 Unit = &FindCompileUnit(SPD.getCompileUnit()); 1100 | |
1101 // Get the subprogram die. | 1093 // Get the subprogram die. |
1102 DIE *SPDie = Unit->getDieMapSlotFor(SPD.getGV()); | 1094 DIE *SPDie = ModuleCU->getDieMapSlotFor(SPD.getGV()); |
1103 assert(SPDie && "Missing subprogram descriptor"); 1104 1105 if (!AbstractScope) { 1106 // Add the function bounds. 1107 AddLabel(SPDie, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr, 1108 DWLabel("func_begin", SubprogramCount)); 1109 AddLabel(SPDie, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr, 1110 DWLabel("func_end", SubprogramCount)); 1111 MachineLocation Location(RI->getFrameRegister(*MF)); 1112 AddAddress(SPDie, dwarf::DW_AT_frame_base, Location); 1113 } 1114 | 1095 assert(SPDie && "Missing subprogram descriptor"); 1096 1097 if (!AbstractScope) { 1098 // Add the function bounds. 1099 AddLabel(SPDie, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr, 1100 DWLabel("func_begin", SubprogramCount)); 1101 AddLabel(SPDie, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr, 1102 DWLabel("func_end", SubprogramCount)); 1103 MachineLocation Location(RI->getFrameRegister(*MF)); 1104 AddAddress(SPDie, dwarf::DW_AT_frame_base, Location); 1105 } 1106 |
1115 ConstructDbgScope(RootScope, 0, 0, SPDie, Unit); | 1107 ConstructDbgScope(RootScope, 0, 0, SPDie, ModuleCU); |
1116} 1117 1118/// ConstructDefaultDbgScope - Construct a default scope for the subprogram. 1119/// 1120void DwarfDebug::ConstructDefaultDbgScope(MachineFunction *MF) { 1121 const char *FnName = MF->getFunction()->getNameStart(); | 1108} 1109 1110/// ConstructDefaultDbgScope - Construct a default scope for the subprogram. 1111/// 1112void DwarfDebug::ConstructDefaultDbgScope(MachineFunction *MF) { 1113 const char *FnName = MF->getFunction()->getNameStart(); |
1122 if (MainCU) { 1123 StringMap<DIE*> &Globals = MainCU->getGlobals(); 1124 StringMap<DIE*>::iterator GI = Globals.find(FnName); 1125 if (GI != Globals.end()) { 1126 DIE *SPDie = GI->second; 1127 1128 // Add the function bounds. 1129 AddLabel(SPDie, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr, 1130 DWLabel("func_begin", SubprogramCount)); 1131 AddLabel(SPDie, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr, 1132 DWLabel("func_end", SubprogramCount)); 1133 1134 MachineLocation Location(RI->getFrameRegister(*MF)); 1135 AddAddress(SPDie, dwarf::DW_AT_frame_base, Location); 1136 return; 1137 } 1138 } else { 1139 for (unsigned i = 0, e = CompileUnits.size(); i != e; ++i) { 1140 CompileUnit *Unit = CompileUnits[i]; 1141 StringMap<DIE*> &Globals = Unit->getGlobals(); 1142 StringMap<DIE*>::iterator GI = Globals.find(FnName); 1143 if (GI != Globals.end()) { 1144 DIE *SPDie = GI->second; 1145 1146 // Add the function bounds. 1147 AddLabel(SPDie, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr, 1148 DWLabel("func_begin", SubprogramCount)); 1149 AddLabel(SPDie, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr, 1150 DWLabel("func_end", SubprogramCount)); 1151 1152 MachineLocation Location(RI->getFrameRegister(*MF)); 1153 AddAddress(SPDie, dwarf::DW_AT_frame_base, Location); 1154 return; 1155 } 1156 } | 1114 StringMap<DIE*> &Globals = ModuleCU->getGlobals(); 1115 StringMap<DIE*>::iterator GI = Globals.find(FnName); 1116 if (GI != Globals.end()) { 1117 DIE *SPDie = GI->second; 1118 1119 // Add the function bounds. 1120 AddLabel(SPDie, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr, 1121 DWLabel("func_begin", SubprogramCount)); 1122 AddLabel(SPDie, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr, 1123 DWLabel("func_end", SubprogramCount)); 1124 1125 MachineLocation Location(RI->getFrameRegister(*MF)); 1126 AddAddress(SPDie, dwarf::DW_AT_frame_base, Location); |
1157 } | 1127 } |
1158 1159#if 0 1160 // FIXME: This is causing an abort because C++ mangled names are compared with 1161 // their unmangled counterparts. See PR2885. Don't do this assert. 1162 assert(0 && "Couldn't find DIE for machine function!"); 1163#endif | |
1164} 1165 1166/// GetOrCreateSourceID - Look up the source id with the given directory and 1167/// source file names. If none currently exists, create a new id and insert it 1168/// in the SourceIds map. This can update DirectoryNames and SourceFileNames 1169/// maps as well. 1170unsigned DwarfDebug::GetOrCreateSourceID(const std::string &DirName, 1171 const std::string &FileName) { --- 56 unchanged lines hidden (view full) --- 1228 AddString(Die, dwarf::DW_AT_APPLE_flags, dwarf::DW_FORM_string, Flags); 1229 1230 unsigned RVer = DIUnit.getRunTimeVersion(); 1231 if (RVer) 1232 AddUInt(Die, dwarf::DW_AT_APPLE_major_runtime_vers, 1233 dwarf::DW_FORM_data1, RVer); 1234 1235 CompileUnit *Unit = new CompileUnit(ID, Die); | 1128} 1129 1130/// GetOrCreateSourceID - Look up the source id with the given directory and 1131/// source file names. If none currently exists, create a new id and insert it 1132/// in the SourceIds map. This can update DirectoryNames and SourceFileNames 1133/// maps as well. 1134unsigned DwarfDebug::GetOrCreateSourceID(const std::string &DirName, 1135 const std::string &FileName) { --- 56 unchanged lines hidden (view full) --- 1192 AddString(Die, dwarf::DW_AT_APPLE_flags, dwarf::DW_FORM_string, Flags); 1193 1194 unsigned RVer = DIUnit.getRunTimeVersion(); 1195 if (RVer) 1196 AddUInt(Die, dwarf::DW_AT_APPLE_major_runtime_vers, 1197 dwarf::DW_FORM_data1, RVer); 1198 1199 CompileUnit *Unit = new CompileUnit(ID, Die); |
1236 if (DIUnit.isMain()) { 1237 assert(!MainCU && "Multiple main compile units are found!"); 1238 MainCU = Unit; 1239 } | 1200 if (!ModuleCU && DIUnit.isMain()) { 1201 // Use first compile unit marked as isMain as the compile unit 1202 // for this module. 1203 ModuleCU = Unit; 1204 } |
1240 1241 CompileUnitMap[DIUnit.getGV()] = Unit; 1242 CompileUnits.push_back(Unit); 1243} 1244 1245void DwarfDebug::ConstructGlobalVariableDIE(GlobalVariable *GV) { 1246 DIGlobalVariable DI_GV(GV); | 1205 1206 CompileUnitMap[DIUnit.getGV()] = Unit; 1207 CompileUnits.push_back(Unit); 1208} 1209 1210void DwarfDebug::ConstructGlobalVariableDIE(GlobalVariable *GV) { 1211 DIGlobalVariable DI_GV(GV); |
1247 CompileUnit *DW_Unit = MainCU; 1248 if (!DW_Unit) 1249 DW_Unit = &FindCompileUnit(DI_GV.getCompileUnit()); | |
1250 1251 // Check for pre-existence. | 1212 1213 // Check for pre-existence. |
1252 DIE *&Slot = DW_Unit->getDieMapSlotFor(DI_GV.getGV()); | 1214 DIE *&Slot = ModuleCU->getDieMapSlotFor(DI_GV.getGV()); |
1253 if (Slot) 1254 return; 1255 | 1215 if (Slot) 1216 return; 1217 |
1256 DIE *VariableDie = CreateGlobalVariableDIE(DW_Unit, DI_GV); | 1218 DIE *VariableDie = CreateGlobalVariableDIE(ModuleCU, DI_GV); |
1257 1258 // Add address. 1259 DIEBlock *Block = new DIEBlock(); 1260 AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_addr); 1261 std::string GLN; 1262 AddObjectLabel(Block, 0, dwarf::DW_FORM_udata, 1263 Asm->getGlobalLinkName(DI_GV.getGlobal(), GLN)); 1264 AddBlock(VariableDie, dwarf::DW_AT_location, 0, Block); 1265 1266 // Add to map. 1267 Slot = VariableDie; 1268 1269 // Add to context owner. | 1219 1220 // Add address. 1221 DIEBlock *Block = new DIEBlock(); 1222 AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_addr); 1223 std::string GLN; 1224 AddObjectLabel(Block, 0, dwarf::DW_FORM_udata, 1225 Asm->getGlobalLinkName(DI_GV.getGlobal(), GLN)); 1226 AddBlock(VariableDie, dwarf::DW_AT_location, 0, Block); 1227 1228 // Add to map. 1229 Slot = VariableDie; 1230 1231 // Add to context owner. |
1270 DW_Unit->getDie()->AddChild(VariableDie); | 1232 ModuleCU->getDie()->AddChild(VariableDie); |
1271 1272 // Expose as global. FIXME - need to check external flag. 1273 std::string Name; | 1233 1234 // Expose as global. FIXME - need to check external flag. 1235 std::string Name; |
1274 DW_Unit->AddGlobal(DI_GV.getName(Name), VariableDie); | 1236 ModuleCU->AddGlobal(DI_GV.getName(Name), VariableDie); |
1275 return; 1276} 1277 1278void DwarfDebug::ConstructSubprogram(GlobalVariable *GV) { 1279 DISubprogram SP(GV); | 1237 return; 1238} 1239 1240void DwarfDebug::ConstructSubprogram(GlobalVariable *GV) { 1241 DISubprogram SP(GV); |
1280 CompileUnit *Unit = MainCU; 1281 if (!Unit) 1282 Unit = &FindCompileUnit(SP.getCompileUnit()); | |
1283 1284 // Check for pre-existence. | 1242 1243 // Check for pre-existence. |
1285 DIE *&Slot = Unit->getDieMapSlotFor(GV); | 1244 DIE *&Slot = ModuleCU->getDieMapSlotFor(GV); |
1286 if (Slot) 1287 return; 1288 1289 if (!SP.isDefinition()) 1290 // This is a method declaration which will be handled while constructing 1291 // class type. 1292 return; 1293 | 1245 if (Slot) 1246 return; 1247 1248 if (!SP.isDefinition()) 1249 // This is a method declaration which will be handled while constructing 1250 // class type. 1251 return; 1252 |
1294 DIE *SubprogramDie = CreateSubprogramDIE(Unit, SP); | 1253 DIE *SubprogramDie = CreateSubprogramDIE(ModuleCU, SP); |
1295 1296 // Add to map. 1297 Slot = SubprogramDie; 1298 1299 // Add to context owner. | 1254 1255 // Add to map. 1256 Slot = SubprogramDie; 1257 1258 // Add to context owner. |
1300 Unit->getDie()->AddChild(SubprogramDie); | 1259 ModuleCU->getDie()->AddChild(SubprogramDie); |
1301 1302 // Expose as global. 1303 std::string Name; | 1260 1261 // Expose as global. 1262 std::string Name; |
1304 Unit->AddGlobal(SP.getName(Name), SubprogramDie); | 1263 ModuleCU->AddGlobal(SP.getName(Name), SubprogramDie); |
1305 return; 1306} 1307 1308 /// BeginModule - Emit all Dwarf sections that should come prior to the 1309 /// content. Create global DIEs and emit initial debug info sections. 1310 /// This is inovked by the target AsmPrinter. 1311void DwarfDebug::BeginModule(Module *M, MachineModuleInfo *mmi) { 1312 this->M = M; --- 13 unchanged lines hidden (view full) --- 1326 1327 if (CompileUnits.empty()) { 1328 if (TimePassesIsEnabled) 1329 DebugTimer->stopTimer(); 1330 1331 return; 1332 } 1333 | 1264 return; 1265} 1266 1267 /// BeginModule - Emit all Dwarf sections that should come prior to the 1268 /// content. Create global DIEs and emit initial debug info sections. 1269 /// This is inovked by the target AsmPrinter. 1270void DwarfDebug::BeginModule(Module *M, MachineModuleInfo *mmi) { 1271 this->M = M; --- 13 unchanged lines hidden (view full) --- 1285 1286 if (CompileUnits.empty()) { 1287 if (TimePassesIsEnabled) 1288 DebugTimer->stopTimer(); 1289 1290 return; 1291 } 1292 |
1293 // If main compile unit for this module is not seen than randomly 1294 // select first compile unit. 1295 if (!ModuleCU) 1296 ModuleCU = CompileUnits[0]; 1297 |
|
1334 // If there is not any debug info available for any global variables and any 1335 // subprograms then there is not any debug info to emit. 1336 if (GVs.empty() && SPs.empty()) { 1337 if (TimePassesIsEnabled) 1338 DebugTimer->stopTimer(); 1339 1340 return; 1341 } --- 360 unchanged lines hidden (view full) --- 1702 unsigned LabelID = MMI->NextLabelID(); 1703 1704 if (!TAI->doesDwarfUsesInlineInfoSection()) 1705 return LabelID; 1706 1707 if (TimePassesIsEnabled) 1708 DebugTimer->startTimer(); 1709 | 1298 // If there is not any debug info available for any global variables and any 1299 // subprograms then there is not any debug info to emit. 1300 if (GVs.empty() && SPs.empty()) { 1301 if (TimePassesIsEnabled) 1302 DebugTimer->stopTimer(); 1303 1304 return; 1305 } --- 360 unchanged lines hidden (view full) --- 1666 unsigned LabelID = MMI->NextLabelID(); 1667 1668 if (!TAI->doesDwarfUsesInlineInfoSection()) 1669 return LabelID; 1670 1671 if (TimePassesIsEnabled) 1672 DebugTimer->startTimer(); 1673 |
1710 CompileUnit *Unit = MainCU; 1711 if (!Unit) 1712 Unit = &FindCompileUnit(SP.getCompileUnit()); | |
1713 GlobalVariable *GV = SP.getGV(); 1714 DenseMap<const GlobalVariable *, DbgScope *>::iterator 1715 II = AbstractInstanceRootMap.find(GV); 1716 1717 if (II == AbstractInstanceRootMap.end()) { 1718 // Create an abstract instance entry for this inlined function if it doesn't 1719 // already exist. 1720 DbgScope *Scope = new DbgScope(NULL, DIDescriptor(GV)); 1721 1722 // Get the compile unit context. | 1674 GlobalVariable *GV = SP.getGV(); 1675 DenseMap<const GlobalVariable *, DbgScope *>::iterator 1676 II = AbstractInstanceRootMap.find(GV); 1677 1678 if (II == AbstractInstanceRootMap.end()) { 1679 // Create an abstract instance entry for this inlined function if it doesn't 1680 // already exist. 1681 DbgScope *Scope = new DbgScope(NULL, DIDescriptor(GV)); 1682 1683 // Get the compile unit context. |
1723 DIE *SPDie = Unit->getDieMapSlotFor(GV); | 1684 DIE *SPDie = ModuleCU->getDieMapSlotFor(GV); |
1724 if (!SPDie) | 1685 if (!SPDie) |
1725 SPDie = CreateSubprogramDIE(Unit, SP, false, true); | 1686 SPDie = CreateSubprogramDIE(ModuleCU, SP, false, true); |
1726 1727 // Mark as being inlined. This makes this subprogram entry an abstract 1728 // instance root. 1729 // FIXME: Our debugger doesn't care about the value of DW_AT_inline, only 1730 // that it's defined. That probably won't change in the future. However, 1731 // this could be more elegant. 1732 AddUInt(SPDie, dwarf::DW_AT_inline, 0, dwarf::DW_INL_declared_not_inlined); 1733 1734 // Keep track of the abstract scope for this function. 1735 DbgAbstractScopeMap[GV] = Scope; 1736 1737 AbstractInstanceRootMap[GV] = Scope; 1738 AbstractInstanceRootList.push_back(Scope); 1739 } 1740 1741 // Create a concrete inlined instance for this inlined function. 1742 DbgConcreteScope *ConcreteScope = new DbgConcreteScope(DIDescriptor(GV)); 1743 DIE *ScopeDie = new DIE(dwarf::DW_TAG_inlined_subroutine); | 1687 1688 // Mark as being inlined. This makes this subprogram entry an abstract 1689 // instance root. 1690 // FIXME: Our debugger doesn't care about the value of DW_AT_inline, only 1691 // that it's defined. That probably won't change in the future. However, 1692 // this could be more elegant. 1693 AddUInt(SPDie, dwarf::DW_AT_inline, 0, dwarf::DW_INL_declared_not_inlined); 1694 1695 // Keep track of the abstract scope for this function. 1696 DbgAbstractScopeMap[GV] = Scope; 1697 1698 AbstractInstanceRootMap[GV] = Scope; 1699 AbstractInstanceRootList.push_back(Scope); 1700 } 1701 1702 // Create a concrete inlined instance for this inlined function. 1703 DbgConcreteScope *ConcreteScope = new DbgConcreteScope(DIDescriptor(GV)); 1704 DIE *ScopeDie = new DIE(dwarf::DW_TAG_inlined_subroutine); |
1744 ScopeDie->setAbstractCompileUnit(Unit); | 1705 ScopeDie->setAbstractCompileUnit(ModuleCU); |
1745 | 1706 |
1746 DIE *Origin = Unit->getDieMapSlotFor(GV); | 1707 DIE *Origin = ModuleCU->getDieMapSlotFor(GV); |
1747 AddDIEEntry(ScopeDie, dwarf::DW_AT_abstract_origin, 1748 dwarf::DW_FORM_ref4, Origin); | 1708 AddDIEEntry(ScopeDie, dwarf::DW_AT_abstract_origin, 1709 dwarf::DW_FORM_ref4, Origin); |
1749 AddUInt(ScopeDie, dwarf::DW_AT_call_file, 0, Unit->getID()); | 1710 AddUInt(ScopeDie, dwarf::DW_AT_call_file, 0, ModuleCU->getID()); |
1750 AddUInt(ScopeDie, dwarf::DW_AT_call_line, 0, Line); 1751 AddUInt(ScopeDie, dwarf::DW_AT_call_column, 0, Col); 1752 1753 ConcreteScope->setDie(ScopeDie); 1754 ConcreteScope->setStartLabelID(LabelID); 1755 MMI->RecordUsedDbgLabel(LabelID); 1756 1757 LexicalScopeStack.back()->AddConcreteInst(ConcreteScope); --- 144 unchanged lines hidden (view full) --- 1902void DwarfDebug::SizeAndOffsets() { 1903 // Compute size of compile unit header. 1904 static unsigned Offset = 1905 sizeof(int32_t) + // Length of Compilation Unit Info 1906 sizeof(int16_t) + // DWARF version number 1907 sizeof(int32_t) + // Offset Into Abbrev. Section 1908 sizeof(int8_t); // Pointer Size (in bytes) 1909 | 1711 AddUInt(ScopeDie, dwarf::DW_AT_call_line, 0, Line); 1712 AddUInt(ScopeDie, dwarf::DW_AT_call_column, 0, Col); 1713 1714 ConcreteScope->setDie(ScopeDie); 1715 ConcreteScope->setStartLabelID(LabelID); 1716 MMI->RecordUsedDbgLabel(LabelID); 1717 1718 LexicalScopeStack.back()->AddConcreteInst(ConcreteScope); --- 144 unchanged lines hidden (view full) --- 1863void DwarfDebug::SizeAndOffsets() { 1864 // Compute size of compile unit header. 1865 static unsigned Offset = 1866 sizeof(int32_t) + // Length of Compilation Unit Info 1867 sizeof(int16_t) + // DWARF version number 1868 sizeof(int32_t) + // Offset Into Abbrev. Section 1869 sizeof(int8_t); // Pointer Size (in bytes) 1870 |
1910 // Process base compile unit. 1911 if (MainCU) { 1912 SizeAndOffsetDie(MainCU->getDie(), Offset, true); 1913 CompileUnitOffsets[MainCU] = 0; 1914 return; 1915 } 1916 1917 // Process all compile units. 1918 unsigned PrevOffset = 0; 1919 1920 for (unsigned i = 0, e = CompileUnits.size(); i != e; ++i) { 1921 CompileUnit *Unit = CompileUnits[i]; 1922 CompileUnitOffsets[Unit] = PrevOffset; 1923 PrevOffset += SizeAndOffsetDie(Unit->getDie(), Offset, true) 1924 + sizeof(int32_t); // FIXME - extra pad for gdb bug. 1925 } | 1871 SizeAndOffsetDie(ModuleCU->getDie(), Offset, true); 1872 CompileUnitOffsets[ModuleCU] = 0; |
1926} 1927 1928/// EmitInitial - Emit initial Dwarf declarations. This is necessary for cc 1929/// tools to recognize the object file contains Dwarf information. 1930void DwarfDebug::EmitInitial() { 1931 // Check to see if we already emitted intial headers. 1932 if (didInitial) return; 1933 didInitial = true; --- 128 unchanged lines hidden (view full) --- 2062 2063 Asm->EOL(); 2064} 2065 2066void DwarfDebug::EmitDebugInfo() { 2067 // Start debug info section. 2068 Asm->SwitchToDataSection(TAI->getDwarfInfoSection()); 2069 | 1873} 1874 1875/// EmitInitial - Emit initial Dwarf declarations. This is necessary for cc 1876/// tools to recognize the object file contains Dwarf information. 1877void DwarfDebug::EmitInitial() { 1878 // Check to see if we already emitted intial headers. 1879 if (didInitial) return; 1880 didInitial = true; --- 128 unchanged lines hidden (view full) --- 2009 2010 Asm->EOL(); 2011} 2012 2013void DwarfDebug::EmitDebugInfo() { 2014 // Start debug info section. 2015 Asm->SwitchToDataSection(TAI->getDwarfInfoSection()); 2016 |
2070 if (MainCU) { 2071 EmitDebugInfoPerCU(MainCU); 2072 return; 2073 } 2074 2075 for (unsigned i = 0, e = CompileUnits.size(); i != e; ++i) 2076 EmitDebugInfoPerCU(CompileUnits[i]); | 2017 EmitDebugInfoPerCU(ModuleCU); |
2077} 2078 2079/// EmitAbbreviations - Emit the abbreviation section. 2080/// 2081void DwarfDebug::EmitAbbreviations() const { 2082 // Check to see if it is worth the effort. 2083 if (!Abbreviations.empty()) { 2084 // Start the debug abbrev section. --- 315 unchanged lines hidden (view full) --- 2400} 2401 2402/// EmitDebugPubNames - Emit visible names into a debug pubnames section. 2403/// 2404void DwarfDebug::EmitDebugPubNames() { 2405 // Start the dwarf pubnames section. 2406 Asm->SwitchToDataSection(TAI->getDwarfPubNamesSection()); 2407 | 2018} 2019 2020/// EmitAbbreviations - Emit the abbreviation section. 2021/// 2022void DwarfDebug::EmitAbbreviations() const { 2023 // Check to see if it is worth the effort. 2024 if (!Abbreviations.empty()) { 2025 // Start the debug abbrev section. --- 315 unchanged lines hidden (view full) --- 2341} 2342 2343/// EmitDebugPubNames - Emit visible names into a debug pubnames section. 2344/// 2345void DwarfDebug::EmitDebugPubNames() { 2346 // Start the dwarf pubnames section. 2347 Asm->SwitchToDataSection(TAI->getDwarfPubNamesSection()); 2348 |
2408 if (MainCU) { 2409 EmitDebugPubNamesPerCU(MainCU); 2410 return; 2411 } 2412 2413 for (unsigned i = 0, e = CompileUnits.size(); i != e; ++i) 2414 EmitDebugPubNamesPerCU(CompileUnits[i]); | 2349 EmitDebugPubNamesPerCU(ModuleCU); |
2415} 2416 2417/// EmitDebugStr - Emit visible names into a debug str section. 2418/// 2419void DwarfDebug::EmitDebugStr() { 2420 // Check to see if it is worth the effort. 2421 if (!StringPool.empty()) { 2422 // Start the dwarf str section. --- 93 unchanged lines hidden (view full) --- 2516/// The rest of the entry consists of a {die_offset, low_pc} pair for each 2517/// inlined instance; the die_offset points to the inlined_subroutine die in the 2518/// __debug_info section, and the low_pc is the starting address for the 2519/// inlining instance. 2520void DwarfDebug::EmitDebugInlineInfo() { 2521 if (!TAI->doesDwarfUsesInlineInfoSection()) 2522 return; 2523 | 2350} 2351 2352/// EmitDebugStr - Emit visible names into a debug str section. 2353/// 2354void DwarfDebug::EmitDebugStr() { 2355 // Check to see if it is worth the effort. 2356 if (!StringPool.empty()) { 2357 // Start the dwarf str section. --- 93 unchanged lines hidden (view full) --- 2451/// The rest of the entry consists of a {die_offset, low_pc} pair for each 2452/// inlined instance; the die_offset points to the inlined_subroutine die in the 2453/// __debug_info section, and the low_pc is the starting address for the 2454/// inlining instance. 2455void DwarfDebug::EmitDebugInlineInfo() { 2456 if (!TAI->doesDwarfUsesInlineInfoSection()) 2457 return; 2458 |
2524 if (!MainCU) | 2459 if (!ModuleCU) |
2525 return; 2526 2527 Asm->SwitchToDataSection(TAI->getDwarfDebugInlineSection()); 2528 Asm->EOL(); 2529 EmitDifference("debug_inlined_end", 1, 2530 "debug_inlined_begin", 1, true); 2531 Asm->EOL("Length of Debug Inlined Information Entry"); 2532 --- 17 unchanged lines hidden (view full) --- 2550 Asm->EOL("MIPS linkage name"); 2551 2552 Asm->EmitString(Name); Asm->EOL("Function name"); 2553 2554 Asm->EmitULEB128Bytes(Labels.size()); Asm->EOL("Inline count"); 2555 2556 for (SmallVector<unsigned, 4>::iterator LI = Labels.begin(), 2557 LE = Labels.end(); LI != LE; ++LI) { | 2460 return; 2461 2462 Asm->SwitchToDataSection(TAI->getDwarfDebugInlineSection()); 2463 Asm->EOL(); 2464 EmitDifference("debug_inlined_end", 1, 2465 "debug_inlined_begin", 1, true); 2466 Asm->EOL("Length of Debug Inlined Information Entry"); 2467 --- 17 unchanged lines hidden (view full) --- 2485 Asm->EOL("MIPS linkage name"); 2486 2487 Asm->EmitString(Name); Asm->EOL("Function name"); 2488 2489 Asm->EmitULEB128Bytes(Labels.size()); Asm->EOL("Inline count"); 2490 2491 for (SmallVector<unsigned, 4>::iterator LI = Labels.begin(), 2492 LE = Labels.end(); LI != LE; ++LI) { |
2558 DIE *SP = MainCU->getDieMapSlotFor(GV); | 2493 DIE *SP = ModuleCU->getDieMapSlotFor(GV); |
2559 Asm->EmitInt32(SP->getOffset()); Asm->EOL("DIE offset"); 2560 2561 if (TD->getPointerSize() == sizeof(int32_t)) 2562 O << TAI->getData32bitsDirective(); 2563 else 2564 O << TAI->getData64bitsDirective(); 2565 2566 PrintLabelName("label", *LI); Asm->EOL("low_pc"); 2567 } 2568 } 2569 2570 EmitLabel("debug_inlined_end", 1); 2571 Asm->EOL(); 2572} | 2494 Asm->EmitInt32(SP->getOffset()); Asm->EOL("DIE offset"); 2495 2496 if (TD->getPointerSize() == sizeof(int32_t)) 2497 O << TAI->getData32bitsDirective(); 2498 else 2499 O << TAI->getData64bitsDirective(); 2500 2501 PrintLabelName("label", *LI); Asm->EOL("low_pc"); 2502 } 2503 } 2504 2505 EmitLabel("debug_inlined_end", 1); 2506 Asm->EOL(); 2507} |