Reapply "Rewrite gdb-remote's SendContinuePacketAndWaitForResponse"

Resumbitting the commit after fixing the following problems:
- broken unit tests on windows: incorrect gtest usage on my part (TEST vs. TEST_F)
- the new code did not correctly handle the case where we went to interrupt the process, but it
  stopped due to a different reason - the interrupt request would remain queued and would
  interfere with the following "continue". I also added a unit test for this case.

This reapplies r277156 and r277139.

llvm-svn: 278118
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
index b974db6..0f41a21 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -43,7 +43,7 @@
 
 class ThreadGDBRemote;
 
-class ProcessGDBRemote : public Process
+class ProcessGDBRemote : public Process, private GDBRemoteClientBase::ContinueDelegate
 {
 public:
     ProcessGDBRemote(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp);
@@ -273,6 +273,9 @@
     StructuredData::ObjectSP
     GetSharedCacheInfo () override;
 
+    std::string
+    HarmonizeThreadIdsForProfileData(StringExtractorGDBRemote &inputStringExtractor);
+
 protected:
     friend class ThreadGDBRemote;
     friend class GDBRemoteCommunicationClient;
@@ -485,12 +488,25 @@
     //------------------------------------------------------------------
     // For ProcessGDBRemote only
     //------------------------------------------------------------------
+    std::string m_partial_profile_data;
+    std::map<uint64_t, uint32_t> m_thread_id_to_used_usec_map;
+
     static bool
     NewThreadNotifyBreakpointHit (void *baton,
                          StoppointCallbackContext *context,
                          lldb::user_id_t break_id,
                          lldb::user_id_t break_loc_id);
 
+    //------------------------------------------------------------------
+    // ContinueDelegate interface
+    //------------------------------------------------------------------
+    void
+    HandleAsyncStdout(llvm::StringRef out) override;
+    void
+    HandleAsyncMisc(llvm::StringRef data) override;
+    void
+    HandleStopReply() override;
+
     DISALLOW_COPY_AND_ASSIGN (ProcessGDBRemote);
 };