This creates a valid Python API for Windows, pending some issues. The changes included are -
 - Ported the SWIG wrapper shell scripts to Python so that they would work on Windows too along with other platforms
 - Updated CMake handling to fix SWIG errors and manage sym-linking on Windows to liblldb.dll
 - More build fixes for Windows
The pending issues are that two Python modules, termios and pexpect are not available on Windows.
These are currently required for the Python command interpreter to be used from within LLDB.
llvm-svn: 212111
diff --git a/lldb/source/CMakeLists.txt b/lldb/source/CMakeLists.txt
index d5241be..b130641 100644
--- a/lldb/source/CMakeLists.txt
+++ b/lldb/source/CMakeLists.txt
@@ -327,6 +327,15 @@
 # FIXME: implement svn/git revision and repository parsing solution on Windows. There is an SVN-only
 #        revision parsing solution in tools/clang/lib/Basic/CMakelists.txt.
 
+if ( LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION )
+	# Add a Post-Build Event to copy over Python files and create the symlink to liblldb.so for the Python API(hardlink on Windows)
+	if ( NOT LLDB_DISABLE_PYTHON )
+	add_custom_command( TARGET liblldb
+	    POST_BUILD
+	    COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/finishSwigWrapperClasses.py "--srcRoot=${LLDB_SOURCE_DIR}" "--targetDir=${CMAKE_CURRENT_BINARY_DIR}" "--cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}" "--prefix=${CMAKE_BINARY_DIR}" "--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}" -m
+	    COMMENT "Python script sym-linking LLDB Python API")
+	endif ()
+endif ()
 
 install(TARGETS liblldb
   RUNTIME DESTINATION bin
diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
index f7e9309e..ef0d71b 100644
--- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp
+++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
@@ -589,7 +589,12 @@
                 input_file_sp = debugger.GetInputFile();
                 // Set output to a temporary file so we can forward the results on to the result object
                 
+#ifdef _MSC_VER
+                // pipe is not supported on windows so default to a fail condition
+                int err = 1;
+#else
                 int err = pipe(pipe_fds);
+#endif
                 if (err == 0)
                 {
                     std::unique_ptr<ConnectionFileDescriptor> conn_ap(new ConnectionFileDescriptor(pipe_fds[0], true));
diff --git a/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp b/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
index 35e8292..3507ccf 100644
--- a/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
+++ b/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
@@ -115,7 +115,7 @@
                 RegisterInfo reg_info;
                 std::vector<uint32_t> value_regs;
                 std::vector<uint32_t> invalidate_regs;
-                bzero (®_info, sizeof(reg_info));
+                memset(®_info, 0, sizeof(reg_info));
                 
                 reg_info.name = ConstString (reg_info_dict.GetItemForKeyAsString(name_pystr)).GetCString();
                 if (reg_info.name == NULL)
diff --git a/lldb/source/Utility/PseudoTerminal.cpp b/lldb/source/Utility/PseudoTerminal.cpp
index ccf650c..8eb022b 100644
--- a/lldb/source/Utility/PseudoTerminal.cpp
+++ b/lldb/source/Utility/PseudoTerminal.cpp
@@ -19,6 +19,7 @@
 
 #ifdef _WIN32
 #include "lldb/Host/windows/win32.h"
+typedef uint32_t pid_t;
 // empty functions
 int posix_openpt(int flag) { return 0; }