summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/posix/PipePosix.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [lldb][NFC] Use static_cast instead of reinterpret_cast where possibleRaphael Isemann2020-01-071-5/+4
| | | | | | | | | | | | | | Summary: There are a few places in LLDB where we do a `reinterpret_cast` for conversions that we could also do with `static_cast`. This patch moves all this code to `static_cast`. Reviewers: shafik, JDevlieghere, labath Reviewed By: labath Subscribers: arphaman, usaxena95, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D72161
* [lldb] Add missing EINTR handlingMichal Gorny2019-03-211-2/+7
| | | | | | Differential Revision: https://reviews.llvm.org/D59606 llvm-svn: 356703
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | 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
* [lldb-server] Add unnamed pipe support to PipeWindowsAaron Smith2019-01-101-2/+3
| | | | | | | | | | | | | | | | | 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
* Do not use PATH_MAX with SmallStringStella Stamenova2018-12-101-2/+2
| | | | | | | | | | | | | | 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
* Replace HostInfo::GetLLDBPath with specific functionsPavel Labath2018-06-191-7/+3
| | | | | | | | | | | | | | | | | | | | | 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
* Reflow paragraphs in comments.Adrian Prantl2018-04-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Rename Error -> Status.Zachary Turner2017-05-121-30/+31
| | | | | | | | | | | | | | | 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
* Resubmit r298334 after fixing OSX build errors.Zachary Turner2017-03-211-2/+1
| | | | | | | 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-1/+2
| | | | | | on macosx. llvm-svn: 298338
* Delete various lldb FileSystem functions.Zachary Turner2017-03-211-2/+1
| | | | | | | | Use LLVM's equivalent versions instead. Differential Revision: https://reviews.llvm.org/D31111 llvm-svn: 298334
* Prevent at compile time converting from Error::success() to Expected<T>Mehdi Amini2016-11-111-1/+1
| | | | | | | | This would trigger an assertion at runtime otherwise. Differential Revision: https://reviews.llvm.org/D26482 llvm-svn: 286562
* Make the Error class constructor protectedMehdi Amini2016-11-111-1/+1
| | | | | | | | | This is forcing to use Error::success(), which is in a wide majority of cases a lot more readable. Differential Revision: https://reviews.llvm.org/D26481 llvm-svn: 286561
* Fix Clang-tidy readability-redundant-string-cstr warningsMalcolm Parsons2016-11-021-1/+1
| | | | | | | | | | Reviewers: zturner, labath Subscribers: tberghammer, danalbert, lldb-commits Differential Revision: https://reviews.llvm.org/D26233 llvm-svn: 285855
* *** This commit represents a complete reformatting of the LLDB source codeKate Stone2016-09-061-271/+208
| | | | | | | | | | | | | | | | | | | | | | | *** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
* Centralize all select() calls into one place so that we can take advantage ↵Greg Clayton2016-08-101-109/+53
| | | | | | | | | of system specific optimizations to deal with more file descriptors than FD_SETSIZE on some systems. <rdar://problem/25325383> https://reviews.llvm.org/D22950 llvm-svn: 278299
* The pipe2(2) call is supported on NetBSDEd Maste2015-09-141-2/+2
| | | | | | | | Patch by Kamil Rytarowski. Differential Revision: http://reviews.llvm.org/D12746 llvm-svn: 247568
* Prevent from a redefinition of _GLIBCXX_USE_NANOSLEEPStephane Sezer2015-09-091-0/+2
| | | | | | | | | | | | | | Summary: Build warning caught on NetBSD. Reviewers: joerg, sas Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D12662 Change by Kamil Rytarowski <n54@gmx.com> llvm-svn: 247114
* Fix for build errors on arm-linux-gnueabi-gccOmair Javaid2015-08-091-0/+4
| | | | | | http://reviews.llvm.org/D11256 llvm-svn: 244419
* Revert "Add Pipe::WriteWithTimeout method"Pavel Labath2015-07-211-10/+6
| | | | | | | | I have observed an increased flakyness in the buildbots. I suspect something was relying on the fact that Pipe::Write had an implicit timeout of 1s, which this commit has removed. Reverting while I investigate. llvm-svn: 242767
* Add Pipe::WriteWithTimeout methodPavel Labath2015-07-211-6/+10
| | | | | | | | | | | | | | | | | | Summary: This commit adds a WriteWithTimeout method to time Pipe class, analogous to the existing ReadWithTimeout(). It also changes the meaning of passing zero as a timeout value. Previously, zero was used as an infinite timeout value. Now, the meaning of zero timeout to return the data avaiable without sleeping (basically, a non-blocking operation). This makes the behaviour of Pipe consistent with the Communication/Connection classes. For blocking operatios with infinite timeout, I introduce a special constant for this purpose. Reviewers: ovyalov, zturner Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D11358 llvm-svn: 242764
* Refactor many file functions to use FileSpec over strings.Chaoren Lin2015-05-291-1/+1
| | | | | | | | | | | | | | | | | Summary: This should solve the issue of sending denormalized paths over gdb-remote if we stick to GetPath(false) in GDBRemoteCommunicationClient, and let the server handle any denormalization. Reviewers: ovyalov, zturner, vharron, clayborg Reviewed By: clayborg Subscribers: tberghammer, emaste, lldb-commits Differential Revision: http://reviews.llvm.org/D9728 llvm-svn: 238604
* PosixPipes should not be copyable but should be movable.Chaoren Lin2015-05-011-1/+19
| | | | | | | | | | | | | | Summary: This addresses Oleksiy's comment in D9307. Reviewers: clayborg, ovyalov Reviewed By: clayborg, ovyalov Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D9405 llvm-svn: 236320
* Add file descriptor constructor for PipePosix.Chaoren Lin2015-04-291-13/+4
| | | | llvm-svn: 236133
* Add an unnamed pipe fail-safe to launching lldb-gdbserver.Chaoren Lin2015-04-271-0/+9
| | | | | | | | | | | | | | | | | | Summary: Currently, launching lldb-gdbserver from platform on Android requires root for mkfifo() and an explicit TMPDIR variable. This should remove both requirements. Test Plan: Successfully launched lldb-gdbserver on a non-rooted Android device. Reviewers: tberghammer, vharron, clayborg Reviewed By: clayborg Subscribers: tberghammer, lldb-commits Differential Revision: http://reviews.llvm.org/D9307 llvm-svn: 235940
* Fix warning about the use of mktemp and make platform agnostic by adding and ↵Oleksiy Vyalov2015-02-051-0/+35
| | | | | | | | using PipeBase::CreateWithUniqueName - on behalf of flackr. http://reviews.llvm.org/D7348 llvm-svn: 228307
* Extend PipePosix with support for named pipes/timeout-based IO and integrate ↵Oleksiy Vyalov2015-01-141-1/+1
| | | | | | | | it with GDBRemoteCommunication / lldb-gdbserver - include reviews fixes. http://reviews.llvm.org/D6954 llvm-svn: 225923
* Extend PipePosix with support for named pipes/timeout-based IO and integrate ↵Oleksiy Vyalov2015-01-131-71/+197
| | | | | | | | it with GDBRemoteCommunication / lldb-gdbserver. http://reviews.llvm.org/D6954 llvm-svn: 225849
* No need to call SetErrorToErrno when pipe2 succeeds.Oleksiy Vyalov2014-12-191-3/+0
| | | | | | http://reviews.llvm.org/D6743 llvm-svn: 224652
* Enhance the Pipe interface for better portability.Zachary Turner2014-12-171-57/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes a number of improvements to the Pipe interface. 1) An interface (PipeBase) is provided which exposes pure virtual methods for any implementation of Pipe to override. While not strictly necessary, this helps catch errors where the interfaces are out of sync. 2) All methods return lldb_private::Error instead of returning bool or void. This allows richer error information to be propagated up to LLDB. 3) A new ReadWithTimeout() method is exposed in the base class and implemented on Windows. 4) Support for both named and anonymous pipes is exposed through the base interface and implemented on Windows. For creating a new pipe, both named and anonymous pipes are supported, and for opening an existing pipe, only named pipes are supported. New methods described in points #3 and #4 are stubbed out on posix, but fully implemented on Windows. These should be implemented by someone on the linux / mac / bsd side. Reviewed by: Greg Clayton, Oleksiy Vyalov Differential Revision: http://reviews.llvm.org/D6686 llvm-svn: 224442
* Extend PipePosix with child_processes_inherit support - to control whether ↵Oleksiy Vyalov2014-11-211-1/+38
| | | | | | | | pipe handles should be inherited by a child process. http://reviews.llvm.org/D6348 llvm-svn: 222541
* Fix deadlock in Python one-line execution.Zachary Turner2014-10-081-0/+145
Python one-line execution was using ConnectionFileDescriptor to do a non-blocking read against a pipe. This won't work on Windows, as CFD is implemented using select(), and select() only works with sockets on Windows. The solution is to use ConnectionGenericFile on Windows, which uses the native API to do overlapped I/O on the pipe. This in turn requires re-implementing Host::Pipe on Windows using native OS handles instead of the more portable _pipe CRT api. Reviewed by: Greg Clayton Differential Revision: http://reviews.llvm.org/D5679 llvm-svn: 219339
OpenPOWER on IntegriCloud