[Lldb-commits] [lldb] r348775 - Do not use PATH_MAX with SmallString
Stella Stamenova via lldb-commits
lldb-commits at lists.llvm.org
Mon Dec 10 09:23:28 PST 2018
Author: stella.stamenova
Date: Mon Dec 10 09:23:28 2018
New Revision: 348775
URL: http://llvm.org/viewvc/llvm-project?rev=348775&view=rev
Log:
Do not use PATH_MAX with SmallString
Summary: Instead use a more reasonable value to start and rely on the fact that SmallString will resize if necessary.
Reviewers: labath, asmith
Reviewed By: labath
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D55457
Modified:
lldb/trunk/source/Commands/CommandCompletions.cpp
lldb/trunk/source/Commands/CommandObjectPlatform.cpp
lldb/trunk/source/Host/common/Host.cpp
lldb/trunk/source/Host/posix/PipePosix.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
lldb/trunk/source/Target/ProcessInfo.cpp
Modified: lldb/trunk/source/Commands/CommandCompletions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandCompletions.cpp?rev=348775&r1=348774&r2=348775&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandCompletions.cpp (original)
+++ lldb/trunk/source/Commands/CommandCompletions.cpp Mon Dec 10 09:23:28 2018
@@ -116,7 +116,7 @@ static int DiskFilesOrDirectories(const
if (FirstSep != llvm::StringRef::npos)
Remainder = Buffer.drop_front(FirstSep + 1);
- llvm::SmallString<PATH_MAX> Resolved;
+ llvm::SmallString<256> Resolved;
if (!Resolver.ResolveExact(Username, Resolved)) {
// We couldn't resolve it as a full username. If there were no slashes
// then this might be a partial username. We try to resolve it as such
Modified: lldb/trunk/source/Commands/CommandObjectPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectPlatform.cpp?rev=348775&r1=348774&r2=348775&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectPlatform.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectPlatform.cpp Mon Dec 10 09:23:28 2018
@@ -1038,7 +1038,7 @@ protected:
Module *exe_module = target->GetExecutableModulePointer();
if (exe_module) {
m_options.launch_info.GetExecutableFile() = exe_module->GetFileSpec();
- llvm::SmallString<PATH_MAX> exe_path;
+ llvm::SmallString<128> exe_path;
m_options.launch_info.GetExecutableFile().GetPath(exe_path);
if (!exe_path.empty())
m_options.launch_info.GetArguments().AppendArgument(exe_path);
Modified: lldb/trunk/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=348775&r1=348774&r2=348775&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Mon Dec 10 09:23:28 2018
@@ -496,7 +496,7 @@ Status Host::RunShellCommand(const Args
if (working_dir)
launch_info.SetWorkingDirectory(working_dir);
- llvm::SmallString<PATH_MAX> output_file_path;
+ llvm::SmallString<64> output_file_path;
if (command_output_ptr) {
// Create a temporary file to get the stdout/stderr and redirect the output
Modified: lldb/trunk/source/Host/posix/PipePosix.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/PipePosix.cpp?rev=348775&r1=348774&r2=348775&view=diff
==============================================================================
--- lldb/trunk/source/Host/posix/PipePosix.cpp (original)
+++ lldb/trunk/source/Host/posix/PipePosix.cpp Mon Dec 10 09:23:28 2018
@@ -125,8 +125,8 @@ Status PipePosix::CreateNew(llvm::String
Status PipePosix::CreateWithUniqueName(llvm::StringRef prefix,
bool child_process_inherit,
llvm::SmallVectorImpl<char> &name) {
- llvm::SmallString<PATH_MAX> named_pipe_path;
- llvm::SmallString<PATH_MAX> pipe_spec((prefix + ".%%%%%%").str());
+ llvm::SmallString<128> named_pipe_path;
+ llvm::SmallString<128> pipe_spec((prefix + ".%%%%%%").str());
FileSpec tmpdir_file_spec = HostInfo::GetProcessTempDir();
if (!tmpdir_file_spec)
tmpdir_file_spec.AppendPathComponent("/tmp");
Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp?rev=348775&r1=348774&r2=348775&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp Mon Dec 10 09:23:28 2018
@@ -832,7 +832,7 @@ ClangExpressionParser::ParseInternal(Dia
if (should_create_file) {
int temp_fd = -1;
- llvm::SmallString<PATH_MAX> result_path;
+ llvm::SmallString<128> result_path;
if (FileSpec tmpdir_file_spec = HostInfo::GetProcessTempDir()) {
tmpdir_file_spec.AppendPathComponent("lldb-%%%%%%.expr");
std::string temp_source_path = tmpdir_file_spec.GetPath();
Modified: lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp?rev=348775&r1=348774&r2=348775&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp Mon Dec 10 09:23:28 2018
@@ -889,7 +889,7 @@ uint32_t ObjectFilePECOFF::ParseDependen
// At this moment we only have the base name of the DLL. The full path can
// only be seen after the dynamic loading. Our best guess is Try to get it
// with the help of the object file's directory.
- llvm::SmallString<PATH_MAX> dll_fullpath;
+ llvm::SmallString<128> dll_fullpath;
FileSpec dll_specs(dll_name);
dll_specs.GetDirectory().SetString(m_file.GetDirectory().GetCString());
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=348775&r1=348774&r2=348775&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Mon Dec 10 09:23:28 2018
@@ -1011,7 +1011,7 @@ Status GDBRemoteCommunication::StartDebu
debugserver_args.AppendArgument(llvm::StringRef("--setsid"));
}
- llvm::SmallString<PATH_MAX> named_pipe_path;
+ llvm::SmallString<128> named_pipe_path;
// socket_pipe is used by debug server to communicate back either
// TCP port or domain socket name which it listens on.
// The second purpose of the pipe to serve as a synchronization point -
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp?rev=348775&r1=348774&r2=348775&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp Mon Dec 10 09:23:28 2018
@@ -538,8 +538,8 @@ const FileSpec &GDBRemoteCommunicationSe
FileSpec
GDBRemoteCommunicationServerPlatform::GetDomainSocketPath(const char *prefix) {
- llvm::SmallString<PATH_MAX> socket_path;
- llvm::SmallString<PATH_MAX> socket_name(
+ llvm::SmallString<128> socket_path;
+ llvm::SmallString<128> socket_name(
(llvm::StringRef(prefix) + ".%%%%%%").str());
FileSpec socket_path_spec(GetDomainSocketDir());
Modified: lldb/trunk/source/Target/ProcessInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ProcessInfo.cpp?rev=348775&r1=348774&r2=348775&view=diff
==============================================================================
--- lldb/trunk/source/Target/ProcessInfo.cpp (original)
+++ lldb/trunk/source/Target/ProcessInfo.cpp Mon Dec 10 09:23:28 2018
@@ -63,7 +63,7 @@ void ProcessInfo::SetExecutableFile(cons
if (exe_file) {
m_executable = exe_file;
if (add_exe_file_as_first_arg) {
- llvm::SmallString<PATH_MAX> filename;
+ llvm::SmallString<128> filename;
exe_file.GetPath(filename);
if (!filename.empty())
m_arguments.InsertArgumentAtIndex(0, filename);
More information about the lldb-commits
mailing list