Refactor many file functions to use FileSpec over strings.
Summary:
This should solve the issue of sending denormalized paths over gdb-remote
if we stick to GetPath(false) in GDBRemoteCommunicationClient, and let the
server handle any denormalization.
Reviewers: ovyalov, zturner, vharron, clayborg
Reviewed By: clayborg
Subscribers: tberghammer, emaste, lldb-commits
Differential Revision: http://reviews.llvm.org/D9728
llvm-svn: 238604
diff --git a/lldb/source/API/SBLaunchInfo.cpp b/lldb/source/API/SBLaunchInfo.cpp
index 4cf8219..54bed87 100644
--- a/lldb/source/API/SBLaunchInfo.cpp
+++ b/lldb/source/API/SBLaunchInfo.cpp
@@ -173,13 +173,13 @@
const char *
SBLaunchInfo::GetWorkingDirectory () const
{
- return m_opaque_sp->GetWorkingDirectory();
+ return m_opaque_sp->GetWorkingDirectory().GetCString();
}
void
SBLaunchInfo::SetWorkingDirectory (const char *working_dir)
{
- m_opaque_sp->SetWorkingDirectory(working_dir);
+ m_opaque_sp->SetWorkingDirectory(FileSpec{working_dir, false});
}
uint32_t
@@ -260,7 +260,7 @@
bool
SBLaunchInfo::AddOpenFileAction (int fd, const char *path, bool read, bool write)
{
- return m_opaque_sp->AppendOpenFileAction(fd, path, read, write);
+ return m_opaque_sp->AppendOpenFileAction(fd, FileSpec{path, false}, read, write);
}
bool
diff --git a/lldb/source/API/SBPlatform.cpp b/lldb/source/API/SBPlatform.cpp
index a522870..5662f36 100644
--- a/lldb/source/API/SBPlatform.cpp
+++ b/lldb/source/API/SBPlatform.cpp
@@ -329,9 +329,9 @@
if (platform_sp)
{
if (path)
- platform_sp->SetWorkingDirectory(ConstString(path));
+ platform_sp->SetWorkingDirectory(FileSpec{path, false});
else
- platform_sp->SetWorkingDirectory(ConstString());
+ platform_sp->SetWorkingDirectory(FileSpec{});
return true;
}
return false;
@@ -545,7 +545,7 @@
shell_command.SetWorkingDirectory(working_dir);
}
return platform_sp->RunShellCommand(command,
- working_dir,
+ FileSpec{working_dir, false},
&shell_command.m_opaque_ptr->m_status,
&shell_command.m_opaque_ptr->m_signo,
&shell_command.m_opaque_ptr->m_output,
@@ -598,7 +598,7 @@
PlatformSP platform_sp(GetSP());
if (platform_sp)
{
- sb_error.ref() = platform_sp->MakeDirectory(path, file_permissions);
+ sb_error.ref() = platform_sp->MakeDirectory(FileSpec{path, false}, file_permissions);
}
else
{
@@ -614,7 +614,7 @@
if (platform_sp)
{
uint32_t file_permissions = 0;
- platform_sp->GetFilePermissions(path, file_permissions);
+ platform_sp->GetFilePermissions(FileSpec{path, false}, file_permissions);
return file_permissions;
}
return 0;
@@ -628,7 +628,7 @@
PlatformSP platform_sp(GetSP());
if (platform_sp)
{
- sb_error.ref() = platform_sp->SetFilePermissions(path, file_permissions);
+ sb_error.ref() = platform_sp->SetFilePermissions(FileSpec{path, false}, file_permissions);
}
else
{
diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp
index ecf0a64..a1dbf68 100644
--- a/lldb/source/API/SBProcess.cpp
+++ b/lldb/source/API/SBProcess.cpp
@@ -167,11 +167,11 @@
{
if (stop_at_entry)
launch_flags |= eLaunchFlagStopAtEntry;
- ProcessLaunchInfo launch_info (stdin_path,
- stdout_path,
- stderr_path,
- working_directory,
- launch_flags);
+ ProcessLaunchInfo launch_info(FileSpec{stdin_path, false},
+ FileSpec{stdout_path, false},
+ FileSpec{stderr_path, false},
+ FileSpec{working_directory, false},
+ launch_flags);
Module *exe_module = process_sp->GetTarget().GetExecutableModulePointer();
if (exe_module)
launch_info.SetExecutableFile(exe_module->GetPlatformFileSpec(), true);
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 192c275..9238852 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -343,7 +343,11 @@
if (getenv("LLDB_LAUNCH_FLAG_DISABLE_STDIO"))
launch_flags |= eLaunchFlagDisableSTDIO;
- ProcessLaunchInfo launch_info (stdin_path, stdout_path, stderr_path, working_directory, launch_flags);
+ ProcessLaunchInfo launch_info(FileSpec{stdin_path, false},
+ FileSpec{stdout_path, false},
+ FileSpec{stderr_path, false},
+ FileSpec{working_directory, false},
+ launch_flags);
Module *exe_module = target_sp->GetExecutableModulePointer();
if (exe_module)