diff options
author | Johnny Chen <johnny.chen@apple.com> | 2012-05-26 00:32:39 +0000 |
---|---|---|
committer | Johnny Chen <johnny.chen@apple.com> | 2012-05-26 00:32:39 +0000 |
commit | ca7835c685ca98909666ae8094737163a6f8734b (patch) | |
tree | 318e3c0f06e664b3930c3bc4c56ac392480a08a4 /lldb/source/Interpreter/CommandObject.cpp | |
parent | de22182b339a8746221ab09f67f1b39b5912e109 (diff) | |
download | bcm5719-llvm-ca7835c685ca98909666ae8094737163a6f8734b.tar.gz bcm5719-llvm-ca7835c685ca98909666ae8094737163a6f8734b.zip |
rdar://problem/11535045
Make 'help arch' return the list of supported architectures.
Add a convenience method StringList::Join(const char *separator) which is called from the help function for 'arch'.
Also add a simple test case.
llvm-svn: 157507
Diffstat (limited to 'lldb/source/Interpreter/CommandObject.cpp')
-rw-r--r-- | lldb/source/Interpreter/CommandObject.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp index a087eca1eec..c86bb5e9f7e 100644 --- a/lldb/source/Interpreter/CommandObject.cpp +++ b/lldb/source/Interpreter/CommandObject.cpp @@ -17,6 +17,7 @@ #include <ctype.h> #include "lldb/Core/Address.h" +#include "lldb/Core/ArchSpec.h" #include "lldb/Interpreter/Options.h" // These are for the Sourcename completers. @@ -845,13 +846,24 @@ CommandObject::GetArgumentDescriptionAsCString (const lldb::CommandArgumentType return NULL; } +static +const char *arch_helper() +{ + StringList archs; + ArchSpec::AutoComplete(NULL, archs); + StreamString ss; + ss.Printf("These are the supported architecture names:\n"); + ss.Printf("%s\n", archs.Join("\n")); + return ss.GetData(); +} + CommandObject::ArgumentTableEntry CommandObject::g_arguments_data[] = { { eArgTypeAddress, "address", CommandCompletions::eNoCompletion, { NULL, false }, "A valid address in the target program's execution space." }, { eArgTypeAliasName, "alias-name", CommandCompletions::eNoCompletion, { NULL, false }, "The name of an abbreviation (alias) for a debugger command." }, { eArgTypeAliasOptions, "options-for-aliased-command", CommandCompletions::eNoCompletion, { NULL, false }, "Command options to be used as part of an alias (abbreviation) definition. (See 'help commands alias' for more information.)" }, - { eArgTypeArchitecture, "arch", CommandCompletions::eArchitectureCompletion, { NULL, false }, "The architecture name, e.g. i386 or x86_64." }, + { eArgTypeArchitecture, "arch", CommandCompletions::eArchitectureCompletion, { arch_helper, true }, "The architecture name, e.g. i386 or x86_64." }, { eArgTypeBoolean, "boolean", CommandCompletions::eNoCompletion, { NULL, false }, "A Boolean value: 'true' or 'false'" }, { eArgTypeBreakpointID, "breakpt-id", CommandCompletions::eNoCompletion, { BreakpointIDHelpTextCallback, false }, NULL }, { eArgTypeBreakpointIDRange, "breakpt-id-list", CommandCompletions::eNoCompletion, { BreakpointIDRangeHelpTextCallback, false }, NULL }, |