summaryrefslogtreecommitdiffstats
path: root/lldb/source
Commit message (Collapse)AuthorAgeFilesLines
...
* [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
* [lldb][NFC] Move searching local variables into own functionRaphael Isemann2019-11-212-39/+74
|
* [lldb][NFC] Move searching the ClangModulesDeclVendor into own functionRaphael Isemann2019-11-212-72/+86
|
* [lldb][NFC] Move searching for the local variable namespace into own functionRaphael Isemann2019-11-212-24/+38
|
* [lldb][NFC] Early exit in ClangExpressionDeclMap::FindExternalVisibleDeclsRaphael Isemann2019-11-211-302/+302
|
* [Reproducer] Limit signals to macro define sin <csignal>Jonas Devlieghere2019-11-201-9/+0
| | | | SIGBUS is not part of the signal macros defined in the header <csignal>.
* Handle the case where the 'g' packet doesn't get all regs.Jason Molenda2019-11-201-0/+15
| | | | | | | | | | lldb would silently accept a response to the 'g' packet (read all registers) which was too large; this handles the case where it is too small. Differential Revision: https://reviews.llvm.org/D70417 <rdar://problem/34916465>
* [Reproducer] Generate LLDB reproducer on crashJonas Devlieghere2019-11-203-3/+147
| | | | | | | | | | | | | | | | | | | | This patch hooks the reproducer infrastructure with the signal handlers. When lldb crashes with reproducers capture enabled, it will now generate the reproducer and print a short message the standard out. This doesn't affect the pretty stack traces, which are still printed before. This patch also introduces a new reproducer sub-command that intentionally raises a given signal to test the reproducer signal handling. Currently the signal handler is doing too much work. Instead of copying over files into the reproducers in the signal handler, we should re-invoke ourselves with a special command line flag that looks at the VFS mapping and performs the copy. This is a NO-OP when reproducers are disabled. Differential revision: https://reviews.llvm.org/D70474
* [lldb] Fix NSURL data formatter truncation issueDavide Italiano2019-11-201-21/+33
| | | | | | | | | | | | Remove hardcoded string prefix length assumption causing issues when concatenating summary for NSURL in NSURLSummaryProvider. Provider relies on concatenation of NSStringProvider results for summary, and while the strings are prefixed with '@' in Objective-C, that is not the case in Swift causing part of the description to be truncated. This will be tested in the downstream fork. Patch by Martin Svensson!
* [lldb][NFC] Move searching for $__lldb_objc_class into its own functionRaphael Isemann2019-11-202-122/+134
| | | | Same as in commit e7cc833ddafdca10be4ef1322ab96ffee774045b but with $__lldb_objc_class.
* [lldb][NFC] Move searching for $__lldb_class into its own function in ↵Raphael Isemann2019-11-202-94/+117
| | | | ClangExpressionDeclMap
* [lldb][NFC] Move ClangExpressionDeclMap's persistent decl search into its ↵Raphael Isemann2019-11-202-53/+73
| | | | | | | | own function Searching persistent decls is a small subset of the things FindExternalVisibleDecls does. It should be its own function instead of being encapsulated in this `do { } while(false);` pattern.
* [lldb][NFC] Remove unused ClangASTContext::GetUnknownAnyTypeRaphael Isemann2019-11-201-7/+0
|
* [lldb][NFC] Simplify ClangASTContext::GetBasicTypesRaphael Isemann2019-11-202-27/+17
| | | | | static convenience methods that do the clang::ASTContext -> ClangASTContext conversion and handle errors by simply ignoring them are not a good idea.
* [lldb][NFC] Remove ClangASTContext::GetAsDeclContextRaphael Isemann2019-11-202-19/+3
| | | | Everything we pass to this function is already a DeclContext.
* [lldb][NFC] Remove ClangASTContext::FieldIsBitfield overloadRaphael Isemann2019-11-201-11/+4
|
* [lldb][NFC] Remove ClangASTContext::GetUniqueNamespaceDeclaration overloadRaphael Isemann2019-11-202-14/+6
| | | | | | This overload is only used in one place and having static overloads for all methods that only do an additional clang::ASTContext -> ClangASTContext conversion is just not sustainable.
* [Reproducer] Namespace the reproducer dump options.Jonas Devlieghere2019-11-192-3/+3
| | | | Make it clear that the current reproducer options are for dumping.
* [lldb] Add logging to IRExecutionUnit::GetStaticInitializersRaphael Isemann2019-11-191-6/+21
|
* [lldb][NFC] Early exit in IRExecutionUnit::GetStaticInitializersRaphael Isemann2019-11-191-24/+28
|
* [lldb] Remove ClangExpressionDeclMap::ResolveUnknownTypesRaphael Isemann2019-11-193-90/+0
| | | | | | | | | | | | | | | | | | | | | Summary: This is some really shady code. It's supposed to kick in after an expression already failed and then try to look up "unknown types" that for some undocumented reason can't be resolved during/before parsing. Beside the fact that we never mark any type as `EVUnknownType` in either swift-lldb or lldb (which means this code is unreachable), this code doesn't even make the expression evaluation succeed if if would ever be executed but instead seems to try to load more debug info that maybe any following expression evaluations might succeed. This patch removes ClangExpressionDeclMap::ResolveUnknownTypes and the related data structures/checks/calls. Reviewers: davide Reviewed By: davide Subscribers: aprantl, abidh, JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70388
* [lldb-server] Use LLDB_LOG_ERROR to consume Error<> even if logging is disabledMartin Storsjö2019-11-193-12/+12
| | | | Differential Revision: https://reviews.llvm.org/D70386
* Replace bitfield in lldb::Type with byte-sized members. (NFC)Adrian Prantl2019-11-184-63/+62
| | | | | | Due to alginment and packing using separate members takes up the same amount of space, but makes it far less cumbersome to deal with it in constructors etc.
* [lldb][NFC] Cleanup comments in ClangASTSource.hRaphael Isemann2019-11-181-22/+23
| | | | | The current file doesn't follow the 80 character limit and uses this cramped comment style that is hard to read.
* [lldb] [Process/NetBSD] Implement thread name gettingMichał Górny2019-11-181-1/+38
| | | | | | | Implement thread name getting sysctl() on NetBSD. Also fix the incorrect type in pthread_setname_np() in the relevant test. Differential Revision: https://reviews.llvm.org/D70363
* Avoid including Builtins.h in Preprocessor.hReid Kleckner2019-11-151-0/+1
| | | | | | Builtins are rarely if ever accessed via the Preprocessor. They are typically found on the ASTContext, so there should be no performance penalty to using a pointer indirection to store the builtin context.
* Fix -Wunused-result warnings in LLDBReid Kleckner2019-11-152-4/+4
| | | | | | | | | | Three uses of try_lock intentionally ignore the result, as explained in the comment. Make that explicit with a void cast. Add what appears to be a missing return in the clang expression parser code. It's a functional change, but presumably the right one. Differential Revision: https://reviews.llvm.org/D70281
* Add a testcase for Clang modules being updated within one LLDB session.Adrian Prantl2019-11-151-3/+4
| | | | This actually works as expected, but wasn't explicitly tested before.
* [-gmodules] Let LLDB log a warning if the Clang module hash mismatches.Adrian Prantl2019-11-153-16/+85
| | | | | | | | This feature is mostly there to aid debugging of Clang module issues, since the only useful actual the end-user can to is to recompile their program. Differential Revision: https://reviews.llvm.org/D70272
* Add RTTI support to the SymbolFile class hierarchyAdrian Prantl2019-11-1517-0/+105
| | | | Differential Revision: https://reviews.llvm.org/D70322
* Rename posix/FileSystem.cpp to FileSystemPosix.cppAdrian Prantl2019-11-152-1/+1
| | | | to avoid a linker warning on Darwin about two files having the same name.
OpenPOWER on IntegriCloud