summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/CommandInterpreter.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2013-02-12 18:52:24 +0000
committerGreg Clayton <gclayton@apple.com>2013-02-12 18:52:24 +0000
commitef5651d93fd6468182356ab55d703771b33884e0 (patch)
tree66c47b8e476e11230fad2b18c9ef87819005ea85 /lldb/source/Interpreter/CommandInterpreter.cpp
parent0da6d71b54ea408866c7f96565b585638bd57653 (diff)
downloadbcm5719-llvm-ef5651d93fd6468182356ab55d703771b33884e0.tar.gz
bcm5719-llvm-ef5651d93fd6468182356ab55d703771b33884e0.zip
<rdar://problem/13178743>
Added a new "env" regular expression alias. If "env" is typed on its own "settings show target.env-vars" will be run. Otherwise it can be used to set and environment variable: "env FOO=BAR". llvm-svn: 174991
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 4ba0031806b..89ed5641acf 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -227,6 +227,12 @@ CommandInterpreter::Initialize ()
AddAlias ("list", cmd_obj_sp);
}
+ cmd_obj_sp = GetCommandSPExact ("_regexp-env", false);
+ if (cmd_obj_sp)
+ {
+ AddAlias ("env", cmd_obj_sp);
+ }
+
cmd_obj_sp = GetCommandSPExact ("memory read", false);
if (cmd_obj_sp)
AddAlias ("x", cmd_obj_sp);
@@ -600,6 +606,21 @@ CommandInterpreter::LoadCommandDictionary ()
}
}
+ std::auto_ptr<CommandObjectRegexCommand>
+ env_regex_cmd_ap(new CommandObjectRegexCommand (*this,
+ "_regexp-env",
+ "Implements a shortcut to viewing and setting environment variables.",
+ "_regexp-env\n_regexp-env FOO=BAR", 2));
+ if (env_regex_cmd_ap.get())
+ {
+ if (env_regex_cmd_ap->AddRegexCommand("^$", "settings show target.env-vars") &&
+ env_regex_cmd_ap->AddRegexCommand("^([A-Za-z_][A-Za-z_0-9]*=.*)$", "settings set target.env-vars %1"))
+ {
+ CommandObjectSP env_regex_cmd_sp(env_regex_cmd_ap.release());
+ m_command_dict[env_regex_cmd_sp->GetCommandName ()] = env_regex_cmd_sp;
+ }
+ }
+
}
int
OpenPOWER on IntegriCloud