Added a 'jump' command, similar to GDBs.
This allows the PC to be directly changed to a different line.
It's similar to the example python script in examples/python/jump.py, except implemented as a builtin.
Also this version will track the current function correctly even if the target line resolves to multiple addresses. (e.g. debugging a templated function)
llvm-svn: 190572
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 16243f9..67ca12f 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -228,6 +228,13 @@
AddAlias ("t", cmd_obj_sp);
}
+ cmd_obj_sp = GetCommandSPExact ("_regexp-jump",false);
+ if (cmd_obj_sp)
+ {
+ AddAlias ("j", cmd_obj_sp);
+ AddAlias ("jump", cmd_obj_sp);
+ }
+
cmd_obj_sp = GetCommandSPExact ("_regexp-list", false);
if (cmd_obj_sp)
{
@@ -618,6 +625,26 @@
}
}
+ std::unique_ptr<CommandObjectRegexCommand>
+ jump_regex_cmd_ap(new CommandObjectRegexCommand (*this,
+ "_regexp-jump",
+ "Sets the program counter to a new address.",
+ "_regexp-jump [<line>]\n"
+ "_regexp-jump [<+-lineoffset>]\n"
+ "_regexp-jump [<file>:<line>]\n"
+ "_regexp-jump [*<addr>]\n", 2));
+ if (jump_regex_cmd_ap.get())
+ {
+ if (jump_regex_cmd_ap->AddRegexCommand("^\\*(.*)$", "thread jump --addr %1") &&
+ jump_regex_cmd_ap->AddRegexCommand("^([0-9]+)$", "thread jump --line %1") &&
+ jump_regex_cmd_ap->AddRegexCommand("^([^:]+):([0-9]+)$", "thread jump --file %1 --line %2") &&
+ jump_regex_cmd_ap->AddRegexCommand("^([+\\-][0-9]+)$", "thread jump --by %1"))
+ {
+ CommandObjectSP jump_regex_cmd_sp(jump_regex_cmd_ap.release());
+ m_command_dict[jump_regex_cmd_sp->GetCommandName ()] = jump_regex_cmd_sp;
+ }
+ }
+
}
int