[Lldb-commits] [lldb] r236699 - Don't call the Process::SyncIOHandler in Target::Launch

Ilia K ki.stfu at gmail.com
Wed May 6 23:26:27 PDT 2015


Author: ki.stfu
Date: Thu May  7 01:26:27 2015
New Revision: 236699

URL: http://llvm.org/viewvc/llvm-project?rev=236699&view=rev
Log:
Don't call the Process::SyncIOHandler in Target::Launch

Summary: This patch moves synchronization of iohandler to CommandObjectProcessLaunch::DoExecute like it was done in CommandObjectProcessContinue::DoExecute.

Reviewers: jingham, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, clayborg, jingham

Differential Revision: http://reviews.llvm.org/D9373

Modified:
    lldb/trunk/source/Commands/CommandObjectProcess.cpp
    lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=236699&r1=236698&r2=236699&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Thu May  7 01:26:27 2015
@@ -264,13 +264,18 @@ protected:
         
         if (error.Success())
         {
-            const char *archname = exe_module_sp->GetArchitecture().GetArchitectureName();
             ProcessSP process_sp (target->GetProcessSP());
             if (process_sp)
             {
+                // There is a race condition where this thread will return up the call stack to the main command
+                // handler and show an (lldb) prompt before HandlePrivateEvent (from PrivateStateThread) has
+                // a chance to call PushProcessIOHandler().
+                process_sp->SyncIOHandler(2000);
+
                 const char *data = stream.GetData();
                 if (data && strlen(data) > 0)
                     result.AppendMessage(stream.GetData());
+                const char *archname = exe_module_sp->GetArchitecture().GetArchitectureName();
                 result.AppendMessageWithFormat ("Process %" PRIu64 " launched: '%s' (%s)\n", process_sp->GetID(), exe_module_sp->GetFileSpec().GetPath().c_str(), archname);
                 result.SetStatus (eReturnStatusSuccessFinishResult);
                 result.SetDidChangeProcessState (true);

Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=236699&r1=236698&r2=236699&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Thu May  7 01:26:27 2015
@@ -2630,13 +2630,6 @@ Target::Launch (ProcessLaunchInfo &launc
                     {
                         m_process_sp->RestoreProcessEvents();
                         error = m_process_sp->PrivateResume();
-                        if (error.Success())
-                        {
-                            // there is a race condition where this thread will return up the call stack to the main command
-                            // handler and show an (lldb) prompt before HandlePrivateEvent (from PrivateStateThread) has
-                            // a chance to call PushProcessIOHandler()
-                            m_process_sp->SyncIOHandler(2000);
-                        }
                     }
                     if (!error.Success())
                     {
@@ -2652,11 +2645,6 @@ Target::Launch (ProcessLaunchInfo &launc
                     // Target was stopped at entry as was intended. Need to notify the listeners about it.
                     m_process_sp->RestoreProcessEvents();
                     m_process_sp->HandlePrivateEvent(event_sp);
-
-                    // there is a race condition where this thread will return up the call stack to the main command
-                    // handler and show an (lldb) prompt before HandlePrivateEvent (from PrivateStateThread) has
-                    // a chance to call PushProcessIOHandler()
-                    m_process_sp->SyncIOHandler(2000);
                 }
             }
             else if (state == eStateExited)





More information about the lldb-commits mailing list