Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lldb/include/lldb/Host/FileAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ class FileAction {

int GetActionArgument() const { return m_arg; }

llvm::StringRef GetPath() const;

const FileSpec &GetFileSpec() const;

void Dump(Stream &stream) const;
Expand Down
4 changes: 0 additions & 4 deletions lldb/source/Host/common/FileAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ void FileAction::Clear() {
m_file_spec.Clear();
}

llvm::StringRef FileAction::GetPath() const {
return m_file_spec.GetPathAsConstString().AsCString();
}

const FileSpec &FileAction::GetFileSpec() const { return m_file_spec; }

bool FileAction::Open(int fd, const FileSpec &file_spec, bool read,
Expand Down
39 changes: 24 additions & 15 deletions lldb/source/Host/macosx/objcxx/Host.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1013,20 +1013,29 @@ static Status LaunchProcessXPC(const char *exe_path,
xpc_dictionary_set_int64(message, LauncherXPCServicePosixspawnFlagsKey,
GetPosixspawnFlags(launch_info));
const FileAction *file_action = launch_info.GetFileActionForFD(STDIN_FILENO);
if (file_action && !file_action->GetPath().empty()) {
std::string file_action_path;
if (file_action)
file_action_path = file_action->GetFileSpec().GetPath();

if (!file_action_path.empty())
xpc_dictionary_set_string(message, LauncherXPCServiceStdInPathKeyKey,
file_action->GetPath().str().c_str());
}
file_action_path.c_str());

file_action = launch_info.GetFileActionForFD(STDOUT_FILENO);
if (file_action && !file_action->GetPath().empty()) {
if (file_action)
file_action_path = file_action->GetFileSpec().GetPath();

if (!file_action_path.empty())
xpc_dictionary_set_string(message, LauncherXPCServiceStdOutPathKeyKey,
file_action->GetPath().str().c_str());
}
file_action_path.c_str());

file_action = launch_info.GetFileActionForFD(STDERR_FILENO);
if (file_action && !file_action->GetPath().empty()) {
if (file_action)
file_action_path = file_action->GetFileSpec().GetPath();

if (!file_action_path.empty())
xpc_dictionary_set_string(message, LauncherXPCServiceStdErrPathKeyKey,
file_action->GetPath().str().c_str());
}
file_action_path.c_str());

xpc_object_t reply =
xpc_connection_send_message_with_reply_sync(conn, message);
Expand Down Expand Up @@ -1135,16 +1144,16 @@ static bool AddPosixSpawnFileAction(void *_file_actions, const FileAction *info,
if (oflag & O_CREAT)
mode = 0640;

error = Status(::posix_spawn_file_actions_addopen(
file_actions, info->GetFD(),
info->GetPath().str().c_str(), oflag, mode),
eErrorTypePOSIX);
const std::string file_path(info->GetFileSpec().GetPath());
error = Status(
::posix_spawn_file_actions_addopen(file_actions, info->GetFD(),
file_path.c_str(), oflag, mode),
eErrorTypePOSIX);
if (error.Fail())
LLDB_LOG(log,
"error: {0}, posix_spawn_file_actions_addopen (action={1}, "
"fd={2}, path='{3}', oflag={4}, mode={5})",
error, file_actions, info->GetFD(), info->GetPath(), oflag,
mode);
error, file_actions, info->GetFD(), file_path, oflag, mode);
}
break;
}
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Host/posix/ProcessLauncherPosixFork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ struct ForkLaunchInfo {
// End of code running in the child process.

ForkFileAction::ForkFileAction(const FileAction &act)
: action(act.GetAction()), fd(act.GetFD()), path(act.GetPath().str()),
arg(act.GetActionArgument()) {}
: action(act.GetAction()), fd(act.GetFD()),
path(act.GetFileSpec().GetPath()), arg(act.GetActionArgument()) {}

static std::vector<ForkFileAction>
MakeForkActions(const ProcessLaunchInfo &info) {
Expand Down
6 changes: 3 additions & 3 deletions lldb/source/Target/Target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5145,17 +5145,17 @@ void TargetProperties::SetProcessLaunchInfo(
const FileAction *input_file_action =
launch_info.GetFileActionForFD(STDIN_FILENO);
if (input_file_action) {
SetStandardInputPath(input_file_action->GetPath());
SetStandardInputPath(input_file_action->GetFileSpec().GetPath());
}
const FileAction *output_file_action =
launch_info.GetFileActionForFD(STDOUT_FILENO);
if (output_file_action) {
SetStandardOutputPath(output_file_action->GetPath());
SetStandardOutputPath(output_file_action->GetFileSpec().GetPath());
}
const FileAction *error_file_action =
launch_info.GetFileActionForFD(STDERR_FILENO);
if (error_file_action) {
SetStandardErrorPath(error_file_action->GetPath());
SetStandardErrorPath(error_file_action->GetFileSpec().GetPath());
}
SetDetachOnError(launch_info.GetFlags().Test(lldb::eLaunchFlagDetachOnError));
SetDisableASLR(launch_info.GetFlags().Test(lldb::eLaunchFlagDisableASLR));
Expand Down
Loading