summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
Commit message (Collapse)AuthorAgeFilesLines
* DWARF: Add "dwo_num" field to the DIERef classPavel Labath2019-06-211-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When dwo support was introduced, it used a trick where debug info entries were referenced by the offset of the compile unit in the main file, but the die offset was relative to the dwo file. Although there was some elegance to it, this representation was starting to reach its breaking point: - the fact that the skeleton compile unit owned the DWO file meant that it was impossible (or at least hard and unintuitive) to support DWO files containing more than one compile unit. These kinds of files are produced by LTO for example. - it made it impossible to reference any DIEs in the skeleton compile unit (although the skeleton units are generally empty, clang still puts some info into them with -fsplit-dwarf-inlining). - (current motivation) it made it very hard to support type units placed in DWO files, as type units don't have any skeleton units which could be referenced in the main file This patch addresses this problem by introducing an new "dwo_num" field to the DIERef class, whose purpose is to identify the dwo file. It's kind of similar to the dwo_id field in DWARF5 unit headers, but while this is a 64bit hash whose main purpose is to catch file mismatches, this is just a smaller integer used to indentify a loaded dwo file. Currently, this is based on the index of the skeleton compile unit which owns the dwo file, but it is intended to be eventually independent of that (to support the LTO use case). Simultaneously the cu_offset is dropped to conserve space, as it is no longer necessary. This means we can remove the "BaseObjectOffset" field from the DWARFUnit class. It also means we can remove some of the workarounds put in place to support the skeleton-unit+dwo-die combo. More work is needed to remove all of them, which is out of scope of this patch. Reviewers: JDevlieghere, clayborg, aprantl Subscribers: mehdi_amini, dexonsmith, arphaman, lldb-commits Differential Revision: https://reviews.llvm.org/D63428 llvm-svn: 364009
* DWARF: Provide accessors to DIERef fieldsPavel Labath2019-06-201-5/+4
| | | | | | | | | | | | | | | | | | | | | | Summary: Instead of accessing the fields directly, use accessor functions to provide access to the DIERef components. This allows us to decouple the external interface, from the internal representation. The external interface can use llvm::Optional and similar goodies, while the data can still be stored internally in a more compact representation. I also document the purpose of the existing DIERef fields. The main motivation for this change is a need to introduce an additional field to the DIERef class, but I believe the change has its own merit. Reviewers: JDevlieghere, aprantl, clayborg Subscribers: arphaman, lldb-commits Differential Revision: https://reviews.llvm.org/D63400 llvm-svn: 363910
* Pass ConstString by value (NFC)Adrian Prantl2019-03-061-2/+2
| | | | | | | | | | | | | | | | | My apologies for the large patch. With the exception of ConstString.h itself it was entirely produced by sed. ConstString has exactly one const char * data member, so passing a ConstString by reference is not any more efficient than copying it by value. In both cases a single pointer is passed. But passing it by value makes it harder to accidentally return the address of a local object. (This fixes rdar://problem/48640859 for the Apple folks) Differential Revision: https://reviews.llvm.org/D59030 llvm-svn: 355553
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Clean up #include "DWARFCompileUnit.h"Jan Kratochvil2018-01-211-1/+0
| | | | | | | | | Clean up needless+missing #include "DWARFCompileUnit.h" for split of DWARFCompileUnit to DWARFUnit as discussed in D40466. Differential revision: https://reviews.llvm.org/D42355 llvm-svn: 323069
* Change UniqueCStringMap to use ConstString as the keyPavel Labath2017-05-021-6/+6
| | | | | | | | | | | | | | | | Summary: UniqueCStringMap "sorts" the entries for fast lookup, but really it only cares about uniqueness. ConstString can be compared by pointer alone, rather than with strcmp, resulting in much faster comparisons. Change the interface to take ConstString instead, and propagate use of the type to the callers where appropriate. Reviewers: #lldb, clayborg Reviewed By: clayborg Subscribers: labath, jasonmolenda, lldb-commits Differential Revision: https://reviews.llvm.org/D32316 Patch by Scott Smith <scott.smith@purestorage.com>. llvm-svn: 301908
* Move classes from Core -> Utility.Zachary Turner2017-02-021-4/+4
| | | | | | | | | | | | | | | | | | | | | | | This moves the following classes from Core -> Utility. ConstString Error RegularExpression Stream StreamString The goal here is to get lldbUtility into a state where it has no dependendencies except on itself and LLVM, so it can be the starting point at which to start untangling LLDB's dependencies. These are all low level and very widely used classes, and previously lldbUtility had dependencies up to lldbCore in order to use these classes. So moving then down to lldbUtility makes sense from both the short term and long term perspective in solving this problem. Differential Revision: https://reviews.llvm.org/D29427 llvm-svn: 293941
* Fix a few warnings caught by clang.Zachary Turner2016-10-071-1/+1
| | | | llvm-svn: 283607
* Convert UniqueCStringMap to use StringRef.Zachary Turner2016-10-061-5/+5
| | | | llvm-svn: 283494
* *** This commit represents a complete reformatting of the LLDB source codeKate Stone2016-09-061-58/+44
| | | | | | | | | | | | | | | | | | | | | | | *** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
* Revert r256769Ewan Crawford2016-01-051-1/+1
| | | | | | | | | Reverts "Use correct format identifiers to print something meaningful." Original format specifiers were correct. Instead use void* casts to remove warnings, since this is what the %p specifier expects. llvm-svn: 256833
* Use correct format identifiers to print something meaningful.Davide Italiano2016-01-041-1/+1
| | | | llvm-svn: 256769
* Re-commit "Make dwarf parsing multi-threaded"Tamas Berghammer2015-10-231-0/+11
| | | | | | | | | | | | | | | Re-commit the change after fixing a lot of race condition in LLDB exposed by this change Loading the debug info from a large application is the slowest task LLDB do. This CL makes most of the dwarf parsing code multi-threaded. As a result the speed of "attach; backtrace; exit;" when the inferior is an LLDB with full debug info increased by a factor of 2. Differential revision: http://reviews.llvm.org/D13662 llvm-svn: 251106
* Revert "Make dwarf parsing multi-threaded"Tamas Berghammer2015-10-201-11/+0
| | | | | | | | | Revert it bacuse it introduces several race condition detected by the build bots. This reverts commit 5107a5ebdb7c4571a30a7098b40bf8098b678447. llvm-svn: 250832
* Make dwarf parsing multi-threadedTamas Berghammer2015-10-201-0/+11
| | | | | | | | | | | | Loading the debug info from a large application is the slowest task LLDB do. This CL makes most of the dwarf parsing code multi-threaded. As a result the speed of "attach; backtrace; exit;" when the inferior is an LLDB with full debug info increased by a factor of 2 (on my machine). Differential revision: http://reviews.llvm.org/D13662 llvm-svn: 250821
* Add basic fission support to SymbolFileDWARFTamas Berghammer2015-09-091-12/+11
| | | | | | | | | | | | | * Create new dwo symbol file class * Add handling for .dwo sections * Change indexes in SymbolFileDWARF to store compile unit offset next to DIE offset * Propagate queries from dwarf compile unit to the dwo compile unit where applicable Differential revision: http://reviews.llvm.org/D12291 llvm-svn: 247132
* Fixed a ton of gcc compile warningsVince Harron2015-05-131-1/+1
| | | | | | | | | | Removed some unused variables, added some consts, changed some casts to const_cast. I don't think any of these changes are very controversial. Differential Revision: http://reviews.llvm.org/D9674 llvm-svn: 237218
* Fix -Wformat-pedantic warningsDavid Blaikie2015-04-081-1/+1
| | | | llvm-svn: 234429
* Introduce DWARFDataExtractor for 64-Bit DWARF parsingEd Maste2013-10-241-1/+0
| | | | | Review: http://llvm-reviews.chandlerc.com/D2007 llvm-svn: 193368
* Added the ability to get a list of types from a SBModule or SBCompileUnit. ↵Greg Clayton2013-06-181-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sebastien Metrot wanted this, and sent a hollowed out patch. I filled in the blanks and did the low level implementation. The new functions are: //------------------------------------------------------------------ /// Get all types matching \a type_mask from debug info in this /// module. /// /// @param[in] type_mask /// A bitfield that consists of one or more bits logically OR'ed /// together from the lldb::TypeClass enumeration. This allows /// you to request only structure types, or only class, struct /// and union types. Passing in lldb::eTypeClassAny will return /// all types found in the debug information for this module. /// /// @return /// A list of types in this module that match \a type_mask //------------------------------------------------------------------ lldb::SBTypeList SBModule::GetTypes (uint32_t type_mask) //------------------------------------------------------------------ /// Get all types matching \a type_mask from debug info in this /// compile unit. /// /// @param[in] type_mask /// A bitfield that consists of one or more bits logically OR'ed /// together from the lldb::TypeClass enumeration. This allows /// you to request only structure types, or only class, struct /// and union types. Passing in lldb::eTypeClassAny will return /// all types found in the debug information for this compile /// unit. /// /// @return /// A list of types in this compile unit that match \a type_mask //------------------------------------------------------------------ lldb::SBTypeList SBCompileUnit::GetTypes (uint32_t type_mask = lldb::eTypeClassAny); This lets you request types by filling out a mask that contains one or more bits from the lldb::TypeClass enumerations, so you can only get the types you really want. llvm-svn: 184251
* Huge memory and performance improvements in the DWARF parser.Greg Clayton2011-09-121-309/+27
| | | | | | | | | | | | | | | | | | | | | | Address ranges are now split up into two different tables: - one in DWARFDebugInfo that is compile unit specific - one in each DWARFCompileUnit that has exact function DIE offsets This helps keep the size of the aranges down since the main table will get uniqued and sorted and have consecutive ranges merged. We then only parse the compile unit one on demand once we have determined that a compile unit contains the address in question. We also now use the .debug_aranges section if there is one instead of always indexing the DWARF manually. NameToDIE now uses a UniqueCStringMap<dw_offset> map instead of a std::map. std::map is very bulky as each node has 3 pointers and the key and value types. This gets our NameToDIE entry down to 12 bytes each instead of 48 which saves us a lot of memory when we have very large DWARF. DWARFDebugAranges now has a smaller footprint for each range it contains to save on memory. llvm-svn: 139557
* Added the ability for DWARF locations to use the ABI plug-ins to resolveGreg Clayton2011-09-021-168/+180
| | | | | | | | register names when dumping variable locations and location lists. Also did some cleanup where "int" types were being used for "lldb::RegisterKind" values. llvm-svn: 138988
* Added support for accessing and loading our new .debug_names and .debug_typesGreg Clayton2011-09-011-30/+233
| | | | | | | | | | | | | | | | | | DWARF accelerator table sections to the DWARF parser. These sections are similar to the .debug_pubnames and .debug_pubtypes, but they are designed to be hash tables that are saved to disc in a way that the sections can just be loaded into memory and used without any work on the debugger side. The .debug_pubnames and .debug_pubtypes sections are not ordered, contain a copy of the name in the section itself which makes these sections quite large, they only include publicly exported names (so no static functions, no types defined inside functions), many compilers put different information in them making them very unreliable so most debugger ignore these sections and parse the DWARF on their own. The tables must also be parsed and sorted in order to be used effectively. The new sections can be quickly loaded and very efficiently be used to do name to DIE lookups with very little up front work. The format of these new sections will be changing while we work out the bugs, but we hope to have really fast name to DIE lookups soon. llvm-svn: 138979
* Added code to test hash bucket sizes for an DWARF index that we can writeGreg Clayton2011-08-261-0/+74
| | | | | | to a file. llvm-svn: 138620
* Header file cleanup and moved an inline to the implementation file.Greg Clayton2011-06-101-0/+8
| | | | llvm-svn: 132828
* So we can't use .debug_pubtypes as it, as designed, does not tell us about Greg Clayton2010-09-151-0/+60
all types in all compile units. I added a new kind of accelerator table to the DWARF that allows us to index the DWARF compile units and DIEs in a way that doesn't require the data to stay loaded. Currently when indexing the DWARF we check if the compile unit had parsed its DIEs and if it hasn't we index the data and free all of the DIEs so we can reparse later when we need to after using one of our complete accelerator tables to determine we need to reparse some DWARF. If the DIEs had already been parsed we leave them loaded. The new accelerator table uses the "const char *" pointers from our ConstString class as the keys, and NameToDIE::Info as the value. This info contains the compile unit index and the DIE index which means we are pointed right to the DIE we need unlike the other DWARF accelerator tables that often just point us to the compile unit we would find our answer in. llvm-svn: 113933
OpenPOWER on IntegriCloud