1 //===-- CommandObjectType.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 liblldb_CommandObjectType_h_ 11 #define liblldb_CommandObjectType_h_ 12 13 // C Includes 14 // C++ Includes 15 16 17 // Other libraries and framework includes 18 // Project includes 19 20 #include "lldb/lldb-types.h" 21 #include "lldb/Interpreter/CommandObjectMultiword.h" 22 #include "lldb/Interpreter/Options.h" 23 24 namespace lldb_private { 25 26 class ScriptAddOptions 27 { 28 29 public: 30 31 bool m_skip_pointers; 32 bool m_skip_references; 33 bool m_cascade; 34 StringList m_target_types; 35 StringList m_user_source; 36 37 bool m_no_children; 38 bool m_no_value; 39 bool m_one_liner; 40 bool m_regex; 41 42 ConstString* m_name; 43 44 const char* m_category; 45 46 ScriptAddOptions(bool sptr, 47 bool sref, 48 bool casc, 49 bool noch, 50 bool novl, 51 bool onel, 52 bool regx, 53 ConstString* name, 54 const char* catg) : 55 m_skip_pointers(sptr), 56 m_skip_references(sref), 57 m_cascade(casc), 58 m_target_types(), 59 m_user_source(), 60 m_no_children(noch), 61 m_no_value(novl), 62 m_one_liner(onel), 63 m_regex(regx), 64 m_name(name), 65 m_category(catg) 66 { 67 } 68 69 typedef lldb::SharedPtr<ScriptAddOptions>::Type SharedPointer; 70 71 }; 72 73 class CommandObjectType : public CommandObjectMultiword 74 { 75 public: 76 CommandObjectType (CommandInterpreter &interpreter); 77 78 virtual 79 ~CommandObjectType (); 80 }; 81 82 class CommandObjectTypeSummaryAdd : public CommandObject 83 { 84 85 private: 86 87 class CommandOptions : public Options 88 { 89 public: 90 91 CommandOptions (CommandInterpreter &interpreter) : 92 Options (interpreter) 93 { 94 } 95 96 virtual 97 ~CommandOptions (){} 98 99 virtual Error 100 SetOptionValue (uint32_t option_idx, const char *option_arg); 101 102 void 103 OptionParsingStarting (); 104 105 const OptionDefinition* 106 GetDefinitions () 107 { 108 return g_option_table; 109 } 110 111 // Options table: Required for subclasses of Options. 112 113 static OptionDefinition g_option_table[]; 114 115 // Instance variables to hold the values for command options. 116 117 bool m_cascade; 118 bool m_no_children; 119 bool m_no_value; 120 bool m_one_liner; 121 bool m_skip_references; 122 bool m_skip_pointers; 123 bool m_regex; 124 std::string m_format_string; 125 ConstString* m_name; 126 std::string m_python_script; 127 std::string m_python_function; 128 bool m_is_add_script; 129 const char* m_category; 130 }; 131 132 CommandOptions m_options; 133 134 virtual Options * 135 GetOptions () 136 { 137 return &m_options; 138 } 139 140 void 141 CollectPythonScript(ScriptAddOptions *options, 142 CommandReturnObject &result); 143 144 bool 145 Execute_ScriptSummary (Args& command, CommandReturnObject &result); 146 147 bool 148 Execute_StringSummary (Args& command, CommandReturnObject &result); 149 150 public: 151 152 enum SummaryFormatType 153 { 154 eRegularSummary, 155 eRegexSummary, 156 eNamedSummary, 157 }; 158 159 CommandObjectTypeSummaryAdd (CommandInterpreter &interpreter); 160 161 ~CommandObjectTypeSummaryAdd () 162 { 163 } 164 165 bool 166 Execute (Args& command, CommandReturnObject &result); 167 168 static bool 169 AddSummary(const ConstString& type_name, 170 lldb::SummaryFormatSP entry, 171 SummaryFormatType type, 172 const char* category, 173 Error* error = NULL); 174 }; 175 176 177 } // namespace lldb_private 178 179 #endif // liblldb_CommandObjectType_h_ 180