Move PseudoTerminal to the lldb_private namespace

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

llvm-svn: 320346
This commit is contained in:
Pavel Labath 2017-12-11 10:09:14 +00:00
parent 390b487994
commit 07d6f881e7
13 changed files with 23 additions and 26 deletions

View File

@ -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_

View File

@ -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;

View File

@ -24,7 +24,7 @@
int posix_openpt(int flags);
#endif
using namespace lldb_utility;
using namespace lldb_private;
//----------------------------------------------------------------------
// PseudoTerminal constructor

View File

@ -372,7 +372,7 @@ PlatformLinux::DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger,
// 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

View File

@ -206,7 +206,7 @@ lldb::ProcessSP PlatformAppleSimulator::DebugProcess(
// 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);
}
}

View File

@ -393,7 +393,7 @@ lldb::ProcessSP PlatformNetBSD::DebugProcess(
// 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

View File

@ -144,7 +144,7 @@ static Status ForkChildForPTraceDebugging(const char *path, char const *argv[],
// 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)));

View File

@ -843,7 +843,7 @@ bool ProcessMonitor::Launch(LaunchArgs *args) {
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;

View File

@ -817,7 +817,7 @@ Status ProcessGDBRemote::DoLaunch(Module *exe_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 *exe_module,
SetPrivateState(SetThreadStopInfo(response));
if (!disable_stdio) {
if (pty.GetMasterFileDescriptor() !=
lldb_utility::PseudoTerminal::invalid_fd)
if (pty.GetMasterFileDescriptor() != PseudoTerminal::invalid_fd)
SetSTDIOFileDescriptor(pty.ReleaseMasterFileDescriptor());
}
}

View File

@ -1196,7 +1196,7 @@ Platform::DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger,
// 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 {

View File

@ -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(const FileSpec &stdin_file_spec,
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;

View File

@ -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;

View File

@ -110,7 +110,7 @@ TEST_F(MainLoopTest, TerminatesImmediately) {
#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>(