Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1 | //===-- CommandObject.cpp ---------------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #include "lldb/Interpreter/CommandObject.h" |
| 11 | |
| 12 | #include <string> |
| 13 | #include <map> |
| 14 | |
| 15 | #include <getopt.h> |
| 16 | #include <stdlib.h> |
| 17 | #include <ctype.h> |
| 18 | |
| 19 | #include "lldb/Core/Address.h" |
Jim Ingham | 84cdc15 | 2010-06-15 19:49:27 +0000 | [diff] [blame] | 20 | #include "lldb/Interpreter/Options.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 21 | |
| 22 | // These are for the Sourcename completers. |
| 23 | // FIXME: Make a separate file for the completers. |
Greg Clayton | 5f54ac3 | 2011-02-08 05:05:52 +0000 | [diff] [blame] | 24 | #include "lldb/Host/FileSpec.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 25 | #include "lldb/Core/FileSpecList.h" |
| 26 | #include "lldb/Target/Process.h" |
| 27 | #include "lldb/Target/Target.h" |
| 28 | |
| 29 | #include "lldb/Interpreter/CommandInterpreter.h" |
| 30 | #include "lldb/Interpreter/CommandReturnObject.h" |
| 31 | #include "lldb/Interpreter/ScriptInterpreter.h" |
| 32 | #include "lldb/Interpreter/ScriptInterpreterPython.h" |
| 33 | |
| 34 | using namespace lldb; |
| 35 | using namespace lldb_private; |
| 36 | |
| 37 | //------------------------------------------------------------------------- |
| 38 | // CommandObject |
| 39 | //------------------------------------------------------------------------- |
| 40 | |
Greg Clayton | 238c0a1 | 2010-09-18 01:14:36 +0000 | [diff] [blame] | 41 | CommandObject::CommandObject |
| 42 | ( |
| 43 | CommandInterpreter &interpreter, |
| 44 | const char *name, |
| 45 | const char *help, |
| 46 | const char *syntax, |
| 47 | uint32_t flags |
| 48 | ) : |
| 49 | m_interpreter (interpreter), |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 50 | m_cmd_name (name), |
| 51 | m_cmd_help_short (), |
| 52 | m_cmd_help_long (), |
| 53 | m_cmd_syntax (), |
Jim Ingham | d40f8a6 | 2010-07-06 22:46:59 +0000 | [diff] [blame] | 54 | m_is_alias (false), |
Caroline Tice | fb35511 | 2010-10-01 17:46:38 +0000 | [diff] [blame] | 55 | m_flags (flags), |
| 56 | m_arguments() |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 57 | { |
| 58 | if (help && help[0]) |
| 59 | m_cmd_help_short = help; |
| 60 | if (syntax && syntax[0]) |
| 61 | m_cmd_syntax = syntax; |
| 62 | } |
| 63 | |
| 64 | CommandObject::~CommandObject () |
| 65 | { |
| 66 | } |
| 67 | |
| 68 | const char * |
| 69 | CommandObject::GetHelp () |
| 70 | { |
| 71 | return m_cmd_help_short.c_str(); |
| 72 | } |
| 73 | |
| 74 | const char * |
| 75 | CommandObject::GetHelpLong () |
| 76 | { |
| 77 | return m_cmd_help_long.c_str(); |
| 78 | } |
| 79 | |
| 80 | const char * |
| 81 | CommandObject::GetSyntax () |
| 82 | { |
Caroline Tice | fb35511 | 2010-10-01 17:46:38 +0000 | [diff] [blame] | 83 | if (m_cmd_syntax.length() == 0) |
| 84 | { |
| 85 | StreamString syntax_str; |
| 86 | syntax_str.Printf ("%s", GetCommandName()); |
| 87 | if (GetOptions() != NULL) |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 88 | syntax_str.Printf (" <cmd-options>"); |
Caroline Tice | fb35511 | 2010-10-01 17:46:38 +0000 | [diff] [blame] | 89 | if (m_arguments.size() > 0) |
| 90 | { |
| 91 | syntax_str.Printf (" "); |
| 92 | GetFormattedCommandArguments (syntax_str); |
| 93 | } |
| 94 | m_cmd_syntax = syntax_str.GetData (); |
| 95 | } |
| 96 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 97 | return m_cmd_syntax.c_str(); |
| 98 | } |
| 99 | |
| 100 | const char * |
| 101 | CommandObject::Translate () |
| 102 | { |
| 103 | //return m_cmd_func_name.c_str(); |
| 104 | return "This function is currently not implemented."; |
| 105 | } |
| 106 | |
| 107 | const char * |
| 108 | CommandObject::GetCommandName () |
| 109 | { |
| 110 | return m_cmd_name.c_str(); |
| 111 | } |
| 112 | |
| 113 | void |
| 114 | CommandObject::SetCommandName (const char *name) |
| 115 | { |
| 116 | m_cmd_name = name; |
| 117 | } |
| 118 | |
| 119 | void |
| 120 | CommandObject::SetHelp (const char *cstr) |
| 121 | { |
| 122 | m_cmd_help_short = cstr; |
| 123 | } |
| 124 | |
| 125 | void |
| 126 | CommandObject::SetHelpLong (const char *cstr) |
| 127 | { |
| 128 | m_cmd_help_long = cstr; |
| 129 | } |
| 130 | |
| 131 | void |
| 132 | CommandObject::SetSyntax (const char *cstr) |
| 133 | { |
| 134 | m_cmd_syntax = cstr; |
| 135 | } |
| 136 | |
| 137 | Options * |
| 138 | CommandObject::GetOptions () |
| 139 | { |
| 140 | // By default commands don't have options unless this virtual function |
| 141 | // is overridden by base classes. |
| 142 | return NULL; |
| 143 | } |
| 144 | |
| 145 | Flags& |
| 146 | CommandObject::GetFlags() |
| 147 | { |
| 148 | return m_flags; |
| 149 | } |
| 150 | |
| 151 | const Flags& |
| 152 | CommandObject::GetFlags() const |
| 153 | { |
| 154 | return m_flags; |
| 155 | } |
| 156 | |
| 157 | bool |
| 158 | CommandObject::ExecuteCommandString |
| 159 | ( |
| 160 | const char *command_line, |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 161 | CommandReturnObject &result |
| 162 | ) |
| 163 | { |
| 164 | Args command_args(command_line); |
Greg Clayton | 238c0a1 | 2010-09-18 01:14:36 +0000 | [diff] [blame] | 165 | return ExecuteWithOptions (command_args, result); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 166 | } |
| 167 | |
| 168 | bool |
| 169 | CommandObject::ParseOptions |
| 170 | ( |
| 171 | Args& args, |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 172 | CommandReturnObject &result |
| 173 | ) |
| 174 | { |
| 175 | // See if the subclass has options? |
| 176 | Options *options = GetOptions(); |
| 177 | if (options != NULL) |
| 178 | { |
| 179 | Error error; |
Greg Clayton | 24bc5d9 | 2011-03-30 18:16:51 +0000 | [diff] [blame] | 180 | options->Reset(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 181 | |
| 182 | // ParseOptions calls getopt_long, which always skips the zero'th item in the array and starts at position 1, |
| 183 | // so we need to push a dummy value into position zero. |
| 184 | args.Unshift("dummy_string"); |
| 185 | error = args.ParseOptions (*options); |
| 186 | |
| 187 | // The "dummy_string" will have already been removed by ParseOptions, |
| 188 | // so no need to remove it. |
| 189 | |
| 190 | if (error.Fail() || !options->VerifyOptions (result)) |
| 191 | { |
| 192 | const char *error_cstr = error.AsCString(); |
| 193 | if (error_cstr) |
| 194 | { |
| 195 | // We got an error string, lets use that |
| 196 | result.GetErrorStream().PutCString(error_cstr); |
| 197 | } |
| 198 | else |
| 199 | { |
| 200 | // No error string, output the usage information into result |
Greg Clayton | f15996e | 2011-04-07 22:46:35 +0000 | [diff] [blame] | 201 | options->GenerateOptionUsage (result.GetErrorStream(), this); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 202 | } |
| 203 | // Set the return status to failed (this was an error). |
| 204 | result.SetStatus (eReturnStatusFailed); |
| 205 | return false; |
| 206 | } |
| 207 | } |
| 208 | return true; |
| 209 | } |
| 210 | bool |
Greg Clayton | 238c0a1 | 2010-09-18 01:14:36 +0000 | [diff] [blame] | 211 | CommandObject::ExecuteWithOptions (Args& args, CommandReturnObject &result) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 212 | { |
| 213 | for (size_t i = 0; i < args.GetArgumentCount(); ++i) |
| 214 | { |
| 215 | const char *tmp_str = args.GetArgumentAtIndex (i); |
| 216 | if (tmp_str[0] == '`') // back-quote |
Greg Clayton | 238c0a1 | 2010-09-18 01:14:36 +0000 | [diff] [blame] | 217 | args.ReplaceArgumentAtIndex (i, m_interpreter.ProcessEmbeddedScriptCommands (tmp_str)); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 218 | } |
| 219 | |
Greg Clayton | e71e258 | 2011-02-04 01:58:07 +0000 | [diff] [blame] | 220 | if (GetFlags().AnySet (CommandObject::eFlagProcessMustBeLaunched | CommandObject::eFlagProcessMustBePaused)) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 221 | { |
Greg Clayton | b72d0f0 | 2011-04-12 05:54:46 +0000 | [diff] [blame^] | 222 | Process *process = m_interpreter.GetExecutionContext().process; |
Greg Clayton | e71e258 | 2011-02-04 01:58:07 +0000 | [diff] [blame] | 223 | if (process == NULL) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 224 | { |
| 225 | result.AppendError ("Process must exist."); |
| 226 | result.SetStatus (eReturnStatusFailed); |
| 227 | return false; |
| 228 | } |
Greg Clayton | e71e258 | 2011-02-04 01:58:07 +0000 | [diff] [blame] | 229 | else |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 230 | { |
Greg Clayton | e71e258 | 2011-02-04 01:58:07 +0000 | [diff] [blame] | 231 | StateType state = process->GetState(); |
| 232 | |
| 233 | switch (state) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 234 | { |
Greg Clayton | 4fdf760 | 2011-03-20 04:57:14 +0000 | [diff] [blame] | 235 | case eStateInvalid: |
Greg Clayton | e71e258 | 2011-02-04 01:58:07 +0000 | [diff] [blame] | 236 | case eStateSuspended: |
| 237 | case eStateCrashed: |
| 238 | case eStateStopped: |
| 239 | break; |
| 240 | |
| 241 | case eStateConnected: |
| 242 | case eStateAttaching: |
| 243 | case eStateLaunching: |
| 244 | case eStateDetached: |
| 245 | case eStateExited: |
| 246 | case eStateUnloaded: |
| 247 | if (GetFlags().Test(CommandObject::eFlagProcessMustBeLaunched)) |
| 248 | { |
| 249 | result.AppendError ("Process must be launched."); |
| 250 | result.SetStatus (eReturnStatusFailed); |
| 251 | return false; |
| 252 | } |
| 253 | break; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 254 | |
Greg Clayton | e71e258 | 2011-02-04 01:58:07 +0000 | [diff] [blame] | 255 | case eStateRunning: |
| 256 | case eStateStepping: |
| 257 | if (GetFlags().Test(CommandObject::eFlagProcessMustBePaused)) |
| 258 | { |
| 259 | result.AppendError ("Process is running. Use 'process interrupt' to pause execution."); |
| 260 | result.SetStatus (eReturnStatusFailed); |
| 261 | return false; |
| 262 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 263 | } |
| 264 | } |
| 265 | } |
| 266 | |
Greg Clayton | 238c0a1 | 2010-09-18 01:14:36 +0000 | [diff] [blame] | 267 | if (!ParseOptions (args, result)) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 268 | return false; |
| 269 | |
| 270 | // Call the command-specific version of 'Execute', passing it the already processed arguments. |
Greg Clayton | 238c0a1 | 2010-09-18 01:14:36 +0000 | [diff] [blame] | 271 | return Execute (args, result); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 272 | } |
| 273 | |
| 274 | class CommandDictCommandPartialMatch |
| 275 | { |
| 276 | public: |
| 277 | CommandDictCommandPartialMatch (const char *match_str) |
| 278 | { |
| 279 | m_match_str = match_str; |
| 280 | } |
| 281 | bool operator() (const std::pair<std::string, lldb::CommandObjectSP> map_element) const |
| 282 | { |
| 283 | // A NULL or empty string matches everything. |
| 284 | if (m_match_str == NULL || *m_match_str == '\0') |
| 285 | return 1; |
| 286 | |
| 287 | size_t found = map_element.first.find (m_match_str, 0); |
| 288 | if (found == std::string::npos) |
| 289 | return 0; |
| 290 | else |
| 291 | return found == 0; |
| 292 | } |
| 293 | |
| 294 | private: |
| 295 | const char *m_match_str; |
| 296 | }; |
| 297 | |
| 298 | int |
| 299 | CommandObject::AddNamesMatchingPartialString (CommandObject::CommandMap &in_map, const char *cmd_str, |
| 300 | StringList &matches) |
| 301 | { |
| 302 | int number_added = 0; |
| 303 | CommandDictCommandPartialMatch matcher(cmd_str); |
| 304 | |
| 305 | CommandObject::CommandMap::iterator matching_cmds = std::find_if (in_map.begin(), in_map.end(), matcher); |
| 306 | |
| 307 | while (matching_cmds != in_map.end()) |
| 308 | { |
| 309 | ++number_added; |
| 310 | matches.AppendString((*matching_cmds).first.c_str()); |
| 311 | matching_cmds = std::find_if (++matching_cmds, in_map.end(), matcher);; |
| 312 | } |
| 313 | return number_added; |
| 314 | } |
| 315 | |
| 316 | int |
| 317 | CommandObject::HandleCompletion |
| 318 | ( |
| 319 | Args &input, |
| 320 | int &cursor_index, |
| 321 | int &cursor_char_position, |
| 322 | int match_start_point, |
| 323 | int max_return_elements, |
Jim Ingham | 802f8b0 | 2010-06-30 05:02:46 +0000 | [diff] [blame] | 324 | bool &word_complete, |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 325 | StringList &matches |
| 326 | ) |
| 327 | { |
| 328 | if (WantsRawCommandString()) |
| 329 | { |
| 330 | // FIXME: Abstract telling the completion to insert the completion character. |
| 331 | matches.Clear(); |
| 332 | return -1; |
| 333 | } |
| 334 | else |
| 335 | { |
| 336 | // Can we do anything generic with the options? |
| 337 | Options *cur_options = GetOptions(); |
| 338 | CommandReturnObject result; |
| 339 | OptionElementVector opt_element_vector; |
| 340 | |
| 341 | if (cur_options != NULL) |
| 342 | { |
| 343 | // Re-insert the dummy command name string which will have been |
| 344 | // stripped off: |
| 345 | input.Unshift ("dummy-string"); |
| 346 | cursor_index++; |
| 347 | |
| 348 | |
| 349 | // I stick an element on the end of the input, because if the last element is |
| 350 | // option that requires an argument, getopt_long will freak out. |
| 351 | |
| 352 | input.AppendArgument ("<FAKE-VALUE>"); |
| 353 | |
Jim Ingham | adb8429 | 2010-06-24 20:31:04 +0000 | [diff] [blame] | 354 | input.ParseArgsForCompletion (*cur_options, opt_element_vector, cursor_index); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 355 | |
| 356 | input.DeleteArgumentAtIndex(input.GetArgumentCount() - 1); |
| 357 | |
| 358 | bool handled_by_options; |
Greg Clayton | f15996e | 2011-04-07 22:46:35 +0000 | [diff] [blame] | 359 | handled_by_options = cur_options->HandleOptionCompletion (input, |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 360 | opt_element_vector, |
| 361 | cursor_index, |
| 362 | cursor_char_position, |
| 363 | match_start_point, |
| 364 | max_return_elements, |
Jim Ingham | 802f8b0 | 2010-06-30 05:02:46 +0000 | [diff] [blame] | 365 | word_complete, |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 366 | matches); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 367 | if (handled_by_options) |
| 368 | return matches.GetSize(); |
| 369 | } |
| 370 | |
| 371 | // If we got here, the last word is not an option or an option argument. |
Greg Clayton | 238c0a1 | 2010-09-18 01:14:36 +0000 | [diff] [blame] | 372 | return HandleArgumentCompletion (input, |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 373 | cursor_index, |
| 374 | cursor_char_position, |
| 375 | opt_element_vector, |
| 376 | match_start_point, |
| 377 | max_return_elements, |
Jim Ingham | 802f8b0 | 2010-06-30 05:02:46 +0000 | [diff] [blame] | 378 | word_complete, |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 379 | matches); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 380 | } |
| 381 | } |
| 382 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 383 | bool |
Greg Clayton | 238c0a1 | 2010-09-18 01:14:36 +0000 | [diff] [blame] | 384 | CommandObject::HelpTextContainsWord (const char *search_word) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 385 | { |
| 386 | const char *short_help; |
| 387 | const char *long_help; |
| 388 | const char *syntax_help; |
| 389 | std::string options_usage_help; |
| 390 | |
| 391 | |
| 392 | bool found_word = false; |
| 393 | |
| 394 | short_help = GetHelp(); |
| 395 | long_help = GetHelpLong(); |
| 396 | syntax_help = GetSyntax(); |
| 397 | |
Caroline Tice | 3439178 | 2010-10-12 22:16:53 +0000 | [diff] [blame] | 398 | if (strcasestr (short_help, search_word)) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 399 | found_word = true; |
Caroline Tice | 3439178 | 2010-10-12 22:16:53 +0000 | [diff] [blame] | 400 | else if (strcasestr (long_help, search_word)) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 401 | found_word = true; |
Caroline Tice | 3439178 | 2010-10-12 22:16:53 +0000 | [diff] [blame] | 402 | else if (strcasestr (syntax_help, search_word)) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 403 | found_word = true; |
| 404 | |
| 405 | if (!found_word |
| 406 | && GetOptions() != NULL) |
| 407 | { |
| 408 | StreamString usage_help; |
Greg Clayton | f15996e | 2011-04-07 22:46:35 +0000 | [diff] [blame] | 409 | GetOptions()->GenerateOptionUsage (usage_help, this); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 410 | if (usage_help.GetSize() > 0) |
| 411 | { |
| 412 | const char *usage_text = usage_help.GetData(); |
Caroline Tice | 3439178 | 2010-10-12 22:16:53 +0000 | [diff] [blame] | 413 | if (strcasestr (usage_text, search_word)) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 414 | found_word = true; |
| 415 | } |
| 416 | } |
| 417 | |
| 418 | return found_word; |
| 419 | } |
Caroline Tice | fb35511 | 2010-10-01 17:46:38 +0000 | [diff] [blame] | 420 | |
| 421 | int |
| 422 | CommandObject::GetNumArgumentEntries () |
| 423 | { |
| 424 | return m_arguments.size(); |
| 425 | } |
| 426 | |
| 427 | CommandObject::CommandArgumentEntry * |
| 428 | CommandObject::GetArgumentEntryAtIndex (int idx) |
| 429 | { |
| 430 | if (idx < m_arguments.size()) |
| 431 | return &(m_arguments[idx]); |
| 432 | |
| 433 | return NULL; |
| 434 | } |
| 435 | |
| 436 | CommandObject::ArgumentTableEntry * |
| 437 | CommandObject::FindArgumentDataByType (CommandArgumentType arg_type) |
| 438 | { |
| 439 | const ArgumentTableEntry *table = CommandObject::GetArgumentTable(); |
| 440 | |
| 441 | for (int i = 0; i < eArgTypeLastArg; ++i) |
| 442 | if (table[i].arg_type == arg_type) |
| 443 | return (ArgumentTableEntry *) &(table[i]); |
| 444 | |
| 445 | return NULL; |
| 446 | } |
| 447 | |
| 448 | void |
| 449 | CommandObject::GetArgumentHelp (Stream &str, CommandArgumentType arg_type, CommandInterpreter &interpreter) |
| 450 | { |
| 451 | const ArgumentTableEntry* table = CommandObject::GetArgumentTable(); |
| 452 | ArgumentTableEntry *entry = (ArgumentTableEntry *) &(table[arg_type]); |
| 453 | |
| 454 | // The table is *supposed* to be kept in arg_type order, but someone *could* have messed it up... |
| 455 | |
| 456 | if (entry->arg_type != arg_type) |
| 457 | entry = CommandObject::FindArgumentDataByType (arg_type); |
| 458 | |
| 459 | if (!entry) |
| 460 | return; |
| 461 | |
| 462 | StreamString name_str; |
| 463 | name_str.Printf ("<%s>", entry->arg_name); |
| 464 | |
| 465 | if (entry->help_function != NULL) |
| 466 | interpreter.OutputFormattedHelpText (str, name_str.GetData(), "--", (*(entry->help_function)) (), |
| 467 | name_str.GetSize()); |
| 468 | else |
| 469 | interpreter.OutputFormattedHelpText (str, name_str.GetData(), "--", entry->help_text, name_str.GetSize()); |
| 470 | } |
| 471 | |
| 472 | const char * |
| 473 | CommandObject::GetArgumentName (CommandArgumentType arg_type) |
| 474 | { |
Caroline Tice | 4d6675c | 2010-10-01 19:59:14 +0000 | [diff] [blame] | 475 | ArgumentTableEntry *entry = (ArgumentTableEntry *) &(CommandObject::GetArgumentTable()[arg_type]); |
| 476 | |
| 477 | // The table is *supposed* to be kept in arg_type order, but someone *could* have messed it up... |
| 478 | |
| 479 | if (entry->arg_type != arg_type) |
| 480 | entry = CommandObject::FindArgumentDataByType (arg_type); |
| 481 | |
Johnny Chen | 25ca984 | 2010-10-08 22:01:52 +0000 | [diff] [blame] | 482 | if (entry) |
| 483 | return entry->arg_name; |
| 484 | |
| 485 | StreamString str; |
| 486 | str << "Arg name for type (" << arg_type << ") not in arg table!"; |
| 487 | return str.GetData(); |
Caroline Tice | fb35511 | 2010-10-01 17:46:38 +0000 | [diff] [blame] | 488 | } |
| 489 | |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 490 | bool |
Greg Clayton | b344843 | 2011-03-24 21:19:54 +0000 | [diff] [blame] | 491 | CommandObject::IsPairType (ArgumentRepetitionType arg_repeat_type) |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 492 | { |
| 493 | if ((arg_repeat_type == eArgRepeatPairPlain) |
| 494 | || (arg_repeat_type == eArgRepeatPairOptional) |
| 495 | || (arg_repeat_type == eArgRepeatPairPlus) |
| 496 | || (arg_repeat_type == eArgRepeatPairStar) |
| 497 | || (arg_repeat_type == eArgRepeatPairRange) |
| 498 | || (arg_repeat_type == eArgRepeatPairRangeOptional)) |
| 499 | return true; |
| 500 | |
| 501 | return false; |
| 502 | } |
| 503 | |
Caroline Tice | fb35511 | 2010-10-01 17:46:38 +0000 | [diff] [blame] | 504 | void |
| 505 | CommandObject::GetFormattedCommandArguments (Stream &str) |
| 506 | { |
| 507 | int num_args = m_arguments.size(); |
| 508 | for (int i = 0; i < num_args; ++i) |
| 509 | { |
| 510 | if (i > 0) |
| 511 | str.Printf (" "); |
| 512 | CommandArgumentEntry arg_entry = m_arguments[i]; |
| 513 | int num_alternatives = arg_entry.size(); |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 514 | |
| 515 | if ((num_alternatives == 2) |
| 516 | && IsPairType (arg_entry[0].arg_repetition)) |
Caroline Tice | fb35511 | 2010-10-01 17:46:38 +0000 | [diff] [blame] | 517 | { |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 518 | const char *first_name = GetArgumentName (arg_entry[0].arg_type); |
| 519 | const char *second_name = GetArgumentName (arg_entry[1].arg_type); |
| 520 | switch (arg_entry[0].arg_repetition) |
| 521 | { |
| 522 | case eArgRepeatPairPlain: |
| 523 | str.Printf ("<%s> <%s>", first_name, second_name); |
| 524 | break; |
| 525 | case eArgRepeatPairOptional: |
| 526 | str.Printf ("[<%s> <%s>]", first_name, second_name); |
| 527 | break; |
| 528 | case eArgRepeatPairPlus: |
| 529 | str.Printf ("<%s> <%s> [<%s> <%s> [...]]", first_name, second_name, first_name, second_name); |
| 530 | break; |
| 531 | case eArgRepeatPairStar: |
| 532 | str.Printf ("[<%s> <%s> [<%s> <%s> [...]]]", first_name, second_name, first_name, second_name); |
| 533 | break; |
| 534 | case eArgRepeatPairRange: |
| 535 | str.Printf ("<%s_1> <%s_1> ... <%s_n> <%s_n>", first_name, second_name, first_name, second_name); |
| 536 | break; |
| 537 | case eArgRepeatPairRangeOptional: |
| 538 | str.Printf ("[<%s_1> <%s_1> ... <%s_n> <%s_n>]", first_name, second_name, first_name, second_name); |
| 539 | break; |
Caroline Tice | b577284 | 2011-03-23 22:31:13 +0000 | [diff] [blame] | 540 | // Explicitly test for all the rest of the cases, so if new types get added we will notice the |
| 541 | // missing case statement(s). |
| 542 | case eArgRepeatPlain: |
| 543 | case eArgRepeatOptional: |
| 544 | case eArgRepeatPlus: |
| 545 | case eArgRepeatStar: |
| 546 | case eArgRepeatRange: |
| 547 | // These should not be reached, as they should fail the IsPairType test above. |
| 548 | break; |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 549 | } |
Caroline Tice | fb35511 | 2010-10-01 17:46:38 +0000 | [diff] [blame] | 550 | } |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 551 | else |
Caroline Tice | fb35511 | 2010-10-01 17:46:38 +0000 | [diff] [blame] | 552 | { |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 553 | StreamString names; |
| 554 | for (int j = 0; j < num_alternatives; ++j) |
| 555 | { |
| 556 | if (j > 0) |
| 557 | names.Printf (" | "); |
| 558 | names.Printf ("%s", GetArgumentName (arg_entry[j].arg_type)); |
| 559 | } |
| 560 | switch (arg_entry[0].arg_repetition) |
| 561 | { |
| 562 | case eArgRepeatPlain: |
| 563 | str.Printf ("<%s>", names.GetData()); |
| 564 | break; |
| 565 | case eArgRepeatPlus: |
| 566 | str.Printf ("<%s> [<%s> [...]]", names.GetData(), names.GetData()); |
| 567 | break; |
| 568 | case eArgRepeatStar: |
| 569 | str.Printf ("[<%s> [<%s> [...]]]", names.GetData(), names.GetData()); |
| 570 | break; |
| 571 | case eArgRepeatOptional: |
| 572 | str.Printf ("[<%s>]", names.GetData()); |
| 573 | break; |
| 574 | case eArgRepeatRange: |
| 575 | str.Printf ("<%s_1> .. <%s_n>", names.GetData()); |
Caroline Tice | b577284 | 2011-03-23 22:31:13 +0000 | [diff] [blame] | 576 | break; |
| 577 | // Explicitly test for all the rest of the cases, so if new types get added we will notice the |
| 578 | // missing case statement(s). |
| 579 | case eArgRepeatPairPlain: |
| 580 | case eArgRepeatPairOptional: |
| 581 | case eArgRepeatPairPlus: |
| 582 | case eArgRepeatPairStar: |
| 583 | case eArgRepeatPairRange: |
| 584 | case eArgRepeatPairRangeOptional: |
| 585 | // These should not be hit, as they should pass the IsPairType test above, and control should |
| 586 | // have gone into the other branch of the if statement. |
| 587 | break; |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 588 | } |
Caroline Tice | fb35511 | 2010-10-01 17:46:38 +0000 | [diff] [blame] | 589 | } |
| 590 | } |
| 591 | } |
| 592 | |
Stephen Wilson | 47f0785 | 2011-03-23 02:12:10 +0000 | [diff] [blame] | 593 | CommandArgumentType |
Caroline Tice | fb35511 | 2010-10-01 17:46:38 +0000 | [diff] [blame] | 594 | CommandObject::LookupArgumentName (const char *arg_name) |
| 595 | { |
| 596 | CommandArgumentType return_type = eArgTypeLastArg; |
| 597 | |
| 598 | std::string arg_name_str (arg_name); |
| 599 | size_t len = arg_name_str.length(); |
| 600 | if (arg_name[0] == '<' |
| 601 | && arg_name[len-1] == '>') |
| 602 | arg_name_str = arg_name_str.substr (1, len-2); |
| 603 | |
| 604 | for (int i = 0; i < eArgTypeLastArg; ++i) |
| 605 | if (arg_name_str.compare (g_arguments_data[i].arg_name) == 0) |
| 606 | return_type = g_arguments_data[i].arg_type; |
| 607 | |
| 608 | return return_type; |
| 609 | } |
| 610 | |
| 611 | static const char * |
| 612 | BreakpointIDHelpTextCallback () |
| 613 | { |
| 614 | return "Breakpoint ID's consist major and minor numbers; the major number corresponds to the single entity that was created with a 'breakpoint set' command; the minor numbers correspond to all the locations that were actually found/set based on the major breakpoint. A full breakpoint ID might look like 3.14, meaning the 14th location set for the 3rd breakpoint. You can specify all the locations of a breakpoint by just indicating the major breakpoint number. A valid breakpoint id consists either of just the major id number, or the major number, a dot, and the location number (e.g. 3 or 3.2 could both be valid breakpoint ids)."; |
| 615 | } |
| 616 | |
| 617 | static const char * |
| 618 | BreakpointIDRangeHelpTextCallback () |
| 619 | { |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 620 | return "A 'breakpoint id list' is a manner of specifying multiple breakpoints. This can be done through several mechanisms. The easiest way is to just enter a space-separated list of breakpoint ids. To specify all the breakpoint locations under a major breakpoint, you can use the major breakpoint number followed by '.*', eg. '5.*' means all the locations under breakpoint 5. You can also indicate a range of breakpoints by using <start-bp-id> - <end-bp-id>. The start-bp-id and end-bp-id for a range can be any valid breakpoint ids. It is not legal, however, to specify a range using specific locations that cross major breakpoint numbers. I.e. 3.2 - 3.7 is legal; 2 - 5 is legal; but 3.2 - 4.4 is not legal."; |
Caroline Tice | fb35511 | 2010-10-01 17:46:38 +0000 | [diff] [blame] | 621 | } |
| 622 | |
Greg Clayton | aa378b1 | 2011-02-20 02:15:07 +0000 | [diff] [blame] | 623 | const char * |
| 624 | CommandObject::GetArgumentTypeAsCString (const lldb::CommandArgumentType arg_type) |
| 625 | { |
| 626 | if (arg_type >=0 && arg_type < eArgTypeLastArg) |
| 627 | return g_arguments_data[arg_type].arg_name; |
| 628 | return NULL; |
| 629 | |
| 630 | } |
| 631 | |
| 632 | const char * |
| 633 | CommandObject::GetArgumentDescriptionAsCString (const lldb::CommandArgumentType arg_type) |
| 634 | { |
| 635 | if (arg_type >=0 && arg_type < eArgTypeLastArg) |
| 636 | return g_arguments_data[arg_type].help_text; |
| 637 | return NULL; |
| 638 | } |
| 639 | |
Caroline Tice | fb35511 | 2010-10-01 17:46:38 +0000 | [diff] [blame] | 640 | CommandObject::ArgumentTableEntry |
| 641 | CommandObject::g_arguments_data[] = |
| 642 | { |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 643 | { eArgTypeAddress, "address", CommandCompletions::eNoCompletion, NULL, "A valid address in the target program's execution space." }, |
| 644 | { eArgTypeAliasName, "alias-name", CommandCompletions::eNoCompletion, NULL, "The name of an abbreviation (alias) for a debugger command." }, |
Greg Clayton | 8f6be2a | 2010-10-09 01:40:57 +0000 | [diff] [blame] | 645 | { eArgTypeAliasOptions, "options-for-aliased-command", CommandCompletions::eNoCompletion, NULL, "Command options to be used as part of an alias (abbreviation) definition. (See 'help commands alias' for more information.)" }, |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 646 | { eArgTypeArchitecture, "arch", CommandCompletions::eNoCompletion, NULL, "The architecture name, e.g. i386 or x86_64." }, |
Caroline Tice | 4d6675c | 2010-10-01 19:59:14 +0000 | [diff] [blame] | 647 | { eArgTypeBoolean, "boolean", CommandCompletions::eNoCompletion, NULL, "A Boolean value: 'true' or 'false'" }, |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 648 | { eArgTypeBreakpointID, "breakpt-id", CommandCompletions::eNoCompletion, BreakpointIDHelpTextCallback, NULL }, |
| 649 | { eArgTypeBreakpointIDRange, "breakpt-id-list", CommandCompletions::eNoCompletion, BreakpointIDRangeHelpTextCallback, NULL }, |
| 650 | { eArgTypeByteSize, "byte-size", CommandCompletions::eNoCompletion, NULL, "Number of bytes to use." }, |
Jim Ingham | 4a9d790 | 2011-03-11 01:50:30 +0000 | [diff] [blame] | 651 | { eArgTypeClassName, "class-name", CommandCompletions::eNoCompletion, NULL, "Then name of a class from the debug information in the program." }, |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 652 | { eArgTypeCommandName, "cmd-name", CommandCompletions::eNoCompletion, NULL, "A debugger command (may be multiple words), without any options or arguments." }, |
Caroline Tice | 4d6675c | 2010-10-01 19:59:14 +0000 | [diff] [blame] | 653 | { eArgTypeCount, "count", CommandCompletions::eNoCompletion, NULL, "An unsigned integer." }, |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 654 | { eArgTypeEndAddress, "end-address", CommandCompletions::eNoCompletion, NULL, "Help text goes here." }, |
| 655 | { eArgTypeExpression, "expr", CommandCompletions::eNoCompletion, NULL, "Help text goes here." }, |
Caroline Tice | 4d6675c | 2010-10-01 19:59:14 +0000 | [diff] [blame] | 656 | { eArgTypeExprFormat, "expression-format", CommandCompletions::eNoCompletion, NULL, "[ [bool|b] | [bin] | [char|c] | [oct|o] | [dec|i|d|u] | [hex|x] | [float|f] | [cstr|s] ]" }, |
Jim Ingham | 949d5ac | 2011-02-18 00:54:25 +0000 | [diff] [blame] | 657 | { eArgTypeFilename, "filename", CommandCompletions::eDiskFileCompletion, NULL, "The name of a file (can include path)." }, |
Caroline Tice | fb35511 | 2010-10-01 17:46:38 +0000 | [diff] [blame] | 658 | { eArgTypeFormat, "format", CommandCompletions::eNoCompletion, NULL, "Help text goes here." }, |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 659 | { eArgTypeFrameIndex, "frame-index", CommandCompletions::eNoCompletion, NULL, "Index into a thread's list of frames." }, |
| 660 | { eArgTypeFullName, "fullname", CommandCompletions::eNoCompletion, NULL, "Help text goes here." }, |
| 661 | { eArgTypeFunctionName, "function-name", CommandCompletions::eNoCompletion, NULL, "The name of a function." }, |
| 662 | { eArgTypeIndex, "index", CommandCompletions::eNoCompletion, NULL, "An index into a list." }, |
| 663 | { eArgTypeLineNum, "linenum", CommandCompletions::eNoCompletion, NULL, "Line number in a source file." }, |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 664 | { eArgTypeLogCategory, "log-category", CommandCompletions::eNoCompletion, NULL, "The name of a category within a log channel, e.g. all (try \"log list\" to see a list of all channels and their categories." }, |
| 665 | { eArgTypeLogChannel, "log-channel", CommandCompletions::eNoCompletion, NULL, "The name of a log channel, e.g. process.gdb-remote (try \"log list\" to see a list of all channels and their categories)." }, |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 666 | { eArgTypeMethod, "method", CommandCompletions::eNoCompletion, NULL, "A C++ method name." }, |
Caroline Tice | fb35511 | 2010-10-01 17:46:38 +0000 | [diff] [blame] | 667 | { eArgTypeName, "name", CommandCompletions::eNoCompletion, NULL, "Help text goes here." }, |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 668 | { eArgTypeNewPathPrefix, "new-path-prefix", CommandCompletions::eNoCompletion, NULL, "Help text goes here." }, |
| 669 | { eArgTypeNumLines, "num-lines", CommandCompletions::eNoCompletion, NULL, "The number of lines to use." }, |
| 670 | { eArgTypeNumberPerLine, "number-per-line", CommandCompletions::eNoCompletion, NULL, "The number of items per line to display." }, |
Caroline Tice | fb35511 | 2010-10-01 17:46:38 +0000 | [diff] [blame] | 671 | { eArgTypeOffset, "offset", CommandCompletions::eNoCompletion, NULL, "Help text goes here." }, |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 672 | { eArgTypeOldPathPrefix, "old-path-prefix", CommandCompletions::eNoCompletion, NULL, "Help text goes here." }, |
Jim Ingham | 4a9d790 | 2011-03-11 01:50:30 +0000 | [diff] [blame] | 673 | { eArgTypeOneLiner, "one-line-command", CommandCompletions::eNoCompletion, NULL, "A command that is entered as a single line of text." }, |
Caroline Tice | fb35511 | 2010-10-01 17:46:38 +0000 | [diff] [blame] | 674 | { eArgTypePath, "path", CommandCompletions::eNoCompletion, NULL, "Help text goes here." }, |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 675 | { eArgTypePid, "pid", CommandCompletions::eNoCompletion, NULL, "The process ID number." }, |
Caroline Tice | fb35511 | 2010-10-01 17:46:38 +0000 | [diff] [blame] | 676 | { eArgTypePlugin, "plugin", CommandCompletions::eNoCompletion, NULL, "Help text goes here." }, |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 677 | { eArgTypeProcessName, "process-name", CommandCompletions::eNoCompletion, NULL, "The name of the process." }, |
| 678 | { eArgTypeQueueName, "queue-name", CommandCompletions::eNoCompletion, NULL, "The name of the thread queue." }, |
| 679 | { eArgTypeRegisterName, "register-name", CommandCompletions::eNoCompletion, NULL, "A register name." }, |
| 680 | { eArgTypeRegularExpression, "regular-expression", CommandCompletions::eNoCompletion, NULL, "A regular expression." }, |
| 681 | { eArgTypeRunArgs, "run-args", CommandCompletions::eNoCompletion, NULL, "Arguments to be passed to the target program when it starts executing." }, |
Caroline Tice | fb35511 | 2010-10-01 17:46:38 +0000 | [diff] [blame] | 682 | { eArgTypeRunMode, "run-mode", CommandCompletions::eNoCompletion, NULL, "Help text goes here." }, |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 683 | { eArgTypeScriptLang, "script-language", CommandCompletions::eNoCompletion, NULL, "The scripting language to be used for script-based commands. Currently only Python is valid." }, |
| 684 | { eArgTypeSearchWord, "search-word", CommandCompletions::eNoCompletion, NULL, "The word for which you wish to search for information about." }, |
| 685 | { eArgTypeSelector, "selector", CommandCompletions::eNoCompletion, NULL, "An Objective-C selector name." }, |
| 686 | { eArgTypeSettingIndex, "setting-index", CommandCompletions::eNoCompletion, NULL, "An index into a settings variable that is an array (try 'settings list' to see all the possible settings variables and their types)." }, |
| 687 | { eArgTypeSettingKey, "setting-key", CommandCompletions::eNoCompletion, NULL, "A key into a settings variables that is a dictionary (try 'settings list' to see all the possible settings variables and their types)." }, |
| 688 | { eArgTypeSettingPrefix, "setting-prefix", CommandCompletions::eNoCompletion, NULL, "The name of a settable internal debugger variable up to a dot ('.'), e.g. 'target.process.'" }, |
Caroline Tice | 3a62e6d | 2010-10-18 22:56:57 +0000 | [diff] [blame] | 689 | { eArgTypeSettingVariableName, "setting-variable-name", CommandCompletions::eNoCompletion, NULL, "The name of a settable internal debugger variable. Type 'settings list' to see a complete list of such variables." }, |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 690 | { eArgTypeShlibName, "shlib-name", CommandCompletions::eNoCompletion, NULL, "The name of a shared library." }, |
Jim Ingham | 4a9d790 | 2011-03-11 01:50:30 +0000 | [diff] [blame] | 691 | { eArgTypeSourceFile, "source-file", CommandCompletions::eSourceFileCompletion, NULL, "The name of a source file.." }, |
Greg Clayton | 8f6be2a | 2010-10-09 01:40:57 +0000 | [diff] [blame] | 692 | { eArgTypeSortOrder, "sort-order", CommandCompletions::eNoCompletion, NULL, "Specify a sort order when dumping lists." }, |
Caroline Tice | fb35511 | 2010-10-01 17:46:38 +0000 | [diff] [blame] | 693 | { eArgTypeStartAddress, "start-address", CommandCompletions::eNoCompletion, NULL, "Help text goes here." }, |
Jim Ingham | 4a9d790 | 2011-03-11 01:50:30 +0000 | [diff] [blame] | 694 | { eArgTypeSymbol, "symbol", CommandCompletions::eSymbolCompletion, NULL, "Any symbol name (function name, variable, argument, etc.)" }, |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 695 | { eArgTypeThreadID, "thread-id", CommandCompletions::eNoCompletion, NULL, "Thread ID number." }, |
| 696 | { eArgTypeThreadIndex, "thread-index", CommandCompletions::eNoCompletion, NULL, "Index into the process' list of threads." }, |
| 697 | { eArgTypeThreadName, "thread-name", CommandCompletions::eNoCompletion, NULL, "The thread's name." }, |
Caroline Tice | 3a62e6d | 2010-10-18 22:56:57 +0000 | [diff] [blame] | 698 | { eArgTypeUnixSignal, "unix-signal", CommandCompletions::eNoCompletion, NULL, "A valid Unix signal name or number (e.g. SIGKILL, KILL or 9)." }, |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 699 | { eArgTypeVarName, "variable-name", CommandCompletions::eNoCompletion, NULL, "The name of a variable in your program." }, |
| 700 | { eArgTypeValue, "value", CommandCompletions::eNoCompletion, NULL, "A value could be anything, depending on where and how it is used." }, |
Caroline Tice | fb35511 | 2010-10-01 17:46:38 +0000 | [diff] [blame] | 701 | { eArgTypeWidth, "width", CommandCompletions::eNoCompletion, NULL, "Help text goes here." }, |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 702 | { eArgTypeNone, "none", CommandCompletions::eNoCompletion, NULL, "No help available for this." }, |
Caroline Tice | fb35511 | 2010-10-01 17:46:38 +0000 | [diff] [blame] | 703 | }; |
| 704 | |
| 705 | const CommandObject::ArgumentTableEntry* |
| 706 | CommandObject::GetArgumentTable () |
| 707 | { |
Greg Clayton | aa378b1 | 2011-02-20 02:15:07 +0000 | [diff] [blame] | 708 | // If this assertion fires, then the table above is out of date with the CommandArgumentType enumeration |
| 709 | assert ((sizeof (CommandObject::g_arguments_data) / sizeof (CommandObject::ArgumentTableEntry)) == eArgTypeLastArg); |
Caroline Tice | fb35511 | 2010-10-01 17:46:38 +0000 | [diff] [blame] | 710 | return CommandObject::g_arguments_data; |
| 711 | } |
| 712 | |
| 713 | |