[Lldb-commits] [lldb] r320346 - Move PseudoTerminal to the lldb_private namespace

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Dec 11 02:09:14 PST 2017


Author: labath
Date: Mon Dec 11 02:09:14 2017
New Revision: 320346

URL: http://llvm.org/viewvc/llvm-project?rev=320346&view=rev
Log:
Move PseudoTerminal to the lldb_private namespace

lldb_utility doesn't make sense, as it is no longer even living in the
"utility" module.

Modified:
    lldb/trunk/include/lldb/Host/PseudoTerminal.h
    lldb/trunk/include/lldb/Target/ProcessLaunchInfo.h
    lldb/trunk/source/Host/common/PseudoTerminal.cpp
    lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
    lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
    lldb/trunk/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp
    lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    lldb/trunk/source/Target/Platform.cpp
    lldb/trunk/source/Target/ProcessLaunchInfo.cpp
    lldb/trunk/unittests/Editline/EditlineTest.cpp
    lldb/trunk/unittests/Host/MainLoopTest.cpp

Modified: lldb/trunk/include/lldb/Host/PseudoTerminal.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/PseudoTerminal.h?rev=320346&r1=320345&r2=320346&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/PseudoTerminal.h (original)
+++ lldb/trunk/include/lldb/Host/PseudoTerminal.h Mon Dec 11 02:09:14 2017
@@ -9,14 +9,13 @@
 
 #ifndef LLDB_HOST_PSEUDOTERMINAL_H
 #define LLDB_HOST_PSEUDOTERMINAL_H
-#if defined(__cplusplus)
 
 #include <fcntl.h>
 #include <string>
 
 #include "lldb/lldb-defines.h"
 
-namespace lldb_utility {
+namespace lldb_private {
 
 //----------------------------------------------------------------------
 /// @class PseudoTerminal PseudoTerminal.h "lldb/Host/PseudoTerminal.h"
@@ -246,7 +245,6 @@ private:
   DISALLOW_COPY_AND_ASSIGN(PseudoTerminal);
 };
 
-} // namespace lldb_utility
+} // namespace lldb_private
 
-#endif // #if defined(__cplusplus)
 #endif // #ifndef liblldb_PseudoTerminal_h_

Modified: lldb/trunk/include/lldb/Target/ProcessLaunchInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ProcessLaunchInfo.h?rev=320346&r1=320345&r2=320346&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ProcessLaunchInfo.h (original)
+++ lldb/trunk/include/lldb/Target/ProcessLaunchInfo.h Mon Dec 11 02:09:14 2017
@@ -117,7 +117,7 @@ public:
 
   bool MonitorProcess() const;
 
-  lldb_utility::PseudoTerminal &GetPTY() { return *m_pty; }
+  PseudoTerminal &GetPTY() { return *m_pty; }
 
   // Get and set the actual listener that will be used for the process events
   lldb::ListenerSP GetListener() const { return m_listener_sp; }
@@ -150,7 +150,7 @@ protected:
   FileSpec m_shell;
   Flags m_flags; // Bitwise OR of bits from lldb::LaunchFlags
   std::vector<FileAction> m_file_actions; // File actions for any other files
-  std::shared_ptr<lldb_utility::PseudoTerminal> m_pty;
+  std::shared_ptr<PseudoTerminal> m_pty;
   uint32_t m_resume_count; // How many times do we resume after launching
   Host::MonitorChildProcessCallback m_monitor_callback;
   void *m_monitor_callback_baton;

Modified: lldb/trunk/source/Host/common/PseudoTerminal.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/PseudoTerminal.cpp?rev=320346&r1=320345&r2=320346&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/PseudoTerminal.cpp (original)
+++ lldb/trunk/source/Host/common/PseudoTerminal.cpp Mon Dec 11 02:09:14 2017
@@ -24,7 +24,7 @@
 int posix_openpt(int flags);
 #endif
 
-using namespace lldb_utility;
+using namespace lldb_private;
 
 //----------------------------------------------------------------------
 // PseudoTerminal constructor

Modified: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp?rev=320346&r1=320345&r2=320346&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp Mon Dec 11 02:09:14 2017
@@ -372,7 +372,7 @@ PlatformLinux::DebugProcess(ProcessLaunc
     // Hook up process PTY if we have one (which we should for local debugging
     // with llgs).
     int pty_fd = launch_info.GetPTY().ReleaseMasterFileDescriptor();
-    if (pty_fd != lldb_utility::PseudoTerminal::invalid_fd) {
+    if (pty_fd != PseudoTerminal::invalid_fd) {
       process_sp->SetSTDIOFileDescriptor(pty_fd);
       LLDB_LOG(log, "hooked up STDIO pty to process");
     } else

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp?rev=320346&r1=320345&r2=320346&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp Mon Dec 11 02:09:14 2017
@@ -206,7 +206,7 @@ lldb::ProcessSP PlatformAppleSimulator::
         // open for stdin/out/err after we have already opened the master
         // so we can read/write stdin/out/err.
         int pty_fd = launch_info.GetPTY().ReleaseMasterFileDescriptor();
-        if (pty_fd != lldb_utility::PseudoTerminal::invalid_fd) {
+        if (pty_fd != PseudoTerminal::invalid_fd) {
           process_sp->SetSTDIOFileDescriptor(pty_fd);
         }
       }

Modified: lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp?rev=320346&r1=320345&r2=320346&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp Mon Dec 11 02:09:14 2017
@@ -393,7 +393,7 @@ lldb::ProcessSP PlatformNetBSD::DebugPro
     // Hook up process PTY if we have one (which we should for local debugging
     // with llgs).
     int pty_fd = launch_info.GetPTY().ReleaseMasterFileDescriptor();
-    if (pty_fd != lldb_utility::PseudoTerminal::invalid_fd) {
+    if (pty_fd != PseudoTerminal::invalid_fd) {
       process_sp->SetSTDIOFileDescriptor(pty_fd);
       if (log)
         log->Printf("PlatformNetBSD::%s pid %" PRIu64

Modified: lldb/trunk/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp?rev=320346&r1=320345&r2=320346&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp Mon Dec 11 02:09:14 2017
@@ -144,7 +144,7 @@ static Status ForkChildForPTraceDebuggin
   // Use a fork that ties the child process's stdin/out/err to a pseudo
   // terminal so we can read it in our MachProcess::STDIOThread
   // as unbuffered io.
-  lldb_utility::PseudoTerminal pty;
+  PseudoTerminal pty;
   char fork_error[256];
   memset(fork_error, 0, sizeof(fork_error));
   *pid = static_cast<::pid_t>(pty.Fork(fork_error, sizeof(fork_error)));

Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp?rev=320346&r1=320345&r2=320346&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp Mon Dec 11 02:09:14 2017
@@ -843,7 +843,7 @@ bool ProcessMonitor::Launch(LaunchArgs *
   const FileSpec &stderr_file_spec = args->m_stderr_file_spec;
   const FileSpec &working_dir = args->m_working_dir;
 
-  lldb_utility::PseudoTerminal terminal;
+  PseudoTerminal terminal;
   const size_t err_len = 1024;
   char err_str[err_len];
   ::pid_t pid;

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=320346&r1=320345&r2=320346&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Mon Dec 11 02:09:14 2017
@@ -817,7 +817,7 @@ Status ProcessGDBRemote::DoLaunch(Module
   if (object_file) {
     error = EstablishConnectionIfNeeded(launch_info);
     if (error.Success()) {
-      lldb_utility::PseudoTerminal pty;
+      PseudoTerminal pty;
       const bool disable_stdio = (launch_flags & eLaunchFlagDisableSTDIO) != 0;
 
       PlatformSP platform_sp(GetTarget().GetPlatform());
@@ -946,8 +946,7 @@ Status ProcessGDBRemote::DoLaunch(Module
         SetPrivateState(SetThreadStopInfo(response));
 
         if (!disable_stdio) {
-          if (pty.GetMasterFileDescriptor() !=
-              lldb_utility::PseudoTerminal::invalid_fd)
+          if (pty.GetMasterFileDescriptor() != PseudoTerminal::invalid_fd)
             SetSTDIOFileDescriptor(pty.ReleaseMasterFileDescriptor());
         }
       }

Modified: lldb/trunk/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=320346&r1=320345&r2=320346&view=diff
==============================================================================
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Mon Dec 11 02:09:14 2017
@@ -1196,7 +1196,7 @@ Platform::DebugProcess(ProcessLaunchInfo
         // open for stdin/out/err after we have already opened the master
         // so we can read/write stdin/out/err.
         int pty_fd = launch_info.GetPTY().ReleaseMasterFileDescriptor();
-        if (pty_fd != lldb_utility::PseudoTerminal::invalid_fd) {
+        if (pty_fd != PseudoTerminal::invalid_fd) {
           process_sp->SetSTDIOFileDescriptor(pty_fd);
         }
       } else {

Modified: lldb/trunk/source/Target/ProcessLaunchInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ProcessLaunchInfo.cpp?rev=320346&r1=320345&r2=320346&view=diff
==============================================================================
--- lldb/trunk/source/Target/ProcessLaunchInfo.cpp (original)
+++ lldb/trunk/source/Target/ProcessLaunchInfo.cpp Mon Dec 11 02:09:14 2017
@@ -39,10 +39,9 @@ using namespace lldb_private;
 
 ProcessLaunchInfo::ProcessLaunchInfo()
     : ProcessInfo(), m_working_dir(), m_plugin_name(), m_flags(0),
-      m_file_actions(), m_pty(new lldb_utility::PseudoTerminal),
-      m_resume_count(0), m_monitor_callback(nullptr),
-      m_monitor_callback_baton(nullptr), m_monitor_signals(false),
-      m_listener_sp(), m_hijack_listener_sp() {}
+      m_file_actions(), m_pty(new PseudoTerminal), m_resume_count(0),
+      m_monitor_callback(nullptr), m_monitor_callback_baton(nullptr),
+      m_monitor_signals(false), m_listener_sp(), m_hijack_listener_sp() {}
 
 ProcessLaunchInfo::ProcessLaunchInfo(const FileSpec &stdin_file_spec,
                                      const FileSpec &stdout_file_spec,
@@ -50,10 +49,9 @@ ProcessLaunchInfo::ProcessLaunchInfo(con
                                      const FileSpec &working_directory,
                                      uint32_t launch_flags)
     : ProcessInfo(), m_working_dir(), m_plugin_name(), m_flags(launch_flags),
-      m_file_actions(), m_pty(new lldb_utility::PseudoTerminal),
-      m_resume_count(0), m_monitor_callback(nullptr),
-      m_monitor_callback_baton(nullptr), m_monitor_signals(false),
-      m_listener_sp(), m_hijack_listener_sp() {
+      m_file_actions(), m_pty(new PseudoTerminal), m_resume_count(0),
+      m_monitor_callback(nullptr), m_monitor_callback_baton(nullptr),
+      m_monitor_signals(false), m_listener_sp(), m_hijack_listener_sp() {
   if (stdin_file_spec) {
     FileAction file_action;
     const bool read = true;

Modified: lldb/trunk/unittests/Editline/EditlineTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Editline/EditlineTest.cpp?rev=320346&r1=320345&r2=320346&view=diff
==============================================================================
--- lldb/trunk/unittests/Editline/EditlineTest.cpp (original)
+++ lldb/trunk/unittests/Editline/EditlineTest.cpp Mon Dec 11 02:09:14 2017
@@ -25,6 +25,8 @@
 #include "lldb/Utility/Status.h"
 #include "lldb/Utility/StringList.h"
 
+using namespace lldb_private;
+
 namespace {
 const size_t TIMEOUT_MILLIS = 5000;
 }
@@ -81,7 +83,7 @@ private:
 
   std::unique_ptr<lldb_private::Editline> _editline_sp;
 
-  lldb_utility::PseudoTerminal _pty;
+  PseudoTerminal _pty;
   int _pty_master_fd;
   int _pty_slave_fd;
 

Modified: lldb/trunk/unittests/Host/MainLoopTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/MainLoopTest.cpp?rev=320346&r1=320345&r2=320346&view=diff
==============================================================================
--- lldb/trunk/unittests/Host/MainLoopTest.cpp (original)
+++ lldb/trunk/unittests/Host/MainLoopTest.cpp Mon Dec 11 02:09:14 2017
@@ -110,7 +110,7 @@ TEST_F(MainLoopTest, TerminatesImmediate
 
 #ifdef LLVM_ON_UNIX
 TEST_F(MainLoopTest, DetectsEOF) {
-  lldb_utility::PseudoTerminal term;
+  PseudoTerminal term;
   ASSERT_TRUE(term.OpenFirstAvailableMaster(O_RDWR, nullptr, 0));
   ASSERT_TRUE(term.OpenSlave(O_RDWR | O_NOCTTY, nullptr, 0));
   auto conn = llvm::make_unique<ConnectionFileDescriptor>(




More information about the lldb-commits mailing list