[Lldb-commits] [lldb] r222775 - Disable GetSTDOUT, GetSTDERR, and PutSTDIN on Windows.

Zachary Turner zturner at google.com
Tue Nov 25 11:03:08 PST 2014


Author: zturner
Date: Tue Nov 25 13:03:08 2014
New Revision: 222775

URL: http://llvm.org/viewvc/llvm-project?rev=222775&view=rev
Log:
Disable GetSTDOUT, GetSTDERR, and PutSTDIN on Windows.

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.

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

Modified: lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp?rev=222775&r1=222774&r2=222775&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp Tue Nov 25 13:03:08 2014
@@ -121,6 +121,26 @@ ProcessWindows::GetPluginDescriptionStat
     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)

Modified: lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.h?rev=222775&r1=222774&r2=222775&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.h (original)
+++ lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.h Tue Nov 25 13:03:08 2014
@@ -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;
+
+    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;
 
-    virtual bool
+    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.

Modified: lldb/trunk/test/lang/cpp/virtual/TestVirtual.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/virtual/TestVirtual.py?rev=222775&r1=222774&r2=222775&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/virtual/TestVirtual.py (original)
+++ lldb/trunk/test/lang/cpp/virtual/TestVirtual.py Tue Nov 25 13:03:08 2014
@@ -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."""

Modified: lldb/trunk/test/python_api/process/io/TestProcessIO.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/process/io/TestProcessIO.py?rev=222775&r1=222774&r2=222775&view=diff
==============================================================================
--- lldb/trunk/test/python_api/process/io/TestProcessIO.py (original)
+++ lldb/trunk/test/python_api/process/io/TestProcessIO.py Tue Nov 25 13:03:08 2014
@@ -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):





More information about the lldb-commits mailing list