[Lldb-commits] [lldb] r125024 - in /lldb/trunk: include/lldb/Core/TTYState.h source/Core/Debugger.cpp source/Core/TTYState.cpp source/Interpreter/ScriptInterpreterPython.cpp

Greg Clayton gclayton at apple.com
Mon Feb 7 11:04:59 PST 2011


Author: gclayton
Date: Mon Feb  7 13:04:58 2011
New Revision: 125024

URL: http://llvm.org/viewvc/llvm-project?rev=125024&view=rev
Log:
More termios fixes from Kirk Beitz.


Modified:
    lldb/trunk/include/lldb/Core/TTYState.h
    lldb/trunk/source/Core/Debugger.cpp
    lldb/trunk/source/Core/TTYState.cpp
    lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp

Modified: lldb/trunk/include/lldb/Core/TTYState.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/TTYState.h?rev=125024&r1=125023&r2=125024&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/TTYState.h (original)
+++ lldb/trunk/include/lldb/Core/TTYState.h Mon Feb  7 13:04:58 2011
@@ -11,8 +11,9 @@
 #define liblldb_TTYState_h_
 #if defined(__cplusplus)
 
+#if LLDB_CONFIG_TERMIOS_SUPPORTED
 #include <termios.h>
-#include <stdint.h>
+#endif // #if LLDB_CONFIG_TERMIOS_SUPPORTED
 
 #include "lldb/lldb-private.h"
 
@@ -121,7 +122,9 @@
     int             m_fd;           ///< File descriptor of the TTY.
     int             m_tflags;       ///< Cached tflags information.
     int             m_ttystate_err; ///< Error value from call to save tflags.
+#if LLDB_CONFIG_TERMIOS_SUPPORTED
     struct termios  m_ttystate;     ///< Cached ttystate information.
+#endif // #if LLDB_CONFIG_TERMIOS_SUPPORTED
     lldb::pid_t     m_process_group;///< Cached process group information.
 
 };

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=125024&r1=125023&r2=125024&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Mon Feb  7 13:04:58 2011
@@ -21,7 +21,9 @@
 #include "lldb/Target/StopInfo.h"
 #include "lldb/Target/Thread.h"
 
+#if LLDB_CONFIG_TERMIOS_SUPPORTED
 #include <termios.h>
+#endif
 
 using namespace lldb;
 using namespace lldb_private;
@@ -547,11 +549,12 @@
 void
 Debugger::ActivateInputReader (const InputReaderSP &reader_sp)
 {
+#if LLDB_CONFIG_TERMIOS_SUPPORTED
     FILE *in_fh = GetInputFileHandle();
 
     if (in_fh)
     {
-        struct termios in_fh_termios;
+    	struct termios in_fh_termios;
         int in_fd = fileno (in_fh);
         if (::tcgetattr(in_fd, &in_fh_termios) == 0)
         {    
@@ -578,6 +581,7 @@
             ::tcsetattr (in_fd, TCSANOW, &in_fh_termios);
         }
     }
+#endif // #if LLDB_CONFIG_TERMIOS_SUPPORTED
 }
 
 void

Modified: lldb/trunk/source/Core/TTYState.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/TTYState.cpp?rev=125024&r1=125023&r2=125024&view=diff
==============================================================================
--- lldb/trunk/source/Core/TTYState.cpp (original)
+++ lldb/trunk/source/Core/TTYState.cpp Mon Feb  7 13:04:58 2011
@@ -10,7 +10,7 @@
 #include "lldb/Core/TTYState.h"
 #include <fcntl.h>
 #include <unistd.h>
-#include <sys/signal.h>
+#include <signal.h>
 
 using namespace lldb_private;
 
@@ -21,7 +21,9 @@
     m_fd(-1),
     m_tflags(-1),
     m_ttystate_err(-1),
+#if LLDB_CONFIG_TERMIOS_SUPPORTED
     m_ttystate(),
+#endif // #if LLDB_CONFIG_TERMIOS_SUPPORTED
     m_process_group(-1)
 {
 }
@@ -45,7 +47,9 @@
     {
         m_fd = fd;
         m_tflags = ::fcntl (fd, F_GETFL, 0);
+#if LLDB_CONFIG_TERMIOS_SUPPORTED
         m_ttystate_err = ::tcgetattr (fd, &m_ttystate);
+#endif // #if LLDB_CONFIG_TERMIOS_SUPPORTED
         if (save_process_group)
             m_process_group = ::tcgetpgrp (0);
         else
@@ -74,8 +78,10 @@
         if (TFlagsIsValid())
             result = fcntl (m_fd, F_SETFL, m_tflags);
 
+#if LLDB_CONFIG_TERMIOS_SUPPORTED
         if (TTYStateIsValid())
             result = tcsetattr (m_fd, TCSANOW, &m_ttystate);
+#endif // #if LLDB_CONFIG_TERMIOS_SUPPORTED
 
         if (ProcessGroupIsValid())
         {

Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=125024&r1=125023&r2=125024&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Mon Feb  7 13:04:58 2011
@@ -201,7 +201,9 @@
     m_dbg_stdout (interpreter.GetDebugger().GetOutputFileHandle()),
     m_new_sysout (NULL),
     m_dictionary_name (interpreter.GetDebugger().GetInstanceName().AsCString()),
+#if LLDB_CONFIG_TERMIOS_SUPPORTED
     m_termios (),
+#endif // #if LLDB_CONFIG_TERMIOS_SUPPORTED
     m_termios_valid (false),
     m_session_is_active (false),
     m_pty_slave_is_open (false),
@@ -569,8 +571,10 @@
             else
                 input_fd = STDIN_FILENO;
 
+#if LLDB_CONFIG_TERMIOS_SUPPORTED
             script_interpreter->m_termios_valid = ::tcgetattr (input_fd, &script_interpreter->m_termios) == 0;
-            
+#endif // #if LLDB_CONFIG_TERMIOS_SUPPORTED
+
             if (!CurrentThreadHasPythonLock())
             {
                 while (!GetPythonLock(1)) 
@@ -674,6 +678,7 @@
         // Restore terminal settings if they were validly saved
         if (log)
             log->Printf ("ScriptInterpreterPython::InputReaderCallback, Done, closing down input reader.");
+#if LLDB_CONFIG_TERMIOS_SUPPORTED
         if (script_interpreter->m_termios_valid)
         {
             int input_fd;
@@ -685,6 +690,7 @@
             
             ::tcsetattr (input_fd, TCSANOW, &script_interpreter->m_termios);
         }
+#endif // #if LLDB_CONFIG_TERMIOS_SUPPORTED
         script_interpreter->m_embedded_python_pty.CloseMasterFileDescriptor();
         break;
     }
@@ -1433,8 +1439,10 @@
 
     int input_fd = STDIN_FILENO;
 
+#if LLDB_CONFIG_TERMIOS_SUPPORTED
     struct termios stdin_termios;
     bool valid_termios = ::tcgetattr (input_fd, &stdin_termios) == 0;
+#endif // #if LLDB_CONFIG_TERMIOS_SUPPORTED
 
     // Find the module that owns this code and use that path we get to
     // set the PYTHONPATH appropriately.
@@ -1511,9 +1519,11 @@
         PyRun_SimpleString ("from termios import *");
         Py_DECREF (pmod);
     }
-    
+
+#if LLDB_CONFIG_TERMIOS_SUPPORTED
     if (valid_termios)
         ::tcsetattr (input_fd, TCSANOW, &stdin_termios);
+#endif // #if LLDB_CONFIG_TERMIOS_SUPPORTED
 }
 
 void





More information about the lldb-commits mailing list