summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert r360876 "[Object] Change object::SectionRef::getContents() to return ↵Hans Wennborg2019-05-163-18/+9
| | | | | | | | | | | | Expected<StringRef>" It broke the Clang build, see llvm-commits thread. > Expected<ArrayRef<uint8_t>> may be better but use Expected<StringRef> for now. > > Follow-up of D61781. llvm-svn: 360878
* [Object] Change object::SectionRef::getContents() to return Expected<StringRef>Fangrui Song2019-05-163-9/+18
| | | | | | | | Expected<ArrayRef<uint8_t>> may be better but use Expected<StringRef> for now. Follow-up of D61781. llvm-svn: 360876
* [codeview] Finish support for reading and writing S_ANNOTATION recordsReid Kleckner2019-05-152-0/+24
| | | | | | Implement dumping via llvm-pdbutil and llvm-readobj. llvm-svn: 360813
* DebugInfo: Only move types out of type units if they're named or type unitedDavid Blaikie2019-05-102-5/+13
| | | | | | | | | | | | | | | | | | Follow up to r359122, after a bug was reported in it - the original change too aggressively tried to move related types out of type units, which included unnamed types (like array types) which can't reasonably be declared-but-not-defined. A step beyond that is that some types in type units can be anonymous, if they are types with a name for linkage purposes (eg: "typedef struct { } x;"). So ensure those don't get turned into plain declarations (without signatures) because, lacking names, they can't be resolved to the definition. [Also include a fix for llvm-dwarfdump/libDebugInfoDWARF to pretty print types in type units] llvm-svn: 360458
* DebugInfo/DWARF: Minor expression simplificationDavid Blaikie2019-05-091-1/+1
| | | | llvm-svn: 360377
* [DebugInfo] Fix use-after-move warning. NFCI.Simon Pilgrim2019-05-081-1/+1
| | | | | | Don't rely on DWARFAbbreviationDeclarationSet::extract cleaning the struct up for reuse - the analyzers don't like it. llvm-svn: 360235
* DWARF v5: fix directory index in the line tableFangrui Song2019-05-061-12/+16
| | | | | | | | | | | | | | Summary: Prior to DWARF v5, a directory index of 0 represents DW_AT_comp_dir. In DWARF v5, the index starts with 0 and Entry.DirIdx is the index into Prologue.IncludeDirectories. Reviewed By: labath Differential Revision: https://reviews.llvm.org/D61253 llvm-svn: 360015
* [PDB] Fix hash function used to write /src/headerblockNico Weber2019-04-292-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | lld-link used to write PDB files that DIA couldn't recover natvis files from if: - The global strings table was > 64kiB - There were at least 3 natvis files The cause was that the hash function for the /src/headerblock stream was incorrect: It needs to be truncated to 16 bit. If the global strings table was <= 64kiB, truncating to 16 bit is a no-op, so this wasn't needed for small programs. If there are only 1 or 2 natvis files, then the growth strategy in HashTable::grow() would mean the hash table would have 2 buckets (for 1 natvis file) or 4 buckets (for 4 natvis files), and since the hash function is used modulo number of buckets, and since 2 and 4 divide 0x10000, the missing `% 0x10000` is a no-op there too. For 3 natvis files, the hash table grows to 6 buckets, which has a factor that's not common with 0x10000 and the difference starts to matter. Fixes PR41626. Differential Revision: https://reviews.llvm.org/D61277 llvm-svn: 359515
* [DWARF] Fix dump of local/foreign TU lists in .debug_namesFangrui Song2019-04-291-2/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D61241 llvm-svn: 359425
* [DWARF] Delete a redundant check in getFileNameByIndex()Fangrui Song2019-04-291-2/+1
| | | | llvm-svn: 359422
* s/Dwarf 5/DWARF v5/ NFCFangrui Song2019-04-261-1/+1
| | | | llvm-svn: 359307
* Use llvm::stable_sortFangrui Song2019-04-231-2/+1
| | | | | | While touching the code, simplify if feasible. llvm-svn: 358996
* [llvm-symbolizer] Fix section index at the end of a sectionFangrui Song2019-04-201-2/+1
| | | | | | | | This is very minor issue. The returned section index is only used by DWARFDebugLine as an llvm::upper_bound input and the use case shouldn't cause any behavioral change. llvm-svn: 358814
* [DWARF] Use hasFileAtIndex to properly verify DWARF 5 after rL358732Fangrui Song2019-04-191-3/+5
| | | | llvm-svn: 358734
* [llvm] Prevent duplicate files in debug line header in dwarf 5: another attemptAli Tamur2019-04-191-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Another attempt to land the changes in debug line header to prevent duplicate files in Dwarf 5. I rolled back my previous commit because of a mistake in generating the object file in a test. Meanwhile, I addressed some offline comments and changed the implementation; the largest difference is that MCDwarfLineTableHeader does not keep DwarfVersion but gets it as a parameter. I also merged the patch to fix two lld tests that will strt to fail into this patch. Original Commit: https://reviews.llvm.org/D59515 Original Message: Motivation: In previous dwarf versions, file name indexes started from 1, and the primary source file was not explicit. Dwarf 5 standard (6.2.4) prescribes the primary source file to be explicitly given an entry with an index number 0. The current implementation honors the specification by just duplicating the main source file, once with index number 0, and later maybe with another index number. While this is compliant with the letter of the standard, the duplication causes problems for consumers of this information such as lldb. (Some files are duplicated, where only some of them have a line table although all refer to the same file) With this change, dwarf 5 debug line section files always start from 0, and the zeroth entry is not duplicated whenever possible. This requires different handling of dwarf 4 and dwarf 5 during generation (e.g. when a function returns an index zero for a file name, it signals an error in dwarf 4, but not in dwarf 5) However, I think the minor complication is worth it, because it enables all consumers (lldb, gdb, dwarfdump, objdump, and so on) to treat all files in the file name list homogenously. llvm-svn: 358732
* [DWARF] llvm::Error -> Error. NFCFangrui Song2019-04-171-4/+5
| | | | | | The unqualified name is more common and is used in the file as well. llvm-svn: 358567
* Change some llvm::{lower,upper}_bound to llvm::bsearch. NFCFangrui Song2019-04-173-13/+8
| | | | llvm-svn: 358564
* [DWARF] Pass ReferenceToDIEOffsets elements by referenceFangrui Song2019-04-171-3/+3
| | | | llvm-svn: 358558
* [DWARF] Fix DWARFVerifier::DieRangeInfo::containsFangrui Song2019-04-151-19/+18
| | | | | | | | | It didn't handle empty LHS correctly. If two ranges of LHS were contiguous and jointly contained one range of RHS, it could also be incorrect. DWARFAddressRange::contains can be removed and its tests can be merged into DWARFVerifier::DieRangeInfo::contains llvm-svn: 358387
* [DWARF] Fix DWARFVerifier::DieRangeInfo::intersectsFangrui Song2019-04-151-16/+9
| | | | | | It was incorrect if RHS had more than 1 ranges and one of the ranges interacted with *this llvm-svn: 358376
* [DWARF] Make DWARFDebugLine::ParsingState::RowNumber a local variableFangrui Song2019-04-151-2/+2
| | | | llvm-svn: 358374
* Use llvm::lower_bound. NFCFangrui Song2019-04-121-4/+4
| | | | | | This reapplies rL358161. That commit inadvertently reverted an exegesis file to an old version. llvm-svn: 358246
* Revert "Use llvm::lower_bound. NFC"Ali Tamur2019-04-111-4/+4
| | | | | | | | | This reverts commit rL358161. This patch have broken the test: llvm/test/tools/llvm-exegesis/X86/uops-CMOV16rm-noreg.s llvm-svn: 358199
* Use llvm::lower_bound. NFCFangrui Song2019-04-111-4/+4
| | | | llvm-svn: 358161
* [DWARF] Set discriminator to 0 for DW_LNS_copyFangrui Song2019-04-111-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Make DW_LNS_copy set the discriminator register to 0, to conform to DWARF 4 & 5: "Then it sets the discriminator register to 0, and sets the basic_block, prologue_end and epilogue_begin registers to false." Because all of DW_LNE_end_sequence, DN_LNS_copy, and special opcodes reset discriminator to 0, we can move discriminator=0 to appendRowToMatrix. Also, make DW_LNS_copy print before appending the row, as it is similar to a address+=0,line+=0 special opcode, which prints before appending the row. Reviewers: dblaikie, probinson, aprantl Reviewed By: dblaikie Subscribers: danielcdh, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60364 llvm-svn: 358148
* [DWARF] Simplify LineTable::findRowInSeqFangrui Song2019-04-101-35/+11
| | | | | | | | | | | | | | We want the last row whose address is less than or equal to Address. This can be computed as upper_bound - 1, which is simpler than lower_bound followed by skipping equal rows in a loop. Since FirstRow (LowPC) does not satisfy the predicate (OrderByAddress) while LastRow-1 (HighPC) satisfies the predicate. We can decrease the search range by two, i.e. upper_bound [FirstRow,LastRow) = upper_bound [FirstRow+1,LastRow-1) llvm-svn: 358053
* [DWARF] DWARFDebugLine: replace Sequence::orderByLowPC with orderByHighPCFangrui Song2019-04-091-32/+10
| | | | | | | In a sorted list of non-overlapping [LowPC,HighPC) ranges, locating an address with upper_bound on HighPC is simpler than lower_bound on LowPC. llvm-svn: 358012
* Use llvm::crc32 instead of crc32. NFCEugene Leviant2019-04-081-1/+1
| | | | llvm-svn: 357911
* Attempt to recommit r357901Eugene Leviant2019-04-081-1/+2
| | | | llvm-svn: 357905
* Reverting r357901 as fails to build on some of the buildbotsEugene Leviant2019-04-081-2/+1
| | | | llvm-svn: 357902
* [Support] Add zlib independent CRC32Eugene Leviant2019-04-081-1/+2
| | | | | | Differential revision: https://reviews.llvm.org/D59816 llvm-svn: 357901
* [DWARF] DWARFDebugLine: delete unused parameter `Offset`Fangrui Song2019-04-071-4/+4
| | | | llvm-svn: 357866
* Change some StringRef::data() reinterpret_cast to bytes_begin() or ↵Fangrui Song2019-04-071-1/+1
| | | | | | arrayRefFromStringRef() llvm-svn: 357852
* [DWARF] Simplify DWARFDebugAranges::findAddressFangrui Song2019-04-061-15/+6
| | | | | | | | The current lower_bound approach has to check two iterators pos and pos-1. Changing it to upper_bound allows us to check one iterator (similar to DWARFUnitVector::getUnitFor*). llvm-svn: 357834
* [Symbolize] Uniquify sorted vector<pair<SymbolDesc, StringRef>>Fangrui Song2019-04-062-10/+16
| | | | llvm-svn: 357833
* [Symbolize] Replace map<SymbolDesc, StringRef> with sorted vectorFangrui Song2019-04-052-10/+19
| | | | llvm-svn: 357758
* [Symbolize] Keep SymbolDescs with the same address and improve ↵Fangrui Song2019-04-042-3/+6
| | | | | | | | getNameFromSymbolTable heuristic I'll follow up with better heuristics or tests. llvm-svn: 357683
* [llvm-symbolizer] Add `--output-style` switch.Igor Kudrin2019-04-041-1/+4
| | | | | | | | | | | | | In general, llvm-symbolizer follows the output style of GNU's addr2line. However, there are still some differences; in particular, for a requested address, llvm-symbolizer prints line and column, while addr2line prints only the line number. This patch adds a new switch to select the preferred style. Differential Revision: https://reviews.llvm.org/D60190 llvm-svn: 357675
* [codeview] Remove Type member from CVRecordReid Kleckner2019-04-0412-67/+33
| | | | | | | | | | | | | | | | | Summary: Now CVType and CVSymbol are effectively type-safe wrappers around ArrayRef<uint8_t>. Make the kind() accessor load it from the RecordPrefix, which is the same for types and symbols. Reviewers: zturner, aganea Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60018 llvm-svn: 357658
* [dwarfdump] Remove bogus verifier errorJonas Devlieghere2019-04-031-11/+1
| | | | | | | | The standard doesn't require a DW_TAG_variable, DW_TAG_formal_parameter or DW_TAG_constant to A DW_AT_type attribute describing the type of the variable. It only specifies that it *can* have one. llvm-svn: 357628
* [DWARF] check whether the DIE is valid before querying for informationPaul Semel2019-04-031-0/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D60147 llvm-svn: 357607
* Delay initialization of three static global maps, NFCReid Kleckner2019-03-281-56/+55
| | | | | | | This avoids allocating a few KB of heap memory on startup, and instead allocates these maps lazily. I noticed this while profiling LLD. llvm-svn: 357192
* [DWARF] Add D to Seen early to avoid duplicate elements in WorklistFangrui Song2019-03-271-7/+5
| | | | llvm-svn: 357054
* [DWARF] Simplify DWARFVerifier::handleDebugAbbrev. NFCFangrui Song2019-03-271-10/+3
| | | | llvm-svn: 357053
* Revert "[llvm] Reapply "Prevent duplicate files in debug line header in ↵Ali Tamur2019-03-261-17/+3
| | | | | | | | | | | | | dwarf 5."" This reverts commit rL357020. The commit broke the test llvm/test/tools/llvm-objdump/embedded-source.test on some builds including clang-ppc64be-linux-multistage, clang-s390x-linux, clang-with-lto-ubuntu, clang-x64-windows-msvc, llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast (and others). llvm-svn: 357026
* [llvm] Reapply "Prevent duplicate files in debug line header in dwarf 5."Ali Tamur2019-03-261-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reapply rL356941 after regenerating the object file in the failing test llvm/test/tools/llvm-objdump/embedded-source.test from source. Original commit message: [llvm] Prevent duplicate files in debug line header in dwarf 5. Motivation: In previous dwarf versions, file name indexes started from 1, and the primary source file was not explicit. Dwarf 5 standard (6.2.4) prescribes the primary source file to be explicitly given an entry with an index number 0. The current implementation honors the specification by just duplicating the main source file, once with index number 0, and later maybe with another index number. While this is compliant with the letter of the standard, the duplication causes problems for consumers of this information such as lldb. (Some files are duplicated, where only some of them have a line table although all refer to the same file) With this change, dwarf 5 debug line section files always start from 0, and the zeroth entry is not duplicated whenever possible. This requires different handling of dwarf 4 and dwarf 5 during generation (e.g. when a function returns an index zero for a file name, it signals an error in dwarf 4, but not in dwarf 5) However, I think the minor complication is worth it, because it enables all consumers (lldb, gdb, dwarfdump, objdump, and so on) to treat all files in the file name list homogenously. Tags: #llvm, #debug-info Differential Revision: https://reviews.llvm.org/D59515 llvm-svn: 357018
* Revert "[llvm] Prevent duplicate files in debug line header in dwarf 5."Ali Tamur2019-03-251-17/+3
| | | | | | | | This reverts commit 312ab05887d0e2caa29aaf843cefe39379a98d36. My commit broke the build; I will revert and find out what happened. llvm-svn: 356951
* [llvm] Prevent duplicate files in debug line header in dwarf 5.Ali Tamur2019-03-251-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Motivation: In previous dwarf versions, file name indexes started from 1, and the primary source file was not explicit. Dwarf 5 standard (6.2.4) prescribes the primary source file to be explicitly given an entry with an index number 0. The current implementation honors the specification by just duplicating the main source file, once with index number 0, and later maybe with another index number. While this is compliant with the letter of the standard, the duplication causes problems for consumers of this information such as lldb. (Some files are duplicated, where only some of them have a line table although all refer to the same file) With this change, dwarf 5 debug line section files always start from 0, and the zeroth entry is not duplicated whenever possible. This requires different handling of dwarf 4 and dwarf 5 during generation (e.g. when a function returns an index zero for a file name, it signals an error in dwarf 4, but not in dwarf 5) However, I think the minor complication is worth it, because it enables all consumers (lldb, gdb, dwarfdump, objdump, and so on) to treat all files in the file name list homogenously. Reviewers: dblaikie, probinson, aprantl, espindola Reviewed By: probinson Subscribers: emaste, jvesely, nhaehnle, aprantl, javed.absar, arichardson, hiraditya, MaskRay, rupprecht, jdoerfert, llvm-commits Tags: #llvm, #debug-info Differential Revision: https://reviews.llvm.org/D59515 llvm-svn: 356941
* [DWARF] Delete a stray break and a stray comment. NFCFangrui Song2019-03-231-2/+1
| | | | llvm-svn: 356838
* [DebugInfo] follow up for "add SectionedAddress to DebugInfo interfaces"Alexey Lapshin2019-03-232-0/+29
| | | | | | | | | | | | | | | | | | | | | | | [Symbolizer] Add getModuleSectionIndexForAddress() helper routine The https://reviews.llvm.org/D58194 patch changed symbolizer interface. Particularily it requires not only Address but SectionIndex also. Note object::SectionedAddress parameter: Expected<DILineInfo> symbolizeCode(const std::string &ModuleName, object::SectionedAddress ModuleOffset, StringRef DWPName = ""); There are callers of symbolizer which do not know particular section index. That patch creates getModuleSectionIndexForAddress() routine which will detect section index for the specified address. Thus if caller set ModuleOffset.SectionIndex into object::SectionedAddress::UndefSection state then symbolizer would detect section index using getModuleSectionIndexForAddress routine. Differential Revision: https://reviews.llvm.org/D58848 llvm-svn: 356829
OpenPOWER on IntegriCloud