[Lldb-commits] [lldb] r230077 - Rename the "glob arguments" feature to "shell expand arguments"
Enrico Granata
egranata at apple.com
Fri Feb 20 14:20:31 PST 2015
Author: enrico
Date: Fri Feb 20 16:20:30 2015
New Revision: 230077
URL: http://llvm.org/viewvc/llvm-project?rev=230077&view=rev
Log:
Rename the "glob arguments" feature to "shell expand arguments"
This should not bring any feature change, except changing names of things here and there
Added:
lldb/trunk/test/functionalities/launch_with_shellexpand/
- copied from r230042, lldb/trunk/test/functionalities/launch_with_glob/
lldb/trunk/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py
- copied, changed from r230042, lldb/trunk/test/functionalities/launch_with_glob/TestLaunchWithGlob.py
Removed:
lldb/trunk/test/functionalities/launch_with_glob/
lldb/trunk/test/functionalities/launch_with_shellexpand/TestLaunchWithGlob.py
Modified:
lldb/trunk/include/lldb/API/SBLaunchInfo.h
lldb/trunk/include/lldb/Host/Host.h
lldb/trunk/include/lldb/Target/Platform.h
lldb/trunk/include/lldb/Target/ProcessLaunchInfo.h
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/scripts/Python/interface/SBLaunchInfo.i
lldb/trunk/source/API/SBLaunchInfo.cpp
lldb/trunk/source/Host/freebsd/Host.cpp
lldb/trunk/source/Host/linux/Host.cpp
lldb/trunk/source/Host/macosx/Host.mm
lldb/trunk/source/Host/windows/Host.cpp
lldb/trunk/source/Target/Platform.cpp
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/ProcessLaunchInfo.cpp
Modified: lldb/trunk/include/lldb/API/SBLaunchInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBLaunchInfo.h?rev=230077&r1=230076&r2=230077&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBLaunchInfo.h (original)
+++ lldb/trunk/include/lldb/API/SBLaunchInfo.h Fri Feb 20 16:20:30 2015
@@ -142,10 +142,10 @@ public:
SetShell (const char * path);
bool
- GetGlobArguments ();
+ GetShellExpandArguments ();
void
- SetGlobArguments (bool glob);
+ SetShellExpandArguments (bool glob);
uint32_t
GetResumeCount ();
Modified: lldb/trunk/include/lldb/Host/Host.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Host.h?rev=230077&r1=230076&r2=230077&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Host.h (original)
+++ lldb/trunk/include/lldb/Host/Host.h Fri Feb 20 16:20:30 2015
@@ -254,14 +254,14 @@ public:
LaunchProcess (ProcessLaunchInfo &launch_info);
//------------------------------------------------------------------
- /// Perform globbing of the command-line for this launch info
+ /// Perform expansion of the command-line for this launch info
/// This can potentially involve wildcard expansion
// environment variable replacement, and whatever other
// argument magic the platform defines as part of its typical
// user experience
//------------------------------------------------------------------
static Error
- GlobArguments (ProcessLaunchInfo &launch_info);
+ ShellExpandArguments (ProcessLaunchInfo &launch_info);
static Error
RunShellCommand (const char *command, // Shouldn't be NULL
Modified: lldb/trunk/include/lldb/Target/Platform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Platform.h?rev=230077&r1=230076&r2=230077&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Platform.h (original)
+++ lldb/trunk/include/lldb/Target/Platform.h Fri Feb 20 16:20:30 2015
@@ -386,14 +386,14 @@ namespace lldb_private {
LaunchProcess (ProcessLaunchInfo &launch_info);
//------------------------------------------------------------------
- /// Perform globbing of the command-line for this launch info
+ /// Perform expansion of the command-line for this launch info
/// This can potentially involve wildcard expansion
// environment variable replacement, and whatever other
// argument magic the platform defines as part of its typical
// user experience
//------------------------------------------------------------------
virtual Error
- GlobArguments (ProcessLaunchInfo &launch_info);
+ ShellExpandArguments (ProcessLaunchInfo &launch_info);
//------------------------------------------------------------------
/// Kill process on a platform.
Modified: lldb/trunk/include/lldb/Target/ProcessLaunchInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ProcessLaunchInfo.h?rev=230077&r1=230076&r2=230077&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ProcessLaunchInfo.h (original)
+++ lldb/trunk/include/lldb/Target/ProcessLaunchInfo.h Fri Feb 20 16:20:30 2015
@@ -134,13 +134,13 @@ namespace lldb_private
SetLaunchInSeparateProcessGroup (bool separate);
bool
- GetGlobArguments () const
+ GetShellExpandArguments () const
{
- return m_flags.Test(lldb::eLaunchFlagGlobArguments);
+ return m_flags.Test(lldb::eLaunchFlagShellExpandArguments);
}
void
- SetGlobArguments (bool glob);
+ SetShellExpandArguments (bool expand);
void
Clear ();
Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=230077&r1=230076&r2=230077&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Fri Feb 20 16:20:30 2015
@@ -51,7 +51,7 @@ namespace lldb {
///< set this flag so lldb & the handee don't race to set its exit status.
eLaunchFlagDetachOnError = (1u << 9), ///< If set, then the client stub should detach rather than killing the debugee
///< if it loses connection with lldb.
- eLaunchFlagGlobArguments = (1u << 10), ///< Glob arguments without going through a shell
+ eLaunchFlagShellExpandArguments = (1u << 10), ///< Perform shell-style argument expansion
eLaunchFlagCloseTTYOnExit = (1u << 11), ///< Close the open TTY on exit
} LaunchFlags;
Modified: lldb/trunk/scripts/Python/interface/SBLaunchInfo.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBLaunchInfo.i?rev=230077&r1=230076&r2=230077&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBLaunchInfo.i (original)
+++ lldb/trunk/scripts/Python/interface/SBLaunchInfo.i Fri Feb 20 16:20:30 2015
@@ -93,10 +93,10 @@ public:
SetShell (const char * path);
bool
- GetGlobArguments ();
+ GetShellExpandArguments ();
void
- SetGlobArguments (bool glob);
+ SetShellExpandArguments (bool expand);
uint32_t
GetResumeCount ();
Modified: lldb/trunk/source/API/SBLaunchInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBLaunchInfo.cpp?rev=230077&r1=230076&r2=230077&view=diff
==============================================================================
--- lldb/trunk/source/API/SBLaunchInfo.cpp (original)
+++ lldb/trunk/source/API/SBLaunchInfo.cpp Fri Feb 20 16:20:30 2015
@@ -224,15 +224,15 @@ SBLaunchInfo::SetShell (const char * pat
}
bool
-SBLaunchInfo::GetGlobArguments ()
+SBLaunchInfo::GetShellExpandArguments ()
{
- return m_opaque_sp->GetGlobArguments();
+ return m_opaque_sp->GetShellExpandArguments();
}
void
-SBLaunchInfo::SetGlobArguments (bool glob)
+SBLaunchInfo::SetShellExpandArguments (bool expand)
{
- m_opaque_sp->SetGlobArguments(glob);
+ m_opaque_sp->SetShellExpandArguments(expand);
}
uint32_t
Modified: lldb/trunk/source/Host/freebsd/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/freebsd/Host.cpp?rev=230077&r1=230076&r2=230077&view=diff
==============================================================================
--- lldb/trunk/source/Host/freebsd/Host.cpp (original)
+++ lldb/trunk/source/Host/freebsd/Host.cpp Fri Feb 20 16:20:30 2015
@@ -313,7 +313,7 @@ Host::GetUnixSignals ()
}
Error
-Host::GlobArguments (ProcessLaunchInfo &launch_info)
+Host::ShellExpandArguments (ProcessLaunchInfo &launch_info)
{
return Error("unimplemented");
}
Modified: lldb/trunk/source/Host/linux/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/linux/Host.cpp?rev=230077&r1=230076&r2=230077&view=diff
==============================================================================
--- lldb/trunk/source/Host/linux/Host.cpp (original)
+++ lldb/trunk/source/Host/linux/Host.cpp Fri Feb 20 16:20:30 2015
@@ -418,7 +418,7 @@ Host::GetUnixSignals ()
}
Error
-Host::GlobArguments (ProcessLaunchInfo &launch_info)
+Host::ShellExpandArguments (ProcessLaunchInfo &launch_info)
{
return Error("unimplemented");
}
Modified: lldb/trunk/source/Host/macosx/Host.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=230077&r1=230076&r2=230077&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/Host.mm Fri Feb 20 16:20:30 2015
@@ -1353,19 +1353,19 @@ Host::LaunchProcess (ProcessLaunchInfo &
}
Error
-Host::GlobArguments (ProcessLaunchInfo &launch_info)
+Host::ShellExpandArguments (ProcessLaunchInfo &launch_info)
{
Error error;
- if (launch_info.GetFlags().Test(eLaunchFlagGlobArguments))
+ if (launch_info.GetFlags().Test(eLaunchFlagShellExpandArguments))
{
- FileSpec glob_tool_spec;
- if (!HostInfo::GetLLDBPath(lldb::ePathTypeSupportExecutableDir, glob_tool_spec))
+ FileSpec expand_tool_spec;
+ if (!HostInfo::GetLLDBPath(lldb::ePathTypeSupportExecutableDir, expand_tool_spec))
{
error.SetErrorString("could not find argdumper tool");
return error;
}
- glob_tool_spec.AppendPathComponent("argdumper");
- if (!glob_tool_spec.Exists())
+ expand_tool_spec.AppendPathComponent("argdumper");
+ if (!expand_tool_spec.Exists())
{
error.SetErrorString("could not find argdumper tool");
return error;
@@ -1373,15 +1373,15 @@ Host::GlobArguments (ProcessLaunchInfo &
std::string quoted_cmd_string;
launch_info.GetArguments().GetQuotedCommandString(quoted_cmd_string);
- StreamString glob_command;
+ StreamString expand_command;
- glob_command.Printf("%s %s",
- glob_tool_spec.GetPath().c_str(),
- quoted_cmd_string.c_str());
+ expand_command.Printf("%s %s",
+ expand_tool_spec.GetPath().c_str(),
+ quoted_cmd_string.c_str());
int status;
std::string output;
- RunShellCommand(glob_command.GetData(), launch_info.GetWorkingDirectory(), &status, nullptr, &output, 10);
+ RunShellCommand(expand_command.GetData(), launch_info.GetWorkingDirectory(), &status, nullptr, &output, 10);
if (status != 0)
{
@@ -1409,7 +1409,7 @@ Host::GlobArguments (ProcessLaunchInfo &
error.SetErrorString("invalid JSON");
return error;
}
-
+
auto args_array_sp = args_sp->GetAsArray();
if (!args_array_sp)
{
Modified: lldb/trunk/source/Host/windows/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/Host.cpp?rev=230077&r1=230076&r2=230077&view=diff
==============================================================================
--- lldb/trunk/source/Host/windows/Host.cpp (original)
+++ lldb/trunk/source/Host/windows/Host.cpp Fri Feb 20 16:20:30 2015
@@ -220,19 +220,19 @@ Host::StartMonitoringChildProcess(Host::
}
Error
-Host::GlobArguments (ProcessLaunchInfo &launch_info)
+Host::ShellExpandArguments (ProcessLaunchInfo &launch_info)
{
Error error;
- if (launch_info.GetFlags().Test(eLaunchFlagGlobArguments))
+ if (launch_info.GetFlags().Test(eLaunchFlagShellExpandArguments))
{
- FileSpec glob_tool_spec;
- if (!HostInfo::GetLLDBPath(lldb::ePathTypeSupportExecutableDir, glob_tool_spec))
+ FileSpec expand_tool_spec;
+ if (!HostInfo::GetLLDBPath(lldb::ePathTypeSupportExecutableDir, expand_tool_spec))
{
error.SetErrorString("could not find argdumper tool");
return error;
}
- glob_tool_spec.AppendPathComponent("argdumper.exe");
- if (!glob_tool_spec.Exists())
+ expand_tool_spec.AppendPathComponent("argdumper.exe");
+ if (!expand_tool_spec.Exists())
{
error.SetErrorString("could not find argdumper tool");
return error;
@@ -241,15 +241,15 @@ Host::GlobArguments (ProcessLaunchInfo &
std::string quoted_cmd_string;
launch_info.GetArguments().GetQuotedCommandString(quoted_cmd_string);
std::replace(quoted_cmd_string.begin(), quoted_cmd_string.end(), '\\', '/');
- StreamString glob_command;
+ StreamString expand_command;
- glob_command.Printf("%s %s",
- glob_tool_spec.GetPath().c_str(),
- quoted_cmd_string.c_str());
+ expand_command.Printf("%s %s",
+ expand_tool_spec.GetPath().c_str(),
+ quoted_cmd_string.c_str());
int status;
std::string output;
- RunShellCommand(glob_command.GetData(), launch_info.GetWorkingDirectory(), &status, nullptr, &output, 10);
+ RunShellCommand(expand_command.GetData(), launch_info.GetWorkingDirectory(), &status, nullptr, &output, 10);
if (status != 0)
{
Modified: lldb/trunk/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=230077&r1=230076&r2=230077&view=diff
==============================================================================
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Fri Feb 20 16:20:30 2015
@@ -1114,9 +1114,9 @@ Platform::LaunchProcess (ProcessLaunchIn
num_resumes))
return error;
}
- else if (launch_info.GetFlags().Test(eLaunchFlagGlobArguments))
+ else if (launch_info.GetFlags().Test(eLaunchFlagShellExpandArguments))
{
- error = GlobArguments(launch_info);
+ error = ShellExpandArguments(launch_info);
if (error.Fail())
return error;
}
@@ -1132,11 +1132,11 @@ Platform::LaunchProcess (ProcessLaunchIn
}
Error
-Platform::GlobArguments (ProcessLaunchInfo &launch_info)
+Platform::ShellExpandArguments (ProcessLaunchInfo &launch_info)
{
if (IsHost())
- return Host::GlobArguments(launch_info);
- return Error("base lldb_private::Platform class can't glob arguments");
+ return Host::ShellExpandArguments(launch_info);
+ return Error("base lldb_private::Platform class can't expand arguments");
}
Error
Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=230077&r1=230076&r2=230077&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Fri Feb 20 16:20:30 2015
@@ -491,14 +491,14 @@ ProcessLaunchCommandOptions::SetOptionVa
break;
}
- case 'G': // Glob args.
+ case 'X': // shell expand args.
{
bool success;
- const bool glob_args = Args::StringToBoolean (option_arg, true, &success);
+ const bool expand_args = Args::StringToBoolean (option_arg, true, &success);
if (success)
- launch_info.SetGlobArguments(glob_args);
+ launch_info.SetShellExpandArguments(expand_args);
else
- error.SetErrorStringWithFormat ("Invalid boolean value for glob-args option: '%s'", option_arg ? option_arg : "<null>");
+ error.SetErrorStringWithFormat ("Invalid boolean value for shell-expand-args option: '%s'", option_arg ? option_arg : "<null>");
break;
}
@@ -538,7 +538,7 @@ ProcessLaunchCommandOptions::g_option_ta
{ LLDB_OPT_SET_2 , false, "tty", 't', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Start the process in a terminal (not supported on all platforms)."},
{ LLDB_OPT_SET_3 , false, "no-stdio", 'n', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Do not set up for terminal I/O to go to running process."},
-{ LLDB_OPT_SET_4, false, "glob-args", 'G', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "Set whether to glob arguments to the process when launching."},
+{ LLDB_OPT_SET_4, false, "shell-expand-args", 'X', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "Set whether to shell expand arguments to the process when launching."},
{ 0 , false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
Modified: lldb/trunk/source/Target/ProcessLaunchInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ProcessLaunchInfo.cpp?rev=230077&r1=230076&r2=230077&view=diff
==============================================================================
--- lldb/trunk/source/Target/ProcessLaunchInfo.cpp (original)
+++ lldb/trunk/source/Target/ProcessLaunchInfo.cpp Fri Feb 20 16:20:30 2015
@@ -211,12 +211,12 @@ ProcessLaunchInfo::SetLaunchInSeparatePr
}
void
-ProcessLaunchInfo::SetGlobArguments (bool glob)
+ProcessLaunchInfo::SetShellExpandArguments (bool expand)
{
- if (glob)
- m_flags.Set(lldb::eLaunchFlagGlobArguments);
+ if (expand)
+ m_flags.Set(lldb::eLaunchFlagShellExpandArguments);
else
- m_flags.Clear(lldb::eLaunchFlagGlobArguments);
+ m_flags.Clear(lldb::eLaunchFlagShellExpandArguments);
}
void
Removed: lldb/trunk/test/functionalities/launch_with_shellexpand/TestLaunchWithGlob.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/launch_with_glob/TestLaunchWithGlob.py?rev=230042&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/launch_with_shellexpand/TestLaunchWithGlob.py (original)
+++ lldb/trunk/test/functionalities/launch_with_shellexpand/TestLaunchWithGlob.py (removed)
@@ -1,70 +0,0 @@
-"""
-Test that argdumper is a viable launching strategy.
-"""
-import commands
-import lldb
-import os
-import time
-import unittest2
-from lldbtest import *
-import lldbutil
-
-class LaunchWithGlobTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
-
- @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
- @dsym_test
- def test_with_dsym (self):
- self.buildDsym()
- self.do_test ()
-
-
- @expectedFailureFreeBSD("llvm.org/pr22627 process launch w/ glob not working")
- @dwarf_test
- def test_with_dwarf (self):
- self.buildDwarf()
- self.do_test ()
-
- def do_test (self):
- exe = os.path.join (os.getcwd(), "a.out")
-
- self.runCmd("target create %s" % exe)
-
- # Create the target
- target = self.dbg.CreateTarget(exe)
-
- # Create any breakpoints we need
- breakpoint = target.BreakpointCreateBySourceRegex ('break here', lldb.SBFileSpec ("main.cpp", False))
- self.assertTrue(breakpoint, VALID_BREAKPOINT)
-
- self.runCmd("process launch -G true -w %s -- fi*.tx?" % (os.getcwd()))
-
- process = self.process()
-
- self.assertTrue(process.GetState() == lldb.eStateStopped,
- STOPPED_DUE_TO_BREAKPOINT)
-
- thread = process.GetThreadAtIndex (0)
-
- self.assertTrue (thread.IsValid(),
- "Process stopped at 'main' should have a valid thread");
-
- stop_reason = thread.GetStopReason()
-
- self.assertTrue (stop_reason == lldb.eStopReasonBreakpoint,
- "Thread in process stopped in 'main' should have a stop reason of eStopReasonBreakpoint");
-
- self.expect("frame variable argv[1]", substrs=['file1.txt'])
- self.expect("frame variable argv[2]", substrs=['file2.txt'])
- self.expect("frame variable argv[3]", substrs=['file3.txt'])
- self.expect("frame variable argv[4]", substrs=['file4.txy'])
- self.expect("frame variable argv[5]", substrs=['file5.tyx'], matching=False)
-
-if __name__ == '__main__':
- import atexit
- lldb.SBDebugger.Initialize()
- atexit.register(lambda: lldb.SBDebugger.Terminate())
- unittest2.main()
-
Copied: lldb/trunk/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py (from r230042, lldb/trunk/test/functionalities/launch_with_glob/TestLaunchWithGlob.py)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py?p2=lldb/trunk/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py&p1=lldb/trunk/test/functionalities/launch_with_glob/TestLaunchWithGlob.py&r1=230042&r2=230077&rev=230077&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/launch_with_glob/TestLaunchWithGlob.py (original)
+++ lldb/trunk/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py Fri Feb 20 16:20:30 2015
@@ -9,7 +9,7 @@ import unittest2
from lldbtest import *
import lldbutil
-class LaunchWithGlobTestCase(TestBase):
+class LaunchWithShellExpandTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -21,7 +21,7 @@ class LaunchWithGlobTestCase(TestBase):
self.do_test ()
- @expectedFailureFreeBSD("llvm.org/pr22627 process launch w/ glob not working")
+ @expectedFailureFreeBSD("llvm.org/pr22627 process launch w/ shell expansion not working")
@dwarf_test
def test_with_dwarf (self):
self.buildDwarf()
@@ -39,7 +39,7 @@ class LaunchWithGlobTestCase(TestBase):
breakpoint = target.BreakpointCreateBySourceRegex ('break here', lldb.SBFileSpec ("main.cpp", False))
self.assertTrue(breakpoint, VALID_BREAKPOINT)
- self.runCmd("process launch -G true -w %s -- fi*.tx?" % (os.getcwd()))
+ self.runCmd("process launch -X true -w %s -- fi*.tx?" % (os.getcwd()))
process = self.process()
More information about the lldb-commits
mailing list