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

Greg Clayton gclayton at apple.com
Mon Feb 7 11:22:32 PST 2011


Author: gclayton
Date: Mon Feb  7 13:22:32 2011
New Revision: 125027

URL: http://llvm.org/viewvc/llvm-project?rev=125027&view=rev
Log:
More termios fixes. We need to currently make sure to include:

#include "lldb/Host/Config.h"

Or the LLDB_CONFIG_TERMIOS_SUPPORTED defined won't be set. I will fix all
of this Termios stuff later today by moving lldb/Core/TTYState.* into the 
host layer and then we conditionalize all of this inside TTYState.cpp and
then we get rid of LLDB_CONFIG_TERMIOS_SUPPORTED all together.

Typically, when we start to see too many "#if LLDB_CONFIG_XXXX" preprocessor
directives, this is a good indicator that something needs to be moved over to
the host layer. TTYState can be modified to do all of the things that many
areas of the code are currently doing, and it will avoid all of the 
preprocessor noise.


Modified:
    lldb/trunk/include/lldb/Core/TTYState.h
    lldb/trunk/include/lldb/Host/Config.h
    lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h
    lldb/trunk/source/Core/Debugger.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=125027&r1=125026&r2=125027&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/TTYState.h (original)
+++ lldb/trunk/include/lldb/Core/TTYState.h Mon Feb  7 13:22:32 2011
@@ -11,6 +11,8 @@
 #define liblldb_TTYState_h_
 #if defined(__cplusplus)
 
+#include "lldb/Host/Config.h"
+
 #if LLDB_CONFIG_TERMIOS_SUPPORTED
 #include <termios.h>
 #endif // #if LLDB_CONFIG_TERMIOS_SUPPORTED

Modified: lldb/trunk/include/lldb/Host/Config.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Config.h?rev=125027&r1=125026&r2=125027&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Config.h (original)
+++ lldb/trunk/include/lldb/Host/Config.h Mon Feb  7 13:22:32 2011
@@ -32,4 +32,4 @@
 
 #endif
 
-#endif // #ifndef liblldb_Config_h_
\ No newline at end of file
+#endif // #ifndef liblldb_Config_h_

Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h?rev=125027&r1=125026&r2=125027&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h (original)
+++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h Mon Feb  7 13:22:32 2011
@@ -17,7 +17,11 @@
 #include <Python.h>
 #endif
 
+#include "lldb/Host/Config.h"
+
+#if LLDB_CONFIG_TERMIOS_SUPPORTED
 #include <termios.h>
+#endif
 
 #include "lldb/lldb-private.h"
 #include "lldb/Interpreter/ScriptInterpreter.h"
@@ -113,8 +117,10 @@
     FILE *m_dbg_stdout;
     PyObject *m_new_sysout;
     std::string m_dictionary_name;
+#if LLDB_CONFIG_TERMIOS_SUPPORTED
     struct termios m_termios;
     bool m_termios_valid;
+#endif // #if LLDB_CONFIG_TERMIOS_SUPPORTED
     bool m_session_is_active;
     bool m_pty_slave_is_open;
     bool m_valid_session;

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=125027&r1=125026&r2=125027&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Mon Feb  7 13:22:32 2011
@@ -14,6 +14,7 @@
 #include "lldb/Core/State.h"
 #include "lldb/Core/StreamString.h"
 #include "lldb/Core/Timer.h"
+#include "lldb/Host/Config.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Target/TargetList.h"
 #include "lldb/Target/Process.h"
@@ -554,7 +555,7 @@
 
     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)
         {    

Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=125027&r1=125026&r2=125027&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Mon Feb  7 13:22:32 2011
@@ -203,8 +203,8 @@
     m_dictionary_name (interpreter.GetDebugger().GetInstanceName().AsCString()),
 #if LLDB_CONFIG_TERMIOS_SUPPORTED
     m_termios (),
-#endif // #if LLDB_CONFIG_TERMIOS_SUPPORTED
     m_termios_valid (false),
+#endif // #if LLDB_CONFIG_TERMIOS_SUPPORTED
     m_session_is_active (false),
     m_pty_slave_is_open (false),
     m_valid_session (true)
@@ -1434,12 +1434,10 @@
 void
 ScriptInterpreterPython::Initialize ()
 {
-
     Timer scoped_timer (__PRETTY_FUNCTION__, __PRETTY_FUNCTION__);
 
-    int input_fd = STDIN_FILENO;
-
 #if LLDB_CONFIG_TERMIOS_SUPPORTED
+    int input_fd = STDIN_FILENO;
     struct termios stdin_termios;
     bool valid_termios = ::tcgetattr (input_fd, &stdin_termios) == 0;
 #endif // #if LLDB_CONFIG_TERMIOS_SUPPORTED





More information about the lldb-commits mailing list