Disable GetSTDOUT, GetSTDERR, and PutSTDIN on Windows.
authorZachary Turner <zturner@google.com>
Tue, 25 Nov 2014 19:03:08 +0000 (19:03 +0000)
committerZachary Turner <zturner@google.com>
Tue, 25 Nov 2014 19:03:08 +0000 (19:03 +0000)
These methods are difficult / impossible to implement in a way
that is semantically equivalent to the expectations set by LLDB
for using them.  In the future, we should find an alternative
strategy (for example, i/o redirection) for achieving similar
functionality, and hopefully deprecate these APIs someday.

llvm-svn: 222775

lldb/source/Plugins/Process/Windows/ProcessWindows.cpp
lldb/source/Plugins/Process/Windows/ProcessWindows.h
lldb/test/lang/cpp/virtual/TestVirtual.py
lldb/test/python_api/process/io/TestProcessIO.py

index 3522a95..c55aa71 100644 (file)
@@ -121,6 +121,26 @@ ProcessWindows::GetPluginDescriptionStatic()
     return "Process plugin for Windows";
 }
 
+size_t
+ProcessWindows::GetSTDOUT(char *buf, size_t buf_size, Error &error)
+{
+    error.SetErrorString("GetSTDOUT unsupported on Windows");
+    return 0;
+}
+
+size_t
+ProcessWindows::GetSTDERR(char *buf, size_t buf_size, Error &error)
+{
+    error.SetErrorString("GetSTDERR unsupported on Windows");
+    return 0;
+}
+
+size_t
+ProcessWindows::PutSTDIN(const char *buf, size_t buf_size, Error &error)
+{
+    error.SetErrorString("PutSTDIN unsupported on Windows");
+    return 0;
+}
 
 bool
 ProcessWindows::UpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list)
index 8e529ab..e482f9f 100644 (file)
@@ -63,58 +63,50 @@ public:
 
     ~ProcessWindows();
 
-    virtual lldb_private::Error DoDetach(bool keep_stopped) override;
+    // lldb_private::Process overrides
+    lldb_private::ConstString GetPluginName() override;
+    uint32_t GetPluginVersion() override;
 
-    virtual bool
+    size_t GetSTDOUT(char *buf, size_t buf_size, lldb_private::Error &error) override;
+    size_t GetSTDERR(char *buf, size_t buf_size, lldb_private::Error &error) override;
+    size_t PutSTDIN(const char *buf, size_t buf_size, lldb_private::Error &error) override;
+
+    lldb_private::Error DoDetach(bool keep_stopped) override;
+    lldb_private::Error DoLaunch(lldb_private::Module *exe_module, lldb_private::ProcessLaunchInfo &launch_info) override;
+    lldb_private::Error DoResume() override;
+    lldb_private::Error DoDestroy() override;
+    lldb_private::Error DoHalt(bool &caused_stop) override;
+
+    void RefreshStateAfterStop() override;
+    lldb::addr_t GetImageInfoAddress() override;
+
+    bool CanDebug(lldb_private::Target &target, bool plugin_specified_by_name) override;
+    bool
     DetachRequiresHalt() override
     {
         return true;
     }
-
-    virtual bool UpdateThreadList(lldb_private::ThreadList &old_thread_list, lldb_private::ThreadList &new_thread_list) override;
-
-    virtual lldb_private::Error DoLaunch(lldb_private::Module *exe_module, lldb_private::ProcessLaunchInfo &launch_info) override;
-
-    virtual lldb_private::Error DoResume() override;
-
-    //------------------------------------------------------------------
-    // PluginInterface protocol
-    //------------------------------------------------------------------
-    virtual lldb_private::ConstString GetPluginName() override;
-
-    virtual uint32_t GetPluginVersion() override;
-
-    virtual bool CanDebug(lldb_private::Target &target, bool plugin_specified_by_name) override;
-
-    virtual lldb_private::Error DoDestroy() override;
-
-    virtual bool
+    bool
     DestroyRequiresHalt() override
     {
         return false;
     }
+    bool UpdateThreadList(lldb_private::ThreadList &old_thread_list, lldb_private::ThreadList &new_thread_list) override;
+    bool IsAlive() override;
 
-    virtual void RefreshStateAfterStop() override;
-
-    virtual bool IsAlive() override;
-
-    virtual lldb_private::Error DoHalt(bool &caused_stop) override;
-
-    virtual lldb::addr_t GetImageInfoAddress() override;
-
-    virtual size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, lldb_private::Error &error) override;
-    virtual size_t DoWriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size, lldb_private::Error &error) override;
+    size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, lldb_private::Error &error) override;
+    size_t DoWriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size, lldb_private::Error &error) override;
 
     // IDebugDelegate overrides.
-    virtual void OnExitProcess(uint32_t exit_code) override;
-    virtual void OnDebuggerConnected(lldb::addr_t image_base) override;
-    virtual ExceptionResult OnDebugException(bool first_chance, const lldb_private::ExceptionRecord &record) override;
-    virtual void OnCreateThread(const lldb_private::HostThread &thread) override;
-    virtual void OnExitThread(const lldb_private::HostThread &thread) override;
-    virtual void OnLoadDll(const lldb_private::ModuleSpec &module_spec, lldb::addr_t module_addr) override;
-    virtual void OnUnloadDll(lldb::addr_t module_addr) override;
-    virtual void OnDebugString(const std::string &string) override;
-    virtual void OnDebuggerError(const lldb_private::Error &error, uint32_t type) override;
+    void OnExitProcess(uint32_t exit_code) override;
+    void OnDebuggerConnected(lldb::addr_t image_base) override;
+    ExceptionResult OnDebugException(bool first_chance, const lldb_private::ExceptionRecord &record) override;
+    void OnCreateThread(const lldb_private::HostThread &thread) override;
+    void OnExitThread(const lldb_private::HostThread &thread) override;
+    void OnLoadDll(const lldb_private::ModuleSpec &module_spec, lldb::addr_t module_addr) override;
+    void OnUnloadDll(lldb::addr_t module_addr) override;
+    void OnDebugString(const std::string &string) override;
+    void OnDebuggerError(const lldb_private::Error &error, uint32_t type) override;
 
   private:
     // Data for the active debugging session.
index fd60da6..e2c09cd 100644 (file)
@@ -22,6 +22,7 @@ class CppVirtualMadness(TestBase):
     # Assert message.
     PRINTF_OUTPUT_GROKKED = "The printf output from compiled code is parsed correctly"
 
+    @unittest2.skipIf(sys.platform.startswith("win32"), "Process::GetSTDOUT unsupported on Windows.  This test should be re-written to use stdout re-direction")
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     def test_virtual_madness_dsym(self):
         """Test that expression works correctly with virtual inheritance as well as virtual function."""
index f363dbf..583e8b2 100644 (file)
@@ -10,7 +10,7 @@ class ProcessIOTestCase(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
 
-    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "dsym requires Darwin")
     @python_api_test
     @dsym_test
     def test_stdin_by_api_with_dsym(self):
@@ -18,6 +18,7 @@ class ProcessIOTestCase(TestBase):
         self.buildDsym()
         self.do_stdin_by_api()
 
+    @unittest2.skipIf(sys.platform.startswith("win32"), "stdio manipulation unsupported on Windows")
     @python_api_test
     @dwarf_test
     def test_stdin_by_api_with_dwarf(self):
@@ -25,7 +26,7 @@ class ProcessIOTestCase(TestBase):
         self.buildDwarf()
         self.do_stdin_by_api()
 
-    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "dsym requires Darwin")
     @python_api_test
     @dsym_test
     def test_stdin_redirection_with_dsym(self):
@@ -33,6 +34,7 @@ class ProcessIOTestCase(TestBase):
         self.buildDsym()
         self.do_stdin_redirection()
 
+    @unittest2.skipIf(sys.platform.startswith("win32"), "stdio manipulation unsupported on Windows")
     @python_api_test
     @dwarf_test
     def test_stdin_redirection_with_dwarf(self):
@@ -40,7 +42,7 @@ class ProcessIOTestCase(TestBase):
         self.buildDwarf()
         self.do_stdin_redirection()
 
-    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "dsym requires Darwin")
     @python_api_test
     @dsym_test
     def test_stdout_redirection_with_dsym(self):
@@ -48,6 +50,7 @@ class ProcessIOTestCase(TestBase):
         self.buildDsym()
         self.do_stdout_redirection()
 
+    @unittest2.skipIf(sys.platform.startswith("win32"), "stdio manipulation unsupported on Windows")
     @python_api_test
     @dwarf_test
     def test_stdout_redirection_with_dwarf(self):
@@ -55,7 +58,7 @@ class ProcessIOTestCase(TestBase):
         self.buildDwarf()
         self.do_stdout_redirection()
 
-    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "dsym requires Darwin")
     @python_api_test
     @dsym_test
     def test_stderr_redirection_with_dsym(self):
@@ -63,6 +66,7 @@ class ProcessIOTestCase(TestBase):
         self.buildDsym()
         self.do_stderr_redirection()
 
+    @unittest2.skipIf(sys.platform.startswith("win32"), "stdio manipulation unsupported on Windows")
     @python_api_test
     @dwarf_test
     def test_stderr_redirection_with_dwarf(self):
@@ -70,7 +74,7 @@ class ProcessIOTestCase(TestBase):
         self.buildDwarf()
         self.do_stderr_redirection()
 
-    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "dsym requires Darwin")
     @python_api_test
     @dsym_test
     def test_stdout_stderr_redirection_with_dsym(self):
@@ -78,6 +82,7 @@ class ProcessIOTestCase(TestBase):
         self.buildDsym()
         self.do_stdout_stderr_redirection()
 
+    # This one actually should work on Windows, since it doesn't call GetSTDOUT, GetSTDERR, or PutSTDIN.
     @python_api_test
     @dwarf_test
     def test_stdout_stderr_redirection_with_dwarf(self):