diff options
author | Greg Clayton <gclayton@apple.com> | 2011-11-15 03:53:30 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2011-11-15 03:53:30 +0000 |
commit | 144f3a9c90f8434b51b544042397718a3f09ac1f (patch) | |
tree | 781ac0d9a76d930a490277849774e129c0a64e37 /lldb/source/Interpreter/Args.cpp | |
parent | 9c0de9bb6b5158e8e45876e978370bed9519c01c (diff) | |
download | bcm5719-llvm-144f3a9c90f8434b51b544042397718a3f09ac1f.tar.gz bcm5719-llvm-144f3a9c90f8434b51b544042397718a3f09ac1f.zip |
Added a new class to Process.h: ProcessAttachInfo. This class contains enough
info for us to attach by pid, or by name and will also allow us to eventually
do a lot more powerful attaches. If you look at the options for the "platform
process list" command, there are many options which we should be able to
specify. This will allow us to do things like "attach to a process named 'tcsh'
that has a parent process ID of 123", or "attach to a process named 'x' which
has an effective user ID of 345".
I finished up the --shell implementation so that it can be used without the
--tty option in "process launch". The "--shell" option now can take an
optional argument which is the path to the shell to use (or a partial name
like "sh" which we will find using the current PATH environment variable).
Modified the Process::Attach to use the new ProcessAttachInfo as the sole
argument and centralized a lot of code that was in the "process attach"
Execute function so that everyone can take advantage of the powerful new
attach functionality.
llvm-svn: 144615
Diffstat (limited to 'lldb/source/Interpreter/Args.cpp')
-rw-r--r-- | lldb/source/Interpreter/Args.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lldb/source/Interpreter/Args.cpp b/lldb/source/Interpreter/Args.cpp index 50b43b1678c..f32b25c9127 100644 --- a/lldb/source/Interpreter/Args.cpp +++ b/lldb/source/Interpreter/Args.cpp @@ -864,6 +864,26 @@ Args::StringToVersion (const char *s, uint32_t &major, uint32_t &minor, uint32_t return 0; } +const char * +Args::GetShellSafeArgument (const char *unsafe_arg, std::string &safe_arg) +{ + safe_arg.assign (unsafe_arg); + size_t prev_pos = 0; + while (prev_pos < safe_arg.size()) + { + // Escape spaces and quotes + size_t pos = safe_arg.find_first_of(" '\"", prev_pos); + if (pos != std::string::npos) + { + safe_arg.insert (pos, 1, '\\'); + prev_pos = pos + 2; + } + else + break; + } + return safe_arg.c_str(); +} + int32_t Args::StringToOptionEnum (const char *s, OptionEnumValueElement *enum_values, int32_t fail_value, Error &error) |