Skip to content

Commit 7fb9d80

Browse files
[lldb][windows] make PseudoTerminal::GetPTY return a shared pointer
1 parent 928393b commit 7fb9d80

File tree

11 files changed

+23
-22
lines changed

11 files changed

+23
-22
lines changed

lldb/include/lldb/Host/ProcessLaunchInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class ProcessLaunchInfo : public ProcessInfo {
118118

119119
bool MonitorProcess() const;
120120

121-
PseudoTerminal &GetPTY() { return *m_pty; }
121+
std::shared_ptr<PseudoTerminal> GetPTY() const { return m_pty; }
122122

123123
void SetLaunchEventData(const char *data) { m_event_data.assign(data); }
124124

lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ PlatformAppleSimulator::DebugProcess(ProcessLaunchInfo &launch_info,
215215
// been used where the secondary side was given as the file to open for
216216
// stdin/out/err after we have already opened the primary so we can
217217
// read/write stdin/out/err.
218-
int pty_fd = launch_info.GetPTY().ReleasePrimaryFileDescriptor();
218+
int pty_fd = launch_info.GetPTY()->ReleasePrimaryFileDescriptor();
219219
if (pty_fd != PseudoTerminal::invalid_fd) {
220220
process_sp->SetSTDIOFileDescriptor(pty_fd);
221221
}

lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -399,18 +399,18 @@ static Status HandleFileAction(ProcessLaunchInfo &launch_info,
399399
case FileAction::eFileActionOpen: {
400400
FileSpec file_spec = file_action->GetFileSpec();
401401
if (file_spec) {
402-
const int primary_fd = launch_info.GetPTY().GetPrimaryFileDescriptor();
402+
const int primary_fd = launch_info.GetPTY()->GetPrimaryFileDescriptor();
403403
if (primary_fd != PseudoTerminal::invalid_fd) {
404404
// Check in case our file action open wants to open the secondary
405-
FileSpec secondary_spec(launch_info.GetPTY().GetSecondaryName());
405+
FileSpec secondary_spec(launch_info.GetPTY()->GetSecondaryName());
406406
if (file_spec == secondary_spec) {
407407
int secondary_fd =
408-
launch_info.GetPTY().GetSecondaryFileDescriptor();
408+
launch_info.GetPTY()->GetSecondaryFileDescriptor();
409409
if (secondary_fd == PseudoTerminal::invalid_fd) {
410-
if (llvm::Error Err = launch_info.GetPTY().OpenSecondary(O_RDWR))
410+
if (llvm::Error Err = launch_info.GetPTY()->OpenSecondary(O_RDWR))
411411
return Status::FromError(std::move(Err));
412412
}
413-
secondary_fd = launch_info.GetPTY().GetSecondaryFileDescriptor();
413+
secondary_fd = launch_info.GetPTY()->GetSecondaryFileDescriptor();
414414
assert(secondary_fd != PseudoTerminal::invalid_fd);
415415
[options setValue:[NSNumber numberWithInteger:secondary_fd]
416416
forKey:key];

lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ lldb::ProcessSP PlatformPOSIX::DebugProcess(ProcessLaunchInfo &launch_info,
488488
if (error.Success()) {
489489
// Hook up process PTY if we have one (which we should for local debugging
490490
// with llgs).
491-
int pty_fd = launch_info.GetPTY().ReleasePrimaryFileDescriptor();
491+
int pty_fd = launch_info.GetPTY()->ReleasePrimaryFileDescriptor();
492492
if (pty_fd != PseudoTerminal::invalid_fd) {
493493
process_sp->SetSTDIOFileDescriptor(pty_fd);
494494
LLDB_LOG(log, "hooked up STDIO pty to process");

lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,10 @@ lldb::ProcessSP PlatformQemuUser::DebugProcess(ProcessLaunchInfo &launch_info,
235235
if (error.Fail())
236236
return nullptr;
237237

238-
if (launch_info.GetPTY().GetPrimaryFileDescriptor() !=
238+
if (launch_info.GetPTY()->GetPrimaryFileDescriptor() !=
239239
PseudoTerminal::invalid_fd)
240240
process_sp->SetSTDIOFileDescriptor(
241-
launch_info.GetPTY().ReleasePrimaryFileDescriptor());
241+
launch_info.GetPTY()->ReleasePrimaryFileDescriptor());
242242

243243
return process_sp;
244244
}

lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,9 @@ NativeProcessAIX::Manager::Launch(ProcessLaunchInfo &launch_info,
8686
LLDB_LOG(log, "inferior started, now in stopped state");
8787

8888
return std::unique_ptr<NativeProcessAIX>(new NativeProcessAIX(
89-
pid, launch_info.GetPTY().ReleasePrimaryFileDescriptor(), native_delegate,
90-
HostInfo::GetArchitecture(HostInfo::eArchKind64), *this, {pid}));
89+
pid, launch_info.GetPTY()->ReleasePrimaryFileDescriptor(),
90+
native_delegate, HostInfo::GetArchitecture(HostInfo::eArchKind64), *this,
91+
{pid}));
9192
}
9293

9394
llvm::Expected<std::unique_ptr<NativeProcessProtocol>>

lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ NativeProcessFreeBSD::Manager::Launch(ProcessLaunchInfo &launch_info,
108108
Info.GetArchitecture().GetArchitectureName());
109109

110110
std::unique_ptr<NativeProcessFreeBSD> process_up(new NativeProcessFreeBSD(
111-
pid, launch_info.GetPTY().ReleasePrimaryFileDescriptor(), native_delegate,
112-
Info.GetArchitecture(), m_mainloop));
111+
pid, launch_info.GetPTY()->ReleasePrimaryFileDescriptor(),
112+
native_delegate, Info.GetArchitecture(), m_mainloop));
113113

114114
status = process_up->SetupTrace();
115115
if (status.Fail())

lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,8 @@ NativeProcessLinux::Manager::Launch(ProcessLaunchInfo &launch_info,
304304
return arch_or.takeError();
305305

306306
return std::unique_ptr<NativeProcessLinux>(new NativeProcessLinux(
307-
pid, launch_info.GetPTY().ReleasePrimaryFileDescriptor(), native_delegate,
308-
*arch_or, *this, {pid}));
307+
pid, launch_info.GetPTY()->ReleasePrimaryFileDescriptor(),
308+
native_delegate, *arch_or, *this, {pid}));
309309
}
310310

311311
llvm::Expected<std::unique_ptr<NativeProcessProtocol>>

lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ NativeProcessNetBSD::Manager::Launch(ProcessLaunchInfo &launch_info,
9494
Info.GetArchitecture().GetArchitectureName());
9595

9696
std::unique_ptr<NativeProcessNetBSD> process_up(new NativeProcessNetBSD(
97-
pid, launch_info.GetPTY().ReleasePrimaryFileDescriptor(), native_delegate,
98-
Info.GetArchitecture(), m_mainloop));
97+
pid, launch_info.GetPTY()->ReleasePrimaryFileDescriptor(),
98+
native_delegate, Info.GetArchitecture(), m_mainloop));
9999

100100
status = process_up->SetupTrace();
101101
if (status.Fail())

lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ namespace lldb_private {
4747
NativeProcessWindows::NativeProcessWindows(ProcessLaunchInfo &launch_info,
4848
NativeDelegate &delegate,
4949
llvm::Error &E)
50-
: NativeProcessProtocol(LLDB_INVALID_PROCESS_ID,
51-
launch_info.GetPTY().ReleasePrimaryFileDescriptor(),
52-
delegate),
50+
: NativeProcessProtocol(
51+
LLDB_INVALID_PROCESS_ID,
52+
launch_info.GetPTY()->ReleasePrimaryFileDescriptor(), delegate),
5353
ProcessDebugger(), m_arch(launch_info.GetArchitecture()) {
5454
ErrorAsOutParameter EOut(&E);
5555
DebugDelegateSP delegate_sp(new NativeDebugDelegate(*this));

0 commit comments

Comments
 (0)