summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host
Commit message (Collapse)AuthorAgeFilesLines
...
* [FileSystem] Change FileSpec constructor signature (2/2)Jonas Devlieghere2018-11-011-4/+2
| | | | | | | Fix breakage due to the recent FileSpec change that extracts the path resultion logic into FileSystem for the FreeBSD host. llvm-svn: 345895
* [FileSystem] Change FileSpec constructor signature.Jonas Devlieghere2018-11-011-3/+4
| | | | | | | Fix breakage due to the recent FileSpec change that extracts the path resultion logic into FileSystem for the Android host. llvm-svn: 345891
* [FileSystem] Move path resolution logic out of FileSpecJonas Devlieghere2018-11-0115-55/+90
| | | | | | | | | This patch removes the logic for resolving paths out of FileSpec and updates call sites to rely on the FileSystem class instead. Differential revision: https://reviews.llvm.org/D53915 llvm-svn: 345890
* [FileSystem] Fix Exists call sitesJonas Devlieghere2018-11-013-6/+9
| | | | | | | There were some calls left to Exists() on non-darwin platforms (Windows, Linux and FreeBSD) that weren't yet updated to use the FileSystem. llvm-svn: 345857
* [FileSystem] Remove Exists() from FileSpecJonas Devlieghere2018-11-014-27/+32
| | | | | | | | | This patch removes the Exists method from FileSpec and updates its uses with calls to the FileSystem. Differential revision: https://reviews.llvm.org/D53845 llvm-svn: 345854
* [FileSystem] Remove ResolveExecutableLocation() from FileSpecJonas Devlieghere2018-11-013-3/+40
| | | | | | | | | This patch removes the ResolveExecutableLocation method from FileSpec and updates its uses with calls to the FileSystem. Differential revision: https://reviews.llvm.org/D53834 llvm-svn: 345853
* [FileSystem] Improve assert and add Terminate in unit test.Jonas Devlieghere2018-11-011-3/+4
| | | | | | | | Speculative fix for the Xcode bots where we were seeing the assertion being triggered because we would re-initialize the FileSystem without terminating it. llvm-svn: 345849
* [FileSystem] Remove GetByteSize() from FileSpecJonas Devlieghere2018-11-011-1/+3
| | | | | | | | | This patch removes the GetByteSize method from FileSpec and updates its uses with calls to the FileSystem. Differential revision: https://reviews.llvm.org/D53788 llvm-svn: 345812
* [FileSystem] Re-add EnumerateDirectoryJonas Devlieghere2018-11-011-0/+30
| | | | | | Re-enable EnumerateDirectory now that no_push is available in llvm (r345793). llvm-svn: 345799
* [FileSystem] Remove EnumerateDirectoryJonas Devlieghere2018-10-311-30/+0
| | | | | | | | The new implementation of EnumerateDirectory relies on `::no_push()` being implemented for the VFS recursive directory iterators. However this patch (D53465) hasn't been landed yet. llvm-svn: 345787
* [FileSystem] Extend file system and have it use the VFS.Jonas Devlieghere2018-10-314-10/+161
| | | | | | | | | | | | | | | | This patch extends the FileSystem class with a bunch of functions that are currently implemented as methods of the FileSpec class. These methods will be removed in future commits and replaced by calls to the file system. The new functions are operated in terms of the virtual file system which was recently moved from clang into LLVM so it could be reused in lldb. Because the VFS is stateful, we turned the FileSystem class into a singleton. Differential revision: https://reviews.llvm.org/D53532 llvm-svn: 345783
* [Windows] Fix threads comparison on WindowsAleksandr Urakov2018-10-183-1/+9
| | | | | | | | | | | | | | | | | | | | | Summary: This patch makes Windows threads to compare by a thread ID, not by a handle. It's because the same thread can have different handles on Windows (for example, `GetCurrentThread` always returns the fake handle `-2`). This leads to some incorrect behavior. For example, in `Process::GetRunLock` always `m_public_run_lock` is returned without this patch. Reviewers: zturner, clayborg, stella.stamenova Reviewed By: stella.stamenova Subscribers: stella.stamenova, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D53357 llvm-svn: 344729
* Fixed an issue that a bot found with my changesJason Molenda2018-10-161-81/+119
| | | | | | | | | | | | | | | | | in r344626 & recommitting. Original commit msg: Simplify LocateDSYMInVincinityOfExecutable by moving some redundant code into a separate function, LookForDsymNextToExecutablePath, and having that function also look for .dSYM.yaa files in addition to .dSYM bundles. Differential Revision: https://reviews.llvm.org/D53305 <rdar://problem/40406580> llvm-svn: 344646
* Revert r344626 while I address a testsuite failure from a bot.Jason Molenda2018-10-161-119/+81
| | | | llvm-svn: 344636
* Simplify LocateDSYMInVincinityOfExecutable by movingJason Molenda2018-10-161-81/+119
| | | | | | | | | | | | | some redundant code into a separate function, LookForDsymNextToExecutablePath, and having that function also look for .dSYM.yaa files in addition to .dSYM bundles. Differential Revision: https://reviews.llvm.org/D53305 <rdar://problem/40406580> llvm-svn: 344626
* Upstreaming the BridgeOS device support and the Jason Molenda2018-10-111-0/+3
| | | | | | | | | | | | | | | LC_BUILD_VERSION load command handling - this commit is a combination of patches by Adrian Prantl and myself. llvm::Triple::BridgeOS isn't defined yet, so all references to that are currently commented out. Also update Xcode project file to build the NativePDB etc plugins. <rdar://problem/43353615> llvm-svn: 344209
* Fix typos.Bruce Mitchener2018-10-042-3/+3
| | | | | | | | | | Reviewers: lldb-commits Subscribers: srhines, ki.stfu Differential Revision: https://reviews.llvm.org/D52884 llvm-svn: 343825
* Pull FixupBreakpointPCAsNeeded into base classPavel Labath2018-10-031-0/+62
| | | | | | | | | | | | | | | | | Summary: This function existed (with identical code) in both NativeProcessLinux and NativeProcessNetBSD, and it is likely that it would be useful to any future implementation of NativeProcessProtocol. Therefore I move it to the base class. Reviewers: krytarowski Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D52719 llvm-svn: 343683
* Pull GetSoftwareBreakpointPCOffset into base classPavel Labath2018-09-301-0/+23
| | | | | | | | | | | | | | | | | | | | | | Summary: This function encodes the knowledge of whether the PC points to the breakpoint instruction of the one following it after the breakpoint is "hit". This behavior mainly(*) depends on the architecture and not on the OS, so it makes sense for it to be implemented in the base class, where it can be shared between different implementations (Linux and NetBSD atm). (*) It is possible for an OS to expose a different API, perhaps by doing some fixups in the kernel. In this case, the implementation can override this function to implement custom behavior. Reviewers: krytarowski, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D52532 llvm-svn: 343409
* Fix a memory read bug in lldb-serverPavel Labath2018-09-261-7/+18
| | | | | | | | | | | | | | NativeProcessProtocol::ReadMemoryWithoutTrap had a bug, where it failed to properly remove inserted breakpoint opcodes if the memory read partially overlapped the trap opcode. This could not happen on x86 because it has a one-byte breakpoint instruction, but it could happen on arm, which has a 4-byte breakpoint instruction (in arm mode). Since triggerring this condition would only be possible on an arm machine (and even then it would be a bit tricky). I test this using a NativeProcessProtocol unit test. llvm-svn: 343076
* build: add libedit to include pathsTatyana Krasnukha2018-09-211-0/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D51999 llvm-svn: 342757
* Add support for descriptions with command completions.Raphael Isemann2018-09-131-10/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds a framework for adding descriptions to the command completions we provide. It also adds descriptions for completed top-level commands so that we can test this code. Completions are in general supposed to be displayed alongside the completion itself. The descriptions can be used to provide additional information about the completion to the user. Examples for descriptions are function signatures when completing function calls in the expression command or the binary name when providing completion for a symbol. There is still some boilerplate code from the old completion API left in LLDB (mostly because the respective APIs are reused for non-completion related purposes, so the CompletionRequest doesn't make sense to be used), so that's why I still had to change some function signatures. Also, as the old API only passes around a list of matches, and the descriptions are for these functions just another list, I had to add some code that essentially just ensures that both lists are always the same side (e.g. all the manual calls to `descriptions->AddString(X)` below a `matches->AddString(Y)` call). The initial command descriptions that come with this patch are just reusing the existing short help that is already added in LLDB. An example completion with descriptions looks like this: ``` (lldb) pl Available completions: platform -- Commands to manage and create platforms. plugin -- Commands for managing LLDB plugins. ``` Reviewers: #lldb, jingham Reviewed By: #lldb, jingham Subscribers: jingham, JDevlieghere, lldb-commits Differential Revision: https://reviews.llvm.org/D51175 llvm-svn: 342181
* NativeProcessProtocol: Sink ReadMemoryWithoutTrap into base classPavel Labath2018-09-131-0/+9
| | | | | | | | The two existing implementations have the function implemented identically, and there's no reason to believe that this would be different for other implementations. llvm-svn: 342167
* Do not create new terminals when launching process on Windows with --no-stdioDavid Bolvansky2018-09-121-0/+3
| | | | | | | | | | | | | | Summary: Partially fixes PR38222 Reviewers: teemperor, zturner, stella.stamenova Reviewed By: zturner, stella.stamenova Subscribers: JDevlieghere, clayborg, labath, abidh, lldb-commits Differential Revision: https://reviews.llvm.org/D51966 llvm-svn: 342075
* Move SafeMachO from Utility to HostPavel Labath2018-09-123-5/+0
| | | | | | | | | | | | | | | | | | | | | | Summary: One of the conclusions of the discussion on D49740 was that SafeMachO is better off in the Host module (as that's the only place which should include mach/machine.h, which is what this header is working around). Also, Utility, which is the only module which cannot include Host, should not be doing anything with object file formats. This patch implements that move, and also removes any unneded includes of that file. I've verified that MacOS still compiles after this. Reviewers: jingham, zturner, teemperor Subscribers: fedor.sergeev, lldb-commits Differential Revision: https://reviews.llvm.org/D50383 llvm-svn: 342050
* Speculative fix for NetBSD bot for r341758Pavel Labath2018-09-091-6/+6
| | | | llvm-svn: 341759
* Re-commit "Modernize NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode"Pavel Labath2018-09-092-47/+47
| | | | | | | | | | | | | This recommits r341487, which was reverted due to failing tests with clang. It turned out I had incorrectly expected that the literal arrays passed to ArrayRef constructor will have static (permanent) storage. This was only the case with gcc, while clang was constructing them on stack, leading to dangling pointers when the function returns. The fix is to explicitly assign static storage duration to the opcode arrays. llvm-svn: 341758
* Revert "Modernize NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode"Pavel Labath2018-09-082-42/+47
| | | | | | | This reverts commit r341487. Jan Kratochvil reports it breaks LLDB when compiling with clang. llvm-svn: 341747
* Check if a terminal supports colors on Windows properlyDavid Bolvansky2018-09-081-0/+3
| | | | | | | | | | | | | | | | | Summary: Previously we SetUseColor(true) wrongly when output was not a terminal so it broken some (not public) bots. Thanks for issue report, @stella.stamenova Reviewers: stella.stamenova, zturner Reviewed By: stella.stamenova Subscribers: abidh, lldb-commits, stella.stamenova Differential Revision: https://reviews.llvm.org/D51772 llvm-svn: 341746
* Modernize NativeProcessProtocol::GetSoftwareBreakpointTrapOpcodePavel Labath2018-09-052-47/+42
| | | | | | | | | | | | return the opcode as a Expected<ArrayRef> instead of a Status+pointer+size combo. I also move the linux implementation to the base class, as the trap opcodes are likely to be the same for all/most implementations of the class (except the arm one, where linux chooses a different opcode than what the arm spec recommends, which I keep linux-specific). llvm-svn: 341487
* [NFC] Use llvm_unreachable instead of lldb::assert David Bolvansky2018-09-031-1/+1
| | | | | | | | | | | | | | Summary: Fixes implicit fall through warnings Reviewers: JDevlieghere, teemperor Reviewed By: teemperor Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D51601 llvm-svn: 341339
* [PseudoTerminal][NFC] Use llvm errno helpersDavid Bolvansky2018-09-031-11/+20
| | | | | | | | | | | | | | | | | | | Summary: LLVM provide (str)errno helpers, so convert code to use it. Also fixes warning: /home/xbolva00/LLVM/llvm/tools/lldb/source/Host/common/PseudoTerminal.cpp:248:25: warning: ignoring return value of ‘char* strerror_r(int, char*, size_t)’, declared with attribute warn_unused_result [-Wunused-result] ::strerror_r(errno, error_str, error_len); Reviewers: JDevlieghere Reviewed By: JDevlieghere Subscribers: abidh, lldb-commits Differential Revision: https://reviews.llvm.org/D51591 llvm-svn: 341320
* Move Predicate.h from Host to UtilityRaphael Isemann2018-08-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This class was initially in Host because its implementation used to be very OS-specific. However, with C++11, it has become a very simple std::condition_variable wrapper, with no host-specific code. It is also a general purpose utility class, so it makes sense for it to live in a place where it can be used by everyone. This has no effect on the layering right now, but it enables me to later move the Listener+Broadcaster+Event combo to a lower layer, which is important, as these are used in a lot of places (notably for launching a process in Host code). Reviewers: jingham, zturner, teemperor Reviewed By: zturner Subscribers: xiaobai, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D50384 llvm-svn: 341089
* Move RegisterValue,Scalar,State from Core to UtilityPavel Labath2018-08-072-2/+2
| | | | | | | | | | | | | These three classes have no external dependencies, but they are used from various low-level APIs. Moving them down to Utility improves overall code layering (although it still does not break any particular dependency completely). The XCode project will need to be updated after this change. Differential Revision: https://reviews.llvm.org/D49740 llvm-svn: 339127
* [cmake] Remove unused ${LLDB_PLUGINS} dependency from our Objective-C++ ↵Raphael Isemann2018-07-231-1/+0
| | | | | | | | | | | | | | | | | | | | CMake config Summary: LLDB_PLUGINS doesn't exist as a variable, so this line doesn't add any dependencies and is just confusing. It seems this slipped in from the gdb-remote CMake I was using as a CMake template. The gdb-remote CMake itself is using a local LLDB_PLUGINS variable, so that code is fine. Reviewers: davide Reviewed By: davide Subscribers: davide, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D49695 llvm-svn: 337741
* [windows] Use a well-known path for ComSpec if we fail to retrieve itStella Stamenova2018-07-181-2/+7
| | | | | | | | | | | | | | Summary: Right now we always try to retrieve ComSpec and if we fail, we give up. This rarely fails, but we can update the logic so that we fail even less frequently. Since there is a well-known path (albeit not always correct), try the path when we failed to retrieve it. Note that on other platforms, we generally just return a well-known path without any checking. Reviewers: asmith, zturner, labath Reviewed By: zturner, labath Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D49451 llvm-svn: 337395
* Fix macos build for r335244Pavel Labath2018-06-211-2/+2
| | | | | | | | | I've made the code accept only 16 byte UUIDs, which is technically not NFC (previously it would also accept 20 byte ones, but use only the first 16 bytes), but this should be more correct as mac UUIDs are always 16 byte long. llvm-svn: 335247
* Remove dependency from Host to pythonPavel Labath2018-06-205-130/+0
| | | | | | | | | | | | | | | | Summary: The only reason python was used in the Host module was to compute the python path. I resolve this the same way as D47384 did for clang, by moving the path computation into the python plugin and modifying SBHostOS class to call into this module for ePathTypePythonDir. Reviewers: zturner, jingham, davide Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D48215 llvm-svn: 335104
* Replace HostInfo::GetLLDBPath with specific functionsPavel Labath2018-06-198-168/+119
| | | | | | | | | | | | | | | | | | | | | Summary: Instead of a function taking an enum value determining which path to return, we now have a suite of functions, each returning a single path kind. This makes it easy to move the python-path function into a specific plugin in a follow-up commit. All the users of GetLLDBPath were converted to call specific functions instead. Most of them were hard-coding the enum value anyway, so this conversion was simple. The only exception was SBHostOS, which I've changed to use a switch on the incoming enum value. Reviewers: clayborg, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D48272 llvm-svn: 335052
* Fix macosx build broken by the VersionTuple refactorPavel Labath2018-06-182-7/+4
| | | | | | | | | | I actually did check that macos builds before committing, but this error was in conditionally compiled code that did not seem to be used on my machine. I also fix a typo in the previous speculative NetBSD patch. llvm-svn: 334955
* Fix netbsd build broken by r334950Pavel Labath2018-06-181-1/+2
| | | | | | This also includes one more build fix for windows. llvm-svn: 334953
* Attempt to fix windows&freebsd builds broken by r334950Pavel Labath2018-06-182-4/+4
| | | | llvm-svn: 334952
* Use llvm::VersionTuple instead of manual version marshallingPavel Labath2018-06-185-69/+32
| | | | | | | | | | | | | | | | | | Summary: This has multiple advantages: - we need only one function argument/instance variable instead of three - no need to default initialize variables - no custom parsing code - VersionTuple has comparison operators, which makes version comparisons much simpler Reviewers: zturner, friss, clayborg, jingham Subscribers: emaste, lldb-commits Differential Revision: https://reviews.llvm.org/D47889 llvm-svn: 334950
* [FileSpec] Make style argument mandatory for SetFile. NFCJonas Devlieghere2018-06-1311-12/+17
| | | | | | Fix SetFile uses in hosts that I missed in r334663. llvm-svn: 334664
* [FileSpec] Make style argument mandatory for SetFile. NFCJonas Devlieghere2018-06-137-16/+25
| | | | | | | | | | | | | | | | SetFile has an optional style argument which defaulted to the native style. This patch makes that argument mandatory so clients of the FileSpec class are forced to think about the correct syntax. At the same time this introduces a (protected) convenience method to update the file from within the FileSpec class that keeps the current style. These two changes together prevent a potential pitfall where the style might be forgotten, leading to the path being updated and the style unintentionally being changed to the host style. llvm-svn: 334663
* Fix macos xcode build.Jason Molenda2018-06-131-5/+5
| | | | llvm-svn: 334662
* [lit] Split test_set_working_dir TestProcessLaunch into two tests and fix it ↵Stella Stamenova2018-06-131-1/+8
| | | | | | | | | | | | | | | | | | | | | | on Windows Summary: test_set_working_dir was testing two scenario: failure to set the working dir because of a non existent directory and succeeding to set the working directory. Since the negative case fails on both Linux and Windows, the positive case was never tested. I split the test into two which allows us to always run both the negative and positive cases. The positive case now succeeds on Linux and the negative case still fails. During the investigation, it turned out that lldbtest.py will try to execute a process launch command up to 3 times if the command failed. This means that we could be covering up intermittent failures by running any test that does process launch multiple times without ever realizing it. I've changed the counter to 1 (though it can still be overwritten with the environment variable). This change also fixes both the positive and negative cases on Windows. There were a few issues: 1) In ProcessLauncherWindows::LaunchProcess, the error was not retrieved until CloseHandle was possibly called. Since CloseHandle is also a system API, its success would overwrite any existing error that could be retrieved using GetLastError. So by the time the error was retrieved, it was now a success. 2) In DebuggerThread::StopDebugging TerminateProcess was called on the process handle regardless of whether it was a valid handle. This was causing the process to crash when the handle was LLDB_INVALID_PROCESS (0xFFFFFFFF). 3) In ProcessWindows::DoLaunch we need to check that the working directory exists before launching the process to have the same behavior as other platforms which first check the directory and then launch process. This way we also control the exact error string. Reviewers: labath, zturner, asmith, jingham Reviewed By: labath Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D48050 llvm-svn: 334642
* Fix/unify the spelling of Objective-C.Adrian Prantl2018-06-131-1/+1
| | | | llvm-svn: 334614
* Add modules support for lldb headers in include/Raphael Isemann2018-06-136-6/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds a modulemap which allows compiling the lldb headers into C++ modules (for example in builds with LLVM_ENABLE_MODULES=On). Even though most of the affected code has been cleaned up to work with the more strict C++ module semantics, there are still some workarounds left in the current modulemap (the most obvious one is the big `lldb` wrapper module). It also moves the Obj-C++ files in lldb to their own subdirectories. This was necessary because we need to filter out the modules flags for this code. Note: With the latest clang and libstdc++ it seems necessary to have a STL C++ module to get a working LLVM_ENABLE_MODULES build for lldb. Otherwise clang will falsely detect ODR violations in the textually included STL code inside the lldb modules. Reviewers: aprantl, bruno Reviewed By: aprantl, bruno Subscribers: mgorny, yamaguchi, v.g.vassilev, lldb-commits Differential Revision: https://reviews.llvm.org/D47929 llvm-svn: 334611
* Document how lldb uses the DBGSourcePathRemapping Jason Molenda2018-06-111-2/+7
| | | | | | | source path remapping src/dest path pairs with respect to the DBGVersion number in the plist. llvm-svn: 334442
OpenPOWER on IntegriCloud