1254721Semaste//===-- CommandObject.h -----------------------------------------*- C++ -*-===// 2254721Semaste// 3254721Semaste// The LLVM Compiler Infrastructure 4254721Semaste// 5254721Semaste// This file is distributed under the University of Illinois Open Source 6254721Semaste// License. See LICENSE.TXT for details. 7254721Semaste// 8254721Semaste//===----------------------------------------------------------------------===// 9254721Semaste 10254721Semaste#ifndef liblldb_CommandObject_h_ 11254721Semaste#define liblldb_CommandObject_h_ 12254721Semaste 13254721Semaste#include <map> 14254721Semaste#include <set> 15254721Semaste#include <string> 16254721Semaste#include <vector> 17254721Semaste 18254721Semaste#include "lldb/lldb-private.h" 19254721Semaste#include "lldb/Interpreter/Args.h" 20254721Semaste#include "lldb/Interpreter/CommandCompletions.h" 21254721Semaste#include "lldb/Core/StringList.h" 22254721Semaste#include "lldb/Core/Flags.h" 23254721Semaste#include "lldb/Host/Mutex.h" 24254721Semaste#include "lldb/Target/ExecutionContext.h" 25254721Semaste 26254721Semastenamespace lldb_private { 27254721Semaste 28254721Semasteclass CommandObject 29254721Semaste{ 30254721Semastepublic: 31254721Semaste 32254721Semaste typedef const char *(ArgumentHelpCallbackFunction) (); 33254721Semaste 34254721Semaste struct ArgumentHelpCallback 35254721Semaste { 36254721Semaste ArgumentHelpCallbackFunction *help_callback; 37254721Semaste bool self_formatting; 38254721Semaste 39254721Semaste const char* 40254721Semaste operator () () const 41254721Semaste { 42254721Semaste return (*help_callback)(); 43254721Semaste } 44254721Semaste 45254721Semaste operator bool() const 46254721Semaste { 47254721Semaste return (help_callback != NULL); 48254721Semaste } 49254721Semaste 50254721Semaste }; 51254721Semaste 52254721Semaste struct ArgumentTableEntry // Entries in the main argument information table 53254721Semaste { 54254721Semaste lldb::CommandArgumentType arg_type; 55254721Semaste const char *arg_name; 56254721Semaste CommandCompletions::CommonCompletionTypes completion_type; 57254721Semaste ArgumentHelpCallback help_function; 58254721Semaste const char *help_text; 59254721Semaste }; 60254721Semaste 61254721Semaste struct CommandArgumentData // Used to build individual command argument lists 62254721Semaste { 63254721Semaste lldb::CommandArgumentType arg_type; 64254721Semaste ArgumentRepetitionType arg_repetition; 65254721Semaste uint32_t arg_opt_set_association; // This arg might be associated only with some particular option set(s). 66254721Semaste CommandArgumentData(): 67254721Semaste arg_type(lldb::eArgTypeNone), 68254721Semaste arg_repetition(eArgRepeatPlain), 69254721Semaste arg_opt_set_association(LLDB_OPT_SET_ALL) // By default, the arg associates to all option sets. 70254721Semaste {} 71254721Semaste }; 72254721Semaste 73254721Semaste typedef std::vector<CommandArgumentData> CommandArgumentEntry; // Used to build individual command argument lists 74254721Semaste 75254721Semaste static ArgumentTableEntry g_arguments_data[lldb::eArgTypeLastArg]; // Main argument information table 76254721Semaste 77254721Semaste typedef std::map<std::string, lldb::CommandObjectSP> CommandMap; 78254721Semaste 79254721Semaste CommandObject (CommandInterpreter &interpreter, 80254721Semaste const char *name, 81254721Semaste const char *help = NULL, 82254721Semaste const char *syntax = NULL, 83254721Semaste uint32_t flags = 0); 84254721Semaste 85254721Semaste virtual 86254721Semaste ~CommandObject (); 87254721Semaste 88254721Semaste 89254721Semaste static const char * 90254721Semaste GetArgumentTypeAsCString (const lldb::CommandArgumentType arg_type); 91254721Semaste 92254721Semaste static const char * 93254721Semaste GetArgumentDescriptionAsCString (const lldb::CommandArgumentType arg_type); 94254721Semaste 95254721Semaste CommandInterpreter & 96254721Semaste GetCommandInterpreter () 97254721Semaste { 98254721Semaste return m_interpreter; 99254721Semaste } 100254721Semaste 101254721Semaste const char * 102254721Semaste GetHelp (); 103254721Semaste 104254721Semaste virtual const char * 105254721Semaste GetHelpLong (); 106254721Semaste 107254721Semaste const char * 108254721Semaste GetSyntax (); 109254721Semaste 110254721Semaste const char * 111254721Semaste GetCommandName (); 112254721Semaste 113254721Semaste void 114254721Semaste SetHelp (const char * str); 115254721Semaste 116254721Semaste void 117254721Semaste SetHelpLong (const char * str); 118254721Semaste 119254721Semaste void 120254721Semaste SetHelpLong (std::string str); 121254721Semaste 122254721Semaste void 123254721Semaste SetSyntax (const char *str); 124254721Semaste 125254721Semaste // override this to return true if you want to enable the user to delete 126254721Semaste // the Command object from the Command dictionary (aliases have their own 127254721Semaste // deletion scheme, so they do not need to care about this) 128254721Semaste virtual bool 129254721Semaste IsRemovable () const { return false; } 130254721Semaste 131254721Semaste bool 132254721Semaste IsAlias () { return m_is_alias; } 133254721Semaste 134254721Semaste void 135254721Semaste SetIsAlias (bool value) { m_is_alias = value; } 136254721Semaste 137254721Semaste virtual bool 138254721Semaste IsMultiwordObject () { return false; } 139254721Semaste 140254721Semaste virtual lldb::CommandObjectSP 141254721Semaste GetSubcommandSP (const char *sub_cmd, StringList *matches = NULL) 142254721Semaste { 143254721Semaste return lldb::CommandObjectSP(); 144254721Semaste } 145254721Semaste 146254721Semaste virtual CommandObject * 147254721Semaste GetSubcommandObject (const char *sub_cmd, StringList *matches = NULL) 148254721Semaste { 149254721Semaste return NULL; 150254721Semaste } 151254721Semaste 152254721Semaste virtual void 153254721Semaste AproposAllSubCommands (const char *prefix, 154254721Semaste const char *search_word, 155254721Semaste StringList &commands_found, 156254721Semaste StringList &commands_help) 157254721Semaste { 158254721Semaste } 159254721Semaste 160254721Semaste void 161254721Semaste GenerateHelpText (CommandReturnObject &result); 162254721Semaste 163254721Semaste virtual void 164254721Semaste GenerateHelpText (Stream &result); 165254721Semaste 166254721Semaste // this is needed in order to allow the SBCommand class to 167254721Semaste // transparently try and load subcommands - it will fail on 168254721Semaste // anything but a multiword command, but it avoids us doing 169254721Semaste // type checkings and casts 170254721Semaste virtual bool 171254721Semaste LoadSubCommand (const char *cmd_name, 172254721Semaste const lldb::CommandObjectSP& command_obj) 173254721Semaste { 174254721Semaste return false; 175254721Semaste } 176254721Semaste 177254721Semaste virtual bool 178254721Semaste WantsRawCommandString() = 0; 179254721Semaste 180254721Semaste // By default, WantsCompletion = !WantsRawCommandString. 181254721Semaste // Subclasses who want raw command string but desire, for example, 182254721Semaste // argument completion should override this method to return true. 183254721Semaste virtual bool 184254721Semaste WantsCompletion() { return !WantsRawCommandString(); } 185254721Semaste 186254721Semaste virtual Options * 187254721Semaste GetOptions (); 188254721Semaste 189254721Semaste static const ArgumentTableEntry* 190254721Semaste GetArgumentTable (); 191254721Semaste 192254721Semaste static lldb::CommandArgumentType 193254721Semaste LookupArgumentName (const char *arg_name); 194254721Semaste 195254721Semaste static ArgumentTableEntry * 196254721Semaste FindArgumentDataByType (lldb::CommandArgumentType arg_type); 197254721Semaste 198254721Semaste int 199254721Semaste GetNumArgumentEntries (); 200254721Semaste 201254721Semaste CommandArgumentEntry * 202254721Semaste GetArgumentEntryAtIndex (int idx); 203254721Semaste 204254721Semaste static void 205254721Semaste GetArgumentHelp (Stream &str, lldb::CommandArgumentType arg_type, CommandInterpreter &interpreter); 206254721Semaste 207254721Semaste static const char * 208254721Semaste GetArgumentName (lldb::CommandArgumentType arg_type); 209254721Semaste 210254721Semaste // Generates a nicely formatted command args string for help command output. 211254721Semaste // By default, all possible args are taken into account, for example, 212254721Semaste // '<expr | variable-name>'. This can be refined by passing a second arg 213254721Semaste // specifying which option set(s) we are interested, which could then, for 214254721Semaste // example, produce either '<expr>' or '<variable-name>'. 215254721Semaste void 216254721Semaste GetFormattedCommandArguments (Stream &str, uint32_t opt_set_mask = LLDB_OPT_SET_ALL); 217254721Semaste 218254721Semaste bool 219254721Semaste IsPairType (ArgumentRepetitionType arg_repeat_type); 220254721Semaste 221254721Semaste enum 222254721Semaste { 223254721Semaste //---------------------------------------------------------------------- 224254721Semaste // eFlagRequiresTarget 225254721Semaste // 226254721Semaste // Ensures a valid target is contained in m_exe_ctx prior to executing 227254721Semaste // the command. If a target doesn't exist or is invalid, the command 228254721Semaste // will fail and CommandObject::GetInvalidTargetDescription() will be 229254721Semaste // returned as the error. CommandObject subclasses can override the 230254721Semaste // virtual function for GetInvalidTargetDescription() to provide custom 231254721Semaste // strings when needed. 232254721Semaste //---------------------------------------------------------------------- 233254721Semaste eFlagRequiresTarget = (1u << 0), 234254721Semaste //---------------------------------------------------------------------- 235254721Semaste // eFlagRequiresProcess 236254721Semaste // 237254721Semaste // Ensures a valid process is contained in m_exe_ctx prior to executing 238254721Semaste // the command. If a process doesn't exist or is invalid, the command 239254721Semaste // will fail and CommandObject::GetInvalidProcessDescription() will be 240254721Semaste // returned as the error. CommandObject subclasses can override the 241254721Semaste // virtual function for GetInvalidProcessDescription() to provide custom 242254721Semaste // strings when needed. 243254721Semaste //---------------------------------------------------------------------- 244254721Semaste eFlagRequiresProcess = (1u << 1), 245254721Semaste //---------------------------------------------------------------------- 246254721Semaste // eFlagRequiresThread 247254721Semaste // 248254721Semaste // Ensures a valid thread is contained in m_exe_ctx prior to executing 249254721Semaste // the command. If a thread doesn't exist or is invalid, the command 250254721Semaste // will fail and CommandObject::GetInvalidThreadDescription() will be 251254721Semaste // returned as the error. CommandObject subclasses can override the 252254721Semaste // virtual function for GetInvalidThreadDescription() to provide custom 253254721Semaste // strings when needed. 254254721Semaste //---------------------------------------------------------------------- 255254721Semaste eFlagRequiresThread = (1u << 2), 256254721Semaste //---------------------------------------------------------------------- 257254721Semaste // eFlagRequiresFrame 258254721Semaste // 259254721Semaste // Ensures a valid frame is contained in m_exe_ctx prior to executing 260254721Semaste // the command. If a frame doesn't exist or is invalid, the command 261254721Semaste // will fail and CommandObject::GetInvalidFrameDescription() will be 262254721Semaste // returned as the error. CommandObject subclasses can override the 263254721Semaste // virtual function for GetInvalidFrameDescription() to provide custom 264254721Semaste // strings when needed. 265254721Semaste //---------------------------------------------------------------------- 266254721Semaste eFlagRequiresFrame = (1u << 3), 267254721Semaste //---------------------------------------------------------------------- 268254721Semaste // eFlagRequiresRegContext 269254721Semaste // 270254721Semaste // Ensures a valid register context (from the selected frame if there 271254721Semaste // is a frame in m_exe_ctx, or from the selected thread from m_exe_ctx) 272254721Semaste // is availble from m_exe_ctx prior to executing the command. If a 273254721Semaste // target doesn't exist or is invalid, the command will fail and 274254721Semaste // CommandObject::GetInvalidRegContextDescription() will be returned as 275254721Semaste // the error. CommandObject subclasses can override the virtual function 276254721Semaste // for GetInvalidRegContextDescription() to provide custom strings when 277254721Semaste // needed. 278254721Semaste //---------------------------------------------------------------------- 279254721Semaste eFlagRequiresRegContext = (1u << 4), 280254721Semaste //---------------------------------------------------------------------- 281254721Semaste // eFlagTryTargetAPILock 282254721Semaste // 283254721Semaste // Attempts to acquire the target lock if a target is selected in the 284254721Semaste // command interpreter. If the command object fails to acquire the API 285254721Semaste // lock, the command will fail with an appropriate error message. 286254721Semaste //---------------------------------------------------------------------- 287254721Semaste eFlagTryTargetAPILock = (1u << 5), 288254721Semaste //---------------------------------------------------------------------- 289254721Semaste // eFlagProcessMustBeLaunched 290254721Semaste // 291254721Semaste // Verifies that there is a launched process in m_exe_ctx, if there 292254721Semaste // isn't, the command will fail with an appropriate error message. 293254721Semaste //---------------------------------------------------------------------- 294254721Semaste eFlagProcessMustBeLaunched = (1u << 6), 295254721Semaste //---------------------------------------------------------------------- 296254721Semaste // eFlagProcessMustBePaused 297254721Semaste // 298254721Semaste // Verifies that there is a paused process in m_exe_ctx, if there 299254721Semaste // isn't, the command will fail with an appropriate error message. 300254721Semaste //---------------------------------------------------------------------- 301254721Semaste eFlagProcessMustBePaused = (1u << 7) 302254721Semaste }; 303254721Semaste 304254721Semaste bool 305254721Semaste ParseOptions (Args& args, CommandReturnObject &result); 306254721Semaste 307254721Semaste void 308254721Semaste SetCommandName (const char *name); 309254721Semaste 310254721Semaste // This function really deals with CommandObjectLists, but we didn't make a 311254721Semaste // CommandObjectList class, so I'm sticking it here. But we really should have 312254721Semaste // such a class. Anyway, it looks up the commands in the map that match the partial 313254721Semaste // string cmd_str, inserts the matches into matches, and returns the number added. 314254721Semaste 315254721Semaste static int 316254721Semaste AddNamesMatchingPartialString (CommandMap &in_map, const char *cmd_str, StringList &matches); 317254721Semaste 318254721Semaste //------------------------------------------------------------------ 319254721Semaste /// The input array contains a parsed version of the line. The insertion 320254721Semaste /// point is given by cursor_index (the index in input of the word containing 321254721Semaste /// the cursor) and cursor_char_position (the position of the cursor in that word.) 322254721Semaste /// This default version handles calling option argument completions and then calls 323254721Semaste /// HandleArgumentCompletion if the cursor is on an argument, not an option. 324254721Semaste /// Don't override this method, override HandleArgumentCompletion instead unless 325254721Semaste /// you have special reasons. 326254721Semaste /// 327254721Semaste /// @param[in] interpreter 328254721Semaste /// The command interpreter doing the completion. 329254721Semaste /// 330254721Semaste /// @param[in] input 331254721Semaste /// The command line parsed into words 332254721Semaste /// 333254721Semaste /// @param[in] cursor_index 334254721Semaste /// The index in \ainput of the word in which the cursor lies. 335254721Semaste /// 336254721Semaste /// @param[in] cursor_char_pos 337254721Semaste /// The character position of the cursor in its argument word. 338254721Semaste /// 339254721Semaste /// @param[in] match_start_point 340254721Semaste /// @param[in] match_return_elements 341254721Semaste /// FIXME: Not yet implemented... If there is a match that is expensive to compute, these are 342254721Semaste /// here to allow you to compute the completions in batches. Start the completion from \amatch_start_point, 343254721Semaste /// and return \amatch_return_elements elements. 344254721Semaste /// 345254721Semaste /// @param[out] word_complete 346254721Semaste /// \btrue if this is a complete option value (a space will be inserted after the 347254721Semaste /// completion.) \bfalse otherwise. 348254721Semaste /// 349254721Semaste /// @param[out] matches 350254721Semaste /// The array of matches returned. 351254721Semaste /// 352254721Semaste /// FIXME: This is the wrong return value, since we also need to make a distinction between 353254721Semaste /// total number of matches, and the window the user wants returned. 354254721Semaste /// 355254721Semaste /// @return 356254721Semaste /// \btrue if we were in an option, \bfalse otherwise. 357254721Semaste //------------------------------------------------------------------ 358254721Semaste virtual int 359254721Semaste HandleCompletion (Args &input, 360254721Semaste int &cursor_index, 361254721Semaste int &cursor_char_position, 362254721Semaste int match_start_point, 363254721Semaste int max_return_elements, 364254721Semaste bool &word_complete, 365254721Semaste StringList &matches); 366254721Semaste 367254721Semaste //------------------------------------------------------------------ 368254721Semaste /// The input array contains a parsed version of the line. The insertion 369254721Semaste /// point is given by cursor_index (the index in input of the word containing 370254721Semaste /// the cursor) and cursor_char_position (the position of the cursor in that word.) 371254721Semaste /// We've constructed the map of options and their arguments as well if that is 372254721Semaste /// helpful for the completion. 373254721Semaste /// 374254721Semaste /// @param[in] interpreter 375254721Semaste /// The command interpreter doing the completion. 376254721Semaste /// 377254721Semaste /// @param[in] input 378254721Semaste /// The command line parsed into words 379254721Semaste /// 380254721Semaste /// @param[in] cursor_index 381254721Semaste /// The index in \ainput of the word in which the cursor lies. 382254721Semaste /// 383254721Semaste /// @param[in] cursor_char_pos 384254721Semaste /// The character position of the cursor in its argument word. 385254721Semaste /// 386254721Semaste /// @param[in] opt_element_vector 387254721Semaste /// The results of the options parse of \a input. 388254721Semaste /// 389254721Semaste /// @param[in] match_start_point 390254721Semaste /// @param[in] match_return_elements 391254721Semaste /// See CommandObject::HandleCompletions for a description of how these work. 392254721Semaste /// 393254721Semaste /// @param[out] word_complete 394254721Semaste /// \btrue if this is a complete option value (a space will be inserted after the 395254721Semaste /// completion.) \bfalse otherwise. 396254721Semaste /// 397254721Semaste /// @param[out] matches 398254721Semaste /// The array of matches returned. 399254721Semaste /// 400254721Semaste /// FIXME: This is the wrong return value, since we also need to make a distinction between 401254721Semaste /// total number of matches, and the window the user wants returned. 402254721Semaste /// 403254721Semaste /// @return 404254721Semaste /// The number of completions. 405254721Semaste //------------------------------------------------------------------ 406254721Semaste 407254721Semaste virtual int 408254721Semaste HandleArgumentCompletion (Args &input, 409254721Semaste int &cursor_index, 410254721Semaste int &cursor_char_position, 411254721Semaste OptionElementVector &opt_element_vector, 412254721Semaste int match_start_point, 413254721Semaste int max_return_elements, 414254721Semaste bool &word_complete, 415254721Semaste StringList &matches) 416254721Semaste { 417254721Semaste return 0; 418254721Semaste } 419254721Semaste 420254721Semaste bool 421254721Semaste HelpTextContainsWord (const char *search_word); 422254721Semaste 423254721Semaste //------------------------------------------------------------------ 424254721Semaste /// The flags accessor. 425254721Semaste /// 426254721Semaste /// @return 427254721Semaste /// A reference to the Flags member variable. 428254721Semaste //------------------------------------------------------------------ 429254721Semaste Flags& 430254721Semaste GetFlags() 431254721Semaste { 432254721Semaste return m_flags; 433254721Semaste } 434254721Semaste 435254721Semaste //------------------------------------------------------------------ 436254721Semaste /// The flags const accessor. 437254721Semaste /// 438254721Semaste /// @return 439254721Semaste /// A const reference to the Flags member variable. 440254721Semaste //------------------------------------------------------------------ 441254721Semaste const Flags& 442254721Semaste GetFlags() const 443254721Semaste { 444254721Semaste return m_flags; 445254721Semaste } 446254721Semaste 447254721Semaste //------------------------------------------------------------------ 448254721Semaste /// Get the command that appropriate for a "repeat" of the current command. 449254721Semaste /// 450254721Semaste /// @param[in] current_command_line 451254721Semaste /// The complete current command line. 452254721Semaste /// 453254721Semaste /// @return 454254721Semaste /// NULL if there is no special repeat command - it will use the current command line. 455254721Semaste /// Otherwise a pointer to the command to be repeated. 456254721Semaste /// If the returned string is the empty string, the command won't be repeated. 457254721Semaste //------------------------------------------------------------------ 458254721Semaste virtual const char *GetRepeatCommand (Args ¤t_command_args, uint32_t index) 459254721Semaste { 460254721Semaste return NULL; 461254721Semaste } 462254721Semaste 463254721Semaste CommandOverrideCallback 464254721Semaste GetOverrideCallback () const 465254721Semaste { 466254721Semaste return m_command_override_callback; 467254721Semaste } 468254721Semaste 469254721Semaste void * 470254721Semaste GetOverrideCallbackBaton () const 471254721Semaste { 472254721Semaste return m_command_override_baton; 473254721Semaste } 474254721Semaste 475254721Semaste void 476254721Semaste SetOverrideCallback (CommandOverrideCallback callback, void *baton) 477254721Semaste { 478254721Semaste m_command_override_callback = callback; 479254721Semaste m_command_override_baton = baton; 480254721Semaste } 481254721Semaste 482254721Semaste virtual bool 483254721Semaste Execute (const char *args_string, CommandReturnObject &result) = 0; 484254721Semaste 485254721Semasteprotected: 486254721Semaste virtual const char * 487254721Semaste GetInvalidTargetDescription() 488254721Semaste { 489254721Semaste return "invalid target, create a target using the 'target create' command"; 490254721Semaste } 491254721Semaste 492254721Semaste virtual const char * 493254721Semaste GetInvalidProcessDescription() 494254721Semaste { 495254721Semaste return "invalid process"; 496254721Semaste } 497254721Semaste 498254721Semaste virtual const char * 499254721Semaste GetInvalidThreadDescription() 500254721Semaste { 501254721Semaste return "invalid thread"; 502254721Semaste } 503254721Semaste 504254721Semaste virtual const char * 505254721Semaste GetInvalidFrameDescription() 506254721Semaste { 507254721Semaste return "invalid frame"; 508254721Semaste } 509254721Semaste 510254721Semaste virtual const char * 511254721Semaste GetInvalidRegContextDescription () 512254721Semaste { 513254721Semaste return "invalid frame, no registers"; 514254721Semaste } 515254721Semaste 516254721Semaste //------------------------------------------------------------------ 517254721Semaste /// Check the command to make sure anything required by this 518254721Semaste /// command is available. 519254721Semaste /// 520254721Semaste /// @param[out] result 521254721Semaste /// A command result object, if it is not okay to run the command 522254721Semaste /// this will be filled in with a suitable error. 523254721Semaste /// 524254721Semaste /// @return 525254721Semaste /// \b true if it is okay to run this command, \b false otherwise. 526254721Semaste //------------------------------------------------------------------ 527254721Semaste bool 528254721Semaste CheckRequirements (CommandReturnObject &result); 529254721Semaste 530254721Semaste void 531254721Semaste Cleanup (); 532254721Semaste 533254721Semaste CommandInterpreter &m_interpreter; 534254721Semaste ExecutionContext m_exe_ctx; 535254721Semaste Mutex::Locker m_api_locker; 536254721Semaste std::string m_cmd_name; 537254721Semaste std::string m_cmd_help_short; 538254721Semaste std::string m_cmd_help_long; 539254721Semaste std::string m_cmd_syntax; 540254721Semaste bool m_is_alias; 541254721Semaste Flags m_flags; 542254721Semaste std::vector<CommandArgumentEntry> m_arguments; 543254721Semaste CommandOverrideCallback m_command_override_callback; 544254721Semaste void * m_command_override_baton; 545254721Semaste 546254721Semaste // Helper function to populate IDs or ID ranges as the command argument data 547254721Semaste // to the specified command argument entry. 548254721Semaste static void 549254721Semaste AddIDsArgumentData(CommandArgumentEntry &arg, lldb::CommandArgumentType ID, lldb::CommandArgumentType IDRange); 550254721Semaste 551254721Semaste}; 552254721Semaste 553254721Semasteclass CommandObjectParsed : public CommandObject 554254721Semaste{ 555254721Semastepublic: 556254721Semaste 557254721Semaste CommandObjectParsed (CommandInterpreter &interpreter, 558254721Semaste const char *name, 559254721Semaste const char *help = NULL, 560254721Semaste const char *syntax = NULL, 561254721Semaste uint32_t flags = 0) : 562254721Semaste CommandObject (interpreter, name, help, syntax, flags) {} 563254721Semaste 564254721Semaste virtual 565254721Semaste ~CommandObjectParsed () {}; 566254721Semaste 567254721Semaste virtual bool 568254721Semaste Execute (const char *args_string, CommandReturnObject &result); 569254721Semaste 570254721Semasteprotected: 571254721Semaste virtual bool 572254721Semaste DoExecute (Args& command, 573254721Semaste CommandReturnObject &result) = 0; 574254721Semaste 575254721Semaste virtual bool 576254721Semaste WantsRawCommandString() { return false; }; 577254721Semaste}; 578254721Semaste 579254721Semasteclass CommandObjectRaw : public CommandObject 580254721Semaste{ 581254721Semastepublic: 582254721Semaste 583254721Semaste CommandObjectRaw (CommandInterpreter &interpreter, 584254721Semaste const char *name, 585254721Semaste const char *help = NULL, 586254721Semaste const char *syntax = NULL, 587254721Semaste uint32_t flags = 0) : 588254721Semaste CommandObject (interpreter, name, help, syntax, flags) {} 589254721Semaste 590254721Semaste virtual 591254721Semaste ~CommandObjectRaw () {}; 592254721Semaste 593254721Semaste virtual bool 594254721Semaste Execute (const char *args_string, CommandReturnObject &result); 595254721Semaste 596254721Semasteprotected: 597254721Semaste virtual bool 598254721Semaste DoExecute (const char *command, CommandReturnObject &result) = 0; 599254721Semaste 600254721Semaste virtual bool 601254721Semaste WantsRawCommandString() { return true; }; 602254721Semaste}; 603254721Semaste 604254721Semaste 605254721Semaste} // namespace lldb_private 606254721Semaste 607254721Semaste 608254721Semaste#endif // liblldb_CommandObject_h_ 609