SBCommandInterpreter.h revision f125250ba7bcaa2ea5ee95539a309e3fd2f8b5d7
1//===-- SBCommandInterpreter.h ----------------------------------*- 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#ifndef LLDB_SBCommandInterpreter_h_ 11#define LLDB_SBCommandInterpreter_h_ 12 13#include "lldb/API/SBDefines.h" 14 15namespace lldb { 16 17class SBCommandInterpreter 18{ 19public: 20 enum 21 { 22 eBroadcastBitThreadShouldExit = (1 << 0), 23 eBroadcastBitResetPrompt = (1 << 1), 24 eBroadcastBitQuitCommandReceived = (1 << 2), // User entered quit 25 eBroadcastBitAsynchronousOutputData = (1 << 3), 26 eBroadcastBitAsynchronousErrorData = (1 << 4) 27 }; 28 29 SBCommandInterpreter (const lldb::SBCommandInterpreter &rhs); 30 31 const lldb::SBCommandInterpreter & 32 operator = (const lldb::SBCommandInterpreter &rhs); 33 34 ~SBCommandInterpreter (); 35 36 static const char * 37 GetArgumentTypeAsCString (const lldb::CommandArgumentType arg_type); 38 39 static const char * 40 GetArgumentDescriptionAsCString (const lldb::CommandArgumentType arg_type); 41 42 bool 43 IsValid() const; 44 45 bool 46 CommandExists (const char *cmd); 47 48 bool 49 AliasExists (const char *cmd); 50 51 lldb::SBBroadcaster 52 GetBroadcaster (); 53 54 static const char * 55 GetBroadcasterClass (); 56 57 bool 58 HasCommands (); 59 60 bool 61 HasAliases (); 62 63 bool 64 HasAliasOptions (); 65 66 lldb::SBProcess 67 GetProcess (); 68 69 void 70 SourceInitFileInHomeDirectory (lldb::SBCommandReturnObject &result); 71 72 void 73 SourceInitFileInCurrentWorkingDirectory (lldb::SBCommandReturnObject &result); 74 75 lldb::ReturnStatus 76 HandleCommand (const char *command_line, lldb::SBCommandReturnObject &result, bool add_to_history = false); 77 78 // This interface is not useful in SWIG, since the cursor & last_char arguments are string pointers INTO current_line 79 // and you can't do that in a scripting language interface in general... 80 int 81 HandleCompletion (const char *current_line, 82 const char *cursor, 83 const char *last_char, 84 int match_start_point, 85 int max_return_elements, 86 lldb::SBStringList &matches); 87 88 int 89 HandleCompletion (const char *current_line, 90 uint32_t cursor_pos, 91 int match_start_point, 92 int max_return_elements, 93 lldb::SBStringList &matches); 94 95 // Catch commands before they execute by registering a callback that will 96 // get called when the command gets executed. This allows GUI or command 97 // line interfaces to intercept a command and stop it from happening 98 bool 99 SetCommandOverrideCallback (const char *command_name, 100 lldb::CommandOverrideCallback callback, 101 void *baton); 102protected: 103 104 lldb_private::CommandInterpreter & 105 ref (); 106 107 lldb_private::CommandInterpreter * 108 get (); 109 110 void 111 reset (lldb_private::CommandInterpreter *); 112private: 113 friend class SBDebugger; 114 115 SBCommandInterpreter (lldb_private::CommandInterpreter *interpreter_ptr = NULL); // Access using SBDebugger::GetCommandInterpreter(); 116 117 static void 118 InitializeSWIG (); 119 120 lldb_private::CommandInterpreter *m_opaque_ptr; 121}; 122 123 124} // namespace lldb 125 126#endif // LLDB_SBCommandInterpreter_h_ 127