summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/CommandInterpreter.cpp
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2012-10-05 05:29:32 +0000
committerJason Molenda <jmolenda@apple.com>2012-10-05 05:29:32 +0000
commit4cddfedf53647cb9b515a7c979b4c6da76a99460 (patch)
treee2a10789a8cf522d5930b5e9c0ee23c0b604adad /lldb/source/Interpreter/CommandInterpreter.cpp
parenta8805d3809cbd6ed37cf15d82aa8334b520cc6bf (diff)
downloadbcm5719-llvm-4cddfedf53647cb9b515a7c979b4c6da76a99460.tar.gz
bcm5719-llvm-4cddfedf53647cb9b515a7c979b4c6da76a99460.zip
Change the "bt" command alias defined in CommandInterpreter::LoadCommandDictionary.
It is now a regex command alias that more faithfully emulates gdb's behavior, most importantly, "bt 5" will backtrace 5 frames of the currently selected thread. "bt all" still backtraces all threads (unlike gdb) and for users who have learned to use "bt -c 5", that form is still accepted. llvm-svn: 165300
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 44ba511ed5b..c387c3d03a1 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -156,10 +156,6 @@ CommandInterpreter::Initialize ()
if (cmd_obj_sp)
AddAlias ("b", cmd_obj_sp);
- cmd_obj_sp = GetCommandSPExact ("thread backtrace", false);
- if (cmd_obj_sp)
- AddAlias ("bt", cmd_obj_sp);
-
cmd_obj_sp = GetCommandSPExact ("thread step-inst", false);
if (cmd_obj_sp)
{
@@ -494,6 +490,26 @@ CommandInterpreter::LoadCommandDictionary ()
}
}
+ std::auto_ptr<CommandObjectRegexCommand>
+ bt_regex_cmd_ap(new CommandObjectRegexCommand (*this,
+ "bt",
+ "Show a backtrace. An optional argument is accepted; if that argument is a number, it specifies the number of frames to display. If that argument is 'all', full backtraces of all threads are displayed.",
+ "bt [<digit>|all]", 2));
+ if (bt_regex_cmd_ap.get())
+ {
+ // accept but don't document "bt -c <number>" -- before bt was a regex command if you wanted to backtrace
+ // three frames you would do "bt -c 3" but the intention is to have this emulate the gdb "bt" command and
+ // so now "bt 3" is the preferred form, in line with gdb.
+ if (bt_regex_cmd_ap->AddRegexCommand("^([[:digit:]]+)$", "thread backtrace -c %1") &&
+ bt_regex_cmd_ap->AddRegexCommand("^-c ([[:digit:]]+)$", "thread backtrace -c %1") &&
+ bt_regex_cmd_ap->AddRegexCommand("^all$", "thread backtrace all") &&
+ bt_regex_cmd_ap->AddRegexCommand("^$", "thread backtrace"))
+ {
+ CommandObjectSP command_sp(bt_regex_cmd_ap.release());
+ m_command_dict[command_sp->GetCommandName ()] = command_sp;
+ }
+ }
+
}
int
OpenPOWER on IntegriCloud