Added the ability for users to create new regex commands.
To do this currently, it must be done in multi-line mode:
(lldb) commands regex --help "Help text for command" --syntax "syntax for command" <cmd-name>
Any example that would use "f" for "finish" when there are no arguments,
and "f <num>" to do a "frame select <num>" would be:
(lldb) commands regex f
Enter multiple regular expressions in the form s/find/replace/ then terminate with an empty line:
s/^$/finish/
s/([0-9]+)/frame select %1/
(lldb) f 11
frame select 12
...
(lldb) f
finish
...
Also added the string version of the OptionValue as OptionValueString.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@129855 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Interpreter/CommandInterpreter.cpp b/source/Interpreter/CommandInterpreter.cpp
index 9506152..cac5dae 100644
--- a/source/Interpreter/CommandInterpreter.cpp
+++ b/source/Interpreter/CommandInterpreter.cpp
@@ -356,6 +356,24 @@
return ret_val;
}
+bool
+CommandInterpreter::AddCommand (const char *name, const lldb::CommandObjectSP &cmd_sp, bool can_replace)
+{
+ if (name && name[0])
+ {
+ std::string name_sstr(name);
+ if (!can_replace)
+ {
+ if (m_command_dict.find (name_sstr) != m_command_dict.end())
+ return false;
+ }
+ m_command_dict[name_sstr] = cmd_sp;
+ return true;
+ }
+ return false;
+}
+
+
CommandObjectSP
CommandInterpreter::GetCommandSPExact (const char *cmd_cstr, bool include_aliases)
{