summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h
diff options
context:
space:
mode:
authorKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
committerKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
commitb9c1b51e45b845debb76d8658edabca70ca56079 (patch)
treedfcb5a13ef2b014202340f47036da383eaee74aa /lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h
parentd5aa73376966339caad04013510626ec2e42c760 (diff)
downloadbcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz
bcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip
*** This commit represents a complete reformatting of the LLDB source code
*** 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
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h257
1 files changed, 123 insertions, 134 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h
index 684ef3e80d1..f392895405a 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h
@@ -14,147 +14,136 @@
#include <condition_variable>
-namespace lldb_private
-{
-namespace process_gdb_remote
-{
+namespace lldb_private {
+namespace process_gdb_remote {
-class GDBRemoteClientBase : public GDBRemoteCommunication
-{
+class GDBRemoteClientBase : public GDBRemoteCommunication {
public:
- struct ContinueDelegate
- {
- virtual ~ContinueDelegate();
- virtual void
- HandleAsyncStdout(llvm::StringRef out) = 0;
- virtual void
- HandleAsyncMisc(llvm::StringRef data) = 0;
- virtual void
- HandleStopReply() = 0;
-
- //
- /// Processes async structured data.
- ///
- /// @return
- /// true if the data was handled; otherwise, false.
- //
- virtual bool
- HandleAsyncStructuredData(const StructuredData::ObjectSP
- &object_sp) = 0;
- };
-
- GDBRemoteClientBase(const char *comm_name, const char *listener_name);
-
- bool
- SendAsyncSignal(int signo);
-
- bool
- Interrupt();
-
- lldb::StateType
- SendContinuePacketAndWaitForResponse(ContinueDelegate &delegate, const UnixSignals &signals,
- llvm::StringRef payload, StringExtractorGDBRemote &response);
-
- PacketResult
- SendPacketAndWaitForResponse(const char *payload, size_t len, StringExtractorGDBRemote &response, bool send_async)
- {
- return SendPacketAndWaitForResponse(llvm::StringRef(payload, len), response, send_async);
- }
-
- PacketResult
- SendPacketAndWaitForResponse(llvm::StringRef payload, StringExtractorGDBRemote &response, bool send_async);
-
- bool
- SendvContPacket(llvm::StringRef payload, StringExtractorGDBRemote &response);
-
- class Lock
- {
- public:
- Lock(GDBRemoteClientBase &comm, bool interrupt);
- ~Lock();
-
- explicit operator bool() { return m_acquired; }
-
- // Whether we had to interrupt the continue thread to acquire the connection.
- bool
- DidInterrupt() const
- {
- return m_did_interrupt;
- }
-
- private:
- std::unique_lock<std::recursive_mutex> m_async_lock;
- GDBRemoteClientBase &m_comm;
- bool m_acquired;
- bool m_did_interrupt;
-
- void
- SyncWithContinueThread(bool interrupt);
- };
+ struct ContinueDelegate {
+ virtual ~ContinueDelegate();
+ virtual void HandleAsyncStdout(llvm::StringRef out) = 0;
+ virtual void HandleAsyncMisc(llvm::StringRef data) = 0;
+ virtual void HandleStopReply() = 0;
+
+ //
+ /// Processes async structured data.
+ ///
+ /// @return
+ /// true if the data was handled; otherwise, false.
+ //
+ virtual bool
+ HandleAsyncStructuredData(const StructuredData::ObjectSP &object_sp) = 0;
+ };
+
+ GDBRemoteClientBase(const char *comm_name, const char *listener_name);
+
+ bool SendAsyncSignal(int signo);
+
+ bool Interrupt();
+
+ lldb::StateType SendContinuePacketAndWaitForResponse(
+ ContinueDelegate &delegate, const UnixSignals &signals,
+ llvm::StringRef payload, StringExtractorGDBRemote &response);
+
+ PacketResult SendPacketAndWaitForResponse(const char *payload, size_t len,
+ StringExtractorGDBRemote &response,
+ bool send_async) {
+ return SendPacketAndWaitForResponse(llvm::StringRef(payload, len), response,
+ send_async);
+ }
+
+ PacketResult SendPacketAndWaitForResponse(llvm::StringRef payload,
+ StringExtractorGDBRemote &response,
+ bool send_async);
+
+ bool SendvContPacket(llvm::StringRef payload,
+ StringExtractorGDBRemote &response);
+
+ class Lock {
+ public:
+ Lock(GDBRemoteClientBase &comm, bool interrupt);
+ ~Lock();
+
+ explicit operator bool() { return m_acquired; }
+
+ // Whether we had to interrupt the continue thread to acquire the
+ // connection.
+ bool DidInterrupt() const { return m_did_interrupt; }
+
+ private:
+ std::unique_lock<std::recursive_mutex> m_async_lock;
+ GDBRemoteClientBase &m_comm;
+ bool m_acquired;
+ bool m_did_interrupt;
+
+ void SyncWithContinueThread(bool interrupt);
+ };
protected:
- PacketResult
- SendPacketAndWaitForResponseNoLock(llvm::StringRef payload, StringExtractorGDBRemote &response);
+ PacketResult
+ SendPacketAndWaitForResponseNoLock(llvm::StringRef payload,
+ StringExtractorGDBRemote &response);
- virtual void
- OnRunPacketSent(bool first);
+ virtual void OnRunPacketSent(bool first);
private:
- // Variables handling synchronization between the Continue thread and any other threads
- // wishing to send packets over the connection. Either the continue thread has control over
- // the connection (m_is_running == true) or the connection is free for an arbitrary number of
- // other senders to take which indicate their interest by incrementing m_async_count.
- // Semantics of individual states:
- // - m_continue_packet == false, m_async_count == 0: connection is free
- // - m_continue_packet == true, m_async_count == 0: only continue thread is present
- // - m_continue_packet == true, m_async_count > 0: continue thread has control, async threads
- // should interrupt it and wait for it to set m_continue_packet to false
- // - m_continue_packet == false, m_async_count > 0: async threads have control, continue
- // thread needs to wait for them to finish (m_async_count goes down to 0).
- std::mutex m_mutex;
- std::condition_variable m_cv;
- // Packet with which to resume after an async interrupt. Can be changed by an async thread
- // e.g. to inject a signal.
- std::string m_continue_packet;
- // When was the interrupt packet sent. Used to make sure we time out if the stub does not
- // respond to interrupt requests.
- std::chrono::time_point<std::chrono::steady_clock> m_interrupt_time;
- uint32_t m_async_count;
- bool m_is_running;
- bool m_should_stop; // Whether we should resume after a stop.
- // end of continue thread synchronization block
-
- // This handles the synchronization between individual async threads. For now they just use a
- // simple mutex.
- std::recursive_mutex m_async_mutex;
-
- bool
- ShouldStop(const UnixSignals &signals, StringExtractorGDBRemote &response);
-
- class ContinueLock
- {
- public:
- enum class LockResult
- {
- Success,
- Cancelled,
- Failed
- };
-
- explicit ContinueLock(GDBRemoteClientBase &comm);
- ~ContinueLock();
- explicit operator bool() { return m_acquired; }
-
- LockResult
- lock();
-
- void
- unlock();
-
- private:
- GDBRemoteClientBase &m_comm;
- bool m_acquired;
- };
+ // Variables handling synchronization between the Continue thread and any
+ // other threads
+ // wishing to send packets over the connection. Either the continue thread has
+ // control over
+ // the connection (m_is_running == true) or the connection is free for an
+ // arbitrary number of
+ // other senders to take which indicate their interest by incrementing
+ // m_async_count.
+ // Semantics of individual states:
+ // - m_continue_packet == false, m_async_count == 0: connection is free
+ // - m_continue_packet == true, m_async_count == 0: only continue thread is
+ // present
+ // - m_continue_packet == true, m_async_count > 0: continue thread has
+ // control, async threads
+ // should interrupt it and wait for it to set m_continue_packet to false
+ // - m_continue_packet == false, m_async_count > 0: async threads have
+ // control, continue
+ // thread needs to wait for them to finish (m_async_count goes down to 0).
+ std::mutex m_mutex;
+ std::condition_variable m_cv;
+ // Packet with which to resume after an async interrupt. Can be changed by an
+ // async thread
+ // e.g. to inject a signal.
+ std::string m_continue_packet;
+ // When was the interrupt packet sent. Used to make sure we time out if the
+ // stub does not
+ // respond to interrupt requests.
+ std::chrono::time_point<std::chrono::steady_clock> m_interrupt_time;
+ uint32_t m_async_count;
+ bool m_is_running;
+ bool m_should_stop; // Whether we should resume after a stop.
+ // end of continue thread synchronization block
+
+ // This handles the synchronization between individual async threads. For now
+ // they just use a
+ // simple mutex.
+ std::recursive_mutex m_async_mutex;
+
+ bool ShouldStop(const UnixSignals &signals,
+ StringExtractorGDBRemote &response);
+
+ class ContinueLock {
+ public:
+ enum class LockResult { Success, Cancelled, Failed };
+
+ explicit ContinueLock(GDBRemoteClientBase &comm);
+ ~ContinueLock();
+ explicit operator bool() { return m_acquired; }
+
+ LockResult lock();
+
+ void unlock();
+
+ private:
+ GDBRemoteClientBase &m_comm;
+ bool m_acquired;
+ };
};
} // namespace process_gdb_remote
OpenPOWER on IntegriCloud