summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2013-02-01 23:33:03 +0000
committerGreg Clayton <gclayton@apple.com>2013-02-01 23:33:03 +0000
commit6bade327dccc44ca8ab82ef5381441a390d97a9a (patch)
treeff3fca87d7ed9f7ffa4b12fc997df82cd53fc45a
parentcc99a2f61d4d502daf6da2f3221cc58fe6c3d2b9 (diff)
downloadbcm5719-llvm-6bade327dccc44ca8ab82ef5381441a390d97a9a.tar.gz
bcm5719-llvm-6bade327dccc44ca8ab82ef5381441a390d97a9a.zip
<rdar://problem/13050227>
Added a regular expression command called "_regexp-list" which mimics the GDB "line" command in the following forms: LINENUM, to list around that line in current file, FILE:LINENUM, to list around that line in that file, FUNCTION, to list around beginning of that function, *ADDRESS, to list around the line containing that address. ADDRESS, same as above, but don't require a '*' as long as ADDRESS is hex llvm-svn: 174233
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 62c11974d9c..6f83ede8ff3 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -220,7 +220,7 @@ CommandInterpreter::Initialize ()
AddAlias ("t", cmd_obj_sp);
}
- cmd_obj_sp = GetCommandSPExact ("source list", false);
+ cmd_obj_sp = GetCommandSPExact ("_regexp-list", false);
if (cmd_obj_sp)
{
AddAlias ("l", cmd_obj_sp);
@@ -580,6 +580,24 @@ CommandInterpreter::LoadCommandDictionary ()
}
}
+ std::auto_ptr<CommandObjectRegexCommand>
+ list_regex_cmd_ap(new CommandObjectRegexCommand (*this,
+ "_regexp-list",
+ "Implements the GDB 'list' command in all of its forms except FILE:FUNCTION and maps them to the appropriate 'source list' commands.",
+ "_regexp-list [<line>]\n_regexp-attach [<file>:<line>]\n_regexp-attach [<file>:<line>]", 2));
+ if (list_regex_cmd_ap.get())
+ {
+ if (list_regex_cmd_ap->AddRegexCommand("^([0-9]+)[[:space:]]*$", "source list --line %1") &&
+ list_regex_cmd_ap->AddRegexCommand("^(.*[^[:space:]])[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*$", "source list --file '%1' --line %2") &&
+ list_regex_cmd_ap->AddRegexCommand("^\\*?(0x[[:xdigit:]]+)[[:space:]]*$", "source list --address %1") &&
+ list_regex_cmd_ap->AddRegexCommand("^(.+)$", "source list --name \"%1\"") &&
+ list_regex_cmd_ap->AddRegexCommand("^$", "source list"))
+ {
+ CommandObjectSP list_regex_cmd_sp(list_regex_cmd_ap.release());
+ m_command_dict[list_regex_cmd_sp->GetCommandName ()] = list_regex_cmd_sp;
+ }
+ }
+
}
int
OpenPOWER on IntegriCloud