Modified all Process::Launch() calls to use a ProcessLaunchInfo structure
on internal only (public API hasn't changed) to simplify the paramter list
to the launch calls down into just one argument. Also all of the argument,
envronment and stdio things are now handled in a much more centralized fashion.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@143656 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Interpreter/Args.cpp b/source/Interpreter/Args.cpp
index 592b0ef..50b43b1 100644
--- a/source/Interpreter/Args.cpp
+++ b/source/Interpreter/Args.cpp
@@ -476,6 +476,16 @@
AppendArgument(rhs.GetArgumentAtIndex(i));
}
+void
+Args::AppendArguments (const char **argv)
+{
+ if (argv)
+ {
+ for (uint32_t i=0; argv[i]; ++i)
+ AppendArgument(argv[i]);
+ }
+}
+
const char *
Args::AppendArgument (const char *arg_cstr, char quote_char)
{
@@ -560,10 +570,8 @@
m_args.clear();
m_args_quote_char.clear();
- // Make a copy of the arguments in our internal buffer
- size_t i;
// First copy each string
- for (i=0; i<argc; ++i)
+ for (size_t i=0; i<argc; ++i)
{
m_args.push_back (argv[i]);
if ((argv[i][0] == '\'') || (argv[i][0] == '"') || (argv[i][0] == '`'))
@@ -575,6 +583,30 @@
UpdateArgvFromArgs();
}
+void
+Args::SetArguments (const char **argv)
+{
+ // m_argv will be rebuilt in UpdateArgvFromArgs() below, so there is
+ // no need to clear it here.
+ m_args.clear();
+ m_args_quote_char.clear();
+
+ if (argv)
+ {
+ // First copy each string
+ for (size_t i=0; argv[i]; ++i)
+ {
+ m_args.push_back (argv[i]);
+ if ((argv[i][0] == '\'') || (argv[i][0] == '"') || (argv[i][0] == '`'))
+ m_args_quote_char.push_back (argv[i][0]);
+ else
+ m_args_quote_char.push_back ('\0');
+ }
+ }
+
+ UpdateArgvFromArgs();
+}
+
Error
Args::ParseOptions (Options &options)