summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins
Commit message (Collapse)AuthorAgeFilesLines
* Shorten sanitizer plugin namesPavel Labath2017-06-2610-15/+15
| | | | | | | | | | | | | | | | | | | | | | | Summary: The new UndefinedBehaviorSanitizer plugin was breaking file path length limits, because it's (fairly long name) appears multiple times in the path. Cmake ends up putting the object file at path tools/lldb/source/Plugins/InstrumentationRuntime/UndefinedBehaviorSanitizer/CMakeFiles/lldbPluginInstrumentationRuntimeUndefinedBehaviorSanitizer.dir/UndefinedBehaviorSanitizerRuntime.cpp.obj which is 191 characters long and very dangerously close to the 260 character path limit on windows systems (also, just the include line for that file was breaking the 80 character line limit). This renames the sanitizer plugins to use shorter names (asan, ubsan, tsan). I think this will still be quite understandable to everyone as those are the names everyone uses to refer to them anyway. Reviewers: zturner, kubamracek, jingham Subscribers: lldb-commits, mgorny Differential Revision: https://reviews.llvm.org/D34553 llvm-svn: 306278
* Updated the NSArray and NSDictionary formatters to support new storage formats.Sean Callanan2017-06-232-17/+493
| | | | | | | | Also un-xfailed a testcase that was affected by this. Thanks to Jason Molenda for the patch. <rdar://problem/32827216> llvm-svn: 306180
* Fix typo: using && instead of & when evaluating a maskMehdi Amini2017-06-231-1/+1
| | | | | | | | | | | | Summary: Reported by coverity, I don't know how to provide a test. Reviewers: zturner Subscribers: lldb-commits, emaste Differential Revision: https://reviews.llvm.org/D34550 llvm-svn: 306134
* Correct syntax mistake hidden in assert(3)Kamil Rytarowski2017-06-201-1/+1
| | | | | | | wait_status cannot be compared with WaitStatus::Stop, go for wait_status.type. llvm-svn: 305794
* [linux] Change the way we load vdso pseudo-modulePavel Labath2017-06-204-104/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is basically a revert of D16107 and parts of D10800, which were trying to get vdso loading working. They did this by implementing a generic load-an-elf-file from memory approach, which is not correct, since we cannot assume that an elf file is loaded in memory in full (it usually isn't, as there's no need to load section headers for example). This meant that we would read garbage instead of section sizes, and if that garbage happened to be a large number, we would crash while trying to allocate a buffer to accomodate the hypothetical section. Instead of this, I add a bit of custom code to load the vdso to DynamicLoaderPOSIXDYLD (which already needed to handle the vdso specially). I determine the size of the memory to read using Process::GetMemoryRegionInfo, which is information coming from the OS, and cannot be forged by a malicious/misbehaving application. Reviewers: eugene, clayborg Subscribers: lldb-commits, ravitheja, tberghammer, emaste Differential Revision: https://reviews.llvm.org/D34352 llvm-svn: 305780
* Updated NSNumber formatter for new internal representation.Sean Callanan2017-06-192-15/+106
| | | | | | <rdar://problem/32780109> llvm-svn: 305727
* Add pretty-printer for wait(2) statuses and modernize the code handling themPavel Labath2017-06-196-175/+43
| | | | | | | | | | | | | | | Summary: A number of places were trying to decode the result of wait(). Add a simple utility function that does that and a struct that encapsulates the decoded result. Then also provide a pretty-printer for that class. Reviewers: zturner, krytarowski, eugene Subscribers: lldb-commits, mgorny Differential Revision: https://reviews.llvm.org/D33998 llvm-svn: 305689
* Tweak SysV_arm64 function entry unwind planPavel Labath2017-06-191-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The motivation for this is to make sure the first row of the plan compares equal to the first row of a generic debug_frame unwind plan. Right now, the code in FuncUnwinders::GetUnwindPlanAtNonCallSite considers them unequal because they specify the return address in a different way (SetReturnAddressRegister(LR) vs. an explicit PC=LR rule). This means that FuncUnwinders would always choose the debug_frame unwind plan, which is not correct, as that one is usually not correct at all locations. Right now this is basically a noop because we don't have parse any debug_frame plans, but it fixes some test failures when merging D33504 in. I have to say I don't understand the full implications of the switch to SetReturnAddressRegister() way of doing things, but given that all of our other unwind plans (eh_frame, instruction profiling) do it this way, it sounds like the right thing to do. Reviewers: tberghammer, jasonmolenda, omjavaid Subscribers: aemerson, javed.absar, kristof.beyls, lldb-commits Differential Revision: https://reviews.llvm.org/D34199 llvm-svn: 305687
* Fix the CMake files for the new InstrumentationRuntime plugins.Kuba Mracek2017-06-162-2/+22
| | | | llvm-svn: 305594
* Upstreaming the UndefinedBehaviorSanitizerRuntime and ↵Kuba Mracek2017-06-169-12/+758
| | | | | | MainThreadCheckerRuntime plugins. llvm-svn: 305589
* Fix backtrace of noreturn functions situated at the end of a modulePavel Labath2017-06-081-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: When a call instruction is the last instruction in a function, the backtrace PC will point past the end of the function. We already had special code to handle that, but we did not handle the case where the PC ends up outside of the bounds of the module containing the function, which is a situation that occured in TestNoreturnUnwind on android for some arch/compiler combinations. I fix this by adding an argument to Address resolution code which states that we are ok with addresses pointing to the end of a module/section to resolve to that module/section. I create a reproducible test case for this situation by hand-crafting an executable which has a noreturn function at the end of a module. Reviewers: jasonmolenda, jingham Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D32022 llvm-svn: 304976
* Switch TaskMapOverInt to llvm::function_refPavel Labath2017-06-071-3/+2
| | | | | | | | | | The function does not persist the callback, so using a lighter-weight asbtraction seems appropriate. Also tweak the signatures of the lambdas to match what the TaskMap interface expects. llvm-svn: 304924
* Move Object format code to lib/BinaryFormat.Zachary Turner2017-06-076-3/+6
| | | | | | | | | | | | This creates a new library called BinaryFormat that has all of the headers from llvm/Support containing structure and layout definitions for various types of binary formats like dwarf, coff, elf, etc as well as the code for identifying a file from its magic. Differential Revision: https://reviews.llvm.org/D33843 llvm-svn: 304864
* Fix assorted compiler warnings. NFCPavel Labath2017-06-062-2/+3
| | | | llvm-svn: 304796
* replace uses of strerror with llvm::sys::StrErrorPavel Labath2017-06-063-29/+26
| | | | | | | | strerror is not thread-safe. llvm's StrError tries hard to retrieve the string in a thread-safe way and falls back to strerror only if it does not have another way. llvm-svn: 304795
* Avoid invalid string access in ObjCLanguage::MethodName::SetNameStephane Sezer2017-06-051-1/+1
| | | | | | | | | | | | | | | | | Summary: Don't access `name[1] if the string is only of length 1. Avoids a crash/assertion failure when parsing the string `-`. Test Plan: Debug a swift binary, set a breakpoint, watch lldb not crash Original change by Paul Menage <menage@fb.com> Reviewers: lldb-commits, clayborg Differential Revision: https://reviews.llvm.org/D33853 llvm-svn: 304725
* Move the code to find a binary in a bundle in the target.exec-search-pathsJason Molenda2017-06-024-64/+93
| | | | | | | | from PlatformRemoteDarwinDevice into PlatformDarwin, and have both PlatformRemoteDarwinDevice and PlatformMacOSX call it there. <rdar://problem/31825940> llvm-svn: 304520
* More StructuredData::Type::eTypeDictionary -> ↵Stephan Bergmann2017-05-292-7/+7
| | | | | | | | lldb::eStructuredDataTypeDictionary ...missing from previous r304138 "Added new API to SBStructuredData class" llvm-svn: 304142
* Fixing Memory LeakRavitheja Addepally2017-05-261-3/+3
| | | | llvm-svn: 303991
* Fix 32-bit buildsPavel Labath2017-05-261-13/+12
| | | | | | | | | | | | r303972 used GetValueForKeyAsInteger with mismatched types (e.g. instantiating with uint64_t, but passing a size_t argument), which manifested itself on 32-bit architectures. The intended usage of these functions was to not specify the type explicitly, and let the compiler figure that out, so switch to that kind of usage instead. llvm-svn: 303988
* Implementation of remote packets for Trace data.Ravitheja Addepally2017-05-266-1/+518
| | | | | | | | | | | | | | | | | | Summary: The changes consist of new packets for trace manipulation and trace collection. The new packets are also documented. The packets are capable of providing custom trace specific parameters to start tracing and also retrieve such configuration from the server. Reviewers: clayborg, lldb-commits, tberghammer, labath, zturner Reviewed By: clayborg, labath Subscribers: krytarowski, lldb-commits Differential Revision: https://reviews.llvm.org/D32585 llvm-svn: 303972
* FreeBSD ProcessMonitor: map TRAP_CAP to a trace trapEd Maste2017-05-261-0/+4
| | | | | | | | | | | | In the absense of a more specific handler for TRAP_CAP (generated by ENOTCAPABLE or ECAPMODE while in capability mode) treat it as a trace trap. Obtained from FreeBSD r318884. We should later add an option to have LLDB control the trapcap procctl (as with ASLR), as well as report a specific stop reason. For now this change eliminates an assertion failure from LLDB. llvm-svn: 303965
* Correct compiler warnings and Debug build of the NetBSD targetKamil Rytarowski2017-05-242-12/+21
| | | | | | Correct files present only in the NetBSD build. llvm-svn: 303823
* Fix bad change in RenderScriptx86ABIFixups.cpp, forgot to change everything ↵Stephane Sezer2017-05-231-2/+2
| | | | | | | | | | | | | | necessary Summary: I didn't change all instances of i to I in this loop. I am a bad person and should feel bad. :( Reviewers: sas Differential Revision: https://reviews.llvm.org/D33456 Change by Alex Langford <apl@fb.com> llvm-svn: 303677
* hange RenderScriptx86ABIFixups.cpp to use llvm::AttributeList iteratorStephane Sezer2017-05-231-1/+2
| | | | | | | | | | LLVM::AttributeList recently had getNumSlots() removed, which broke the build. This fixes the build using functions introduced in the update to LLVM::AttributeList. Change by Alex Langford <apl@fb.com> llvm-svn: 303674
* [Expression parser] Look up module symbols before hunting globallySean Callanan2017-05-162-118/+12
| | | | | | | | | | | | | | | | | | | When it resolves symbol-only variables, the expression parser currently looks only in the global module list. It should prefer the current module. I've fixed that behavior by making it search the current module first, and only search globally if it finds nothing. I've also added a test case. After review, I moved the core of the lookup algorithm into SymbolContext for use by other code that needs it. Thanks to Greg Clayton and Pavel Labath for their help. Differential Revision: https://reviews.llvm.org/D33083 llvm-svn: 303223
* Skip TestWatchedVarHitWhenInScope on android arm because it triggers a ↵Pavel Labath2017-05-161-1/+1
| | | | | | kernel bug llvm-svn: 303160
* Fix darwin build for r303058Pavel Labath2017-05-151-2/+5
| | | | llvm-svn: 303061
* Remove an expensive lock from TimerPavel Labath2017-05-1512-34/+52
| | | | | | | | | | | | | The Timer destructor would grab a global mutex in order to update execution time. Add a class to define a category once, statically; the class adds itself to an atomic singly linked list, and thus subsequent updates only need to use an atomic rather than grab a lock and perform a hashtable lookup. Differential Revision: https://reviews.llvm.org/D32823 Patch by Scott Smith <scott.smith@purestorage.com>. llvm-svn: 303058
* Update StructuredData::String to return StringRefs.Zachary Turner2017-05-1212-54/+48
| | | | | | | | It was returning const std::string& which was leading to unnecessary copies all over the place, and preventing people from doing things like Dict->GetValueForKeyAsString("foo", ref); llvm-svn: 302875
* Fix Linux Buildbot.Zachary Turner2017-05-121-1/+1
| | | | llvm-svn: 302874
* Rename Error -> Status.Zachary Turner2017-05-12261-2848/+2905
| | | | | | | | | | | | | | | This renames the LLDB error class to Status, as discussed on the lldb-dev mailing list. A change of this magnitude cannot easily be done without find and replace, but that has potential to catch unwanted occurrences of common strings such as "Error". Every effort was made to find all the obvious things such as the word "Error" appearing in a string, etc, but it's possible there are still some lingering occurences left around. Hopefully nothing too serious. llvm-svn: 302872
* [DWARF parser] Produce correct template parameter packsSean Callanan2017-05-114-20/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Templates can end in parameter packs, like this template <class T...> struct MyStruct { /*...*/ }; LLDB does not currently support these parameter packs; it does not emit them into the template argument list at all. This causes problems when you specialize, e.g.: template <> struct MyStruct<int> { /*...*/ }; template <> struct MyStruct<int, int> : MyStruct<int> { /*...*/ }; LLDB generates two template specializations, each with no template arguments, and then when they are imported by the ASTImporter into a parser's AST context we get a single specialization that inherits from itself, causing Clang's record layout mechanism to smash its stack. This patch fixes the problem for classes and adds tests. The tests for functions fail because Clang's ASTImporter can't import them at the moment, so I've xfailed that test. Differential Revision: https://reviews.llvm.org/D33025 llvm-svn: 302833
* Be a little more permissive in DynamicLoaderMacOS::CanLoadImageJim Ingham2017-05-061-8/+9
| | | | | | | | | | | | | If we can't find the "is dyld locked" symbol, assume it is safe to load the image unless we only have 1 image loaded - in which case we are in _dyld_start and it is definitely NOT safe. Also add a little better errors to that function, and better logging in SBProcess.cpp. <rdar://problem/30174817> llvm-svn: 302327
* Add TaskMap for iterating a function over a set of integersPavel Labath2017-05-051-43/+30
| | | | | | | | | | | | | | | | Summary: Many parallel tasks just want to iterate over all the possible numbers from 0 to N-1. Rather than enqueue N work items, instead just "map" the function across the requested integer space. Reviewers: clayborg, labath, tberghammer, zturner Reviewed By: clayborg, zturner Subscribers: zturner, lldb-commits Differential Revision: https://reviews.llvm.org/D32757 Patch by Scott Smith <scott.smith@purestorage.com>. llvm-svn: 302223
* ABISysV_arm64: compute return value for large vectors correctlyPavel Labath2017-05-051-18/+16
| | | | | | | | | | | | | | | | | | | | | Summary: Arm64 Procedure Call Standard specifies than only vectors up to 16 bytes are stored in v0 (which makes sense, as that's the size of the register). 32-byte vector types are passed as regular structs via x8 pointer. Treat them as such. This fixes TestReturnValue for arm64-clang. I also split the test case into two so I can avoid the if(gcc) line, and annotate each test instead. (It seems the vector type tests fail with gcc only when targetting x86 arches). Reviewers: tberghammer, eugene Subscribers: aemerson, omjavaid, rengolin, srhines, lldb-commits Differential Revision: https://reviews.llvm.org/D32813 llvm-svn: 302220
* Fixed a bug where we did not properly use the complete versions of ↵Sean Callanan2017-05-031-2/+2
| | | | | | | | | | Objective-C classes. Also added a test case, thanks to Greg Clayton. <rdar://problem/18913551> llvm-svn: 301993
* ObjectFileELF: Fix symbol lookup in bss sectionPavel Labath2017-05-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Summary: If we have symbol information in a separate file, we need to be very careful about presenting a unified section view of module to the rest of the debugger. ObjectFileELF had code to handle that, but it was being overly cautious -- the section->GetFileSize()!=0 meant that the unification would fail for sections which do not occupy any space in the object file (e.g., .bss). In my case, that manifested itself as not being able to display the values of .bss variables properly as the section associated with the variable did not have it's load address set (because it was not present in the unified section list). I test this by making sure the unified section list and the variables refer to the same section. Reviewers: eugene, zturner Subscribers: tberghammer, lldb-commits, mgorny Differential Revision: https://reviews.llvm.org/D32434 llvm-svn: 301917
* Change UniqueCStringMap to use ConstString as the keyPavel Labath2017-05-026-23/+21
| | | | | | | | | | | | | | | | 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
* Remove unused code related to CPlusPlusLanguage::FindEquivalentNamesPavel Labath2017-05-022-150/+0
| | | | | | | | | | | | | | | Summary: It is simply unused, and the header for it is private, so there should be no external dependencies. Reviewers: #lldb, zturner Reviewed By: zturner Subscribers: zturner, tberghammer, jingham, lldb-commits Differential Revision: https://reviews.llvm.org/D32503 Patch by Scott Smith <scott.smith@purestorage.com>. llvm-svn: 301903
* Provide a mechanism to do some pre-loading of symbols up front.Jim Ingham2017-04-282-0/+8
| | | | | | | | | | | Loading a shared library can require a large amount of work; rather than do that serially for each library, this patch will allow parallelization of the symbols and debug info name indexes. From scott.smith@purestorage.com https://reviews.llvm.org/D32598 llvm-svn: 301609
* Fix libcxx formatters for changes in r300140.Lang Hames2017-04-263-16/+87
| | | | | | | | | | | | | | | | | | Summary: LLVM r300140 changed the layout and field names of __compressed_pair, which broke LLDB's std::vector, std::map and std::unsorted_map formatters. This patch attempts to fix these formatters by having them interogate the __compressed_pair values to determine whether they're pre- or post-r300140 variants, then access them accordingly. Reviewers: jingham, EricWF Reviewed By: jingham Differential Revision: https://reviews.llvm.org/D32554 llvm-svn: 301493
* Re-landing IPv6 support for LLDB HostChris Bieneman2017-04-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | This support was landed in r300579, and reverted in r300669 due to failures on the bots. The failures were caused by sockets not being properly closed, and this updated version of the patches should resolve that. Summary from the original change: This patch adds IPv6 support to LLDB/Host's TCP socket implementation. Supporting IPv6 involved a few significant changes to the implementation of the socket layers, and I have performed some significant code cleanup along the way. This patch changes the Socket constructors for all types of sockets to not create sockets until first use. This is required for IPv6 support because the socket type will vary based on the address you are connecting to. This also has the benefit of removing code that could have errors from the Socket subclass constructors (which seems like a win to me). The patch also slightly changes the API and behaviors of the Listen/Accept pattern. Previously both Listen and Accept calls took an address specified as a string. Now only listen does. This change was made because the Listen call can result in opening more than one socket. In order to support listening for both IPv4 and IPv6 connections we need to open one AF_INET socket and one AF_INET6 socket. During the listen call we construct a map of file descriptors to addrin structures which represent the allowable incoming connection address. This map removes the need for taking an address into the Accept call. This does have a change in functionality. Previously you could Listen for connections based on one address, and Accept connections from a different address. This is no longer supported. I could not find anywhere in LLDB where we actually used the APIs in that way. The new API does still support AnyAddr for allowing incoming connections from any address. The Listen implementation is implemented using kqueue on FreeBSD and Darwin, WSAPoll on Windows and poll(2) everywhere else. https://reviews.llvm.org/D31823 llvm-svn: 301492
* Fixed a crash when dealing with an empty method name in the ObjC runtime.Sean Callanan2017-04-261-1/+6
| | | | | | | | I've filed a bug covering better unit testing of our runtime metadata reader, which will allow this to be testable.. <rdar://problem/31793264> llvm-svn: 301461
* Use llvm::ArrayRef rather than std::vector/std::initializer lists for someLang Hames2017-04-261-1/+2
| | | | | | | | | | | ValueObject methods. Using ArrayRef allows us to remove some overloads, work with more array-like types, and avoid some std::vector temporaries. https://reviews.llvm.org/D32518 llvm-svn: 301441
* [Expression parser] Return both types and variablesSean Callanan2017-04-241-256/+249
| | | | | | | | | | | | | | | | | | | | | Many times a user wants to access a type when there's a variable of the same name, or a variable when there's a type of the same name. Depending on the precise context, currently the expression parser can fail to resolve one or the other. This is because ClangExpressionDeclMap has logic to limit the amount of information it searches, and that logic sometimes cuts down the search prematurely. This patch removes some of those early exits. In that sense, this patch trades performance (early exit is faster) for correctness. I've also included two new test cases showing examples of this behavior – as well as modifying an existing test case that gets it wrong. llvm-svn: 301273
* [DWARF] Fix lookup in the abstract origins of inlined blocks/functionsSean Callanan2017-04-243-2/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LLDB uses clang::DeclContexts for lookups, and variables get put into the DeclContext for their abstract origin. (The abstract origin is a DWARF pointer that indicates the unique definition of inlined code.) When the expression parser is looking for variables, it locates the DeclContext for the current context. This needs to be done carefully, though, e.g.: __attribute__ ((always_inline)) void f(int a) { { int b = a * 2; } } void g() { f(3); } Here, if we're stopped in the inlined copy of f, we have to find the DeclContext corresponding to the definition of f – its abstract origin. Clang doesn't allow multiple functions with the same name and arguments to exist. It also means that any variables we see must be placed in the appropriate DeclContext. [Bug 1]: When stopped in an inline block, the function GetDeclContextDIEContainingDIE for that block doesn't properly construct a DeclContext for the abstract origin for inlined subroutines. That means we get duplicated function DeclContexts, but function arguments only get put in the abstract origin's DeclContext, and as a result when we try to look for them in nested contexts they aren't found. [Bug 2]: When stopped in an inline block, the DWARF (for space reasons) doesn't explicitly point to the abstract origin for that block. This means that the function GetClangDeclContextForDIE returns a different DeclContext for each place the block is inlined. However, any variables defined in the block have abstract origins, so they will only get placed in the DeclContext for their abstract origin. In this fix, I've introduced a test covering both of these issues, and fixed them. Bug 1 could be resolved simply by making sure we look up the abstract origin for inlined functions when looking up their DeclContexts on behalf of nested blocks. For Bug 2, I've implemented an algorithm that makes the DeclContext for a block be the containing DeclContext for the closest entity we would find during lookup that has an abstract origin pointer. That means that in the following situation: { // block 1 int a; { // block 2 int b; } } if we looked up the DeclContext for block 2, we'd find the block containing the abstract origin of b, and lookup would proceed correctly because we'd see b and a. However, in the situation { // block 1 int a; { // block 2 } } since there isn't anything to look up in block 2, we can't determine its abstract origin (and there is no such pointer in the DWARF for blocks). However, we can walk up the parent chain and find a, and its abstract origin lives in the abstract origin of block 1. So we simply say that the DeclContext for block 2 is the same as the DeclContext for block 1, which contains a. Lookups will return the same results. Thanks to Jim Ingham for review and suggestions. Differential revision: https://reviews.llvm.org/D32375 llvm-svn: 301263
* ThreadSanitizer plugin: match for loop variable with expected typeEd Maste2017-04-221-1/+1
| | | | | | | | Removes Clang warning ThreadSanitizerRuntime.cpp:591:21: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare] llvm-svn: 301067
* [Utility] Placate another GCC warning.Davide Italiano2017-04-201-3/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D32137 llvm-svn: 300845
* Add extra logging for when lldb is looking for kernels and kexts.Jason Molenda2017-04-201-3/+31
| | | | | | <rdar://problem/26863256> llvm-svn: 300810
OpenPOWER on IntegriCloud