DwarfDebug.h revision 01eb99af2f2196241801b12f8ad841a2db346472
1//===-- llvm/CodeGen/DwarfDebug.h - Dwarf Debug Framework ------*- C++ -*--===// 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//===----------------------------------------------------------------------===// 9// 10// This file contains support for writing dwarf debug info into asm files. 11// 12//===----------------------------------------------------------------------===// 13 14#ifndef CODEGEN_ASMPRINTER_DWARFDEBUG_H__ 15#define CODEGEN_ASMPRINTER_DWARFDEBUG_H__ 16 17#include "DIE.h" 18#include "llvm/ADT/DenseMap.h" 19#include "llvm/ADT/FoldingSet.h" 20#include "llvm/ADT/SetVector.h" 21#include "llvm/ADT/SmallPtrSet.h" 22#include "llvm/ADT/StringMap.h" 23#include "llvm/CodeGen/AsmPrinter.h" 24#include "llvm/CodeGen/LexicalScopes.h" 25#include "llvm/DebugInfo.h" 26#include "llvm/MC/MachineLocation.h" 27#include "llvm/Support/Allocator.h" 28#include "llvm/Support/DebugLoc.h" 29 30namespace llvm { 31 32class CompileUnit; 33class ConstantInt; 34class ConstantFP; 35class DbgVariable; 36class MachineFrameInfo; 37class MachineModuleInfo; 38class MachineOperand; 39class MCAsmInfo; 40class DIEAbbrev; 41class DIE; 42class DIEBlock; 43class DIEEntry; 44 45//===----------------------------------------------------------------------===// 46/// \brief This class is used to record source line correspondence. 47class SrcLineInfo { 48 unsigned Line; // Source line number. 49 unsigned Column; // Source column. 50 unsigned SourceID; // Source ID number. 51 MCSymbol *Label; // Label in code ID number. 52public: 53 SrcLineInfo(unsigned L, unsigned C, unsigned S, MCSymbol *label) 54 : Line(L), Column(C), SourceID(S), Label(label) {} 55 56 // Accessors 57 unsigned getLine() const { return Line; } 58 unsigned getColumn() const { return Column; } 59 unsigned getSourceID() const { return SourceID; } 60 MCSymbol *getLabel() const { return Label; } 61}; 62 63/// \brief This struct describes location entries emitted in the .debug_loc 64/// section. 65typedef struct DotDebugLocEntry { 66 const MCSymbol *Begin; 67 const MCSymbol *End; 68 MachineLocation Loc; 69 const MDNode *Variable; 70 bool Merged; 71 bool Constant; 72 enum EntryType { 73 E_Location, 74 E_Integer, 75 E_ConstantFP, 76 E_ConstantInt 77 }; 78 enum EntryType EntryKind; 79 80 union { 81 int64_t Int; 82 const ConstantFP *CFP; 83 const ConstantInt *CIP; 84 } Constants; 85 DotDebugLocEntry() 86 : Begin(0), End(0), Variable(0), Merged(false), 87 Constant(false) { Constants.Int = 0;} 88 DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E, MachineLocation &L, 89 const MDNode *V) 90 : Begin(B), End(E), Loc(L), Variable(V), Merged(false), 91 Constant(false) { Constants.Int = 0; EntryKind = E_Location; } 92 DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E, int64_t i) 93 : Begin(B), End(E), Variable(0), Merged(false), 94 Constant(true) { Constants.Int = i; EntryKind = E_Integer; } 95 DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E, const ConstantFP *FPtr) 96 : Begin(B), End(E), Variable(0), Merged(false), 97 Constant(true) { Constants.CFP = FPtr; EntryKind = E_ConstantFP; } 98 DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E, 99 const ConstantInt *IPtr) 100 : Begin(B), End(E), Variable(0), Merged(false), 101 Constant(true) { Constants.CIP = IPtr; EntryKind = E_ConstantInt; } 102 103 /// \brief Empty entries are also used as a trigger to emit temp label. Such 104 /// labels are referenced is used to find debug_loc offset for a given DIE. 105 bool isEmpty() { return Begin == 0 && End == 0; } 106 bool isMerged() { return Merged; } 107 void Merge(DotDebugLocEntry *Next) { 108 if (!(Begin && Loc == Next->Loc && End == Next->Begin)) 109 return; 110 Next->Begin = Begin; 111 Merged = true; 112 } 113 bool isLocation() const { return EntryKind == E_Location; } 114 bool isInt() const { return EntryKind == E_Integer; } 115 bool isConstantFP() const { return EntryKind == E_ConstantFP; } 116 bool isConstantInt() const { return EntryKind == E_ConstantInt; } 117 int64_t getInt() { return Constants.Int; } 118 const ConstantFP *getConstantFP() { return Constants.CFP; } 119 const ConstantInt *getConstantInt() { return Constants.CIP; } 120} DotDebugLocEntry; 121 122//===----------------------------------------------------------------------===// 123/// \brief This class is used to track local variable information. 124class DbgVariable { 125 DIVariable Var; // Variable Descriptor. 126 DIE *TheDIE; // Variable DIE. 127 unsigned DotDebugLocOffset; // Offset in DotDebugLocEntries. 128 DbgVariable *AbsVar; // Corresponding Abstract variable, if any. 129 const MachineInstr *MInsn; // DBG_VALUE instruction of the variable. 130 int FrameIndex; 131public: 132 // AbsVar may be NULL. 133 DbgVariable(DIVariable V, DbgVariable *AV) 134 : Var(V), TheDIE(0), DotDebugLocOffset(~0U), AbsVar(AV), MInsn(0), 135 FrameIndex(~0) {} 136 137 // Accessors. 138 DIVariable getVariable() const { return Var; } 139 void setDIE(DIE *D) { TheDIE = D; } 140 DIE *getDIE() const { return TheDIE; } 141 void setDotDebugLocOffset(unsigned O) { DotDebugLocOffset = O; } 142 unsigned getDotDebugLocOffset() const { return DotDebugLocOffset; } 143 StringRef getName() const { return Var.getName(); } 144 DbgVariable *getAbstractVariable() const { return AbsVar; } 145 const MachineInstr *getMInsn() const { return MInsn; } 146 void setMInsn(const MachineInstr *M) { MInsn = M; } 147 int getFrameIndex() const { return FrameIndex; } 148 void setFrameIndex(int FI) { FrameIndex = FI; } 149 // Translate tag to proper Dwarf tag. 150 unsigned getTag() const { 151 if (Var.getTag() == dwarf::DW_TAG_arg_variable) 152 return dwarf::DW_TAG_formal_parameter; 153 154 return dwarf::DW_TAG_variable; 155 } 156 /// \brief Return true if DbgVariable is artificial. 157 bool isArtificial() const { 158 if (Var.isArtificial()) 159 return true; 160 if (getType().isArtificial()) 161 return true; 162 return false; 163 } 164 165 bool isObjectPointer() const { 166 if (Var.isObjectPointer()) 167 return true; 168 if (getType().isObjectPointer()) 169 return true; 170 return false; 171 } 172 173 bool variableHasComplexAddress() const { 174 assert(Var.Verify() && "Invalid complex DbgVariable!"); 175 return Var.hasComplexAddress(); 176 } 177 bool isBlockByrefVariable() const { 178 assert(Var.Verify() && "Invalid complex DbgVariable!"); 179 return Var.isBlockByrefVariable(); 180 } 181 unsigned getNumAddrElements() const { 182 assert(Var.Verify() && "Invalid complex DbgVariable!"); 183 return Var.getNumAddrElements(); 184 } 185 uint64_t getAddrElement(unsigned i) const { 186 return Var.getAddrElement(i); 187 } 188 DIType getType() const; 189}; 190 191 192// A String->Symbol mapping of strings used by indirect 193// references. 194typedef StringMap<std::pair<MCSymbol*, unsigned>, 195 BumpPtrAllocator&> StrPool; 196 197// A Symbol->unsigned mapping of addresses used by indirect 198// references. 199typedef DenseMap<const MCExpr *, unsigned> AddrPool; 200 201/// \brief Collects and handles information specific to a particular 202/// collection of units. 203class DwarfUnits { 204 // Target of Dwarf emission, used for sizing of abbreviations. 205 AsmPrinter *Asm; 206 207 // Used to uniquely define abbreviations. 208 FoldingSet<DIEAbbrev> *AbbreviationsSet; 209 210 // A list of all the unique abbreviations in use. 211 std::vector<DIEAbbrev *> *Abbreviations; 212 213 // A pointer to all units in the section. 214 SmallVector<CompileUnit *, 1> CUs; 215 216 // Collection of strings for this unit and assorted symbols. 217 StrPool StringPool; 218 unsigned NextStringPoolNumber; 219 std::string StringPref; 220 221 // Collection of addresses for this unit and assorted labels. 222 AddrPool AddressPool; 223 unsigned NextAddrPoolNumber; 224 225public: 226 DwarfUnits(AsmPrinter *AP, FoldingSet<DIEAbbrev> *AS, 227 std::vector<DIEAbbrev *> *A, const char *Pref, 228 BumpPtrAllocator &DA) : 229 Asm(AP), AbbreviationsSet(AS), Abbreviations(A), 230 StringPool(DA), NextStringPoolNumber(0), StringPref(Pref), 231 AddressPool(), NextAddrPoolNumber(0) {} 232 233 /// \brief Compute the size and offset of a DIE given an incoming Offset. 234 unsigned computeSizeAndOffset(DIE *Die, unsigned Offset); 235 236 /// \brief Compute the size and offset of all the DIEs. 237 void computeSizeAndOffsets(); 238 239 /// \brief Define a unique number for the abbreviation. 240 void assignAbbrevNumber(DIEAbbrev &Abbrev); 241 242 /// \brief Add a unit to the list of CUs. 243 void addUnit(CompileUnit *CU) { CUs.push_back(CU); } 244 245 /// \brief Emit all of the units to the section listed with the given 246 /// abbreviation section. 247 void emitUnits(DwarfDebug *, const MCSection *, const MCSection *, 248 const MCSymbol *); 249 250 /// \brief Emit all of the strings to the section given. 251 void emitStrings(const MCSection *, const MCSection *, const MCSymbol *); 252 253 /// \brief Emit all of the addresses to the section given. 254 void emitAddresses(const MCSection *); 255 256 /// \brief Returns the entry into the start of the pool. 257 MCSymbol *getStringPoolSym(); 258 259 /// \brief Returns an entry into the string pool with the given 260 /// string text. 261 MCSymbol *getStringPoolEntry(StringRef Str); 262 263 /// \brief Returns the index into the string pool with the given 264 /// string text. 265 unsigned getStringPoolIndex(StringRef Str); 266 267 /// \brief Returns the string pool. 268 StrPool *getStringPool() { return &StringPool; } 269 270 /// \brief Returns the index into the address pool with the given 271 /// label/symbol. 272 unsigned getAddrPoolIndex(const MCExpr *); 273 unsigned getAddrPoolIndex(const MCSymbol *); 274 275 /// \brief Returns the address pool. 276 AddrPool *getAddrPool() { return &AddressPool; } 277 278 /// \brief for a given compile unit DIE, returns offset from beginning of 279 /// debug info. 280 unsigned getCUOffset(DIE *Die); 281}; 282 283/// \brief Collects and handles dwarf debug information. 284class DwarfDebug { 285 // Target of Dwarf emission. 286 AsmPrinter *Asm; 287 288 // Collected machine module information. 289 MachineModuleInfo *MMI; 290 291 // All DIEValues are allocated through this allocator. 292 BumpPtrAllocator DIEValueAllocator; 293 294 //===--------------------------------------------------------------------===// 295 // Attribute used to construct specific Dwarf sections. 296 // 297 298 CompileUnit *FirstCU; 299 300 // Maps MDNode with its corresponding CompileUnit. 301 DenseMap <const MDNode *, CompileUnit *> CUMap; 302 303 // Maps subprogram MDNode with its corresponding CompileUnit. 304 DenseMap <const MDNode *, CompileUnit *> SPMap; 305 306 // Used to uniquely define abbreviations. 307 FoldingSet<DIEAbbrev> AbbreviationsSet; 308 309 // A list of all the unique abbreviations in use. 310 std::vector<DIEAbbrev *> Abbreviations; 311 312 // Stores the current file ID for a given compile unit. 313 DenseMap <unsigned, unsigned> FileIDCUMap; 314 // Source id map, i.e. CUID, source filename and directory, 315 // separated by a zero byte, mapped to a unique id. 316 StringMap<unsigned, BumpPtrAllocator&> SourceIdMap; 317 318 // Provides a unique id per text section. 319 SetVector<const MCSection*> SectionMap; 320 321 // List of Arguments (DbgValues) for current function. 322 SmallVector<DbgVariable *, 8> CurrentFnArguments; 323 324 LexicalScopes LScopes; 325 326 // Collection of abstract subprogram DIEs. 327 DenseMap<const MDNode *, DIE *> AbstractSPDies; 328 329 // Collection of dbg variables of a scope. 330 typedef DenseMap<LexicalScope *, 331 SmallVector<DbgVariable *, 8> > ScopeVariablesMap; 332 ScopeVariablesMap ScopeVariables; 333 334 // Collection of abstract variables. 335 DenseMap<const MDNode *, DbgVariable *> AbstractVariables; 336 337 // Collection of DotDebugLocEntry. 338 SmallVector<DotDebugLocEntry, 4> DotDebugLocEntries; 339 340 // Collection of subprogram DIEs that are marked (at the end of the module) 341 // as DW_AT_inline. 342 SmallPtrSet<DIE *, 4> InlinedSubprogramDIEs; 343 344 // Keep track of inlined functions and their location. This 345 // information is used to populate the debug_inlined section. 346 typedef std::pair<const MCSymbol *, DIE *> InlineInfoLabels; 347 typedef DenseMap<const MDNode *, 348 SmallVector<InlineInfoLabels, 4> > InlineInfoMap; 349 InlineInfoMap InlineInfo; 350 SmallVector<const MDNode *, 4> InlinedSPNodes; 351 352 // This is a collection of subprogram MDNodes that are processed to 353 // create DIEs. 354 SmallPtrSet<const MDNode *, 16> ProcessedSPNodes; 355 356 // Maps instruction with label emitted before instruction. 357 DenseMap<const MachineInstr *, MCSymbol *> LabelsBeforeInsn; 358 359 // Maps instruction with label emitted after instruction. 360 DenseMap<const MachineInstr *, MCSymbol *> LabelsAfterInsn; 361 362 // Every user variable mentioned by a DBG_VALUE instruction in order of 363 // appearance. 364 SmallVector<const MDNode*, 8> UserVariables; 365 366 // For each user variable, keep a list of DBG_VALUE instructions in order. 367 // The list can also contain normal instructions that clobber the previous 368 // DBG_VALUE. 369 typedef DenseMap<const MDNode*, SmallVector<const MachineInstr*, 4> > 370 DbgValueHistoryMap; 371 DbgValueHistoryMap DbgValues; 372 373 SmallVector<const MCSymbol *, 8> DebugRangeSymbols; 374 375 // Previous instruction's location information. This is used to determine 376 // label location to indicate scope boundries in dwarf debug info. 377 DebugLoc PrevInstLoc; 378 MCSymbol *PrevLabel; 379 380 // This location indicates end of function prologue and beginning of function 381 // body. 382 DebugLoc PrologEndLoc; 383 384 // Section Symbols: these are assembler temporary labels that are emitted at 385 // the beginning of each supported dwarf section. These are used to form 386 // section offsets and are created by EmitSectionLabels. 387 MCSymbol *DwarfInfoSectionSym, *DwarfAbbrevSectionSym; 388 MCSymbol *DwarfStrSectionSym, *TextSectionSym, *DwarfDebugRangeSectionSym; 389 MCSymbol *DwarfDebugLocSectionSym, *DwarfLineSectionSym, *DwarfAddrSectionSym; 390 MCSymbol *FunctionBeginSym, *FunctionEndSym; 391 MCSymbol *DwarfAbbrevDWOSectionSym, *DwarfStrDWOSectionSym; 392 393 // As an optimization, there is no need to emit an entry in the directory 394 // table for the same directory as DW_AT_comp_dir. 395 StringRef CompilationDir; 396 397 // Counter for assigning globally unique IDs for CUs. 398 unsigned GlobalCUIndexCount; 399 400 // Holder for the file specific debug information. 401 DwarfUnits InfoHolder; 402 403 // Holders for the various debug information flags that we might need to 404 // have exposed. See accessor functions below for description. 405 406 // Whether or not we're emitting info for older versions of gdb on darwin. 407 bool IsDarwinGDBCompat; 408 409 // Holder for imported entities. 410 typedef SmallVector<std::pair<const MDNode *, const MDNode *>, 32> 411 ImportedEntityMap; 412 ImportedEntityMap ScopesWithImportedEntities; 413 414 // DWARF5 Experimental Options 415 bool HasDwarfAccelTables; 416 bool HasSplitDwarf; 417 418 unsigned DwarfVersion; 419 420 // Separated Dwarf Variables 421 // In general these will all be for bits that are left in the 422 // original object file, rather than things that are meant 423 // to be in the .dwo sections. 424 425 // The CUs left in the original object file for separated debug info. 426 SmallVector<CompileUnit *, 1> SkeletonCUs; 427 428 // Used to uniquely define abbreviations for the skeleton emission. 429 FoldingSet<DIEAbbrev> SkeletonAbbrevSet; 430 431 // A list of all the unique abbreviations in use. 432 std::vector<DIEAbbrev *> SkeletonAbbrevs; 433 434 // Holder for the skeleton information. 435 DwarfUnits SkeletonHolder; 436 437private: 438 439 void addScopeVariable(LexicalScope *LS, DbgVariable *Var); 440 441 /// \brief Find abstract variable associated with Var. 442 DbgVariable *findAbstractVariable(DIVariable &Var, DebugLoc Loc); 443 444 /// \brief Find DIE for the given subprogram and attach appropriate 445 /// DW_AT_low_pc and DW_AT_high_pc attributes. If there are global 446 /// variables in this scope then create and insert DIEs for these 447 /// variables. 448 DIE *updateSubprogramScopeDIE(CompileUnit *SPCU, const MDNode *SPNode); 449 450 /// \brief Construct new DW_TAG_lexical_block for this scope and 451 /// attach DW_AT_low_pc/DW_AT_high_pc labels. 452 DIE *constructLexicalScopeDIE(CompileUnit *TheCU, LexicalScope *Scope); 453 454 /// \brief This scope represents inlined body of a function. Construct 455 /// DIE to represent this concrete inlined copy of the function. 456 DIE *constructInlinedScopeDIE(CompileUnit *TheCU, LexicalScope *Scope); 457 458 /// \brief Construct a DIE for this scope. 459 DIE *constructScopeDIE(CompileUnit *TheCU, LexicalScope *Scope); 460 461 /// \brief Emit initial Dwarf sections with a label at the start of each one. 462 void emitSectionLabels(); 463 464 /// \brief Compute the size and offset of a DIE given an incoming Offset. 465 unsigned computeSizeAndOffset(DIE *Die, unsigned Offset); 466 467 /// \brief Compute the size and offset of all the DIEs. 468 void computeSizeAndOffsets(); 469 470 /// \brief Attach DW_AT_inline attribute with inlined subprogram DIEs. 471 void computeInlinedDIEs(); 472 473 /// \brief Collect info for variables that were optimized out. 474 void collectDeadVariables(); 475 476 /// \brief Finish off debug information after all functions have been 477 /// processed. 478 void finalizeModuleInfo(); 479 480 /// \brief Emit labels to close any remaining sections that have been left 481 /// open. 482 void endSections(); 483 484 /// \brief Emit a set of abbreviations to the specific section. 485 void emitAbbrevs(const MCSection *, std::vector<DIEAbbrev*> *); 486 487 /// \brief Emit the debug info section. 488 void emitDebugInfo(); 489 490 /// \brief Emit the abbreviation section. 491 void emitAbbreviations(); 492 493 /// \brief Emit the last address of the section and the end of 494 /// the line matrix. 495 void emitEndOfLineMatrix(unsigned SectionEnd); 496 497 /// \brief Emit visible names into a hashed accelerator table section. 498 void emitAccelNames(); 499 500 /// \brief Emit objective C classes and categories into a hashed 501 /// accelerator table section. 502 void emitAccelObjC(); 503 504 /// \brief Emit namespace dies into a hashed accelerator table. 505 void emitAccelNamespaces(); 506 507 /// \brief Emit type dies into a hashed accelerator table. 508 void emitAccelTypes(); 509 510 /// \brief Emit visible names into a debug pubnames section. 511 void emitDebugPubnames(); 512 513 /// \brief Emit visible types into a debug pubtypes section. 514 void emitDebugPubTypes(); 515 516 /// \brief Emit visible names into a debug str section. 517 void emitDebugStr(); 518 519 /// \brief Emit visible names into a debug loc section. 520 void emitDebugLoc(); 521 522 /// \brief Emit visible names into a debug aranges section. 523 void emitDebugARanges(); 524 525 /// \brief Emit visible names into a debug ranges section. 526 void emitDebugRanges(); 527 528 /// \brief Emit visible names into a debug macinfo section. 529 void emitDebugMacInfo(); 530 531 /// \brief Emit inline info using custom format. 532 void emitDebugInlineInfo(); 533 534 /// DWARF 5 Experimental Split Dwarf Emitters 535 536 /// \brief Construct the split debug info compile unit for the debug info 537 /// section. 538 CompileUnit *constructSkeletonCU(const MDNode *); 539 540 /// \brief Emit the local split abbreviations. 541 void emitSkeletonAbbrevs(const MCSection *); 542 543 /// \brief Emit the debug info dwo section. 544 void emitDebugInfoDWO(); 545 546 /// \brief Emit the debug abbrev dwo section. 547 void emitDebugAbbrevDWO(); 548 549 /// \brief Emit the debug str dwo section. 550 void emitDebugStrDWO(); 551 552 /// \brief Create new CompileUnit for the given metadata node with tag 553 /// DW_TAG_compile_unit. 554 CompileUnit *constructCompileUnit(const MDNode *N); 555 556 /// \brief Construct subprogram DIE. 557 void constructSubprogramDIE(CompileUnit *TheCU, const MDNode *N); 558 559 /// \brief Construct imported_module or imported_declaration DIE. 560 void constructImportedEntityDIE(CompileUnit *TheCU, const MDNode *N); 561 562 /// \brief Construct import_module DIE. 563 void constructImportedEntityDIE(CompileUnit *TheCU, const MDNode *N, 564 DIE *Context); 565 566 /// \brief Construct import_module DIE. 567 void constructImportedEntityDIE(CompileUnit *TheCU, 568 const DIImportedEntity &Module, 569 DIE *Context); 570 571 /// \brief Register a source line with debug info. Returns the unique 572 /// label that was emitted and which provides correspondence to the 573 /// source line list. 574 void recordSourceLine(unsigned Line, unsigned Col, const MDNode *Scope, 575 unsigned Flags); 576 577 /// \brief Indentify instructions that are marking the beginning of or 578 /// ending of a scope. 579 void identifyScopeMarkers(); 580 581 /// \brief If Var is an current function argument that add it in 582 /// CurrentFnArguments list. 583 bool addCurrentFnArgument(const MachineFunction *MF, 584 DbgVariable *Var, LexicalScope *Scope); 585 586 /// \brief Populate LexicalScope entries with variables' info. 587 void collectVariableInfo(const MachineFunction *, 588 SmallPtrSet<const MDNode *, 16> &ProcessedVars); 589 590 /// \brief Collect variable information from the side table maintained 591 /// by MMI. 592 void collectVariableInfoFromMMITable(const MachineFunction * MF, 593 SmallPtrSet<const MDNode *, 16> &P); 594 595 /// \brief Ensure that a label will be emitted before MI. 596 void requestLabelBeforeInsn(const MachineInstr *MI) { 597 LabelsBeforeInsn.insert(std::make_pair(MI, (MCSymbol*)0)); 598 } 599 600 /// \brief Return Label preceding the instruction. 601 MCSymbol *getLabelBeforeInsn(const MachineInstr *MI); 602 603 /// \brief Ensure that a label will be emitted after MI. 604 void requestLabelAfterInsn(const MachineInstr *MI) { 605 LabelsAfterInsn.insert(std::make_pair(MI, (MCSymbol*)0)); 606 } 607 608 /// \brief Return Label immediately following the instruction. 609 MCSymbol *getLabelAfterInsn(const MachineInstr *MI); 610 611public: 612 //===--------------------------------------------------------------------===// 613 // Main entry points. 614 // 615 DwarfDebug(AsmPrinter *A, Module *M); 616 ~DwarfDebug(); 617 618 /// \brief Emit all Dwarf sections that should come prior to the 619 /// content. 620 void beginModule(); 621 622 /// \brief Emit all Dwarf sections that should come after the content. 623 void endModule(); 624 625 /// \brief Gather pre-function debug information. 626 void beginFunction(const MachineFunction *MF); 627 628 /// \brief Gather and emit post-function debug information. 629 void endFunction(const MachineFunction *MF); 630 631 /// \brief Process beginning of an instruction. 632 void beginInstruction(const MachineInstr *MI); 633 634 /// \brief Process end of an instruction. 635 void endInstruction(const MachineInstr *MI); 636 637 /// \brief Look up the source id with the given directory and source file 638 /// names. If none currently exists, create a new id and insert it in the 639 /// SourceIds map. 640 unsigned getOrCreateSourceID(StringRef DirName, StringRef FullName, 641 unsigned CUID); 642 643 /// \brief Recursively Emits a debug information entry. 644 void emitDIE(DIE *Die, std::vector<DIEAbbrev *> *Abbrevs); 645 646 /// \brief Returns whether or not to limit some of our debug 647 /// output to the limitations of darwin gdb. 648 bool useDarwinGDBCompat() { return IsDarwinGDBCompat; } 649 650 // Experimental DWARF5 features. 651 652 /// \brief Returns whether or not to emit tables that dwarf consumers can 653 /// use to accelerate lookup. 654 bool useDwarfAccelTables() { return HasDwarfAccelTables; } 655 656 /// \brief Returns whether or not to change the current debug info for the 657 /// split dwarf proposal support. 658 bool useSplitDwarf() { return HasSplitDwarf; } 659 660 /// Returns the Dwarf Version. 661 unsigned getDwarfVersion() const { return DwarfVersion; } 662}; 663} // End of namespace llvm 664 665#endif 666