summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert 218406 - Refactor the RelocVisitor::visit methodRenato Golin2014-09-241-1/+1
| | | | llvm-svn: 218416
* Refactor the RelocVisitor::visit methodRenato Golin2014-09-241-1/+1
| | | | | | | | | | | | | | | | | | This change replaces the brittle if/else chain of string comparisons with a switch statement on the detected target triple, removing the need for testing arbitrary architecture names returned from getFileFormatName, whose primary purpose seems to be for display (user-interface) purposes. The visitor now takes a reference to the object file, rather than its arbitrary file format name to figure out whether the file is a 32 or 64-bit object file and what the detected target triple is. A set of tests have been added to help show that the refactoring processes relocations for the same targets as the original code. Patch by Charlie Turner. llvm-svn: 218406
* Revert "Refactor the RelocVisitor::visit method"Kaelyn Takata2014-09-241-1/+1
| | | | | | | | | This reverts commit faac033f7364bb4226e22c8079c221c96af10d02. The test depends on all targets to be enabled in llc in order to pass, and needs to be rewritten/refactored to not have that dependency. llvm-svn: 218393
* Refactor the RelocVisitor::visit methodRenato Golin2014-09-241-1/+1
| | | | | | | | | | | | | | | | | | This change replaces the brittle if/else chain of string comparisons with a switch statement on the detected target triple, removing the need for testing arbitrary architecture names returned from getFileFormatName, whose primary purpose seems to be for display (user-interface) purposes. The visitor now takes a reference to the object file, rather than its arbitrary file format name to figure out whether the file is a 32 or 64-bit object file and what the detected target triple is. A set of tests have been added to help show that the refactoring processes relocations for the same targets as the original code. Patch by Charlie Turner. llvm-svn: 218388
* [dwarfdump] Dump full filenames as DW_AT_(decl|call)_file attribute valuesFrederic Riss2014-09-222-5/+15
| | | | | | | | | | Reviewers: dblaikie samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5192 llvm-svn: 218246
* Allow DWARFDebugInfoEntryMinimal::getSubroutineName to resolve cross-unit ↵Frederic Riss2014-09-221-4/+16
| | | | | | | | | | | | | | references. Summary: getSubroutineName is currently only used by llvm-symbolizer, thus add a binary test containing a cross-cu inlining example. Reviewers: samsonov, dblaikie Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5394 llvm-svn: 218245
* Turn local DWARFContext helpers getFileNameForUnit() and ↵Frederic Riss2014-09-193-58/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | getFileLineInfoForCompileUnit() into full-blowm DWARFDebugLine::LineTable methods. Summary: getFileNameForUnit() is basically a wrapper around LineTable::getFileNameByIndex(). Fold its additional functionality (adding the DWARFUnit compilation dir) into LineTable::getFileNameByIndex(). getFileLineInfoForCompileUnit() is a wrapper around getFileNameForUnit(). As a function to search the line information by address, it seems natural to put it in the LineTable also. Before this commit only the Context with its private helpers could do Linetable lookups. This newly exposed feature will be used by the DIE dumping code to get access to file information referenced in DIE attributes. This commit has already been partly reviewed in D5192 and contained an additional and a bit controversial 'realpath' call that is left out of this patch. We can reinstate that realpath code later if it is desirable. Test Plan: The patch contains no tests as it should be functionally equivalent to the previous code. As requested in the last review, I checked if the relative path handling copied from the Context to LineTable::getFileNameByIndex() was covered, and indeed the symbolizer tests fail if it is removed. Reviewers: dblaikie, echristo, aprantl, samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5354 llvm-svn: 218125
* Fix DWARFUnitSection::getUnitForOffset().Frederic Riss2014-09-181-10/+2
| | | | | | | | | | | | | | | | | | | | | The current code is only able to return the right unit if the passed offset is the exact offset of a section. Generalize the search function by comparing againt the offset of the next unit instead and by switching the search algorithm to upper_bound. This way, the unit returned is the first unit with a getNextUnitOffset() strictly greater than the searched offset, which is exactly what we want. Note that there is no need for testing the range of the resulting unit as the offsets of a DWARFUnitSection are in a single contiguous range from 0 inclusive to lastUnit->getNextUnitOffset() exclusive. Reviewers: dblaikie samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5262 llvm-svn: 218040
* Make DWARFUnitSection final and change base class to non-virtual protected ↵Frederic Riss2014-09-161-3/+4
| | | | | | | | destructor. As per dblaikie suggestion. llvm-svn: 217871
* Fix a non-virtual destructor warning introduced in r217747.Frederic Riss2014-09-151-0/+2
| | | | llvm-svn: 217756
* Fix ambiguous typedef introduced in r217747.Frederic Riss2014-09-151-2/+2
| | | | | | | | Use fully qualified name inside a typedef from llvm::iterator_range<...> to iterator_range. This is reported (rightly I think) by GCC as an ambiguous name redefinition. Hope this fixes the buildbots. llvm-svn: 217751
* Introduce the DWARFUnitSection abstraction.Frederic Riss2014-09-156-44/+69
| | | | | | | | | | | | | | | | | | A DWARFUnitSection is the collection of Units that have been extracted from the same debug section. By embeding a reference to their DWARFUnitSection in each unit, the DIEs will be able to resolve inter-unit references by interrogating their Unit's DWARFUnitSection. This is a minimal patch where the DWARFUnitSection is-a SmallVector of Units, thus exposing exactly the same interface as before. Followup-up patches might change from inheritance to composition in order to expose only the wanted DWARFUnitSection abstraction. Differential Revision: http://reviews.llvm.org/D5310 llvm-svn: 217747
* [DWARF parser] Fix nasty memory corruption in .dwo files handling.Alexey Samsonov2014-09-052-13/+11
| | | | | | | Forge a test case where llvm-symbolizer has to use external .dwo file to produce the inlining information. llvm-svn: 217270
* [dwarfdump] Dump DW_AT_(decl|call)_line attribute values as decimal values.Frederic Riss2014-09-051-0/+2
| | | | llvm-svn: 217232
* [ dwarfdump ] Add symbolic dump of known DWARF attribute values.Frederic Riss2014-09-041-1/+11
| | | | | | | | | | Reviewed By: dblaikie Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5187 llvm-svn: 217186
* Fix build faliure introduced by r217129.Frederic Riss2014-09-041-2/+2
| | | | | | Looks like one can't put 'const uint8_t' as ArrayRef contained type. It fails to build with libstdc++. llvm-svn: 217132
* Rename DWARFContext::getLineTableForCompileUnit to getLineTableForUnit.Frederic Riss2014-09-042-19/+18
| | | | | | | All DWARFUnits can have line information. Rename and change arguments' type accordingly. llvm-svn: 217130
* Add DWARFFormValue::getAsBlock() and add FC_Flag as an acceptable class for ↵Frederic Riss2014-09-041-1/+9
| | | | | | | | an unsigned constant. To be used in further patches that improve the dumpers. llvm-svn: 217129
* Add a DWARFContext& member in DWARFUnit.Frederic Riss2014-09-045-24/+29
| | | | | | | | | | The DWARFContext will be used to pass global 'context' down, like pointers to related debug info sections or command line options. The first use will be for the debug_info dumper to be able to access other debug info section to dump eg. Location Expression inline in the debug_info dump. llvm-svn: 217128
* Don't own the buffer in object::Binary.Rafael Espindola2014-08-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Owning the buffer is somewhat inflexible. Some Binaries have sub Binaries (like Archive) and we had to create dummy buffers just to handle that. It is also a bad fit for IRObjectFile where the Module wants to own the buffer too. Keeping this ownership would make supporting IR inside native objects particularly painful. This patch focuses in lib/Object. If something elsewhere used to own an Binary, now it also owns a MemoryBuffer. This patch introduces a few new types. * MemoryBufferRef. This is just a pair of StringRefs for the data and name. This is to MemoryBuffer as StringRef is to std::string. * OwningBinary. A combination of Binary and a MemoryBuffer. This is needed for convenience functions that take a filename and return both the buffer and the Binary using that buffer. The C api now uses OwningBinary to avoid any change in semantics. I will start a new thread to see if we want to change it and how. llvm-svn: 216002
* Canonicalize header guards into a common format.Benjamin Kramer2014-08-1314-29/+29
| | | | | | | | | | Add header guards to files that were missing guards. Remove #endif comments as they don't seem common in LLVM (we can easily add them back if we decide they're useful) Changes made by clang-tidy with minor tweaks. llvm-svn: 215558
* DWOHolder takes ownership of the argument constructor, use std::unique_ptr.Rafael Espindola2014-07-312-5/+6
| | | | | | Thanks to David Blaikie for noticing it. llvm-svn: 214434
* Use a reference instead of a pointer.Rafael Espindola2014-07-314-10/+10
| | | | | | This makes using a std::unique_ptr in the caller more convenient. llvm-svn: 214433
* Use std::unique_ptr to make the ownership explicit.Rafael Espindola2014-07-311-2/+2
| | | | llvm-svn: 214377
* Revert "Introduce a string_ostream string builder facilty"Alp Toker2014-06-261-3/+4
| | | | | | Temporarily back out commits r211749, r211752 and r211754. llvm-svn: 211814
* Introduce a string_ostream string builder faciltyAlp Toker2014-06-261-4/+3
| | | | | | | | | | | | | | | | | | | | string_ostream is a safe and efficient string builder that combines opaque stack storage with a built-in ostream interface. small_string_ostream<bytes> additionally permits an explicit stack storage size other than the default 128 bytes to be provided. Beyond that, storage is transferred to the heap. This convenient class can be used in most places an std::string+raw_string_ostream pair or SmallString<>+raw_svector_ostream pair would previously have been used, in order to guarantee consistent access without byte truncation. The patch also converts much of LLVM to use the new facility. These changes include several probable bug fixes for truncated output, a programming error that's no longer possible with the new interface. llvm-svn: 211749
* [DWARF parser] Use distinction between DW_AT_ranges_base and ↵Alexey Samsonov2014-06-133-8/+17
| | | | | | DW_AT_GNU_ranges_base instead of DWARF version llvm-svn: 210945
* Remove 'using std::errro_code' from lib.Rafael Espindola2014-06-131-2/+1
| | | | llvm-svn: 210871
* [DWARF parser] Fix broken address ranges construction.Alexey Samsonov2014-06-122-60/+56
| | | | | | | | | | | | | | | | | Previous algorithm for constructing [Address ranges]->[Compile Units] mapping was wrong. It somewhat relied on the assumption that address ranges for different compile units may not overlap. It is not so. For example, two compile units may contain the definition of the same linkonce_odr function. These definitions will be merged at link-time, resulting in equivalent .debug_ranges entries for both these units Instead of sorting and merging original address ranges (from .debug_ranges and .debug_aranges), implement a different approach: save endpoints of all ranges, and then use a sweep-line approach to construct the desired mapping. If we find that certain address maps to several compilation units, we just pick any of them. llvm-svn: 210860
* Don't use 'using std::error_code' in include/llvm.Rafael Espindola2014-06-121-0/+1
| | | | | | This should make sure that most new uses use the std prefix. llvm-svn: 210835
* [llvm-symbolizer] Fix parsing DW_AT_ranges in Fission skeleton compile unit ↵Alexey Samsonov2014-06-121-3/+9
| | | | | | | | | | | | | DIEs. Turns out that DW_AT_ranges_base attribute sets the offset for DW_AT_ranges values specified in the .dwo file, but not for DW_AT_ranges specified in the skeleton compile unit DIE in the main executable. This is extremely confusing, and would hopefully be fixed in DWARF-5 when it's finalized. For now this behavior makes sense, as otherwise Fission would break DWARF consumers who doesn't know anything about DW_AT_ranges_base. llvm-svn: 210809
* [modules] Add module maps for LLVM. These are not quite ready for prime-timeRichard Smith2014-05-211-0/+1
| | | | | | | yet, but only a few more Clang patches need to land. (I have 'ninja check' passing locally.) llvm-svn: 209269
* [DWARF parser] Teach DIContext to fetch short (non-linkage) function names ↵Alexey Samsonov2014-05-171-7/+9
| | | | | | | | | | for a given address. Change --functions option in llvm-symbolizer tool to accept values "none", "short" or "linkage". Update the tests and docs accordingly. llvm-svn: 209050
* [DWARF parser] Use enums instead of bitfields in DILineInfoSpecifier.Alexey Samsonov2014-05-155-53/+55
| | | | | | | | | | | | It is more appropriate than the current situation, when one flag (AbsoluteFilePath) is relevant only if another flag is set. This refactoring would also simplify fetching the short function name (stored in DW_AT_name) instead of a linkage name returned currently. No functionality change. llvm-svn: 208921
* [DWARF parser] Cleanup code in DWARFDebugLine.Alexey Samsonov2014-04-303-128/+112
| | | | | | | | | | | | | | | | | | Streamline parsing and dumping line tables: Prefer composition to multiple inheritance in DWARFDebugLine::ParsingState. Get rid of the weird concept of "DumpingState" structure. was: DWARFDebugLine::DumpingState state(OS); DWARFDebugLine::parseStatementTable(..., state); now: DWARFDebugLine::LineTable LineTable; LineTable.parse(...); LineTable.dump(OS); No functionality change. llvm-svn: 207599
* [DWARF parser] Cleanup code in DWARFDebugLine.Alexey Samsonov2014-04-293-98/+119
| | | | | | | | | | | | | Move several function definitions into .cpp, unify constructors and clear() methods (fixing a couple of latent bugs from copy-paste), turn static function parsePrologue() into Prologue::parse(). More work needed here to untangle weird multiple inheritance in table parsing and dumping. No functionality change. llvm-svn: 207579
* [DWARF parser] Compress DIEMinimal even further, simplify building DIE tree.Alexey Samsonov2014-04-292-62/+29
| | | | | | | | | | | DIE doesn't need to store a pointer to its parent: we can traverse the DIE tree only with functions getFirstChild() and getSibling(). Parents must be known only when we construct the tree. Rewrite setDIERelations() procedure in a more straightforward way, and get rid of lots of now unused DIEMinimal methods. No functionality change. llvm-svn: 207563
* [DWARF parser] DWARFDebugFrame: Make FrameEntry struct smaller.Alexey Samsonov2014-04-281-27/+24
| | | | | | | | | | FrameEntry doesn't need to hold a reference to the section it is located in. Instead, pass DataExtractor as an argument of parsing function. No functionality change. llvm-svn: 207461
* [DWARF parser] DWARFDebugFrame: use unique_ptr instead of raw pointerAlexey Samsonov2014-04-282-23/+10
| | | | llvm-svn: 207459
* [DWARF parser] Simplify DWARFDebugAranges generation.Alexey Samsonov2014-04-282-20/+2
| | | | | | | | | | There is no need to keep the whole contents of .debug_aranges section in memory when we build address ranges table. Memory optimization that used to be in this code (precalculate the size of vector of ranges before filling it) is not really needed - later we will compact and resize this vector anyway. llvm-svn: 207457
* [C++] Use 'nullptr'.Craig Topper2014-04-283-11/+11
| | | | llvm-svn: 207394
* Fix missing includeAlexey Samsonov2014-04-251-0/+1
| | | | llvm-svn: 207278
* [DWARF parser] Cleanup code in DWARFDebugAranges.Alexey Samsonov2014-04-253-11/+13
| | | | | | No functionality change. llvm-svn: 207276
* [DWARF parser] Cleanup code in DWARFDebugAbbrev.Alexey Samsonov2014-04-253-73/+73
| | | | | | No functionality change. llvm-svn: 207274
* [DWARF parser] Make a few methods non-publicAlexey Samsonov2014-04-243-10/+12
| | | | llvm-svn: 207156
* [DWARF parser] DWARFUnit ctor doesn't need both parsed and raw .debug_abbrev ↵Alexey Samsonov2014-04-245-36/+34
| | | | | | section. Remove the former. llvm-svn: 207153
* [DWARF parser] Simplify and re-format a methodAlexey Samsonov2014-04-242-11/+13
| | | | llvm-svn: 207151
* [Modules] Make Support/Debug.h modular. This requires it to not changeChandler Carruth2014-04-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | behavior based on other files defining DEBUG_TYPE, which means it cannot define DEBUG_TYPE at all. This is actually better IMO as it forces folks to define relevant DEBUG_TYPEs for their files. However, it requires all files that currently use DEBUG(...) to define a DEBUG_TYPE if they don't already. I've updated all such files in LLVM and will do the same for other upstream projects. This still leaves one important change in how LLVM uses the DEBUG_TYPE macro going forward: we need to only define the macro *after* header files have been #include-ed. Previously, this wasn't possible because Debug.h required the macro to be pre-defined. This commit removes that. By defining DEBUG_TYPE after the includes two things are fixed: - Header files that need to provide a DEBUG_TYPE for some inline code can do so by defining the macro before their inline code and undef-ing it afterward so the macro does not escape. - We no longer have rampant ODR violations due to including headers with different DEBUG_TYPE definitions. This may be mostly an academic violation today, but with modules these types of violations are easy to check for and potentially very relevant. Where necessary to suppor headers with DEBUG_TYPE, I have moved the definitions below the includes in this commit. I plan to move the rest of the DEBUG_TYPE macros in LLVM in subsequent commits; this one is big enough. The comments in Debug.h, which were hilariously out of date already, have been updated to reflect the recommended practice going forward. llvm-svn: 206822
* [llvm-symbolizer] Print file/line for a PC even if there is no DIE ↵Alexey Samsonov2014-04-181-9/+20
| | | | | | | | | | | describing it. This is important for symbolizing executables with debug info in unavailable .dwo files. Even if all DIE entries are missing, we can still symbolize an address: function name can be fetched from symbol table, and file/line info can be fetched from line table. llvm-svn: 206665
* [DWARF parser] Turn DILineInfo into a struct.Alexey Samsonov2014-04-181-54/+46
| | | | | | | | | | Immutable DILineInfo doesn't bring any benefits and complicates code. Also, use std::string instead of SmallString<16> for file and function names - their length can vary significantly. No functionality change. llvm-svn: 206654
OpenPOWER on IntegriCloud