diff options
author | Greg Clayton <gclayton@apple.com> | 2014-05-02 00:45:31 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2014-05-02 00:45:31 +0000 |
commit | f0066ad07fadc7c1386c65572e6d988dfd26610d (patch) | |
tree | bb4ae7aeedcca4c081697032a493465a2d21d42a /lldb/source/Core/ConnectionFileDescriptor.cpp | |
parent | 34a38d8efbde085814bbbb5d1d7c7fcb15897e42 (diff) | |
download | bcm5719-llvm-f0066ad07fadc7c1386c65572e6d988dfd26610d.tar.gz bcm5719-llvm-f0066ad07fadc7c1386c65572e6d988dfd26610d.zip |
Fixed CTRL+C related issues:
- CTRL+C wasn't clearing the command in lldb
- CTRL+C doesn't work in python macros in lldb
- Ctrl+C no longer interrupts the running process that you attach to
<rdar://problem/15949205>
<rdar://problem/16778652>
<rdar://problem/16774411>
llvm-svn: 207816
Diffstat (limited to 'lldb/source/Core/ConnectionFileDescriptor.cpp')
-rw-r--r-- | lldb/source/Core/ConnectionFileDescriptor.cpp | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/lldb/source/Core/ConnectionFileDescriptor.cpp b/lldb/source/Core/ConnectionFileDescriptor.cpp index fc1e9f2b535..31761d8864a 100644 --- a/lldb/source/Core/ConnectionFileDescriptor.cpp +++ b/lldb/source/Core/ConnectionFileDescriptor.cpp @@ -361,6 +361,14 @@ ConnectionFileDescriptor::Connect (const char *s, Error *error_ptr) return eConnectionStatusError; } +bool +ConnectionFileDescriptor::InterruptRead() +{ + if (m_pipe_write != -1 ) + return write (m_pipe_write, "i", 1) == 1; + return false; +} + ConnectionStatus ConnectionFileDescriptor::Disconnect (Error *error_ptr) { @@ -390,7 +398,7 @@ ConnectionFileDescriptor::Disconnect (Error *error_ptr) m_shutting_down = true; Mutex::Locker locker; - bool got_lock= locker.TryLock (m_mutex); + bool got_lock = locker.TryLock (m_mutex); if (!got_lock) { @@ -839,14 +847,19 @@ ConnectionFileDescriptor::BytesAvailable (uint32_t timeout_usec, Error *error_pt { bytes_read = ::read (pipe_fd, buffer, sizeof(buffer)); } while (bytes_read < 0 && errno == EINTR); - assert (bytes_read == 1 && buffer[0] == 'q'); - - if (log) - log->Printf("%p ConnectionFileDescriptor::BytesAvailable() got data: %*s from the command channel.", - static_cast<void*>(this), - static_cast<int>(bytes_read), buffer); - - return eConnectionStatusEndOfFile; + + switch (buffer[0]) + { + case 'q': + if (log) + log->Printf("%p ConnectionFileDescriptor::BytesAvailable() got data: %*s from the command channel.", + static_cast<void*>(this), + static_cast<int>(bytes_read), buffer); + return eConnectionStatusEndOfFile; + case 'i': + // Interrupt the current read + return eConnectionStatusInterrupted; + } } } } |