diff options
author | Johnny Chen <johnny.chen@apple.com> | 2012-08-24 18:15:45 +0000 |
---|---|---|
committer | Johnny Chen <johnny.chen@apple.com> | 2012-08-24 18:15:45 +0000 |
commit | 6d675243b4685e2610fbbd1d79bb68da11f4128a (patch) | |
tree | 9360e2280633e6fcdbb7305b7e00b284eb75fa73 /lldb/source/Interpreter/CommandInterpreter.cpp | |
parent | cf10446ffa5e2abd0af6c757ecfc266352b95c4c (diff) | |
download | bcm5719-llvm-6d675243b4685e2610fbbd1d79bb68da11f4128a.tar.gz bcm5719-llvm-6d675243b4685e2610fbbd1d79bb68da11f4128a.zip |
rdar://problem/11811338
Add 'attach <pid>|<process-name>' command to lldb, as well as 'detach' which is an alias of 'process detach'.
Add two completion test cases for "attach" and "detach".
llvm-svn: 162573
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r-- | lldb/source/Interpreter/CommandInterpreter.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 7ea69a320cf..bbd18b94c12 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -132,12 +132,18 @@ CommandInterpreter::Initialize () AddAlias ("exit", cmd_obj_sp); } - cmd_obj_sp = GetCommandSPExact ("process attach", false); + cmd_obj_sp = GetCommandSPExact ("_regexp-attach",false); if (cmd_obj_sp) { AddAlias ("attach", cmd_obj_sp); } + cmd_obj_sp = GetCommandSPExact ("process detach",false); + if (cmd_obj_sp) + { + AddAlias ("detach", cmd_obj_sp); + } + cmd_obj_sp = GetCommandSPExact ("process continue", false); if (cmd_obj_sp) { @@ -381,6 +387,21 @@ CommandInterpreter::LoadCommandDictionary () } std::auto_ptr<CommandObjectRegexCommand> + attach_regex_cmd_ap(new CommandObjectRegexCommand (*this, + "_regexp-attach", + "Attach to a process id if in decimal, otherwise treat the argument as a process name to attach to.", + "_regexp-attach [<pid>]\n_regexp-attach [<process-name>]", 2)); + if (attach_regex_cmd_ap.get()) + { + if (attach_regex_cmd_ap->AddRegexCommand("^([0-9]+)$", "process attach --pid %1") && + attach_regex_cmd_ap->AddRegexCommand("^(.*[^[:space:]])[[:space:]]*$", "process attach --name '%1'")) + { + CommandObjectSP attach_regex_cmd_sp(attach_regex_cmd_ap.release()); + m_command_dict[attach_regex_cmd_sp->GetCommandName ()] = attach_regex_cmd_sp; + } + } + + std::auto_ptr<CommandObjectRegexCommand> down_regex_cmd_ap(new CommandObjectRegexCommand (*this, "_regexp-down", "Go down \"n\" frames in the stack (1 frame by default).", |