If debugserver is running on the local machine, pass it a
pseudoterminal to pass to the inferior for the inferior's I/O
(to allow direct writing, rather than passing all the I/O around
via packets).



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@118308 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 2cc9e0a..8d3675d 100644
--- a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1752,7 +1752,8 @@
             lldb_utility::PseudoTerminal pty;
             if (stdio_path == NULL)
             {
-                pass_stdio_path_to_debugserver = false;
+                if (! m_local_debugserver)
+                    pass_stdio_path_to_debugserver = false;
                 if (pty.OpenFirstAvailableMaster(O_RDWR|O_NOCTTY, NULL, 0))
                 {
                     struct termios stdin_termios;
@@ -1785,7 +1786,7 @@
                 {
                     debugserver_args.AppendArgument("-s");    // short for --stdio-path
                     StreamString strm;
-                    strm.Printf("'%s'", stdio_path);
+                    strm.Printf("%s", stdio_path);
                     debugserver_args.AppendArgument(strm.GetData());    // path to file to have inferior open as it's STDIO
                 }
             }
@@ -1880,19 +1881,19 @@
             if (error.Fail() || log)
                 error.PutToLog(log, "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )", m_debugserver_pid, debugserver_path, NULL, &attr, inferior_argv, inferior_envp);
 
-//            if (m_debugserver_pid != LLDB_INVALID_PROCESS_ID)
-//            {
-//                std::auto_ptr<ConnectionFileDescriptor> conn_ap(new ConnectionFileDescriptor (pty.ReleaseMasterFileDescriptor(), true));
-//                if (conn_ap.get())
-//                {
-//                    m_stdio_communication.SetConnection(conn_ap.release());
-//                    if (m_stdio_communication.IsConnected())
-//                    {
-//                        m_stdio_communication.SetReadThreadBytesReceivedCallback (STDIOReadThreadBytesReceived, this);
-//                        m_stdio_communication.StartReadThread();
-//                    }
-//                }
-//            }
+            if (m_debugserver_pid != LLDB_INVALID_PROCESS_ID)
+            {
+                std::auto_ptr<ConnectionFileDescriptor> conn_ap(new ConnectionFileDescriptor (pty.ReleaseMasterFileDescriptor(), true));
+                if (conn_ap.get())
+                {
+                    m_stdio_communication.SetConnection(conn_ap.release());
+                    if (m_stdio_communication.IsConnected())
+                    {
+                        m_stdio_communication.SetReadThreadBytesReceivedCallback (STDIOReadThreadBytesReceived, this);
+                        m_stdio_communication.StartReadThread();
+                    }
+                }
+            }
         }
         else
         {