summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host
Commit message (Collapse)AuthorAgeFilesLines
...
* Replace 'ap' with 'up' suffix in variable names. (NFC)Jonas Devlieghere2019-02-132-17/+17
| | | | | | | | | | | | | | | | | The `ap` suffix is a remnant of lldb's former use of auto pointers, before they got deprecated. Although all their uses were replaced by unique pointers, some variables still carried the suffix. In r353795 I removed another auto_ptr remnant, namely redundant calls to ::get for unique_pointers. Jim justly noted that this is a good opportunity to clean up the variable names as well. I went over all the changes to ensure my find-and-replace didn't have any undesired side-effects. I hope I didn't miss any, but if you end up at this commit doing a git blame on a weirdly named variable, please know that the change was unintentional. llvm-svn: 353912
* Remove redundant ::get() for smart pointer. (NFC)Jonas Devlieghere2019-02-122-3/+3
| | | | | | | | This commit removes redundant calls to smart pointer’s ::get() method. https://clang.llvm.org/extra/clang-tidy/checks/readability-redundant-smartptr-get.html llvm-svn: 353795
* Use std::make_shared in LLDB (NFC)Jonas Devlieghere2019-02-111-6/+7
| | | | | | | | | | | Unlike std::make_unique, which is only available since C++14, std::make_shared is available since C++11. Not only is std::make_shared a lot more readable compared to ::reset(new), it also performs a single heap allocation for the object and control block. Differential revision: https://reviews.llvm.org/D57990 llvm-svn: 353764
* [lldb] [MainLoop] Initialize empty sigset_t correctlyMichal Gorny2019-02-111-4/+6
| | | | | | | | | | | | | | Fix MainLoop::RunImpl::get_sigmask() to correctly return empty sigset_t when SIGNAL_POLLING_UNSUPPORTED is true. On NetBSD (and probably on some other platforms), integers are not implicitly convertible to sigset_t, so 'return 0' is erraneous. Instead, sigset_t should be reset through sigemptyset(). While at it, move common parts out of the #ifdef. Differential Revision: https://reviews.llvm.org/D57959 llvm-svn: 353675
* lldb: Fix compilation on OpenBSDRaphael Isemann2019-02-101-2/+1
| | | | | | | | | | | | | | | | Summary: Update the OpenBSD Host.cpp for the new SetFile() function signature. Fixes compiling lldb on OpenBSD. Reviewers: krytarowski Reviewed By: krytarowski Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D57907 llvm-svn: 353642
* [lldb-server] Improve support on WindowsAaron Smith2019-02-072-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This commit contains the following changes: - Rewrite vfile close/read/write packet handlers with portable routines from lldb. This removes #if(s) and allows the handlers to work on Windows. - Fix a bug in File::Write. This is intended to write data at an offset to a file but actually writes at the current position of the file. - Add a default boolean argument 'should_close_fd' to FileSystem::Open to let the user decide whether to close the fd or not. Reviewers: zturner, llvm-commits, labath Reviewed By: zturner Subscribers: Hui, labath, abidh, lldb-commits Differential Revision: https://reviews.llvm.org/D56231 llvm-svn: 353446
* [gdb-remote] Use lldb's portable Host::GetEnvironment() instead of getenvAaron Smith2019-02-071-1/+14
| | | | | | | | | | | | Reviewers: zturner, llvm-commits, labath, serge-sans-paille Reviewed By: labath Subscribers: Hui, labath, lldb-commits Differential Revision: https://reviews.llvm.org/D56230 llvm-svn: 353440
* Move FileAction, ProcessInfo and ProcessLaunchInfo from Target to HostPavel Labath2019-02-049-6/+559
| | | | | | | | | | | | | | | | | | | | | | | Summary: These classes describe the details of the process we are about to launch, and so they are naturally used by the launching code in the Host module. Previously they were present in Target because that is the most important (but by far not the only) user of the launching code. Since the launching code has other customers, must of which do not care about Targets, it makes sense to move these classes to the Host layer, next to the launching code. This move reduces the number of times that Target is included from host to 8 (it used to be 14). Reviewers: zturner, clayborg, jingham, davide, teemperor Subscribers: emaste, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D56602 llvm-svn: 353047
* [Reproducers] Add file providerJonas Devlieghere2019-01-292-10/+73
| | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the file provider which is responsible for capturing files used by LLDB. When capturing a reproducer, we use a file collector that is very similar to the one used in clang. For every file that we touch, we add an entry with a mapping from its virtual to its real path. When we decide to generate a reproducer we copy over the files and their permission into to reproducer folder. When replaying a reproducer, we load the VFS mapping and instantiate a RedirectingFileSystem. The latter will transparently use the files available in the reproducer. I've tested this on two macOS machines with an artificial example. Still, it is very likely that I missed some places where we (still) use native file system calls. I'm hoping to flesh those out while testing with more advanced examples. However, I will fix those things in separate patches. Differential revision: https://reviews.llvm.org/D54617 llvm-svn: 352538
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1983-332/+249
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Use llvm::VersionTuple instead of manual version marshallingBrad Smith2019-01-181-5/+6
| | | | llvm-svn: 351504
* [lldb] - Fix crash when listing the history with the key up.George Rimar2019-01-161-1/+1
| | | | | | | | | | | | This is https://bugs.llvm.org/show_bug.cgi?id=40112, Currently, lldb crashes after pressing the up arrow key when listing the history for expressions. The patch fixes the mistype that was a reason. Differential revision: https://reviews.llvm.org/D56014 llvm-svn: 351313
* [lldb-server] Add unnamed pipe support to PipeWindowsAaron Smith2019-01-102-18/+66
| | | | | | | | | | | | | | | | | Summary: This adds unnamed pipe support in PipeWindows to support communication between a debug server and child process. Modify PipeWindows::CreateNew to support the creation of an unnamed pipe. Rename the previous method that created a named pipe to PipeWindows::CreateNewNamed. Reviewers: zturner, llvm-commits Reviewed By: zturner Subscribers: Hui, labath, lldb-commits Differential Revision: https://reviews.llvm.org/D56234 llvm-svn: 350784
* symbols.enable-external-lookup=false on all hosts (not just OSX)Jan Kratochvil2019-01-031-18/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is already in use: lit/lit-lldb-init: settings set symbols.enable-external-lookup false packages/Python/lldbsuite/test/lldbtest.py: self.runCmd('settings set symbols.enable-external-lookup false') But those are not in effect during MI part of the testsuite. Another problem is that symbols.enable-external-lookup (read by GetEnableExternalLookup) has been currently read only by LocateMacOSXFilesUsingDebugSymbols and therefore it had no effect on Linux. On Red Hat platforms (Fedoras, RHEL-7) there is DWZ in use and so MiSyntaxTestCase-test_lldbmi_output_grammar FAILs due to: AssertionError: error: inconsistent pattern ''^.+?\n'' for state 0x5f (matched string: warning: (x86_64) /lib64/libstdc++.so.6 unsupported DW_FORM values: 0x1f20 0x1f21 It is the only testcase with this error. It happens due to: (lldb) target create "/lib64/libstdc++.so.6" Current executable set to '/lib64/libstdc++.so.6' (x86_64). (lldb) b main warning: (x86_64) /lib64/libstdc++.so.6 unsupported DW_FORM values: 0x1f20 0x1f21 Breakpoint 1: no locations (pending). WARNING: Unable to resolve breakpoint to any actual locations. which happens only with gcc-base-debuginfo rpm installed (similarly for other packages). It should also speed up the testsuite as it no longer needs to read /usr/lib/debug symbols which have no effect (and should not have any effect) on the testsuite results. Differential Revision: https://reviews.llvm.org/D55859 llvm-svn: 350368
* [NFC] Replace `compare` with (in)equality operator where applicable.Jonas Devlieghere2018-12-211-1/+1
| | | | | | | | Using compare is verbose, bug prone and potentially inefficient (because of early termination). Replace relevant call sites with the (in)equality operator. llvm-svn: 349972
* Fix stack-buffer-overflow in lldb_private::Host::FindProcesses (2/2)Jonas Devlieghere2018-12-211-2/+2
| | | | | | This fixes the second call at line 640 that I missed in r349858. llvm-svn: 349869
* Fix stack-buffer-overflow in lldb_private::Host::FindProcessesJonas Devlieghere2018-12-201-1/+1
| | | | | | | Found by the address sanitizer on GreenDragon: http://green.lab.llvm.org/green/view/LLDB/job/lldb-sanitized/1628/console llvm-svn: 349858
* refactor testsuite spawnLldbMi args->exe+argsJan Kratochvil2018-12-191-1/+1
| | | | | | | | | | | | | | | | | Currently spawnLldbMi accepts both lldb-mi options and executable to debug as a single parameter. Split them. As in D55859 we will need to execute one lldb-mi command before loading the exe. Therefore we can no longer use the exe as lldb-mi command-line parameter as then there is no way to execute a command before loading exe specified as lldb-mi command-line parameter. LocateExecutableSymbolFileDsym should be static, that is also a little refactorization. Differential Revision: https://reviews.llvm.org/D55858 llvm-svn: 349607
* Simplify Boolean expressionsJonas Devlieghere2018-12-159-22/+19
| | | | | | | | | | | This patch simplifies boolean expressions acorss LLDB. It was generated using clang-tidy with the following command: run-clang-tidy.py -checks='-*,readability-simplify-boolean-expr' -format -fix $PWD Differential revision: https://reviews.llvm.org/D55584 llvm-svn: 349215
* [Host] Use FileSystem wrapperJonas Devlieghere2018-12-101-10/+8
| | | | | | | Fixes Host.mm to use the FileSystem class instead of making native calls to check if a file exists. llvm-svn: 348779
* Do not use PATH_MAX with SmallStringStella Stamenova2018-12-102-3/+3
| | | | | | | | | | | | | | Summary: Instead use a more reasonable value to start and rely on the fact that SmallString will resize if necessary. Reviewers: labath, asmith Reviewed By: labath Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D55457 llvm-svn: 348775
* [FileSystem] Migrate CommandCompletionsJonas Devlieghere2018-12-041-0/+19
| | | | | | | | Make use of the convenience helpers from FileSystem. Differential revision: https://reviews.llvm.org/D55240 llvm-svn: 348287
* [FileSystem] Migrate MonitoringProcessLauncherJonas Devlieghere2018-12-031-10/+5
| | | | | | Use the FileSystem helpers instead of using the file system directly. llvm-svn: 348207
* [Reproducers] Change how reproducers are initialized.Jonas Devlieghere2018-12-031-33/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes the way the reproducer is initialized. Rather than making changes at run time we now do everything at initialization time. To make this happen we had to introduce initializer options and their SB variant. This allows us to tell the initializer that we're running in reproducer capture/replay mode. Because of this change we also had to alter our testing strategy. We cannot reinitialize LLDB when using the dotest infrastructure. Instead we use lit and invoke two instances of the driver. Another consequence is that we can no longer enable capture or replay through commands. This was bound to go away form the beginning, but I had something in mind where you could enable/disable specific providers. However this seems like it adds very little value right now so the corresponding commands were removed. Finally this change also means you now have to control this through the driver, for which I replaced --reproducer with --capture and --replay to differentiate between the two modes. Differential revision: https://reviews.llvm.org/D55038 llvm-svn: 348152
* [CMake] Pass full libedit path to linkerTatyana Krasnukha2018-11-271-1/+1
| | | | | | Otherwise, linker fails with "cannot find -ledit" in case of custom libedit installation. llvm-svn: 347693
* Move time cast to SymbolFileDWARFDebugMapJonas Devlieghere2018-11-271-11/+4
| | | | | | | | | When trying to fix the bots we expected that the cast would be needed in different places. Ultimately it turned out only the SymbolFileDWARFDebugMap was affected so, as Pavel correctly notes, it makes more sense to do the cast just there instead of in teh FS. llvm-svn: 347660
* [FileSystem] Ignore nanoseconds when comparing oso_mod_timeJonas Devlieghere2018-11-261-4/+11
| | | | | | | | | | | After a recent change in LLVM the TimePoint encoding become more precise, exceeding the precision of the TimePoint obtained from the DebugMap. This patch adds a flag to the GetModificationTime helper in the FileSystem to return the modification time with less precision. Thanks to Davide for bisecting this failure on the LLDB bots. llvm-svn: 347615
* Add GDB remote packet reproducer.Jonas Devlieghere2018-11-131-0/+33
| | | | llvm-svn: 346780
* Re-land "Extract construction of DataBufferLLVM into FileSystem"Jonas Devlieghere2018-11-123-3/+40
| | | | | | This fixes some UB in isLocal detected by the sanitized bot. llvm-svn: 346707
* Revert "Extract construction of DataBufferLLVM into FileSystem"Davide Italiano2018-11-123-40/+3
| | | | | | It broke the lldb sanitizer bots. llvm-svn: 346694
* [CMake] Fix: add_host_subdirectory source/Host/macosxStefan Granitz2018-11-121-1/+1
| | | | | | | | | | | | Summary: Typo introduced with https://reviews.llvm.org/D47929 Reviewers: teemperor Subscribers: mgorny, friss, lldb-commits Differential Revision: https://reviews.llvm.org/D54335 llvm-svn: 346667
* Remove header grouping comments.Jonas Devlieghere2018-11-1111-41/+0
| | | | | | | | This patch removes the comments grouping header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. llvm-svn: 346626
* Remove comments after header includes.Jonas Devlieghere2018-11-114-6/+6
| | | | | | | | | | This patch removes the comments following the header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. Differential revision: https://reviews.llvm.org/D54385 llvm-svn: 346625
* Add missing includeJonas Devlieghere2018-11-101-0/+1
| | | | llvm-svn: 346599
* Extract construction of DataBufferLLVM into FileSystemJonas Devlieghere2018-11-103-3/+40
| | | | | | | | | | This moves construction of data buffers into the FileSystem class. Like some of the previous refactorings we don't translate the path yet because the functionality hasn't been landed in LLVM yet. Differential revision: https://reviews.llvm.org/D54272 llvm-svn: 346598
* Revert "[FileSystem] Make use of FS in TildeExpressionResolver"Jonas Devlieghere2018-11-091-5/+4
| | | | | | | | The whole point of this change was making it possible to resolve paths without depending on the FileSystem, which is not what I did here. Not sure what I was thinking... llvm-svn: 346466
* [FileSystem] Make use of FS in TildeExpressionResolverJonas Devlieghere2018-11-091-4/+5
| | | | | | | | In order to call real_path from the TildeExpressionResolver we need access to the FileSystem. Since the resolver lives under utility we have to pass in the FS. llvm-svn: 346457
* Fix CMake build when building with -fmodules-local-submodule-visibility.Adrian Prantl2018-11-091-0/+2
| | | | llvm-svn: 346456
* Update FileSpec constructor signatureJonas Devlieghere2018-11-081-2/+5
| | | | llvm-svn: 346449
* [FileSystem] Add convenience method to check for directories.Jonas Devlieghere2018-11-085-5/+16
| | | | | | | | | | | Replace calls to LLVM's is_directory with calls to LLDB's FileSytem class. For this I introduced a new convenience method that, like the other methods, takes either a path or filespec. This still uses the LLVM functions under the hood. Differential revision: https://reviews.llvm.org/D54135 llvm-svn: 346375
* Fix NetBSD build after "Move path resolution logic out of FileSpec"Kamil Rytarowski2018-11-042-2/+2
| | | | | | D53915 llvm-svn: 346100
* Fix log statement in r346093Pavel Labath2018-11-041-1/+1
| | | | | | Thanks to Dávid Bolvanský for pointing that out. llvm-svn: 346094
* NativeProcessProtocol: Simplify breakpoint setting codePavel Labath2018-11-046-706/+183
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: A fairly simple operation as setting a breakpoint (writing a breakpoint opcode) at a given address was going through three classes: NativeProcessProtocol which called NativeBreakpointList, which then called SoftwareBrekpoint, only to end up again in NativeProcessProtocol to do the actual writing itself. This is unnecessarily complex and can be simplified by moving all of the logic into NativeProcessProtocol class itself, removing a lot of boilerplate. One of the reeasons for this complexity was that (it seems) NativeBreakpointList class was meant to hold both software and hardware breakpoints. However, that never materialized, and hardware breakpoints are stored in a separate map holding only hardware breakpoints. Essentially, this patch makes software breakpoints follow that approach by replacing the heavy SoftwareBraekpoint with a light struct of the same name, which holds only the data necessary to describe one breakpoint. The rest of the logic is in the main class. As, at the lldb-server level, handling software and hardware breakpoints is very different, this seems like a reasonable state of things. Reviewers: krytarowski, zturner, clayborg Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D52941 llvm-svn: 346093
* Fix some windows-specific fallout from the FileSpec change.Zachary Turner2018-11-031-2/+3
| | | | llvm-svn: 346058
* [FileSystem] Open File instances through the FileSystem.Jonas Devlieghere2018-11-023-103/+114
| | | | | | | | | | | This patch modifies how we open File instances in LLDB. Rather than passing a path or FileSpec to the constructor, we now go through the virtual file system. This is needed in order to make things work with the VFS in the future. Differential revision: https://reviews.llvm.org/D54020 llvm-svn: 346049
* [FileSystem] Remove `SetFileSystem` method.Jonas Devlieghere2018-11-021-4/+0
| | | | | | | This is no longer relevant with the new way we initialize the FileSystem. llvm-svn: 346003
* [FileSystme] Move ::open abstraction into FileSystem.Jonas Devlieghere2018-11-023-10/+16
| | | | | | | This moves the abstraction around ::open into the FileSystem, as is already the case for ::fopen. llvm-svn: 346002
* [Windows] Fix Windows build after be053dd5a384a03da5a77552686900ddc7bfc178Aleksandr Urakov2018-11-024-8/+8
| | | | llvm-svn: 345956
* [File] Remove static method to get permissions.Jonas Devlieghere2018-11-012-14/+14
| | | | | | | This patch removes the static accessor in File to get a file's permissions. Permissions should be checked through the FileSystem class. llvm-svn: 345901
* [FileSystem] Update SetFile signature.Jonas Devlieghere2018-11-011-1/+1
| | | | llvm-svn: 345898
OpenPOWER on IntegriCloud