summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Platform
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* NFC: Fix some comment typos.Bob Wilson2018-05-283-3/+3
| | | | llvm-svn: 333364
* Normalize some lldb #include statements.James Y Knight2018-05-221-1/+1
| | | | | | | | | | | Most non-local includes of header files living under lldb/sources/ were specified with the full path starting after sources/. However, in a few instances, other sub-directories were added to include paths, or Normalize those few instances to follow the style used by the rest of the codebase, to make it easier to understand. llvm-svn: 333035
* Enable ProcessMachCore plugin on non-apple platformsPavel Labath2018-05-221-0/+1
| | | | | | | | | | | | | | | | | | | Summary: The plugin already builds fine on other platforms (linux, at least). All that was necessary was to revitalize the hack in PlatformDarwinKernel (not a very pretty hack, but it gets us going at least). I haven't done a thorough investigation of the state of the plugin on other platforms, but at least the two core file tests we have seem to pass, so I enable them. Reviewers: JDevlieghere, jasonmolenda Subscribers: lldb-commits, mgorny Differential Revision: https://reviews.llvm.org/D47133 llvm-svn: 332997
* Reapply "Remove Process references from the Host module"Pavel Labath2018-05-151-5/+6
| | | | | | This re-lands r332250/D46395, after fixing Mac build errors. llvm-svn: 332353
* Revert "Remove Process references from the Host module"Pavel Labath2018-05-141-6/+5
| | | | | | | | | | The first fix wasn't enough, there is still a missing ProcessInstanceInfo include in Host.mm. I won't be able to test a fix before leaving work, so I am reverting both commits. This reverts commit r332250 and the subsequent fix attempt. llvm-svn: 332261
* Remove Process references from the Host modulePavel Labath2018-05-141-5/+6
| | | | | | | | | | | | | | | | | | | | | The Process class was only being referenced because of the last-ditch effort in the process launchers to set a process death callback in case one isn't set already. Although launching a process for debugging is the most important kind of "launch" we are doing, it is by far not the only one, so assuming this particular callback is the one to be used is not a good idea (besides breaking layering). Instead of assuming a particular exit callback, I change the launcher code to require the callback to be set by the user (and fix up the two call sites which did not set the callback already). Reviewers: jingham, davide Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D46395 llvm-svn: 332250
* FileSpec: Remove PathSyntax enum and use llvm version insteadPavel Labath2018-05-141-3/+2
| | | | | | | | | | | | | | | | | | | | Summary: The llvm version of the enum has the same enumerators, with stlightly different names, so this is mostly just a search&replace exercise. One concrete benefit of this is that we can remove the function for converting between the two enums. To avoid typing llvm::sys::path::Style::windows everywhere I import the enum into the FileSpec class, so it can be referenced as FileSpec::Style::windows. Reviewers: zturner, clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D46753 llvm-svn: 332247
* Add a lock to PlatformPOSIX::DoLoadImageFrederic Riss2018-05-112-22/+16
| | | | | | | | | | | | | | Summary: Multiple threads could be calling into DoLoadImage concurrently, only one should be allowed to create the UtilityFunction. Reviewers: jingham Subscribers: emaste, lldb-commits Differential Revision: https://reviews.llvm.org/D46733 llvm-svn: 332115
* Fix the code that gets the Xcode path. After path normalization this could ↵Greg Clayton2018-05-101-1/+1
| | | | | | | | was failing. This meant if the "debugserver" binary was removed from the LLDB.framework, lldb wouldn't be able to find debugserver. llvm-svn: 332050
* Convert all RunShellCommand functions to use the Timeout classPavel Labath2018-05-106-23/+21
| | | | | | | this completes the Timeout migration started in r331880 with the Predicate class. llvm-svn: 331970
* Reflow paragraphs in comments.Adrian Prantl2018-04-3021-354/+302
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is intended as a clean up after the big clang-format commit (r280751), which unfortunately resulted in many of the comment paragraphs in LLDB being very hard to read. FYI, the script I used was: import textwrap import commands import os import sys import re tmp = "%s.tmp"%sys.argv[1] out = open(tmp, "w+") with open(sys.argv[1], "r") as f: header = "" text = "" comment = re.compile(r'^( *//) ([^ ].*)$') special = re.compile(r'^((([A-Z]+[: ])|([0-9]+ )).*)|(.*;)$') for line in f: match = comment.match(line) if match and not special.match(match.group(2)): # skip intentionally short comments. if not text and len(match.group(2)) < 40: out.write(line) continue if text: text += " " + match.group(2) else: header = match.group(1) text = match.group(2) continue if text: filled = textwrap.wrap(text, width=(78-len(header)), break_long_words=False) for l in filled: out.write(header+" "+l+'\n') text = "" out.write(line) os.rename(tmp, sys.argv[1]) Differential Revision: https://reviews.llvm.org/D46144 llvm-svn: 331197
* Change PlatformPosix::DoLoadImage to use a UtilityFunction.Jim Ingham2018-04-172-50/+258
| | | | | | | | | | | That way we won't have to compile a new expression every time we want dlopen a library. <rdar://problem/32626584> Differential Revision: https://reviews.llvm.org/D45703 llvm-svn: 330214
* Move Args.cpp from Interpreter to UtilityPavel Labath2018-04-171-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: The Args class is used in plenty of places besides the command interpreter (e.g., anything requiring an argc+argv combo, such as when launching a process), so it needs to be in a lower layer. Now that the class has no external dependencies, it can be moved down to the Utility module. This removes the last (direct) dependency from the Host module to Interpreter, so I remove the Interpreter module from Host's dependency list. Reviewers: zturner, jingham, davide Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D45480 llvm-svn: 330200
* Sync PlatformNetBSD.cpp with LinuxKamil Rytarowski2018-02-051-88/+26
| | | | | | | | | | | | | | | | | Summary: Various changes in logging from log->Printf() to generic LLDB_LOG(). Sponsored by <The NetBSD Foundation> Reviewers: labath, joerg Reviewed By: labath Subscribers: llvm-commits, lldb-commits Differential Revision: https://reviews.llvm.org/D42912 llvm-svn: 324251
* Add Utility/Environment class for handling... environmentsPavel Labath2018-01-107-68/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: There was some confusion in the code about how to represent process environment. Most of the code (ab)used the Args class for this purpose, but some of it used a more basic StringList class instead. In either case, the fact that the underlying abstraction did not provide primitive operations for the typical environment operations meant that even a simple operation like checking for an environment variable value was several lines of code. This patch adds a separate Environment class, which is essentialy a llvm::StringMap<std::string> in disguise. To standard StringMap functionality, it adds a couple of new functions, which are specific to the environment use case: - (most important) envp conversion for passing into execve() and likes. Instead of trying to maintain a constantly up-to-date envp view, it provides a function which creates a envp view on demand, with the expectation that this will be called as the very last thing before handing the value to the system function. - insert(StringRef KeyEqValue) - splits KeyEqValue into (key, value) pair and inserts it into the environment map. - compose(value_type KeyValue) - takes a map entry and converts in back into "KEY=VALUE" representation. With this interface most of the environment-manipulating code becomes one-liners. The only tricky part was maintaining compatibility in SBLaunchInfo, which expects that the environment entries are accessible by index and that the returned const char* is backed by the launch info object (random access into maps is hard and the map stores the entry in a deconstructed form, so we cannot just return a .c_str() value). To solve this, I have the SBLaunchInfo convert the environment into the "envp" form, and use it to answer the environment queries. Extra code is added to make sure the envp version is always in sync. (This also improves the layering situation as Args was in the Interpreter module whereas Environment is in Utility.) Reviewers: zturner, davide, jingham, clayborg Subscribers: emaste, lldb-commits, mgorny Differential Revision: https://reviews.llvm.org/D41359 llvm-svn: 322174
* Make sure DataBufferLLVM contents are writablePavel Labath2017-12-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: We sometimes need to write to the object file we've mapped into memory, generally to apply relocations to debug info sections. We've had that ability before, but with the introduction of DataBufferLLVM, we have lost it, as the underlying llvm class (MemoryBuffer) only supports read-only mappings. This switches DataBufferLLVM to use the new llvm::WritableMemoryBuffer class as a back-end, as this one guarantees to return a writable buffer. This removes the need for the "Private" flag to the DataBufferLLVM creation functions, as it was really used to mean "writable". The LLVM function also does not have the NullTerminate flag, so I've modified our clients to not require this feature and removed that flag as well. Reviewers: zturner, clayborg, jingham Subscribers: emaste, aprantl, arichardson, krytarowski, lldb-commits Differential Revision: https://reviews.llvm.org/D40079 llvm-svn: 321255
* Fix osx build broken in r320346Pavel Labath2017-12-111-1/+0
| | | | llvm-svn: 320349
* Move PseudoTerminal to the lldb_private namespacePavel Labath2017-12-113-3/+3
| | | | | | | lldb_utility doesn't make sense, as it is no longer even living in the "utility" module. llvm-svn: 320346
* Change the ordering that we search for kexts and kernels on the localJason Molenda2017-12-091-7/+22
| | | | | | | | | | | | | | | | | | | | | computer. When doing kernel debugging, lldb scrapes around a few well-known locations to find kexts and kernels. It builds up two lists - kexts and kernels with dSYM, and kexts and kernels without dSYMs. After both lists have failed to provide a file, then we'll call out to things like the DebugSymbols framework to find a kext/kernel. This meant that when you had a kext/kernel on the local computer that did not have debug information, lldb wouldn't consult DebugSymbols etc once it'd locked on to one of these no-debug-info binaries on the local computer. Reorder this so we give DebugSymbols etc a shot at finding a debug-info file before we use any of the no-debug-info binaries that were found on the system. <rdar://problem/34434440> llvm-svn: 320241
* Update PlatformDarwin::GetDeveloperDir to handle the twoJason Molenda2017-12-091-8/+13
| | | | | | | | | | | | | | | | | most common cases where the Xcode.app bundle puts lldb - either as a default part of the bundle, or in a toolchain subdirectory, so the platform subclasses can find files relative to this directory. Dropped support for handling the case where the lldb framework was in /Library/PrivateFrameworks. I think this was intended to handle the case where lldb is installed in / (outside the Xcode.app bundle) - but in that case, we can look in the raw directory file paths to find anything. <rdar://problem/35285622> llvm-svn: 320240
* Fix netbsd, freebsd and osx builds for ArchSpec movePavel Labath2017-11-134-4/+4
| | | | llvm-svn: 318052
* Move ArchSpec to the Utility modulePavel Labath2017-11-134-4/+3
| | | | | | | | | | | | | The rationale here is that ArchSpec is used throughout the codebase, including in places which should not depend on the rest of the code in the Core module. This commit touches many files, but most of it is just renaming of #include lines. In a couple of cases, I removed the #include ArchSpec line altogether, as the file was not using it. In one or two places, this necessitated adding other #includes like lldb-private-defines.h. llvm-svn: 318048
* Increase AdbClient read timeoutPavel Labath2017-10-311-1/+1
| | | | | | | | The previous value was not sufficient for Pixel 2 phones. One would have hoped that the newer phones are faster, but that does not seem to be the case here. llvm-svn: 316993
* convert hard tabs to spaces in PlatformOpenBSD.cppEd Maste2017-08-161-1/+1
| | | | | | | Another case of this was responsible for the whitespace conflict in D34776. llvm-svn: 311003
* Make i386-*-freebsd expression work on JIT pathEd Maste2017-08-168-20/+46
| | | | | | | | | | | | | | | | * Enable i386 ABI creation for freebsd * Added an extra argument in ABISysV_i386::PrepareTrivialCall for mmap syscall * Unlike linux, the last argument of mmap is actually 64-bit(off_t). This requires us to push an additional word for the higher order bits. * Prior to this change, ktrace dump will show mmap failures due to invalid argument coming from the 6th mmap argument. Patch by Karnajit Wangkhem Differential Revision: https://reviews.llvm.org/D34776 llvm-svn: 311002
* [LLDB][MIPS] Fix process load/unload on android.Nitesh Jain2017-08-144-8/+25
| | | | | | | | | | | | To detect the correct function name based on the list of available symbols instead of the SDK version Reviewers: tberghammer, clayborg Subscribers: jaydeep, bhushan, lldb-commits Differential Revision: https://reviews.llvm.org/D36445 llvm-svn: 310856
* Clean up lldb-types.hPavel Labath2017-07-181-0/+1
| | | | | | | | | | | | | | | | | | | | Summary: It defined a couple of types (condition_t) which we don't use anymore, as we have c++11 goodies now. I remove these definitions. Also it unnecessarily included a couple of headers which weren't necessary for it's operation. I remove these, and place the includes in the relevant files (usually .cpp, usually in Host code) which use them. This allows us to reduce namespace pollution in most of the lldb files which don't need the OS-specific definitions. Reviewers: zturner, jingham Subscribers: ki.stfu, lldb-commits Differential Revision: https://reviews.llvm.org/D35113 llvm-svn: 308304
* Fix "process load" on new android targetsPavel Labath2017-07-054-9/+13
| | | | | | | | | | | | | | | Summary: On older android targets, we needed a dlopen rename workaround to get "process load" working. Since API 26 this is not required as the targets have a proper libdl so with the function names one would expect. To make this work I've had to remove the const qualifier from the GetLibdlFunctionDeclarations function (as now the declarations can depend on the connected target). Since I was already modifying the prototype (and the lower levels were already converted to StringRef) I took the oportunity to convert this function as well. llvm-svn: 307160
* Move Timer and TraceOptions from Core to UtilityPavel Labath2017-06-291-1/+1
| | | | | | | | | | | | | | Summary: The classes have no dependencies, and they are used both by lldb and lldb-server, so it makes sense for them to live in the lowest layers. Reviewers: zturner, jingham Subscribers: emaste, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D34746 llvm-svn: 306682
* 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
* Skip TestWatchedVarHitWhenInScope on android arm because it triggers a ↵Pavel Labath2017-05-161-1/+1
| | | | | | kernel bug llvm-svn: 303160
* Update StructuredData::String to return StringRefs.Zachary Turner2017-05-121-2/+2
| | | | | | | | 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
* Rename Error -> Status.Zachary Turner2017-05-1242-569/+582
| | | | | | | | | | | | | | | 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
* 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
* Add extra logging for when lldb is looking for kernels and kexts.Jason Molenda2017-04-201-3/+31
| | | | | | <rdar://problem/26863256> llvm-svn: 300810
* Revert yesterdays IPv6 patchesPavel Labath2017-04-191-1/+1
| | | | | | | | | | | | | The break the linux bots (and probably any other machine which would run the test suite in a massively parallel way). The problem is that it can happen that we only successfully create an IPv6 listening socket (because the relevant IPv4 port is used by another process) and then the connecting side attempts to connect to the IPv4 port and fails. It's not very obvious how to fix this problem, so I am reverting this until we come up with a solution. llvm-svn: 300669
* Update LLDB Host to support IPv6 over TCPChris Bieneman2017-04-181-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: 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. Reviewers: zturner, clayborg Subscribers: jasonmolenda, labath, lldb-commits, emaste Differential Revision: https://reviews.llvm.org/D31823 llvm-svn: 300579
* Unify the common code in the ios, tvos, watchos platforms into a singleJason Molenda2017-04-1710-2178/+899
| | | | | | | | | PlatformRemoveDarwinDevice class, subclassed to those three so they can provide their specific information. <rdar://problem/30159764> llvm-svn: 300512
* iwyu fixes for lldbCore.Zachary Turner2017-04-061-0/+1
| | | | | | | | | | | | | | This adjusts header file includes for headers and source files in Core. In doing so, one dependency cycle is eliminated because all the includes from Core to that project were dead includes anyway. In places where some files in other projects were only compiling due to a transitive include from another header, fixups have been made so that those files also include the header they need. Tested on Windows and Linux, and plan to address failures on OSX and FreeBSD after watching the bots. llvm-svn: 299714
* [LLDB] OpenBSD supportKamil Rytarowski2017-03-265-1/+301
| | | | | | | | | | | | | | | | | | | | Summary: Add basic OpenBSD support. This is enough to be able to analyze core dumps for OpenBSD/amd64, OpenBSD/arm, OpenBSD/arm64 and OpenBSD/i386. Note that part of the changes to source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp fix a bug that probably affects other platforms as well. The GetProgramHeaderByIndex() interface use 1-based indices, but in some case when looping over the headers the, the loop starts at 0 and misses the last header. This caused problems on OpenBSD since OpenBSD core dumps have the PT_NOTE segment as the last program header. Reviewers: joerg, labath, krytarowski Reviewed By: krytarowski Subscribers: aemerson, emaste, rengolin, srhines, krytarowski, mgorny, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D31131 llvm-svn: 298810
* Delete some more dead includes.Zachary Turner2017-03-222-2/+0
| | | | | | | This breaks the cycle between Target and PluginLanguageC++, reducing the overall cycle count from 43 to 42. llvm-svn: 298561
* Move FileSpec from Host -> Utility.Zachary Turner2017-03-2221-21/+21
| | | | llvm-svn: 298536
* Replace std::ofstream with llvm::raw_fd_ostreamPavel Labath2017-03-211-5/+10
| | | | | | | | | | | | | | Summary: ofstream does not handle paths with non-ascii characters correctly on windows, so I am switching these to llvm streams to fix that. Reviewers: zturner, eugene Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D31079 llvm-svn: 298375
* Resubmit r298334 after fixing OSX build errors.Zachary Turner2017-03-211-4/+7
| | | | | | | Hopefully this works, I can't test since I don't have Mac hardware, however. llvm-svn: 298340
* Revert r298334 until Zachary has a chance to fix the buildbot failureJason Molenda2017-03-211-7/+4
| | | | | | on macosx. llvm-svn: 298338
* Delete various lldb FileSystem functions.Zachary Turner2017-03-211-4/+7
| | | | | | | | Use LLVM's equivalent versions instead. Differential Revision: https://reviews.llvm.org/D31111 llvm-svn: 298334
* Delete LLDB's MD5 code. Use LLVM instead.Zachary Turner2017-03-201-5/+7
| | | | | | Differential Revision: https://reviews.llvm.org/D31108 llvm-svn: 298325
* Remove FileSystem::MakeDirectory.Zachary Turner2017-03-192-5/+2
| | | | | | | | Have callers use llvm::sys::fs::create_directory() instead. Differential Revision: https://reviews.llvm.org/D31086 llvm-svn: 298203
* Resubmit FileSystem changes.Zachary Turner2017-03-0813-50/+71
| | | | | | | | | | This was originall reverted due to some test failures in ModuleCache and TestCompDirSymlink. These issues have all been resolved and the code now passes all tests. Differential Revision: https://reviews.llvm.org/D30698 llvm-svn: 297300
OpenPOWER on IntegriCloud