The Windows build was broken on this branch, but with a little work I was able to fix that.

The included patch should remedy things (builds against revision 198602).

Also these two files need to be moved and renamed:
- "tools/driver/ELWrapper.cpp" should be moved and renamed to "source/host/windows/EditLineWin.cpp" - "tools/driver/ELWrapper.h" should be moved and renamed to "include/host/windows/editlinewin.h"

Also I am a little worried about the use of unix named pipes in GDBRemoteCommunication.cpp and Process.cpp, since this isn't portable to windows.
What are these pipes for?
Is it something that can be harmlessly disabled on windows?

Overall this looks like a nice branch for LLDB and seems to clean a lot of things up.

Thanks,
Aidan Dodds

On 02/01/2014 22:56, Greg Clayton wrote:
svn co https://[email protected]/svn/llvm-project/lldb/branches/iohandler

The first step is to get it building for your platform as I am sure the 
Makefiles are out of date.

This branch will soon be merged back into top of tree, but I wanted to give all 
the major platforms time to submit patches against this to get things working 
on all systems before any buildbots get broken.

The major benefits include:
- editline is not built into the lldb shared library so all IOHandler objects 
can use the editline functionality.
- autocomplete now working in the embedded python interpreter
- history now working in the embedded python interpreter
- autocomplete now working for multi-line command entering (like in "breakpoint 
command add")
- when editing multiple lines you can use the UP and DOWN arrow keys to edit 
previous lines. This makes multi-line expressions and commands much easier to 
write and edit. Use ^B and ^N for next/prev history when in multi-line mode.
- curses is now supported with the new IOHandler infrastructure. To try this out, run and 
hit a breakpoint, and type "gui" on the command line to drop into the curses 
GUI mode! Lots of stuff isn't hooked up yet, but I am sure the open source community can 
help fill in some new views and improve existing ones.

So please get this building and test this on your system and let us know what 
issues you run into.

Greg Clayton

_______________________________________________
lldb-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev


Index: include/lldb/Core/IOHandler.h
===================================================================
--- include/lldb/Core/IOHandler.h       (revision 198602)
+++ include/lldb/Core/IOHandler.h       (working copy)
@@ -21,11 +21,13 @@
 #include "lldb/Core/ValueObjectList.h"
 #include "lldb/Host/Mutex.h"
 
+#ifdef LLDB_USE_CURSES
 namespace curses
 {
     class Application;
     typedef std::unique_ptr<Application> ApplicationAP;
 }
+#endif // LLDB_USE_CURSES
 
 namespace lldb_private {
 
@@ -418,6 +420,8 @@
         bool m_user_response;
     };
 
+#ifdef LLDB_USE_CURSES
+
     class IOHandlerCursesGUI :
         public IOHandler
     {
@@ -479,6 +483,8 @@
         ValueObjectList m_valobj_list;
     };
 
+#endif // LLDB_USE_CURSES
+
     class IOHandlerStack
     {
     public:
Index: include/lldb/Host/Editline.h
===================================================================
--- include/lldb/Host/Editline.h        (revision 198602)
+++ include/lldb/Host/Editline.h        (working copy)
@@ -15,7 +15,7 @@
 
 #include <stdio.h>
 #ifdef _WIN32
-#include "ELWrapper.h"
+#include "lldb/Host/windows/editlinewin.h"
 #else
 #include <histedit.h>
 #endif
Index: source/Commands/CommandObjectGUI.cpp
===================================================================
--- source/Commands/CommandObjectGUI.cpp        (revision 198602)
+++ source/Commands/CommandObjectGUI.cpp        (working copy)
@@ -38,6 +38,7 @@
 bool
 CommandObjectGUI::DoExecute (Args& args, CommandReturnObject &result)
 {
+#ifdef LLDB_USE_CURSES
     if (args.GetArgumentCount() == 0)
     {
         Debugger &debugger = m_interpreter.GetDebugger();
@@ -52,5 +53,10 @@
         result.SetStatus (eReturnStatusFailed);
     }
     return true;
+#else
+       result.AppendError("GUI is not supported on windows.");
+       result.SetStatus(eReturnStatusFailed);
+       return false;
+#endif
 }
 
Index: source/Commands/CommandObjectType.cpp
===================================================================
--- source/Commands/CommandObjectType.cpp       (revision 198602)
+++ source/Commands/CommandObjectType.cpp       (working copy)
@@ -195,6 +195,7 @@
     {
         StreamFileSP error_sp = io_handler.GetErrorStreamFile();
         
+#ifndef LLDB_DISABLE_PYTHON
         ScriptInterpreter *interpreter = m_interpreter.GetScriptInterpreter();
         if (interpreter)
         {
@@ -310,6 +311,7 @@
             error_sp->Flush();
         }
         
+#endif // LLDB_DISABLE_PYTHON
         io_handler.SetIsDone(true);
     }
     
@@ -482,6 +484,7 @@
     {
         StreamFileSP error_sp = io_handler.GetErrorStreamFile();
         
+#ifndef LLDB_DISABLE_PYTHON
         ScriptInterpreter *interpreter = m_interpreter.GetScriptInterpreter();
         if (interpreter)
         {
@@ -577,6 +580,7 @@
             error_sp->Flush();
         }
         
+#endif // LLDB_DISABLE_PYTHON
         io_handler.SetIsDone(true);
         
         
Index: source/Core/ConnectionFileDescriptor.cpp
===================================================================
--- source/Core/ConnectionFileDescriptor.cpp    (revision 198602)
+++ source/Core/ConnectionFileDescriptor.cpp    (working copy)
@@ -38,6 +38,9 @@
 #include "lldb/Host/windows/windows.h"
 #include <winsock2.h>
 #include <WS2tcpip.h>
+#else
+// for PATH_MAX
+#include <linux/limits.h>
 #endif
 
 // C++ Includes
@@ -1380,7 +1383,7 @@
         {
             struct sockaddr_in accept_addr;
             ::memset (&accept_addr, 0, sizeof accept_addr);
-#ifndef __linux__
+#if (!defined __linux__) && (! defined _MSC_VER)
             accept_addr.sin_len = sizeof accept_addr;
 #endif
             socklen_t accept_addr_len = sizeof accept_addr;
@@ -1402,7 +1405,7 @@
             else
             {
                 if (
-#ifndef __linux__
+#if (!defined __linux__) && (!defined _MSC_VER)
                     accept_addr_len == listen_addr.sockaddr_in().sin_len &&
 #endif
                     accept_addr.sin_addr.s_addr == 
listen_addr.sockaddr_in().sin_addr.s_addr)
Index: source/Core/IOHandler.cpp
===================================================================
--- source/Core/IOHandler.cpp   (revision 198602)
+++ source/Core/IOHandler.cpp   (working copy)
@@ -11,9 +11,12 @@
 #include "lldb/lldb-python.h"
 
 #include <stdio.h>     /* ioctl, TIOCGWINSZ */
+
+#ifndef _MSC_VER
 #include <sys/ioctl.h> /* ioctl, TIOCGWINSZ */
 
 
+#endif
 #include <string>
 
 #include "lldb/Breakpoint/BreakpointLocation.h"
@@ -32,7 +35,9 @@
 
 
 
+#ifndef _MSC_VER
 #include <ncurses.h>
+#endif
 
 using namespace lldb;
 using namespace lldb_private;
@@ -484,6 +489,8 @@
         m_editline_ap->Interrupt();
 }
 
+#ifdef LLDB_USE_CURSES
+
 #include "lldb/Core/ValueObject.h"
 #include "lldb/Symbol/VariableList.h"
 #include "lldb/Target/Target.h"
@@ -3427,3 +3434,4 @@
 {
 }
 
+#endif // LLDB_USE_CURSES
\ No newline at end of file
Index: source/Host/common/Editline.cpp
===================================================================
--- source/Host/common/Editline.cpp     (revision 198602)
+++ source/Host/common/Editline.cpp     (working copy)
@@ -15,6 +15,11 @@
 #include "lldb/Core/StringList.h"
 #include "lldb/Host/Host.h"
 
+// for PATH_MAX
+#ifndef _MSC_VER
+#include <linux/limits.h>
+#endif
+
 using namespace lldb;
 using namespace lldb_private;
 
Index: source/Host/common/Host.cpp
===================================================================
--- source/Host/common/Host.cpp (revision 198602)
+++ source/Host/common/Host.cpp (working copy)
@@ -13,12 +13,12 @@
 #include <errno.h>
 #include <limits.h>
 #include <sys/types.h>
-#include <unistd.h>
 #ifdef _WIN32
 #include "lldb/Host/windows/windows.h"
 #include <winsock2.h>
 #include <WS2tcpip.h>
 #else
+#include <unistd.h>
 #include <dlfcn.h>
 #include <grp.h>
 #include <netdb.h>
Index: source/Host/windows/CMakeLists.txt
===================================================================
--- source/Host/windows/CMakeLists.txt  (revision 198602)
+++ source/Host/windows/CMakeLists.txt  (working copy)
@@ -6,4 +6,5 @@
   Mutex.cpp
   Condition.cpp
   Windows.cpp
+  EditLineWin.cpp
   )
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
===================================================================
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp        
(revision 198602)
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp        
(working copy)
@@ -679,7 +679,13 @@
 
             if (::mktemp (named_pipe_path))
             {
+#ifdef _MSC_VER
+                               // bypass mkfifo since it doesnt exist on 
windows
+                               // real fix needed here.
+                               if ( false )
+#else
                 if (::mkfifo(named_pipe_path, 0600) == 0)
+#endif
                 {
                     debugserver_args.AppendArgument("--named-pipe");
                     debugserver_args.AppendArgument(named_pipe_path);
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
===================================================================
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp  
(revision 198602)
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp  
(working copy)
@@ -807,7 +807,9 @@
 {
 #ifdef _WIN32
     // No unix sockets on windows
-    return false;
+    // return success here because that is 0 which is closest to return false
+    // which was here previously. needs someone else to advise.
+    return GDBRemoteCommunication::PacketResult::Success;
 #else
     // Spawn a local debugserver as a platform so we can then attach or launch
     // a process...
Index: source/Target/Process.cpp
===================================================================
--- source/Target/Process.cpp   (revision 198602)
+++ source/Target/Process.cpp   (working copy)
@@ -43,6 +43,14 @@
 #include "lldb/Target/ThreadPlan.h"
 #include "lldb/Target/ThreadPlanBase.h"
 
+#ifdef _MSC_VER
+// needed for fd_set, read_fdset
+#include <WinSock2.h>
+// We now have a name clash with the following
+#undef GetUserName
+#undef LoadImage
+#endif
+
 #ifndef LLDB_DISABLE_POSIX
 #include <spawn.h>
 #endif
@@ -4709,7 +4717,11 @@
             return true;
 
         int fds[2];
-        int err = pipe(fds);
+#ifdef _MSC_VER
+               int err = NULL;
+#else
+               int err = pipe(fds);
+#endif
         if (err == 0)
         {
             m_pipe_read.SetDescriptor(fds[0], true);
Index: tools/driver/CMakeLists.txt
===================================================================
--- tools/driver/CMakeLists.txt (revision 198602)
+++ tools/driver/CMakeLists.txt (working copy)
@@ -1,10 +1,6 @@
 set(LLVM_NO_RTTI 1)
 add_lldb_executable(lldb
   Driver.cpp
-  #DriverEvents.cpp
-  #DriverOptions.cpp
-  #DriverPosix.cpp
-  ELWrapper.cpp
   Platform.cpp
   GetOptWrapper.cpp
   )
_______________________________________________
lldb-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev

Reply via email to