summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins
Commit message (Collapse)AuthorAgeFilesLines
...
* [lldb][NFC] Migrate FileSpec::Dump to raw_ostreamRaphael Isemann2019-12-062-4/+4
|
* [lldb][NFC] Move Address and AddressRange functions out of Stream and let ↵Raphael Isemann2019-12-052-6/+9
| | | | | | | | | | | | | | | | | | | | | | them take raw_ostream Summary: Yet another step on the long road towards getting rid of lldb's Stream class. We probably should just make this some kind of member of Address/AddressRange, but it seems quite often we just push in random integers in there and this is just about getting rid of Stream and not improving arbitrary APIs. I had to rename another `DumpAddress` function in FormatEntity that is dumping the content of an address to make Clang happy. Reviewers: labath Reviewed By: labath Subscribers: JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D71052
* [lldb/DWARF] Switch to llvm debug_rnglists parserPavel Labath2019-12-058-230/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Our rnglist support was working only for the trivial cases (one CU), because we only ever parsed one contribution out of the debug_rnglists section. This means we were never able to resolve range lists for the second and subsequent units (DW_FORM_sec_offset references came out blang, and DW_FORM_rnglistx references always used the ranges lists from the first unit). Since both llvm and lldb rnglist parsers are sufficiently self-contained, and operate similarly, we can fix this problem by switching to the llvm parser instead. Besides the changes which are due to variations in the interface, the main thing is that now the range list object is a member of the DWARFUnit, instead of the entire symbol file. This ensures that each unit can get it's own private set of range list indices, and is consistent with how llvm's DWARFUnit does it (overall, I've tried to structure the code the same way as the llvm version). I've also added a test case for the two unit scenario. Reviewers: JDevlieghere, aprantl, clayborg Subscribers: dblaikie, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D71021
* [lldb/cpluspluslanguage] Add constructor substitutorPavel Labath2019-12-051-41/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds code which will substitute references to the full object constructors/destructors with their base object versions. Like all substitutions in this category, this operation is not really sound, but doing this in a more precise way allows us to get rid of a much larger hack -- matching function according to their demangled names, which effectively does the same thing, but also much more. This is a (very late) follow-up to D54074. Background: clang has an optimization which can eliminate full object structors completely, if they are found to be equivalent to their base object versions. It does this because it assumes they can be regenerated on demand in the compile unit that needs them (e.g., because they are declared inline). However, this doesn't work for the debugging scenario, where we don't have the structor bodies available -- we pretend all constructors are defined out-of-line as far as clang is concerned. This causes clang to emit references to the (nonexisting) full object structors during expression evaluation. Fun fact: This is not a problem on darwin, because the relevant optimization is disabled to work around a linker bug. Reviewers: teemperor, JDevlieghere Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70721
* [lldb] Don't put compile unit name into the support file list and support ↵Pavel Labath2019-12-053-26/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DWARF5 line tables Summary: Lldb's "format-independent" debug info made use of the fact that DWARF (<=4) did not use the file index zero, and reused the support file index zero for storing the compile unit name. While this provided some convenience for DWARF<=4, it meant that the PDB plugin needed to artificially remap file indices in order to free up index 0. Furthermore, DWARF v5 make file index 0 legal, which meant that similar remapping would be needed in the dwarf plugin too. What this patch does instead is remove the requirement of having the compile unit name in the index 0. It is not that useful since the name can always be fetched from the CompileUnit object. Remapping code in the pdb plugin(s) has been removed or simplified. DWARF plugin has started inserting an empty FileSpec at index 0 to ensure the indices keep matching up (in case of DWARF<=4). For DWARF5, we insert the file 0 from the line table. I add a test to ensure we can correctly lookup line table entries referencing file 0, and in particular the case where the file 0 is also duplicated in another file entry, as this is how clang produces line tables in some circumstances (see pr44170). Though this is probably a bug in clang, this is not forbidden by DWARF, and lldb already has support for that in some (but not all) cases -- this adds a test for the code path which was not fixed in this patch. Reviewers: clayborg, JDevlieghere, jdoerfert Subscribers: aprantl, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70954
* Add a default copy-assignment or copy-constructor for -Wdeprecated-copy ↵Eric Christopher2019-12-041-0/+2
| | | | warnings.
* [lldb] Remove FileSpec(FileSpec*) constructorPavel Labath2019-12-044-13/+14
| | | | | This constructor was the cause of some pretty weird behavior. Remove it, and update all code to properly dereference the argument instead.
* [lldb] s/FileSpec::Equal/FileSpec::MatchPavel Labath2019-12-043-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The FileSpec class is often used as a sort of a pattern -- one specifies a bare file name to search, and we check if in matches the full file name of an existing module (for example). These comparisons used FileSpec::Equal, which had some support for it (via the full=false argument), but it was not a good fit for this job. For one, it did a symmetric comparison, which makes sense for a function called "equal", but not for typical searches (when searching for "/foo/bar.so", we don't want to find a module whose name is just "bar.so"). This resulted in patterns like: if (FileSpec::Equal(pattern, file, pattern.GetDirectory())) which would request a "full" match only if the pattern really contained a directory. This worked, but the intended behavior was very unobvious. On top of that, a lot of the code wanted to handle the case of an "empty" pattern, and treat it as matching everything. This resulted in conditions like: if (pattern && !FileSpec::Equal(pattern, file, pattern.GetDirectory()) which are nearly impossible to decipher. This patch introduces a FileSpec::Match function, which does exactly what most of FileSpec::Equal callers want, an asymmetric match between a "pattern" FileSpec and a an actual FileSpec. Empty paterns match everything, filename-only patterns match only the filename component. I've tried to update all callers of FileSpec::Equal to use a simpler interface. Those that hardcoded full=true have been changed to use operator==. Those passing full=pattern.GetDirectory() have been changed to use FileSpec::Match. There was also a handful of places which hardcoded full=false. I've changed these to use FileSpec::Match too. This is a slight change in semantics, but it does not look like that was ever intended, and it was more likely a result of a misunderstanding of the "proper" way to use FileSpec::Equal. [In an ideal world a "FileSpec" and a "FileSpec pattern" would be two different types, but given how widespread FileSpec is, it is unlikely we'll get there in one go. This at least provides a good starting point by centralizing all matching behavior.] Reviewers: teemperor, JDevlieghere, jdoerfert Subscribers: emaste, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70851
* [lldb][NFC] Extract single member parsing out of ↵Raphael Isemann2019-12-042-443/+490
| | | | | | | | | | | | | DWARFASTParserClang::ParseChildMembers ParseChildMembers does a few things, only one part is actually parsing a single member. This extracts the member parsing logic into its own function. This commit just moves the code as-is into its own function and forwards the parameters/ local variables to it, which means it should be NFC. The only actual changes to the code are replacing 'break's (and one very curious 'continue' that behaves like a 'break') with 'return's.
* [lldb][NFC] Migrate to raw_ostream in Module::GetDescriptionRaphael Isemann2019-12-041-1/+1
|
* [LLDB] Disable MSVC warning C4190: ↵Alexandre Ganea2019-12-031-0/+12
| | | | | | 'LLDBSwigPythonBreakpointCallbackFunction' has C-linkage specified, but returns UDT 'llvm::Expected<bool>' which is incompatible with C Differential Revision: https://reviews.llvm.org/D70830
* [lldb][NFC] Extract searching for function SymbolContexts out of ↵Raphael Isemann2019-12-032-92/+116
| | | | | | | | | | ClangExpressionDeclMap::LookupFunction This code was just creating a new SymbolContextList with any found functions in the front and orders them by how close they are to the current frame. This refactors this code into its own function to make this more obvious. Doesn't do any other changes to the code, so this is NFC.
* [lldb] Move register info "augmentation" from gdb-remote into ABIPavel Labath2019-12-031-34/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously the ABI plugin exposed some "register infos" and the gdb-remote code used those to fill in the missing bits. Now, the "filling in" code is in the ABI plugin itself, and the gdb-remote code just invokes that. The motivation for this is two-fold: a) the "augmentation" logic is useful outside of process gdb-remote. For instance, it would allow us to avoid repeating the register number definitions in minidump code. b) It gives more implementation freedom to the ABI classes. Now that these "register infos" are essentially implementation details, classes can use other methods to obtain dwarf/eh_frame register numbers -- for instance they can consult llvm MC layer. Since the augmentation code was not currently tested anywhere, I took the opportunity to create a simple test for it. Reviewers: jasonmolenda, clayborg, tatyana-krasnukha Subscribers: aprantl, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70906
* [lldb][NFC] Don't calculate member indices in ↵Raphael Isemann2019-12-021-2/+0
| | | | | | DWARFASTParserClang::ParseChildMembers We keep counting members and then don't do anything with the computed result.
* [LLDB] [ARM] Use r11 as frame pointer on Windows on ARMMartin Storsjö2019-11-291-2/+6
| | | | | | | Extend EmulateMOVRdRm to identify "mov r11, sp" in thumb mode as setting the frame pointer, if r11 is the frame pointer register. Differential Revision: https://reviews.llvm.org/D70797
* [lldb][NFC] Remove ClangASTContext::GetBuiltinTypeForEncodingAndBitSize overloadRaphael Isemann2019-11-291-2/+2
|
* [lldb][NFC] Explicitly ask for a ClangASTContext in ClangASTSourceRaphael Isemann2019-11-294-30/+24
| | | | | | | | | | | ClangASTSource currently takes a clang::ASTContext and keeps that around, but a lot of LLDB's functionality for doing operations on a clang::ASTContext is in its ClangASTContext twin class. We currently constantly recompute the respective ClangASTContext from the clang::ASTContext while we instead could just pass and store a ClangASTContext in the ClangASTSource. This also allows us to get rid of a bunch of unreachable error checking for cases where recomputation fails for some reason.
* [lldb][NFC] Remove dead logging code from ↵Raphael Isemann2019-11-291-70/+1
| | | | | | | | | DWARFASTParserClang::CompleteRecordType This code is behind a `if (log)` that is always a nullptr as the initializer was commented out. One could uncomment the initializer code, but then this logging code just leads to a deadlock as it tries to aquire the module lock. This removes the logging code until I get this working again.
* [lldb] Remove FileSpec->CompileUnit inheritancePavel Labath2019-11-294-6/+6
| | | | | | | | | | | | | | | | | | | | | | | Summary: CompileUnit is a complicated class. Having it be implicitly convertible to a FileSpec makes reasoning about it even harder. This patch replaces the inheritance by a simple member and an accessor function. This avoid the need for casting in places where one needed to force a CompileUnit to be treated as a FileSpec, and does not add much verbosity elsewhere. It also fixes a bug where we were wrongly comparing CompileUnit& and a CompileUnit*, which compiled due to a combination of this inheritance and the FileSpec*->FileSpec implicit constructor. Reviewers: teemperor, JDevlieghere, jdoerfert Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70827
* [lldb][NFC] Remove unused variable in ClangASTSource::CompleteTypeRaphael Isemann2019-11-281-1/+0
| | | | | Now that CompilerDeclContext is a trivial class, Clang started warning that this unused variable is in fact unused. Let's remove it.
* [lldb][NFC] Remove unused CStringToDIEMap typedefRaphael Isemann2019-11-281-6/+0
|
* [lldb][NFC] Split up DWARFASTParserClang::CompleteTypeFromDWARFRaphael Isemann2019-11-282-222/+243
| | | | | Moving the different parts into their own functions without any additional cleanup/refactoring, so this is NFC.
* [LLDB] [PECOFF] Look for the truncated ".eh_fram" section nameMartin Storsjö2019-11-281-1/+2
| | | | | | | | | | | | | | COFF section names can either be stored truncated to 8 chars, in the section header, or as a longer section name, stored separately in the string table. libunwind locates the .eh_frame section by runtime introspection, which only works for section names stored in the section header (as the string table isn't mapped at runtime). To support this behaviour, lld always truncates the section names for sections that will be mapped, like .eh_frame. Differential Revision: https://reviews.llvm.org/D70745
* [LLDB] [PECOFF] Factorize mapping section names to types using StringSwitch. ↵Martin Storsjö2019-11-282-98/+75
| | | | | | | | | NFCI. Keep the existing special cases based on combinations of section name, flags and sizes/offsets. Differential Revision: https://reviews.llvm.org/D70778
* [lldb] Remove debugging code used for LLDB_DWARF_DONT_COMPLETE_TYPENAMESRaphael Isemann2019-11-281-33/+0
| | | | | | | | | | | | Reviewers: labath, clayborg, shafik Reviewed By: labath Subscribers: JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70802
* [LLDB] Avoid using InitializeContext for zero-initializing a CONTEXT. NFC.Martin Storsjö2019-11-271-9/+2
| | | | | | | | | | | | | | | | | | InitializeContext is useful for allocating a (potentially variable size) CONTEXT struct in an unaligned byte buffer. In this case, we already have a fixed size CONTEXT we want to initialize, and we only used this as a very roundabout way of zero initializing it. Instead just memset the CONTEXT we have, and set the ContextFlags field manually. This matches how it is done in NativeRegisterContextWindows_*.cpp. This also makes LLDB run successfully in Wine (for a trivial tested case at least), as Wine hasn't implemented the InitializeContext function. Differential Revision: https://reviews.llvm.org/D70742
* [lldb][NFC] Early exit in DWARFASTParserClang::ParseArrayTypeRaphael Isemann2019-11-271-74/+74
|
* [lldb] Avoid snprintf in PlatformRemoteDarwinDevicePavel Labath2019-11-261-19/+14
| | | | This quashes a -Wformat-truncation warning.
* [lldb][NFC] Modernize string handling in DWARFASTParserClang::ParseTypeModifierRaphael Isemann2019-11-261-22/+16
|
* [lldb] Use llvm::format in AppleObjCRuntimeV2.cppPavel Labath2019-11-261-8/+2
| | | | Crushing a "sprintf" buffer is null warning.
* [lldb] remove a superfluous semicolonPavel Labath2019-11-261-1/+1
|
* [lldb/symbolvendorelf] Copy more sections from separate debug filesPavel Labath2019-11-261-8/+11
| | | | Include the fancier DWARF5 sections too.
* [lldb][NFC] Remove no longer unused variable in ↵Raphael Isemann2019-11-261-1/+0
| | | | DWARFASTParserClang::ParseTypeFromDWARF
* [lldb][NFC] Simplify structure parsing code in ↵Raphael Isemann2019-11-261-4/+2
| | | | | | | | DWARFASTParserClang::ParseTypeFromDWARF This way it looks more like the code around it. The assert is also gone as it just checks that the variables we declare directly above were not initialized by anyone. That made more sense when this was one large function.
* [lldb] Add boilerplate to recognize the .debug_rnglists.dwo sectionPavel Labath2019-11-263-1/+4
|
* [lldb][NFC] Extract type modifier parsing from ↵Raphael Isemann2019-11-262-208/+226
| | | | | | DWARFASTParserClang::ParseTypeFromDWARF Part of the work to split up this monolithic parsing function.
* [lldb][NFC] Extract enum parsing from DWARFASTParserClang::ParseTypeFromDWARFRaphael Isemann2019-11-262-100/+113
| | | | Part of the work to split up this monolithic parsing function.
* [lldb][NFCI] Extract subroutine parsing from ↵Raphael Isemann2019-11-262-374/+384
| | | | | | | | | DWARFASTParserClang::ParseTypeFromDWARF Part of the work to split up this monolithic parsing function. Should be NFC but due to the kafkaesque control flow in this case statement this might have some unintended side effects.
* [lldb][NFC] Extract array type parsing from ↵Raphael Isemann2019-11-262-84/+95
| | | | | | DWARFASTParserClang::ParseTypeFromDWARF Part of the work to split up this monolithic parsing function.
* [lldb][NFC] Extract pointer to member type parsing from ↵Raphael Isemann2019-11-262-18/+28
| | | | | | DWARFASTParserClang::ParseTypeFromDWARF Part of the work to split up this monolithic parsing function.
* [lldb][NFC] NULL -> nullptr in ↵Raphael Isemann2019-11-261-4/+4
| | | | DWARFASTParserClang::UpdateSymbolContextScopeForType
* [lldb] [Process/NetBSD] Fix handling concurrent watchpoint eventsMichał Górny2019-11-254-24/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix handling concurrent watchpoint events so that they are reported correctly in LLDB. If multiple watchpoints are hit concurrently, the NetBSD kernel reports them as series of SIGTRAPs with a thread specified, and the debugger investigates DR6 in order to establish which watchpoint was hit. This is normally fine. However, LLDB disables and reenables the watchpoint on all threads after each hit, which results in the hit status from DR6 being wiped. As a result, it can't establish which watchpoint was hit in successive SIGTRAP processing. In order to workaround this problem, clear DR6 only if the breakpoint is overwritten with a new one. More specifically, move cleaning DR6 from ClearHardwareWatchpoint() to SetHardwareWatchpointWithIndex(), and do that only if the newly requested watchpoint is different from the one being set previously. This ensures that the disable-enable logic of LLDB does not clear watchpoint hit status for the remaining threads. This also involves refactoring of watchpoint logic. With the old logic, clearing watchpoint involved wiping dr6 & dr7, and setting it setting dr{0..3} & dr7. With the new logic, only enable bit is cleared from dr7, and the remaining bits are cleared/overwritten while setting new watchpoint. Differential Revision: https://reviews.llvm.org/D70025
* [lldb] [Process/NetBSD] Copy watchpoints to newly-created threadsMichał Górny2019-11-257-8/+54
| | | | | | | | | | | | | NetBSD ptrace interface does not populate watchpoints to newly-created threads. Solve this via copying the watchpoints from the current thread when new thread is reported via TRAP_LWP. Add a test that verifies that when the user does not have permissions to set watchpoints on NetBSD, the 'watchpoint set' errors out gracefully and thread monitoring does not crash on being unable to copy watchpoints to new threads. Differential Revision: https://reviews.llvm.org/D70023
* [lldb] [Process/NetBSD] Improve threading supportMichał Górny2019-11-254-86/+256
| | | | | | | | | | | | | | | | | | | | | | | | | Implement major improvements to multithreaded program support. Notably, support tracking new and exited threads, associate signals and events with correct threads and support controlling individual threads when resuming. Firstly, use PT_SET_EVENT_MASK to enable reporting of created and exited threads via SIGTRAP. Handle TRAP_LWP events to keep track of the currently running threads. Secondly, update the signal (both generic and SIGTRAP) handling code to account for per-thread signals correctly. Signals delivered to the whole process are reported on all threads, while per-thread signals and events are reported only to the specific thread. The remaining threads are marked as 'stopped with no reason'. Note that NetBSD always stops all threads on debugger events. Thirdly, implement the ability to set every thread as running, stopped or single-stepping separately while continuing the process. This also provides the ability to send a signal to the whole process or to one of its thread while resuming. Differential Revision: https://reviews.llvm.org/D70022
* [lldb][NFC] Allow range-based for-loops on VariableListRaphael Isemann2019-11-252-5/+2
| | | | | | | | | | | | | | | | Summary: Adds support for doing range-based for-loops on LLDB's VariableList and modernises all the index-based for-loops in LLDB where possible. Reviewers: labath, jdoerfert Reviewed By: labath Subscribers: JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70668
* [lldb] Remove lldb's own ASTDumperRaphael Isemann2019-11-256-316/+94
| | | | | | | | | | | | | | | | | | | | | Summary: LLDB's ASTDumper is just a clone of Clang's ASTDumper but with some scary code and some unrelated functionality (like dumping name/attributes of types). This removes LLDB's ASTDumper and replaces its uses with the `ClangUtils::DumpDecl` method that just calls Clang's ASTDumper and returns the result as a string. The few uses where we just want a textual representation of a type (which will print their name/attributes but not dump any AST) are now also in ClangUtil under a `ToString` name until we find a better home for them. Reviewers: labath Reviewed By: labath Subscribers: mgorny, JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70663
* [lldb][NFC] Do an early exit in LookupLocalVarNamespace and LookUpLldbObjCClassRaphael Isemann2019-11-232-48/+56
|
* [lldb][NFC] NFC refactoring for ↵Raphael Isemann2019-11-231-55/+30
| | | | | | ClangExpressionDeclMap::LookupInModulesDeclVendor Early exiting and deduplicating copy-pasted code.
* [lldb][NFC] NFC refactoring ClangExpressionDeclMap::LookupLocalVariableRaphael Isemann2019-11-231-36/+33
| | | | | Adding an early exits and moving variable declarations closer to their actual use.
* [lldb][NFC] Fix LLDB build after ModuleManager->ASTReader renameRaphael Isemann2019-11-232-2/+2
| | | | That happened in 20d51b2f14ac4488f684f8f but LLDB wasn't updated.
OpenPOWER on IntegriCloud