summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/common/MainLoop.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [lldb] Add #include to appease the modules buildVedant Kumar2019-12-101-0/+1
| | | | | | | | | | | | | | | | | This #include appears to be completely unnecessary, but it does fix the following build failure: http://green.lab.llvm.org/green/job/lldb-cmake/4565/consoleText FAILED: tools/lldb/source/Host/CMakeFiles/lldbHost.dir/common/MainLoop.cpp.o /Users/buildslave/jenkins/workspace/lldb-cmake/host-compiler/bin/clang++ -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -DLIBXML2_DEFINED -DLLDB_CONFIGURATION_RELEASE -DLLDB_USE_OS_LOG -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/lldb/source/Host -I/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/lldb/source/Host -Itools/lldb/source -I/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/lldb/include -Itools/lldb/include -Iinclude -I/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include -I/usr/local/Frameworks/Python.framework/Versions/3.7/include/python3.7m -I/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/../clang/include -Itools/lldb/../clang/include -I/usr/local/include -I/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/lldb/source/. -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/libxml2 -Wdocumentation -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -fmodules -fmodules-cache-path=/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/module.cache -fcxx-modules -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-deprecated-register -Wno-vla-extension -O3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -UNDEBUG -fno-exceptions -fno-rtti -std=c++14 -MD -MT tools/lldb/source/Host/CMakeFiles/lldbHost.dir/common/MainLoop.cpp.o -MF tools/lldb/source/Host/CMakeFiles/lldbHost.dir/common/MainLoop.cpp.o.d -o tools/lldb/source/Host/CMakeFiles/lldbHost.dir/common/MainLoop.cpp.o -c /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/lldb/source/Host/common/MainLoop.cpp /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/lldb/source/Host/common/MainLoop.cpp:211:7: error: use of undeclared identifier 'ppoll' if (ppoll(read_fds.data(), read_fds.size(), nullptr, &sigmask) == -1 && ^ /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/lldb/source/Host/common/MainLoop.cpp:336:25: error: use of undeclared identifier 'HAVE_SYS_EVENT_H' ret = pthread_sigmask(HAVE_SYS_EVENT_H ? SIG_UNBLOCK : SIG_BLOCK, ^ 2 errors generated.
* Fix an unused variable warning in no-assert buildsPavel Labath2019-08-271-0/+1
| | | | llvm-svn: 370026
* Fix LLDB warnings when compiling with Clang 8.0Alexandre Ganea2019-05-211-0/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D62021 llvm-svn: 361295
* [lldb] [MainLoop] Add kevent() EINTR handlingMichal Gorny2019-02-151-2/+8
| | | | | | | | | | | | | Add missing EINTR handling for kevent() calls. If the call is interrupted, return from Poll() as if zero events were returned and let the polling resume on next iteration. This fixes test flakiness on NetBSD. Includes a test case suggested by Pavel Labath on D42206. Differential Revision: https://reviews.llvm.org/D58230 llvm-svn: 354122
* [lldb] [MainLoop] Remove redundant termination clause (NFCI)Michal Gorny2019-02-141-3/+0
| | | | | | | | | | | | | Remove the redundant termination clause from within the loop. Since the check is done at the end of the loop, it's entirely redundant to the 'while' condition. If termination was requested, the latter will become false and the 'while' loop will terminate, resulting in the 'return' statement below the loop being executed (which is equivalent to the one used inside 'if'). Differential Revision: https://reviews.llvm.org/D58227 llvm-svn: 354050
* [lldb] [MainLoop] Report errno for failed kevent()Michal Gorny2019-02-141-1/+1
| | | | | | | | | | Modify the kevent() error reporting to use errno rather than returning the return value. At least on FreeBSD and NetBSD, kevent() always returns -1 in case of error, and the actual error is returned via errno. Differential Revision: https://reviews.llvm.org/D58229 llvm-svn: 354029
* [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
* 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
* Fix typos.Bruce Mitchener2018-10-041-2/+2
| | | | | | | | | | Reviewers: lldb-commits Subscribers: srhines, ki.stfu Differential Revision: https://reviews.llvm.org/D52884 llvm-svn: 343825
* Reflow paragraphs in comments.Adrian Prantl2018-04-301-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* s/LLVM_ON_WIN32/_WIN32/, lldbNico Weber2018-04-101-4/+4
| | | | | | | | | | | LLVM_ON_WIN32 is set exactly with MSVC and MinGW (but not Cygwin) in HandleLLVMOptions.cmake, which is where _WIN32 defined too. Just use the default macro instead of a reinvented one. See thread "Replacing LLVM_ON_WIN32 with just _WIN32" on llvm-dev and cfe-dev. No intended behavior change. llvm-svn: 329697
* MainLoop: avoid infinite loop when pty slave gets closedPavel Labath2017-12-111-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: For ptys (at least on Linux), the end-of-file (closing of the slave FD) is signalled by the POLLHUP flag. We were ignoring this flag, which meant that when this happened, we would spin in a loop, continuously calling poll(2) and not making any progress. This makes sure we treat POLLHUP as a read event (reading will return 0), and we call the registered callback when it happens. This is the behavior our clients expect (and is consistent with how select(2) works). Reviewers: eugene, beanz Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D41008 llvm-svn: 320345
* Fix windows build broken in r316915Pavel Labath2017-10-301-1/+0
| | | | | | I accidentally left a linux-specific include in generic code. llvm-svn: 316919
* MainLoop: work around an android libc bugPavel Labath2017-10-301-6/+26
| | | | | | | | | | | | | Versions of android before kitkat implemented pselect non-atomically, which caused flakyness, as we were relying on it atomically setting the signal mask to implement waiting for signals. This patch implements a direct call to the the pselect kernel syscall, which does not suffer from this problem. The code itself is not very pretty, but fortunately the uglyness is contained in the android version of the MainLoop::RunImpl::Poll function. llvm-svn: 316915
* Signal polling is supported with pselect (re-land r313704 without a Windows ↵Eugene Zemtsov2017-09-201-4/+0
| | | | | | | | | breakage) Older Android API levels don't have ppoll, but LLDB works just fine, since on Android it always uses pselect anyway. llvm-svn: 313726
* Rollback r313704 because of the Windows build breakEugene Zemtsov2017-09-201-0/+4
| | | | llvm-svn: 313707
* Signal polling is supported with pselectEugene Zemtsov2017-09-201-4/+0
| | | | | | | Older Android API levels don't have ppoll, but LLDB works just fine, since on Android it always uses pselect anyway. llvm-svn: 313704
* Fix NetBSD/FreeBSD build after r308304Pavel Labath2017-07-181-0/+1
| | | | llvm-svn: 308307
* [MainLoop] Fix possible use of an invalid iteratorPetr Pavlu2017-07-121-9/+18
| | | | | | | | | | | | | | | | Store file descriptors from loop.m_read_fds (if FORCE_PSELECT is defined) and signals from loop.m_signals that need to be processed in MainLoop::RunImpl::ProcessEvents() into a separate vector and then iterate over this container to invoke the callbacks. This prevents a problem where when the code iterated directly over m_read_fds/m_signals, a callback invoked from within the loop could modify these variables and invalidate the loop iterator. This would then result in an assertion failure in llvm::DenseMapIterator::operator++(). Differential Revision: https://reviews.llvm.org/D35298 llvm-svn: 307782
* Rename Error -> Status.Zachary Turner2017-05-121-23/+22
| | | | | | | | | | | | | | | 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
* MainLoop: Add unit testsPavel Labath2017-05-041-105/+101
| | | | | | | | | | | | | | | | | | | | Summary: This adds a couple of unit tests to the MainLoop class. To get the kqueue based version of the signal handling passing, I needed to modify the implementation a bit to make the queue object persistent. Otherwise, only the signals which are send during the Run call would get processed, which did not match the ppoll behaviour. I also took the opportunity to remove the ForEach template functions and replace them with something more reasonable. Reviewers: beanz, eugene Subscribers: lldb-commits, mgorny Differential Revision: https://reviews.llvm.org/D32753 llvm-svn: 302133
* Resurrect pselect MainLoop implementationPavel Labath2017-04-281-94/+208
| | | | | | | | | | | | | | | | | | | | Summary: It turns out that even though ppoll is available on all the android devices we support, it does not seem to be working properly on all of them -- MainLoop just does a busy loop with ppoll returning EINTR and not making any progress. This brings back the pselect implementation and makes it available on android. I could not do any cmake checks for this as the ppoll symbol is actually avaiable -- it just does not work. Reviewers: beanz, eugene Subscribers: srhines, lldb-commits Differential Revision: https://reviews.llvm.org/D32600 llvm-svn: 301636
* Resurrect the standalone build of LLDBKamil Rytarowski2017-04-281-1/+1
| | | | | | | | Switch includes "llvm/Config/config.h" to "llvm/Config/llvm-config.h". Tested on NetBSD 7.99.70 amd64 llvm-svn: 301603
* Re-landing IPv6 support for LLDB HostChris Bieneman2017-04-261-0/+268
| | | | | | | | | | | | | | | | | | | | | | 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
* Revert yesterdays IPv6 patchesPavel Labath2017-04-191-268/+0
| | | | | | | | | | | | | 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
* One more attempt and WindowsChris Bieneman2017-04-191-0/+1
| | | | | | This is the last Windows compile error, so... Hit me with your best shot. llvm-svn: 300647
* Another netbsd build failure...Chris Bieneman2017-04-191-1/+0
| | | | llvm-svn: 300640
* Buildbot wack-a-mole!Chris Bieneman2017-04-191-1/+1
| | | | | | This should fix the netbsd bot I just broke. llvm-svn: 300638
* ifdefing out the signal handling code on WindowsChris Bieneman2017-04-191-6/+17
| | | | | | | | *fingers crossed* This might fix the Window bots, but I really don't know... llvm-svn: 300636
* Include time.h, and fix a Darwin warningChris Bieneman2017-04-181-8/+2
| | | | | | This is a little more cleanup from r300579. llvm-svn: 300615
* Fix Windows bot failureChris Bieneman2017-04-181-1/+8
| | | | | | timespec is not available on Windows, and we should use size_t instead of nfds_t. llvm-svn: 300610
* Removing unused includeChris Bieneman2017-04-181-1/+0
| | | | | | This is causing the Windows bot failures. llvm-svn: 300605
* Writing multi-platform code is hard...Chris Bieneman2017-04-181-1/+1
| | | | | | Fixing another error from r300579. llvm-svn: 300589
* Fix broken windows build.Chris Bieneman2017-04-181-1/+0
| | | | | | This is not ideal, but it should get the bot going again. I'll need to revisit this if we want to get signal handling working on Windows. llvm-svn: 300587
* Update LLDB Host to support IPv6 over TCPChris Bieneman2017-04-181-0/+258
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
OpenPOWER on IntegriCloud