summaryrefslogtreecommitdiffstats
path: root/lldb/source
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "[lldb] NFC: refactor CompileUnit::ResolveSymbolContext"Raphael Isemann2019-11-283-67/+83
| | | | | | This reverts commit 373e2a4f69d623e59329ff801f261d8b299e12d2. This broke breakpoint setting.
* [lldb][NFC] Use llvm::StringRef instead of C-strings as multimap keyRaphael Isemann2019-11-281-10/+5
|
* [lldb] NFC: refactor CompileUnit::ResolveSymbolContextKonrad Kleine2019-11-283-83/+67
| | | | | | | | | | | | | | | | | | | | | | | Summary: I found the above named method hard to read because it had a) many nested blocks and b) one return statement at the end with some logic involved. I decided to refactor this function by employing an early exit strategy. In order to capture the logic in the return statement and to not have it repeated more than once I chose to implement a very small lamda function that captures all the variables it needs. This is a non-functional change (NFC). Reviewers: jdoerfert Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70774
* [lldb][NFC] Remove unused CStringToDIEMap typedefRaphael Isemann2019-11-281-6/+0
|
* [lldb][NFC] Remove forward declaration of PrivateAutoCompleteMembersRaphael Isemann2019-11-281-7/+0
| | | | That's declared directly above the actual definition, so it serves no use.
* [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] Always interpret arm instructions as thumb on windowsMartin Storsjö2019-11-281-0/+3
| | | | | | | | Windows on ARM always uses thumb mode, and doesn't have most of the mechanisms that are used in e.g. ELF for distinguishing between arm and thumb. Differential Revision: https://reviews.llvm.org/D70796
* [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][NFC] Move TypeSystem RTTI to static variable to remove swift referenceRaphael Isemann2019-11-274-10/+9
|
* [lldb][NFC] Remove unused CompilerType memory functionsRaphael Isemann2019-11-271-167/+0
| | | | | | | | | | | | | | | | Summary: All these functions are unused from what I can see. Unless I'm missing something here, this code can go the way of the Dodo. Reviewers: labath Reviewed By: labath Subscribers: abidh, JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70770
* [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] remove unsigned Stream::operator<< overloadsPavel Labath2019-11-265-36/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: I recently re-discovered that the unsinged stream operators of the lldb_private::Stream class have a surprising behavior in that they print the number in hex. This is all the more confusing because the "signed" versions of those operators behave normally. Now that, thanks to Raphael, each Stream class has a llvm::raw_ostream wrapper, I think we should delete most of our formatting capabilities and just delegate to that. This patch tests the water by just deleting the operators with the most surprising behavior. Most of the code using these operators was printing user_id_t values. It wasn't fully consistent about prefixing them with "0x", but I've tried to consistenly print it without that prefix, to make it more obviously different from pointer values. Reviewers: teemperor, JDevlieghere, jdoerfert Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70241
* [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-265-1/+7
|
* [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-2511-85/+58
| | | | | | | | | | | | | | | | 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-257-316/+115
| | | | | | | | | | | | | | | | | | | | | 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.
* [DWARF] Handle call sites with indirect call targetsVedant Kumar2019-11-227-68/+160
| | | | | | | | | | Split CallEdge into DirectCallEdge and IndirectCallEdge. Teach DWARFExpression how to evaluate entry values in cases where the current activation was created by an indirect call. rdar://57094085 Differential Revision: https://reviews.llvm.org/D70100
* [lldb][DataFormatters] Support pretty printing std::string when built with ↵Jordan Rupprecht2019-11-221-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -funsigned-char. Summary: When built w/ `-funsigned-char`, `std::string` becomes equivalent to `std::basic_string<unsigned char>`, causing these formatters to not match. This patch adds overloads for both libstdc++ and libc++ string formatters that accepts unsigned char. Motivated by the following example: ``` $ cat pretty_print.cc template <typename T> void print_val(T s) { std::cerr << s << '\n'; // Set a breakpoint here! } int main() { std::string val = "hello"; print_val(val); return 0; } $ clang++ -stdlib=libc++ -funsigned-char -fstandalone-debug -g pretty_print.cc $ lldb ./a.out -b -o 'b pretty_print.cc:6' -o r -o 'fr v' ... (lldb) fr v (std::__1::basic_string<unsigned char, std::__1::char_traits<unsigned char>, std::__1::allocator<unsigned char> >) s = { __r_ = { std::__1::__compressed_pair_elem<std::__1::basic_string<unsigned char, std::__1::char_traits<unsigned char>, std::__1::allocator<unsigned char> >::__rep, 0, false> = { __value_ = { = { __l = (__cap_ = 122511465736202, __size_ = 0, __data_ = 0x0000000000000000) __s = { = (__size_ = '\n', __lx = '\n') __data_ = { [0] = 'h' [1] = 'e' [2] = 'l' [3] = 'l' [4] = 'o' [5] = '\0' ... ``` Reviewers: labath, JDevlieghere, shafik Subscribers: christof, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70517
* Reformat code for readability.Adrian Prantl2019-11-221-2/+2
|
* Complete complete types early when importing types from Clang module DWARF.Adrian Prantl2019-11-221-1/+14
| | | | | | | | | | | | | | | | | | | | | This affects -gmodules only. Under normal operation pcm_type is a shallow forward declaration that gets completed later. This is necessary to support cyclic data structures. If, however, pcm_type is already complete (for example, because it was loaded for a different target before), the definition needs to be imported right away, too. Type::ResolveClangType() effectively ignores the ResolveState inside type_sp and only looks at IsDefined(), so it never calls ClangASTImporter::ASTImporterDelegate::ImportDefinitionTo(), which does extra work for Objective-C classes. This would result in only the forward declaration to be visible. An alternative implementation would be to sink this into Type::ResolveClangType ( https://github.com/llvm/llvm-project/blob/88235812a71d99c082e7aa2ef9356d43d1f83a80/lldb/source/Symbol/Type.cpp#L5809) though it isn't clear to me how to best do this from a layering perspective. rdar://problem/52134074 Differential Revision: https://reviews.llvm.org/D70415
* Register Objective-C property accessors with their property decls.Adrian Prantl2019-11-221-29/+45
| | | | | | | | | | This is a correctness fix for the Clang DWARF parser that primarily matters for swift-lldb's ability to import Clang types that were reconstructed from DWARF into Swift. rdar://problem/55025799 Differential Revision: https://reviews.llvm.org/D70580
* [lldb] Fix exception breakpoint not being resolved when set on dummy targetMartin Svensson2019-11-221-1/+3
| | | | | | | | | | | | | | Summary: Ensure that breakpoint ivar is properly set in exception breakpoint resolver so that exception breakpoints set on dummy targets are resolved once real targets are created and run. Reviewers: jingham Reviewed By: jingham Subscribers: teemperor, JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D69880
* Early-exitify ClangASTContext::AddObjCClassProperty() (NFC)Adrian Prantl2019-11-211-178/+162
|
* [Reproducer] Make 'reproducer xcrash' behave the same during capture & replayJonas Devlieghere2019-11-211-2/+3
| | | | | There's no point in preventing this command from running during replay. We should simulate the same crash as during capture.
* [NFC] Refactor and improve comments in CommandObjectTargetAdrian McCarthy2019-11-211-145/+141
| | | | | | | | | | | | | | Made small improvements while debugging through CommandObjectTarget::AddModuleSymbols. 1. Refactored error case for an early out, reducing the indentation of the rest of this long function. 2. Clarified some comments by correcting spelling and punctuation. 3. Reduced duplicate code at the end of the function. Tested with `ninja check-lldb` Differential Review: https://reviews.llvm.org/D70458
* [lldb][NFC] Modernize string handling in ↵Raphael Isemann2019-11-211-11/+8
| | | | ClangExpressionDeclMap::FindExternalVisibleDecl
* [lldb][NFC] Move searching functions in ClangExpressionDeclMap to own functionRaphael Isemann2019-11-212-89/+121
|
* [lldb][NFC] Reduce scope of some variables in ↵Raphael Isemann2019-11-211-5/+3
| | | | ClangExpressionDeclMap::FindExternalVisibleDecls
OpenPOWER on IntegriCloud