summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins
Commit message (Collapse)AuthorAgeFilesLines
...
* DWARFDebugNames: Implement last GetGlobalVariables overloadPavel Labath2018-06-122-1/+23
| | | | | | | This function implements the search for all global variables within a given compilation unit. llvm-svn: 334500
* Document how lldb uses the DBGSourcePathRemapping Jason Molenda2018-06-111-9/+7
| | | | | | | source path remapping src/dest path pairs with respect to the DBGVersion number in the plist. llvm-svn: 334442
* Fix tuple getter in std unique pointer pretty-printerPavel Labath2018-06-111-0/+2
| | | | | | | | | | | | | Summary: Check case when _M_t child member is not present. Reviewers: labath, tberghammer Reviewed By: labath, tberghammer Differential Revision: https://reviews.llvm.org/D47932 Patch by Aleksandr Urakov <aleksandr.urakov@jetbrains.com>. llvm-svn: 334411
* DWARFDebugNames: Fix lookup in dwo filesPavel Labath2018-06-112-9/+31
| | | | | | | | | | | | The getDIESectionOffset function is not correct for split dwarf files (and will probably be removed in D48009). This patch implements correct section offset computation for split and non-split compile units -- we first need to check if the referenced unit is a skeleton unit, and if it is, we add the die offset to the full unit base offset (as the full unit is the one which contains the die). llvm-svn: 334402
* Move VersionTuple from clang/Basic to llvm/SupportPavel Labath2018-06-111-5/+4
| | | | | | | | | | | | | | | | | | | | | | | Summary: This kind of functionality is useful to other project apart from clang. LLDB works with version numbers a lot, but it does not have a convenient abstraction for this. Moving this class to a lower level library allows it to be freely used within LLDB. Since this class is used in a lot of places in clang, and it used to be in the clang namespace, it seemed appropriate to add it to the list of adopted classes in LLVM.h to avoid prefixing all uses with "llvm::". Also, I didn't find any tests specific for this class, so I wrote a couple of quick ones for the more interesting bits of functionality. Reviewers: zturner, erik.pilkington Subscribers: mgorny, cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D47887 llvm-svn: 334399
* Remove more dead code from NativeProcessLinuxAlex Langford2018-06-081-14/+0
| | | | | | This should have been removed in r334333. llvm-svn: 334336
* Delete dead code in NativeProcessLinuxAlex Langford2018-06-081-149/+0
| | | | | | | As far as I can tell, this code has always been guarded by `#if 0`. If this is useful code, it can be added back. llvm-svn: 334333
* Fix DynamicRegisterInfo copying/moving issue.Tatyana Krasnukha2018-06-082-23/+51
| | | | | | | | | | | | | | | Summary: Default copy/move constructors and assignment operators leave wrong m_sets[i].registers pointers. Made the class movable and non-copyable (it's difficult to imagine when it needs to be copied). Reviewers: clayborg Reviewed By: clayborg Differential Revision: https://reviews.llvm.org/D47728 llvm-svn: 334282
* DebugNamesDWARFIndex: Implement regex version of the GetFunctions methodPavel Labath2018-06-084-13/+34
| | | | | | | | | This also fixes a bug where SymbolFileDWARF was returning the same function multiple times - this can happen if both mangled and demangled names match the regex. Other lookup lookup functions had code to handle this case, but it was forgotten here. llvm-svn: 334277
* DebugNamesDWARFIndex: Implement GetFunctions methodPavel Labath2018-06-086-72/+105
| | | | | | | | | | | | | | | | | | | | | | Summary: This patch implements the non-regex variant of GetFunctions. To share more code with the Apple implementation, I've extracted the common filtering code from that class into a utility function on the DWARFIndex base class. The new implementation also searching the accelerator table multiple times -- previously it could happen that the apple table would return the same die more than once if one specified multiple search flags in name_type_mask. This way, I separate table iteration from filtering, and so we can be sure each die is inserted at most once. Reviewers: clayborg, JDevlieghere Subscribers: aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D47881 llvm-svn: 334273
* PDB support of function-level linking and splitted functionsAaron Smith2018-06-081-0/+3
| | | | | | | | | | | | | | | | | | | Summary: The patch adds support of splitted functions (when MSVC is used with PGO) and function-level linking feature. SymbolFilePDB::ParseCompileUnitLineTable function relies on fact that ranges of compiled source files in the binary are continuous and don't intersect each other. The function creates LineSequence for each file and inserts it into LineTable, and implementation of last one relies on continuity of the sequence. But it's not always true when function-level linking enabled, e.g. in added input test file test-pdb-function-level-linking.exe there is xstring's std__basic_string_char_std__char_traits_char__std__allocator_char_____max_size (.00454820) between test-pdb-function-level-linking.cpp's foo (.00454770) and main (.004548F0). To fix the problem this patch renews the sequence on each address gap. Reviewers: asmith, zturner Reviewed By: asmith Subscribers: aleksandr.urakov, labath, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D47708 llvm-svn: 334260
* [Platform] Accept arbitrary kext variantsJonas Devlieghere2018-06-072-22/+43
| | | | | | | | | | | | | | | | | | | When loading kexts in PlatformDarwinKernel, we use the BundleID as the filename to to create shared modules. In GetSharedModule we call ExamineKextForMatchingUUID for any BundleID it finds that is a match, to see if the UUID is also a match. Until now we were using Host::ResolveExecutableInBundle which calls a CoreFoundation API to obtain the executable. However, it's possible that the executable has a variant suffix (e.g. foo_development) and these files were ignored. This patch replaces that call with logic that looks for all the binaries in the bundle. Because of the way ExamineKextForMatchingUUID works, it's fine to try to load executables that are not valid and we can just iterate over the list until we found a match. Differential revision: https://reviews.llvm.org/D47539 llvm-svn: 334205
* DIERef: move trivial constructors into the headerPavel Labath2018-06-072-9/+4
| | | | | | | | | This enables more inlining/optimization opportunities for a fairly critical class. NFCI llvm-svn: 334198
* DebugNamesDWARFIndex: Add type lookup suportPavel Labath2018-06-072-1/+11
| | | | | | | | This implements just one of the GetTypes overloads. The other is not testable from lldb-test so I'm leaving it unimplemented until I figure out what to do with testing. llvm-svn: 334190
* DebugNamesDWARFIndex: add namespace lookup supportPavel Labath2018-06-072-1/+11
| | | | llvm-svn: 334186
* DebugNamesDWARFIndex: Add support for partial indexesPavel Labath2018-06-074-18/+46
| | | | | | | | | | | | | | | | | | | | | Summary: It possible that a single module has indexed and non-indexed compile units. In this case, we can use the fast indexed lookup for the first ones and fall back to the manual index for the others. This patch implements this functionality by adding a units_to_avoid argument to the ManualDWARFIndex constructor. Any units present in that list will be ignored for the purposes of manual index. Individual DebugNamesDWARFIndex then always consult both the manual fallback index as well as the index in the .debug_names section. Reviewers: JDevlieghere, clayborg Subscribers: aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D47832 llvm-svn: 334185
* DebugNamesDWARFIndex: Add ability to lookup variablesPavel Labath2018-06-078-31/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds the ability to lookup variables to the DWARF v5 index class. During review we discovered an inconsistency between how the existing two indexes handle looking up qualified names of the variables: - manual index would return a value if the input string exactly matched the demangled name of some variable. - apple index ignored the context and returned any variable with the same base name. So, this patch also rectifies that situation: - it removes all context handling from the index classes. The GetGlobalVariables functions now just take a base name. For manual index, this meant we can stop putting demangled names into the variable index (this matches the behavior for functions). - context extraction is put into SymbolFileDWARF, so that it is common to all indexes. - additional filtering based on the context is also done in SymbolFileDWARF. This is done via a simple substring search, which is not ideal, but it matches what we are doing for functions (cf. Module::LookupInfo::Prune). Reviewers: clayborg, JDevlieghere Subscribers: aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D47781 llvm-svn: 334181
* [DWARF] Add (empty) DebugNamesDWARFIndex class and a setting to control its usePavel Labath2018-06-067-23/+162
| | | | | | | | | | | | | | | | | | | Summary: This patch adds the skeleton for implementing the DWARF v5 name index class. All of the methods are stubbed out and will be implemented in subsequent patches. The interesting part of the patch is the addition of a "ignore-file-indexes" setting to the dwarf plugin which enables a user to force using manual indexing path in lldb (for example as a debugging aid). I have also added a test that verifies that file indexes are used by default. Reviewers: JDevlieghere, clayborg, jingham Subscribers: mgorny, mehdi_amini, aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D47629 llvm-svn: 334088
* Revert "PDB support of function-level linking and splitted functions"Pavel Labath2018-06-061-3/+0
| | | | | | This reverts commit r334030 because it adds a broken test. llvm-svn: 334076
* PDB support of function-level linking and splitted functionsAaron Smith2018-06-051-0/+3
| | | | | | | | | | | | | | | | | | | Summary: The patch adds support of splitted functions (when MSVC is used with PGO) and function-level linking feature. SymbolFilePDB::ParseCompileUnitLineTable function relies on fact that ranges of compiled source files in the binary are continuous and don't intersect each other. The function creates LineSequence for each file and inserts it into LineTable, and implementation of last one relies on continuity of the sequence. But it's not always true when function-level linking enabled, e.g. in added input test file test-pdb-function-level-linking.exe there is xstring's std__basic_string_char_std__char_traits_char__std__allocator_char_____max_size (.00454820) between test-pdb-function-level-linking.cpp's foo (.00454770) and main (.004548F0). To fix the problem this patch renews the sequence on each address gap. Reviewers: asmith, zturner Reviewed By: asmith Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D47708 llvm-svn: 334030
* DWARFIndex: more GetFunctions cleanupPavel Labath2018-06-057-63/+14
| | | | | | | This applies similar simplification as r334004, only it touches the regex version of the method. llvm-svn: 334012
* Fix windows build broken by r334004Pavel Labath2018-06-051-1/+1
| | | | | | | The problem was a link error due to a missing =0 on an abstract method. Interestingly, this was not a problem for clang/linux. llvm-svn: 334006
* DWARFIndex: simplify GetFunctions methodsPavel Labath2018-06-056-175/+92
| | | | | | | | | | | | | | | | Now that Apple index determines method-ness straight from the debug info, we don't need to resolve the functions into SymbolContexts inside the Index classes. This removes the need for callback arguments and allows us to pull the common parts out of the two implementations of these functions back into the SymbolFileDWARF class. Reviewers: JDevlieghere, clayborg Subscribers: aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D47147 llvm-svn: 334004
* Fixup r333987Pavel Labath2018-06-052-2/+3
| | | | | | | - add #include <atomic> (fixes windows build) - remove std::move (fixes "using move prevents copy ellision" warnings) llvm-svn: 333996
* Protect DWARFCompileUnit::m_die_array by new mutexesJan Kratochvil2018-06-053-38/+134
| | | | | | | | | | | | | If BuildAddressRangeTable called ExtractDIEsIfNeeded(false), then another thread started processing data from m_die_array and then the first thread called final ClearDIEs() the second thread would crash. It is also required without multithreaded debugger using DW_TAG_partial_unit for DWZ. Differential revision: https://reviews.llvm.org/D40470 llvm-svn: 333987
* Add ClangHost.cpp to the Xcode project. Jim Ingham2018-06-051-0/+1
| | | | | | | Also add an include that was needed for the if APPLE branch of the function. llvm-svn: 333971
* Remove dependency from Host to clang.Zachary Turner2018-06-044-13/+171
| | | | | | | | | | Host depended on clang because HostInfo had a function to get the directory where clang was installed. We move this over to the clang expression parser plugin where it's more at home. Differential Revision: https://reviews.llvm.org/D47384 llvm-svn: 333933
* AppleDWARFIndex: Get function method-ness directly from debug infoPavel Labath2018-06-044-61/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When searching for methods only, we need to do extra work to make sure the functions we get from the apple tables are indeed methods. Previously we were resolving the DIE into a SymbolContext and then checked whether the enclosing CompilerDeclContext is a class (or struct, or union). This patch changes that to operate on the debug info directly. This should be: - simpler - faster - more consistent with the ManualDWARFIndex (which does the same check, only at indexing time). What we lose this ways is for the language plugin to have a say in what it considers to be a "class", but that's probably more flexibility than we need (and if we really wanted to do that in the future, we could implement a more direct way to consult the plugin about this). This also fixes the find-method-local-struct test, which was failing because we were not able to construct a CompilerDeclContext for a local struct correctly. As a drive-by, I rename the DWARFDIE's IsStructClassOrUnion method to match the name on the CompilerDeclContext class. Reviewers: clayborg, JDevlieghere Subscribers: aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D47470 llvm-svn: 333878
* Fix support for distinguishing archive members by timestamp on Darwin.James Y Knight2018-06-022-3/+7
| | | | | | | | | | | | | | | | | | | On Darwin, the binary's symbol table points to debug info in object files -- potentially object files within a static library. Such a library may have multiple entries with the same name, distinguished only by timestamp. The code was already _attempting_ to handle this case (see the code in ObjectContainerBSDArchive::Archive::FindObject which disambiguates via timestamp). But, unfortunately, while the timestamp was taken into account on the _first_ lookup, the result was then cached in a map keyed only off of the path. Added the timestamp to the cache, and added a test case. Differential Revision: https://reviews.llvm.org/D47660 llvm-svn: 333813
* [lldb, process] Fix occasional hang when launching a process in LLDBStella Stamenova2018-06-011-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Occasionally, when launching a process in lldb (especially on windows, but not limited to), lldb will hang before the process is launched and it will never recover. This happens because the timing of the processing of the state changes can be slightly different. The state changes that are issued are: 1) SetPublicState(eStateLaunching) 2) SetPrivateState(eStateLaunching) 3) SetPublicState(eStateStopped) 4) SetPrivateState(eStateStopped) What we expect to see is: public state: launching -> launching -> stopped private state: launching -> stopped What we see is: public state: launching -> stopped -> launching private state: launching -> stopped The second launching change to the public state is issued when WaitForProcessStopPrivate calls HandlePrivateEvent on the event which was created when the private state was set to launching. HandlePrivateEvent has logic to determine whether to broadcase the event and a launching event is *always* broadcast. At the same time, when the stopped event is processed by WaitForProcessStopPrivate next, the function exists and that event is never broadcast, so the public state remains as launching. HandlePrivateEvent does two things: determine whether there's a next action as well as determine whether to broadcast the event that was processed. There's only ever a next action set if we are trying to attach to a process, but WaitForProcessStopPrivate is only ever called when we are launching a process or connecting remotely, so the first part of HandlePrivateEvent (handling the next action) is irrelevant for WaitForProcessStopPrivate. As far as broadcasting the event is concerned, since we are handling state changes that already occurred to the public state (and are now duplicated in the private state), I believe the broadcast step is unnecessary also (and in fact, it causes the hang). This change removes the call to HandlePrivateEvent from inside WaitForProcessStopPrivate. Incidentally, there was also a bug filed recently that is the same issue: https://bugs.llvm.org/show_bug.cgi?id=37496 Reviewers: asmith, labath, zturner, jingham Reviewed By: zturner, jingham Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D47609 llvm-svn: 333781
* Add .debug_names section glue codePavel Labath2018-06-013-0/+10
| | | | llvm-svn: 333743
* Remove infinite recursion due to FileSpec change.Jonas Devlieghere2018-05-311-5/+3
| | | | | | | | | Fixes infinite recursion due to change in how FileSpec deals with removing the last path component. Fixes timout for TestMiniDumpNew.py llvm-svn: 333666
* Remove append parameter to FindGlobalVariablesPavel Labath2018-05-3111-61/+40
| | | | | | | | | | | | | | | | | | | Summary: As discussed in https://bugs.llvm.org/show_bug.cgi?id=37317, FindGlobalVariables does not properly handle the case where append=false. As this doesn't seem to be used in the tree, this patch removes the parameter entirely. Reviewers: clayborg, jingham, labath Reviewed By: clayborg Subscribers: aprantl, lldb-commits, kubamracek, JDevlieghere Differential Revision: https://reviews.llvm.org/D46885 Patch by Tom Tromey <ttromey@mozilla.com>. llvm-svn: 333639
* Simplify DWARFUnit::m_die_array swap() to use shrink_to_fit()Jan Kratochvil2018-05-311-9/+1
| | | | | | | | | rL145086 introduced m_die_array.shrink_to_fit() implemented by exact_size_die_array.swap, it was before LLVM became written in C++11. Differential revision: https://reviews.llvm.org/D47492 llvm-svn: 333636
* Fix return value of DWARFUnit::ExtractDIEsIfNeeded()Jan Kratochvil2018-05-301-6/+5
| | | | | | This is a leftover regression from: https://reviews.llvm.org/D46810 llvm-svn: 333517
* [ObjC] Fix the formatter for NSOrderedSet.Davide Italiano2018-05-291-28/+5
| | | | | | | | While I'm here, delete some dead code. <rdar://problem/40622096> llvm-svn: 333465
* Remove unused DWARFUnit::HasDIEsParsed()Jan Kratochvil2018-05-292-4/+0
| | | | | | | It was not implemented correctly after https://reviews.llvm.org/D46810 but then it has not been used anywhere anyway. llvm-svn: 333452
* Fix compiler unused variable warning in DWARFUnitJan Kratochvil2018-05-291-2/+0
| | | | | | Alex Langford has reported it from: https://reviews.llvm.org/D46810 llvm-svn: 333449
* Fix DWARFUnit::GetUnitDIEPtrOnly stale pointerJan Kratochvil2018-05-295-80/+130
| | | | | | | | | | | | | GetUnitDIEPtrOnly() needs to return pointer to the first DIE. But the first element of m_die_array after ExtractDIEsIfNeeded(true) may move in memory after later ExtractDIEsIfNeeded(false). DWARFDebugInfoEntry::collection m_die_array is std::vector, its data may move during its expansion. Differential revision: https://reviews.llvm.org/D46810 llvm-svn: 333437
* Typo fixes.Bruce Mitchener2018-05-2912-29/+29
| | | | | | | | | | Reviewers: javed.absar Subscribers: ki.stfu, JDevlieghere, lldb-commits Differential Revision: https://reviews.llvm.org/D47421 llvm-svn: 333399
* ManualDWARFIndex: Treat DW_TAG_subprogram and DW_TAG_inlined_subroutine the ↵Pavel Labath2018-05-291-22/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | same way Summary: We were treating subprograms and inlined subroutines differently when building the index. The difference was in which indexes were individual tags inserted (subprograms went to all indexes, where as inlined subroutines only into the basename and full name indexes). This seems like an error, because an inlined subroutine can still represent an C++ or an ObjC method. I don't see anything in the subprogram branch which should not apply to an inlined subroutine, so I propose to just treat them identically. This makes searching for an inlined method behave the same way as for the apple index. I write an assembly-based test because I did not want to depend on particular clang inlining behavior (and because I wanted to see how hard would it be). Reviewers: clayborg, JDevlieghere Subscribers: eraman, lldb-commits Differential Revision: https://reviews.llvm.org/D47368 llvm-svn: 333398
* NFC: Fix some comment typos.Bob Wilson2018-05-283-3/+3
| | | | llvm-svn: 333364
* Fix memory leak in SubsPrimitiveParmItaniumRaphael Isemann2018-05-271-1/+3
| | | | | | | | | | | | | | Summary: FastDemangle gives us a C-string that we own (which is allocated in SymbolDemangler::GetDemangledCopy). As we are not deleting the string, we leak memory whenever we call SubsPrimitiveParmItanium. Reviewers: javed.absar Subscribers: kristof.beyls, chrib, lldb-commits Differential Revision: https://reviews.llvm.org/D47418 llvm-svn: 333353
* Add missing includes to some LLDB headers.Raphael Isemann2018-05-263-0/+6
| | | | | | | | | | Summary: When compiling with modules, these missing includes cause the build to fail (as the header can't be compiled into a module). Subscribers: ki.stfu, lldb-commits Differential Revision: https://reviews.llvm.org/D47412 llvm-svn: 333345
* Remove DWARFUnit::ClearDIEs parameter keep_compile_unit_dieJan Kratochvil2018-05-253-7/+6
| | | | | | | It has been now always passed as true and during planned D46810 it would no longer make sense. llvm-svn: 333287
* ManualDWARFIndex: Fix misclassification of methods in unionsPavel Labath2018-05-253-8/+8
| | | | | | | Apple index was already treating them as methods. Not doing the same seems like an omission. llvm-svn: 333266
* ManualDWARFIndex: reduce long parameter listsPavel Labath2018-05-252-117/+93
| | | | | | | | | Several functions were passing a list of 8 NameToDIE arguments around. This puts those variables in a struct and passes that instead, reducing code duplication and the possibility of error (swapping two arguments accidentally). llvm-svn: 333264
* Use DWARFBaseDIE as a compile-time protectionJan Kratochvil2018-05-244-10/+10
| | | | | | | | | As suggested by Pavel Labath in D46810 DWARFUnit::GetUnitDIEOnly() returning a pointer to m_first_die should not permit using methods like GetFirstChild(). Differential revision: https://reviews.llvm.org/D47276 llvm-svn: 333224
* DWARFDIE split out to DWARFBaseDIEJan Kratochvil2018-05-245-306/+358
| | | | | | | | | | | | This new DWARFBaseDIE is going to be used for DWARFUnit::GetUnitDIEOnly() as other DIEs are unavailable that time so the caller should not have methods available to access them. This patch is only a mechanical split without any use of it. Differential revision: https://reviews.llvm.org/D47275 llvm-svn: 333222
* DWARF: Move indexing code from DWARFUnit to ManualDWARFIndexPavel Labath2018-05-244-346/+346
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: I think this makes sense for several reasons: - better separation of concerns: DWARFUnit's job should be to provide a nice interface to its users to access the unit contents. ManualDWARFIndex can then use this interface to build an index and provide it to its users. - closer alignment with llvm parsers: there is no indexing equivalent in llvm, and there probably never will be, as the index is very centered around how lldb wants to access debug info. If we ever switch to llvm's parser, this will allow us swap out DWARFUnit implementations and keep indexing as-is. - closer proximity of the indexing code to AppleDWARFIndex will make it easier to keep the two in sync (e.g. right now the two use very different algorithms to determine whether a DW_TAG_subroutine represents a "method"). This is my primary motivation for making this change now, but I am leaving this work to a separate patch. The only interface change to DWARFUnit I needed to make was to add an efficient way to iterate over the list of all DIEs. Adding this also aligns us closer to the llvm parser. Reviewers: JDevlieghere, clayborg, aprantl Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D47253 llvm-svn: 333178
OpenPOWER on IntegriCloud