summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/common
Commit message (Collapse)AuthorAgeFilesLines
...
* Create a HostThread abstraction.Zachary Turner2014-09-096-225/+291
| | | | | | | | | | | | | This patch moves creates a thread abstraction that represents a thread running inside the LLDB process. This is a replacement for otherwise using lldb::thread_t, and provides a platform agnostic interface to managing these threads. Differential Revision: http://reviews.llvm.org/D5198 Reviewed by: Jim Ingham llvm-svn: 217460
* Consolidate UnixSignals setting/getting in Process.Todd Fiala2014-08-291-0/+12
| | | | | | | | | | | | | | | | See http://reviews.llvm.org/D5108 for details. This change does the following: * eliminates the Process::GetUnixSignals() virtual method and replaces with a fixed getter. * replaces the Process UnixSignals storage with a shared pointer. * adds a Process constructor variant that can be passed the UnixSignalsSP. When the constructor without the UnixSignalsSP is specified, the Host's default UnixSignals is used. * adds a host-specific version of GetUnixSignals() that is used when we need the host's appropriate UnixSignals variant. * replaces GetUnixSignals() overrides in PlatformElfCore, ProcessGDBRemote, ProcessFreeBSD and ProcessLinux with code that appropriately sets the Process::UnixSignals for the process. This change also enables some future patches that will enable llgs to be used for local Linux debugging. llvm-svn: 216748
* Ensure the Host wait4 thread is able to show pid in thread name.Todd Fiala2014-08-281-1/+12
| | | | | | | | | For hosts that cannot support long thread names, shrink the host wait4 thread name so that it does not truncate the PID in the thread name. Change by Shawn Best. llvm-svn: 216686
* llgs: add proper exec support for Linux.Todd Fiala2014-08-282-0/+27
| | | | | | | | | | | | | | | This change: * properly captures execs in NativeProcessLinux. * clears out all non-main-thread thread metadata in NativeProcessLinux on exec. * adds a DidExec() method to the NativeProcessProtocol delegate. * clears out the auxv data cache when we exec (on Linux). This is a small part of the llgs for local Linux debugging work going on here: https://github.com/tfiala/lldb/tree/dev-llgs-local I'm breaking it into small patches. llvm-svn: 216670
* Update LLDB to use LLVM's DynamicLibrary.Zachary Turner2014-08-272-157/+0
| | | | | | | | | LLDB had implemented its own DynamicLibrary class for plugin support. LLVM has an equivalent mechanism, so this patch deletes the duplicated code in LLDB and updates LLDB to reference the mechanism provided by LLVM. llvm-svn: 216606
* lldb AArch64 should be listed as yet another 64-bit architecture in ↵Todd Fiala2014-08-271-0/+1
| | | | | | | | | | HostInfoBase. See http://reviews.llvm.org/D5070. Change by Paul Osmialowski. llvm-svn: 216556
* Change back all paths returns for lldb::PathType enumerations from ↵Greg Clayton2014-08-251-2/+2
| | | | | | HostInfo::GetLLDBPath() to return the directories in the FileSpec.m_directory field to match previous implementations. This change previously broke some path stuff in upstream branches. llvm-svn: 216398
* Fixes a few more places where we were manually setting the filename.Zachary Turner2014-08-211-1/+1
| | | | llvm-svn: 216247
* Move the rest of the HostInfo functions over.Zachary Turner2014-08-211-90/+0
| | | | | | | | | This should bring HostInfo up to 99% completion. The remainder of code in Host will be split into instantiatable classes representing host processes, threads, dynamic libraries, and process launching strategies. llvm-svn: 216230
* Move GetUsername and GetGroupname to HostInfoPosixZachary Turner2014-08-211-76/+0
| | | | llvm-svn: 216210
* Convert static constructors to be explicitly initialized at startupZachary Turner2014-08-211-40/+55
| | | | llvm-svn: 216197
* Move Host::GetLLDBPath to HostInfo.Zachary Turner2014-08-212-341/+172
| | | | | | | | This continues the effort to get Host code moved over to HostInfo, and removes many more instances of preprocessor defines along the way. llvm-svn: 216195
* Revert "Avoid global contstructors and place static variablesZachary Turner2014-08-201-19/+18
| | | | | | | | | | | | | | | | | inside classes as static local variables and remove the static ivars. Subclasses should use the accessor functions." This change moved global statics to function local statics, but forgot to make the locals static in the function, breaking all platforms. Furthermore, MSVC doesn't support thread-safe function local statics, so any use of a function local static on non primitive types is undefined behavior on MSVC. Reverting due to the fact that it's broken on all platforms, but would like to have a discussion about the thread-safety issue before it goes back in. llvm-svn: 216123
* Avoid global contstructors and place static variables inside classes as ↵Greg Clayton2014-08-201-18/+19
| | | | | | static local variables and remove the static ivars. Subclasses should use the accessor functions. llvm-svn: 216080
* Move Host::GetArchitecture to HostInfo::GetArchitecture.Zachary Turner2014-08-202-153/+58
| | | | | | | | As a side effect, this patch also eliminates all of the preprocessor conditionals previously used to implement GetArchitecture(). llvm-svn: 216074
* Move some Host logic into HostInfo class.Zachary Turner2014-08-192-138/+86
| | | | | | | | | | | | | | | | | | This patch creates a HostInfo class, a static class used to answer basic queries about the host platform. As part of this change, some functionality is moved from Host to HostInfo, and relevant fixups are performed in the rest of the codebase. This is part of a larger effort to isolate more code in the Host layer into platform-specific groups, to make it easier to make platform specific changes for a particular Host without breaking other hosts. Reviewed by: Greg Clayton Differential Revision: http://reviews.llvm.org/D4963 llvm-svn: 215992
* In the CMake build, convert lldbHost to be a single static library.Zachary Turner2014-08-151-26/+0
| | | | | | | | | Previously lldbHost was built as multiple static libraries such as lldbHostCommon, lldbHostLinux, etc. With this patch, the CMake build produces only a single static library, lldbHost, whose file set is dynamically created based on the platform. llvm-svn: 215792
* Move FileSystem functions out of Host and into their own classes.Zachary Turner2014-08-155-376/+205
| | | | | | | | | | | | | | | | More specifically, this change can be summarized as follows: 1) Makes an lldbHostPosix library which contains code common to all posix platforms. 2) Creates Host/FileSystem.h which defines a common FileSystem interface. 3) Implements FileSystem.h in Host/windows and Host/posix. 4) Creates Host/FileCache.h, implemented in Host/common, which defines a class useful for storing handles to open files needed by the debugger. Differential Revision: http://reviews.llvm.org/D4889 llvm-svn: 215775
* Don't crash when specifying a core file that isn't readable.Greg Clayton2014-08-151-0/+9
| | | | | | | | | | | | | Fixes include: 1 - added new FileSpec method: bool FileSpec::Readable() 2 - detect when an executable is not readable and give an appropriate error for: (lldb) file /tmp/unreadablefile 3 - detect when a core file is not readable and give an appropriate error 4 - detect when a specified core file doesn't exist and give an appropriate error <rdar://problem/17727734> llvm-svn: 215741
* Refactor FileAction out of ProcessLaunchInfo.Zachary Turner2014-08-141-2/+68
| | | | | | | | | | | | | FileAction was previously a nested class in ProcessLaunchInfo. This led to some unfortunate style consequences, such as requiring the AddPosixSpawnFileAction() funciton to be defined in the Target layer, instead of the more appropriate Host layer. This patch makes FileAction its own independent class in the Target layer, and then moves AddPosixSpawnFileAction() into Host as a result. Differential Revision: http://reviews.llvm.org/D4877 llvm-svn: 215649
* Host: remove unused functionSaleem Abdulrasool2014-08-091-21/+0
| | | | | | Remove unused static function identified by GCC 4.8.2. llvm-svn: 215300
* Implement some common file operations on Windows.Zachary Turner2014-08-091-60/+1
| | | | llvm-svn: 215273
* Fix bug causing FileSpec::GetPath() to crash with a null dest.Zachary Turner2014-08-081-0/+3
| | | | llvm-svn: 215262
* r215124 missed a few Mac OS X only uses of FileSpec::Resolve, fixing to matchJim Ingham2014-08-071-11/+10
| | | | | | the new signature. llvm-svn: 215159
* Optimizations for FileSpec.Zachary Turner2014-08-072-144/+81
| | | | llvm-svn: 215124
* Fix FileSpec to be able to understand Windows paths.Zachary Turner2014-08-072-45/+74
| | | | | | | | | | | | | This patch adds the notion of a "path syntax" to FileSpec. There are two syntaxes (Posix and Windows) and one "meta syntax", Host Native, which uses the current platform to figure out the appropriate syntax for host paths. This allows paths from one platform to be represented and manipulated on another platform even if they have different path syntaxes. llvm-svn: 215123
* Creates a socket host object.Zachary Turner2014-08-064-11/+697
| | | | | | | | | | | | | | | | | | This patch moves the logic of many common socket operations into its own class lldb_private::Socket. It then modifies the ConnectionFileDescriptor class, and a few users of that class, to use this new Socket class instead of hardcoding socket logic directly. Finally, this patch creates a common interface called IOObject for any objects that support reading and writing, so that endpoints such as sockets and files can be treated the same. Differential Revision: http://reviews.llvm.org/D4641 Reviewed by: Todd Fiala, Greg Clayton llvm-svn: 214984
* Resolve the executable _before_ we try to get the module specifications.Greg Clayton2014-07-291-0/+11
| | | | | | | | Also fixed the host 32 and 64 bit arch to return "x86_64-apple-macosx" again instead of "x86_64-apple-" (unspecified OS) after recent changes. <rdar://problem/17845078> llvm-svn: 214223
* Fix compile error on Windows.Zachary Turner2014-07-291-1/+1
| | | | | | | A piece of a future patch accidentally made it in, this simply fixes the error. llvm-svn: 214161
* Use llvm Support functions to get the user's home directory.Zachary Turner2014-07-281-0/+18
| | | | | | | | | | | Assuming that the user's home directory is at ~ is incorrect on Windows. This patch delegates the request to LLVM's support library, which already provides a cross-platform implementation of this function. Differential Revision: http://reviews.llvm.org/D4674 llvm-svn: 214093
* Fix configure/make builds on MacOSX.Todd Fiala2014-07-241-0/+3
| | | | | | Change by Keno Fischer. llvm-svn: 213904
* Enable lldb-platform exe support for Linux.Todd Fiala2014-07-221-0/+23
| | | | | | | | | | | | | | This change enables lldb-platform for Linux. In addition, it does the following: * fixes Host::GetLLDBPath() to work on Linux/*BSD for ePathTypeSupportExecutableDir-relative paths. * adds more logging and comments around lldb-platform startup and remote lldb-platform usage. * refactors lldb-platform remote-* support for Darwin and Linux into PlatformPOSIX. This, in theory, is the bulk of what is needed for *BSD to make remote connections to lldb-platform as well (although I haven't tested that yet). FreeBSD can make similar changes to their Platform* as was made here for PlatformLinux to pick up the rest of the bits. * teaches GDBRemoteCommunication to use lldb-gdbserver for non-Apple hosts. llvm-svn: 213707
* Host: Fix a pointer-to-function to void-pointer castDavid Majnemer2014-07-221-1/+2
| | | | | | | | | | | | reinterpret_cast may not convert a pointer-to-function to a void-pointer. Take a detour through intptr_t and *then* convert to a pointer-to-function. This silences a warning emitted by GCC when building LLDB. Differential Revision: http://reviews.llvm.org/D4631 llvm-svn: 213693
* Make lldb -P work on Windows.Zachary Turner2014-07-181-1/+5
| | | | | | | | | | | | | | lldb -P, which outputs its python path, works by using Host-layer facilities to get information about the loaded python module. This Host functionality was unimplemented on Windows, so this patch implements it. Additionally, it removes a pexpect dependency from the test runner and uses an equivalent invocation of subprocess. Reviewed by: Todd Fiala Differential Revision: http://reviews.llvm.org/D4548 llvm-svn: 213410
* Fixing warnings shouldn't introduce a crasher.Greg Clayton2014-07-181-1/+3
| | | | | | | | Fix the warning the correct way without making things crash when ENABLE_MUTEX_ERROR_CHECKING is non enabled. <rdar://problem/17703039> llvm-svn: 213394
* Add Host::MAX_THREAD_NAME_LENGTH constant.Todd Fiala2014-07-161-0/+9
| | | | | | | | | | | | | | | This value gets set to a max uint32_t value when there is no known limit; otherwise, it is set to a value appropriate for the platform. For the moment, only Linux, FreeBSD and NetBSD set it to 16. All other platforms set it to the max uint32_t value. Modifies the Process private state thread names to fit within a 16-character limit when the max thread name length is <= 16. These guarantee that the thread names can be distinguished within the first 16 characters. Prior to this change, those threads had names in the final dotted name segment that were not distinguishable within the first 16 characters. llvm-svn: 213183
* lldb.LLDB_ARCH_DEFAULT now works correctly on Macs with haswell enabled kernels.Greg Clayton2014-07-141-9/+15
| | | | | | <rdar://problem/17604133> llvm-svn: 213004
* Fix tests broken by the OptionValidator changes.Zachary Turner2014-07-091-1/+16
| | | | | | | | | | | | | | | | | | | | | | | The getopt library has a structure called option (lowercase). We have a structure called Option (uppercase). previously the two structures had exactly the same definitions, and we were doing a C-style cast of an Option* to an option*. C-style casts don't bother to warn you when you cast to unrelated types, but in the original OptionValidator patch I modified the definition of Option. This patch fixes the errors by building an array of option structures and filling it out the correct way before passing it to the getopt library. This also fixes one other source of test failures: an uninitialized read that occurs due to not initializing a field of the OptionDefinition. Reviewed By: Todd Fiala Differential Revision: http://reviews.llvm.org/D4425 llvm-svn: 212628
* __arm64__ and __aarch64__ #ifdef adjustmentsTodd Fiala2014-07-091-1/+1
| | | | | | | | Change by Paul Osmialowski See http://reviews.llvm.org/D4379 for details. llvm-svn: 212583
* Implment "platform process list" for Windows.Zachary Turner2014-07-081-1/+2
| | | | | | | | | | | | | | | | | | This patch implements basic functionality of the "platform process list" command for Windows. Currently this has the following limitations. * Certain types of filtering are not enabled (e.g. filtering by architecture with -a), although most filters work. * The username of the process is not yet obtained. * Using -v to list verbose information generates an error. * The architecture column displays the entire triple, leading to misaligned formatting of the printed table. Reviewed by: Greg Clayton Differential Revision: http://reviews.llvm.org/D4413 llvm-svn: 212510
* Fix compilation errors introduced by host Pipe abstractionZachary Turner2014-07-031-6/+5
| | | | | | on Windows. llvm-svn: 212255
* Add host layer support for pipes.Greg Clayton2014-07-022-0/+173
| | | | | | | | | | | Windows does support pipes, but they do so in a slightly different way. Added a Host layer which abstracts the use of pipes into a new Pipe class that everyone can use. Windows benefits include: - Being able to interrupt running processes when IO is directly hooked up - being able to interrupt long running python scripts - being able to interrupt anything based on ConnectionFileDescriptor llvm-svn: 212220
* Fix typos.Bruce Mitchener2014-07-012-3/+3
| | | | llvm-svn: 212132
* Add lldb-gdbserver support for Linux x86_64.Todd Fiala2014-06-3011-0/+1686
| | | | | | | | | | | | | | | | | | | | | This change brings in lldb-gdbserver (llgs) specifically for Linux x86_64. (More architectures coming soon). Not every debugserver option is covered yet. Currently the lldb-gdbserver command line can start unattached, start attached to a pid (process-name attach not supported yet), or accept lldb attaching and launching a process or connecting by process id. The history of this large change can be found here: https://github.com/tfiala/lldb/tree/dev-tfiala-native-protocol-linux-x86_64 Until mid/late April, I was not sharing the work and continued to rebase it off of head (developed via id tfiala@google.com). I switched over to user todd.fiala@gmail.com in the middle, and once I went to github, I did merges rather than rebasing so I could share with others. llvm-svn: 212069
* lldb: remove adhoc implementation of array_sizeofSaleem Abdulrasool2014-06-272-3/+5
| | | | | | | | Replace adhoc inline implementation of llvm::array_lengthof in favour of the implementation in LLVM. This is simply a cleanup change, no functional change intended. llvm-svn: 211868
* Don't use libc's "char *basename(char *)" or "char *dirname(char *)" as they ↵Greg Clayton2014-05-301-35/+8
| | | | | | | | | | are not thread safe. I switched the lldb_private::FileSpec code over to use "llvm::StringRef llvm::sys::path::filename(llvm::StringRef)" for basename() and "llvm::StringRef llvm::sys::path::parent_path(llvm::StringRef)" for dirname(). <rdar://problem/16870083> llvm-svn: 209917
* Fix Windows warnings.Todd Fiala2014-05-281-0/+1
| | | | | | | | | | This fixes a number of trivial warnings in the Windows build. This is part of a larger effort to make the Windows build warning-free. See http://reviews.llvm.org/D3914 for more details. Change by Zachary Turner llvm-svn: 209749
* "process kill" and "process detach" were causing double prompts or prompts ↵Greg Clayton2014-05-081-46/+35
| | | | | | | | that would overwrite each other. Fixed now. <rdar://problem/16547729> llvm-svn: 208369
* control-D on empty line to quit lldb stopped working in Release builds on ↵Greg Clayton2014-05-061-1/+2
| | | | | | | | MacOSX. <rdar://problem/16822217> llvm-svn: 208117
* Use posix_spawn on NetBSD as well.Joerg Sonnenberger2014-05-021-6/+6
| | | | llvm-svn: 207864
OpenPOWER on IntegriCloud