Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1 | //===-- CommandObjectSettings.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 "CommandObjectSettings.h" |
| 11 | |
| 12 | // C Includes |
| 13 | // C++ Includes |
| 14 | // Other libraries and framework includes |
| 15 | // Project includes |
| 16 | #include "lldb/Interpreter/CommandInterpreter.h" |
| 17 | #include "lldb/Interpreter/CommandReturnObject.h" |
Caroline Tice | 3df9a8d | 2010-09-04 00:03:46 +0000 | [diff] [blame] | 18 | #include "lldb/Interpreter/CommandCompletions.h" |
Zachary Turner | 633a29c | 2015-03-04 01:58:01 +0000 | [diff] [blame] | 19 | #include "lldb/Interpreter/OptionValueProperties.h" |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 20 | |
| 21 | using namespace lldb; |
| 22 | using namespace lldb_private; |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 23 | #include "llvm/ADT/StringRef.h" |
| 24 | |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 25 | //------------------------------------------------------------------------- |
| 26 | // CommandObjectSettingsSet |
| 27 | //------------------------------------------------------------------------- |
| 28 | |
| 29 | class CommandObjectSettingsSet : public CommandObjectRaw |
| 30 | { |
| 31 | public: |
| 32 | CommandObjectSettingsSet (CommandInterpreter &interpreter) : |
| 33 | CommandObjectRaw (interpreter, |
| 34 | "settings set", |
| 35 | "Set or change the value of a single debugger setting variable.", |
| 36 | NULL), |
| 37 | m_options (interpreter) |
| 38 | { |
| 39 | CommandArgumentEntry arg1; |
| 40 | CommandArgumentEntry arg2; |
| 41 | CommandArgumentData var_name_arg; |
| 42 | CommandArgumentData value_arg; |
| 43 | |
| 44 | // Define the first (and only) variant of this arg. |
| 45 | var_name_arg.arg_type = eArgTypeSettingVariableName; |
| 46 | var_name_arg.arg_repetition = eArgRepeatPlain; |
| 47 | |
| 48 | // There is only one variant this argument could be; put it into the argument entry. |
| 49 | arg1.push_back (var_name_arg); |
| 50 | |
| 51 | // Define the first (and only) variant of this arg. |
| 52 | value_arg.arg_type = eArgTypeValue; |
| 53 | value_arg.arg_repetition = eArgRepeatPlain; |
| 54 | |
| 55 | // There is only one variant this argument could be; put it into the argument entry. |
| 56 | arg2.push_back (value_arg); |
| 57 | |
| 58 | // Push the data for the first argument into the m_arguments vector. |
| 59 | m_arguments.push_back (arg1); |
| 60 | m_arguments.push_back (arg2); |
| 61 | |
| 62 | SetHelpLong ( |
| 63 | "When setting a dictionary or array variable, you can set multiple entries \n\ |
| 64 | at once by giving the values to the set command. For example: \n\ |
| 65 | \n\ |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 66 | (lldb) settings set target.run-args value1 value2 value3 \n\ |
| 67 | (lldb) settings set target.env-vars MYPATH=~/.:/usr/bin SOME_ENV_VAR=12345 \n\ |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 68 | \n\ |
| 69 | (lldb) settings show target.run-args \n\ |
| 70 | [0]: 'value1' \n\ |
| 71 | [1]: 'value2' \n\ |
| 72 | [3]: 'value3' \n\ |
| 73 | (lldb) settings show target.env-vars \n\ |
| 74 | 'MYPATH=~/.:/usr/bin'\n\ |
| 75 | 'SOME_ENV_VAR=12345' \n\ |
| 76 | \n\ |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 77 | Warning: The 'set' command re-sets the entire array or dictionary. If you \n\ |
| 78 | just want to add, remove or update individual values (or add something to \n\ |
| 79 | the end), use one of the other settings sub-commands: append, replace, \n\ |
| 80 | insert-before or insert-after.\n"); |
| 81 | |
| 82 | } |
| 83 | |
| 84 | |
| 85 | virtual |
| 86 | ~CommandObjectSettingsSet () {} |
| 87 | |
| 88 | // Overrides base class's behavior where WantsCompletion = !WantsRawCommandString. |
| 89 | virtual bool |
| 90 | WantsCompletion() { return true; } |
| 91 | |
| 92 | virtual Options * |
| 93 | GetOptions () |
| 94 | { |
| 95 | return &m_options; |
| 96 | } |
| 97 | |
| 98 | class CommandOptions : public Options |
| 99 | { |
| 100 | public: |
| 101 | |
| 102 | CommandOptions (CommandInterpreter &interpreter) : |
| 103 | Options (interpreter), |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 104 | m_global (false) |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 105 | { |
| 106 | } |
| 107 | |
| 108 | virtual |
| 109 | ~CommandOptions () {} |
| 110 | |
| 111 | virtual Error |
| 112 | SetOptionValue (uint32_t option_idx, const char *option_arg) |
| 113 | { |
| 114 | Error error; |
Greg Clayton | 3bcdfc0 | 2012-12-04 00:32:51 +0000 | [diff] [blame] | 115 | const int short_option = m_getopt_table[option_idx].val; |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 116 | |
| 117 | switch (short_option) |
| 118 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 119 | case 'g': |
| 120 | m_global = true; |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 121 | break; |
| 122 | default: |
| 123 | error.SetErrorStringWithFormat ("unrecognized options '%c'", short_option); |
| 124 | break; |
| 125 | } |
| 126 | |
| 127 | return error; |
| 128 | } |
| 129 | |
| 130 | void |
| 131 | OptionParsingStarting () |
| 132 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 133 | m_global = false; |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 134 | } |
| 135 | |
| 136 | const OptionDefinition* |
| 137 | GetDefinitions () |
| 138 | { |
| 139 | return g_option_table; |
| 140 | } |
| 141 | |
| 142 | // Options table: Required for subclasses of Options. |
| 143 | |
| 144 | static OptionDefinition g_option_table[]; |
| 145 | |
| 146 | // Instance variables to hold the values for command options. |
| 147 | |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 148 | bool m_global; |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 149 | }; |
| 150 | |
| 151 | virtual int |
| 152 | HandleArgumentCompletion (Args &input, |
| 153 | int &cursor_index, |
| 154 | int &cursor_char_position, |
| 155 | OptionElementVector &opt_element_vector, |
| 156 | int match_start_point, |
| 157 | int max_return_elements, |
| 158 | bool &word_complete, |
| 159 | StringList &matches) |
| 160 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 161 | std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 162 | |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 163 | const size_t argc = input.GetArgumentCount(); |
| 164 | const char *arg = NULL; |
| 165 | int setting_var_idx; |
Saleem Abdulrasool | 3985c8c | 2014-04-02 03:51:35 +0000 | [diff] [blame] | 166 | for (setting_var_idx = 1; setting_var_idx < static_cast<int>(argc); |
| 167 | ++setting_var_idx) |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 168 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 169 | arg = input.GetArgumentAtIndex(setting_var_idx); |
| 170 | if (arg && arg[0] != '-') |
| 171 | break; // We found our setting variable name index |
| 172 | } |
| 173 | if (cursor_index == setting_var_idx) |
| 174 | { |
| 175 | // Attempting to complete setting variable name |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 176 | CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter, |
| 177 | CommandCompletions::eSettingsNameCompletion, |
| 178 | completion_str.c_str(), |
| 179 | match_start_point, |
| 180 | max_return_elements, |
| 181 | NULL, |
| 182 | word_complete, |
| 183 | matches); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 184 | } |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 185 | else |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 186 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 187 | arg = input.GetArgumentAtIndex(cursor_index); |
| 188 | |
| 189 | if (arg) |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 190 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 191 | if (arg[0] == '-') |
| 192 | { |
| 193 | // Complete option name |
| 194 | } |
| 195 | else |
| 196 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 197 | // Complete setting value |
| 198 | const char *setting_var_name = input.GetArgumentAtIndex(setting_var_idx); |
| 199 | Error error; |
Greg Clayton | f9fc609 | 2013-01-09 19:44:40 +0000 | [diff] [blame] | 200 | lldb::OptionValueSP value_sp (m_interpreter.GetDebugger().GetPropertyValue(&m_exe_ctx, setting_var_name, false, error)); |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 201 | if (value_sp) |
| 202 | { |
| 203 | value_sp->AutoComplete (m_interpreter, |
| 204 | completion_str.c_str(), |
| 205 | match_start_point, |
| 206 | max_return_elements, |
| 207 | word_complete, |
| 208 | matches); |
| 209 | } |
| 210 | } |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 211 | } |
| 212 | } |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 213 | return matches.GetSize(); |
| 214 | } |
| 215 | |
| 216 | protected: |
| 217 | virtual bool |
| 218 | DoExecute (const char *command, CommandReturnObject &result) |
| 219 | { |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 220 | Args cmd_args(command); |
| 221 | |
| 222 | // Process possible options. |
| 223 | if (!ParseOptions (cmd_args, result)) |
| 224 | return false; |
| 225 | |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 226 | const size_t argc = cmd_args.GetArgumentCount (); |
| 227 | if ((argc < 2) && (!m_options.m_global)) |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 228 | { |
| 229 | result.AppendError ("'settings set' takes more arguments"); |
| 230 | result.SetStatus (eReturnStatusFailed); |
| 231 | return false; |
| 232 | } |
| 233 | |
| 234 | const char *var_name = cmd_args.GetArgumentAtIndex (0); |
| 235 | if ((var_name == NULL) || (var_name[0] == '\0')) |
| 236 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 237 | result.AppendError ("'settings set' command requires a valid variable name"); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 238 | result.SetStatus (eReturnStatusFailed); |
| 239 | return false; |
| 240 | } |
| 241 | |
| 242 | // Split the raw command into var_name and value pair. |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 243 | llvm::StringRef raw_str(command); |
Greg Clayton | 30820f0 | 2013-03-05 23:52:49 +0000 | [diff] [blame] | 244 | std::string var_value_string = raw_str.split(var_name).second.str(); |
Pavel Labath | df50f94 | 2015-02-16 13:13:39 +0000 | [diff] [blame] | 245 | const char *var_value_cstr = Args::StripSpaces(var_value_string, true, false, false); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 246 | |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 247 | Error error; |
| 248 | if (m_options.m_global) |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 249 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 250 | error = m_interpreter.GetDebugger().SetPropertyValue (NULL, |
| 251 | eVarSetOperationAssign, |
| 252 | var_name, |
Greg Clayton | 30820f0 | 2013-03-05 23:52:49 +0000 | [diff] [blame] | 253 | var_value_cstr); |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 254 | } |
| 255 | |
| 256 | if (error.Success()) |
| 257 | { |
Enrico Granata | 84a53df | 2013-05-20 22:29:23 +0000 | [diff] [blame] | 258 | // FIXME this is the same issue as the one in commands script import |
| 259 | // we could be setting target.load-script-from-symbol-file which would cause |
| 260 | // Python scripts to be loaded, which could run LLDB commands |
| 261 | // (e.g. settings set target.process.python-os-plugin-path) and cause a crash |
| 262 | // if we did not clear the command's exe_ctx first |
| 263 | ExecutionContext exe_ctx(m_exe_ctx); |
| 264 | m_exe_ctx.Clear(); |
| 265 | error = m_interpreter.GetDebugger().SetPropertyValue (&exe_ctx, |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 266 | eVarSetOperationAssign, |
| 267 | var_name, |
Greg Clayton | 30820f0 | 2013-03-05 23:52:49 +0000 | [diff] [blame] | 268 | var_value_cstr); |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 269 | } |
| 270 | |
| 271 | if (error.Fail()) |
| 272 | { |
| 273 | result.AppendError (error.AsCString()); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 274 | result.SetStatus (eReturnStatusFailed); |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 275 | return false; |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 276 | } |
| 277 | else |
| 278 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 279 | result.SetStatus (eReturnStatusSuccessFinishResult); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 280 | } |
| 281 | |
| 282 | return result.Succeeded(); |
| 283 | } |
| 284 | private: |
| 285 | CommandOptions m_options; |
| 286 | }; |
| 287 | |
| 288 | OptionDefinition |
| 289 | CommandObjectSettingsSet::CommandOptions::g_option_table[] = |
| 290 | { |
Zachary Turner | d37221d | 2014-07-09 16:31:49 +0000 | [diff] [blame] | 291 | { LLDB_OPT_SET_2, false, "global", 'g', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Apply the new value to the global default value." }, |
| 292 | { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL } |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 293 | }; |
| 294 | |
| 295 | |
| 296 | //------------------------------------------------------------------------- |
| 297 | // CommandObjectSettingsShow -- Show current values |
| 298 | //------------------------------------------------------------------------- |
| 299 | |
| 300 | class CommandObjectSettingsShow : public CommandObjectParsed |
| 301 | { |
| 302 | public: |
| 303 | CommandObjectSettingsShow (CommandInterpreter &interpreter) : |
| 304 | CommandObjectParsed (interpreter, |
| 305 | "settings show", |
| 306 | "Show the specified internal debugger setting variable and its value, or show all the currently set variables and their values, if nothing is specified.", |
| 307 | NULL) |
| 308 | { |
| 309 | CommandArgumentEntry arg1; |
| 310 | CommandArgumentData var_name_arg; |
| 311 | |
| 312 | // Define the first (and only) variant of this arg. |
| 313 | var_name_arg.arg_type = eArgTypeSettingVariableName; |
| 314 | var_name_arg.arg_repetition = eArgRepeatOptional; |
| 315 | |
| 316 | // There is only one variant this argument could be; put it into the argument entry. |
| 317 | arg1.push_back (var_name_arg); |
| 318 | |
| 319 | // Push the data for the first argument into the m_arguments vector. |
| 320 | m_arguments.push_back (arg1); |
| 321 | } |
| 322 | |
| 323 | virtual |
| 324 | ~CommandObjectSettingsShow () {} |
| 325 | |
| 326 | |
| 327 | virtual int |
| 328 | HandleArgumentCompletion (Args &input, |
| 329 | int &cursor_index, |
| 330 | int &cursor_char_position, |
| 331 | OptionElementVector &opt_element_vector, |
| 332 | int match_start_point, |
| 333 | int max_return_elements, |
| 334 | bool &word_complete, |
| 335 | StringList &matches) |
| 336 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 337 | std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 338 | |
| 339 | CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter, |
| 340 | CommandCompletions::eSettingsNameCompletion, |
| 341 | completion_str.c_str(), |
| 342 | match_start_point, |
| 343 | max_return_elements, |
| 344 | NULL, |
| 345 | word_complete, |
| 346 | matches); |
| 347 | return matches.GetSize(); |
| 348 | } |
| 349 | |
| 350 | protected: |
| 351 | virtual bool |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 352 | DoExecute (Args& args, CommandReturnObject &result) |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 353 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 354 | result.SetStatus (eReturnStatusSuccessFinishResult); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 355 | |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 356 | const size_t argc = args.GetArgumentCount (); |
| 357 | if (argc > 0) |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 358 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 359 | for (size_t i=0; i<argc; ++i) |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 360 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 361 | const char *property_path = args.GetArgumentAtIndex (i); |
| 362 | |
Greg Clayton | f9fc609 | 2013-01-09 19:44:40 +0000 | [diff] [blame] | 363 | Error error(m_interpreter.GetDebugger().DumpPropertyValue (&m_exe_ctx, result.GetOutputStream(), property_path, OptionValue::eDumpGroupValue)); |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 364 | if (error.Success()) |
| 365 | { |
| 366 | result.GetOutputStream().EOL(); |
| 367 | } |
| 368 | else |
| 369 | { |
| 370 | result.AppendError (error.AsCString()); |
| 371 | result.SetStatus (eReturnStatusFailed); |
| 372 | } |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 373 | } |
| 374 | } |
| 375 | else |
| 376 | { |
Greg Clayton | f9fc609 | 2013-01-09 19:44:40 +0000 | [diff] [blame] | 377 | m_interpreter.GetDebugger().DumpAllPropertyValues (&m_exe_ctx, result.GetOutputStream(), OptionValue::eDumpGroupValue); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 378 | } |
| 379 | |
| 380 | return result.Succeeded(); |
| 381 | } |
| 382 | }; |
| 383 | |
| 384 | //------------------------------------------------------------------------- |
| 385 | // CommandObjectSettingsList -- List settable variables |
| 386 | //------------------------------------------------------------------------- |
| 387 | |
| 388 | class CommandObjectSettingsList : public CommandObjectParsed |
| 389 | { |
| 390 | public: |
| 391 | CommandObjectSettingsList (CommandInterpreter &interpreter) : |
| 392 | CommandObjectParsed (interpreter, |
| 393 | "settings list", |
| 394 | "List and describe all the internal debugger settings variables that are available to the user to 'set' or 'show', or describe a particular variable or set of variables (by specifying the variable name or a common prefix).", |
| 395 | NULL) |
| 396 | { |
| 397 | CommandArgumentEntry arg; |
| 398 | CommandArgumentData var_name_arg; |
| 399 | CommandArgumentData prefix_name_arg; |
| 400 | |
| 401 | // Define the first variant of this arg. |
| 402 | var_name_arg.arg_type = eArgTypeSettingVariableName; |
| 403 | var_name_arg.arg_repetition = eArgRepeatOptional; |
| 404 | |
| 405 | // Define the second variant of this arg. |
| 406 | prefix_name_arg.arg_type = eArgTypeSettingPrefix; |
| 407 | prefix_name_arg.arg_repetition = eArgRepeatOptional; |
| 408 | |
| 409 | arg.push_back (var_name_arg); |
| 410 | arg.push_back (prefix_name_arg); |
| 411 | |
| 412 | // Push the data for the first argument into the m_arguments vector. |
| 413 | m_arguments.push_back (arg); |
| 414 | } |
| 415 | |
| 416 | virtual |
| 417 | ~CommandObjectSettingsList () {} |
| 418 | |
| 419 | virtual int |
| 420 | HandleArgumentCompletion (Args &input, |
| 421 | int &cursor_index, |
| 422 | int &cursor_char_position, |
| 423 | OptionElementVector &opt_element_vector, |
| 424 | int match_start_point, |
| 425 | int max_return_elements, |
| 426 | bool &word_complete, |
| 427 | StringList &matches) |
| 428 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 429 | std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 430 | |
| 431 | CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter, |
| 432 | CommandCompletions::eSettingsNameCompletion, |
| 433 | completion_str.c_str(), |
| 434 | match_start_point, |
| 435 | max_return_elements, |
| 436 | NULL, |
| 437 | word_complete, |
| 438 | matches); |
| 439 | return matches.GetSize(); |
| 440 | } |
| 441 | |
| 442 | protected: |
| 443 | virtual bool |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 444 | DoExecute (Args& args, CommandReturnObject &result) |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 445 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 446 | result.SetStatus (eReturnStatusSuccessFinishResult); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 447 | |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 448 | const bool will_modify = false; |
| 449 | const size_t argc = args.GetArgumentCount (); |
| 450 | if (argc > 0) |
| 451 | { |
| 452 | const bool dump_qualified_name = true; |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 453 | |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 454 | for (size_t i=0; i<argc; ++i) |
| 455 | { |
| 456 | const char *property_path = args.GetArgumentAtIndex (i); |
| 457 | |
Greg Clayton | f9fc609 | 2013-01-09 19:44:40 +0000 | [diff] [blame] | 458 | const Property *property = m_interpreter.GetDebugger().GetValueProperties()->GetPropertyAtPath (&m_exe_ctx, will_modify, property_path); |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 459 | |
| 460 | if (property) |
| 461 | { |
| 462 | property->DumpDescription (m_interpreter, result.GetOutputStream(), 0, dump_qualified_name); |
| 463 | } |
| 464 | else |
| 465 | { |
| 466 | result.AppendErrorWithFormat ("invalid property path '%s'", property_path); |
| 467 | result.SetStatus (eReturnStatusFailed); |
| 468 | } |
| 469 | } |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 470 | } |
| 471 | else |
| 472 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 473 | m_interpreter.GetDebugger().DumpAllDescriptions (m_interpreter, result.GetOutputStream()); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 474 | } |
| 475 | |
| 476 | return result.Succeeded(); |
| 477 | } |
| 478 | }; |
| 479 | |
| 480 | //------------------------------------------------------------------------- |
| 481 | // CommandObjectSettingsRemove |
| 482 | //------------------------------------------------------------------------- |
| 483 | |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 484 | class CommandObjectSettingsRemove : public CommandObjectRaw |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 485 | { |
| 486 | public: |
| 487 | CommandObjectSettingsRemove (CommandInterpreter &interpreter) : |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 488 | CommandObjectRaw (interpreter, |
| 489 | "settings remove", |
| 490 | "Remove the specified element from an array or dictionary settings variable.", |
| 491 | NULL) |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 492 | { |
| 493 | CommandArgumentEntry arg1; |
| 494 | CommandArgumentEntry arg2; |
| 495 | CommandArgumentData var_name_arg; |
| 496 | CommandArgumentData index_arg; |
| 497 | CommandArgumentData key_arg; |
| 498 | |
| 499 | // Define the first (and only) variant of this arg. |
| 500 | var_name_arg.arg_type = eArgTypeSettingVariableName; |
| 501 | var_name_arg.arg_repetition = eArgRepeatPlain; |
| 502 | |
| 503 | // There is only one variant this argument could be; put it into the argument entry. |
| 504 | arg1.push_back (var_name_arg); |
| 505 | |
| 506 | // Define the first variant of this arg. |
| 507 | index_arg.arg_type = eArgTypeSettingIndex; |
| 508 | index_arg.arg_repetition = eArgRepeatPlain; |
| 509 | |
| 510 | // Define the second variant of this arg. |
| 511 | key_arg.arg_type = eArgTypeSettingKey; |
| 512 | key_arg.arg_repetition = eArgRepeatPlain; |
| 513 | |
| 514 | // Push both variants into this arg |
| 515 | arg2.push_back (index_arg); |
| 516 | arg2.push_back (key_arg); |
| 517 | |
| 518 | // Push the data for the first argument into the m_arguments vector. |
| 519 | m_arguments.push_back (arg1); |
| 520 | m_arguments.push_back (arg2); |
| 521 | } |
| 522 | |
| 523 | virtual |
| 524 | ~CommandObjectSettingsRemove () {} |
| 525 | |
| 526 | virtual int |
| 527 | HandleArgumentCompletion (Args &input, |
| 528 | int &cursor_index, |
| 529 | int &cursor_char_position, |
| 530 | OptionElementVector &opt_element_vector, |
| 531 | int match_start_point, |
| 532 | int max_return_elements, |
| 533 | bool &word_complete, |
| 534 | StringList &matches) |
| 535 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 536 | std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 537 | |
| 538 | // Attempting to complete variable name |
| 539 | if (cursor_index < 2) |
| 540 | CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter, |
| 541 | CommandCompletions::eSettingsNameCompletion, |
| 542 | completion_str.c_str(), |
| 543 | match_start_point, |
| 544 | max_return_elements, |
| 545 | NULL, |
| 546 | word_complete, |
| 547 | matches); |
| 548 | |
| 549 | return matches.GetSize(); |
| 550 | } |
| 551 | |
| 552 | protected: |
| 553 | virtual bool |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 554 | DoExecute (const char *command, CommandReturnObject &result) |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 555 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 556 | result.SetStatus (eReturnStatusSuccessFinishNoResult); |
| 557 | |
| 558 | Args cmd_args(command); |
| 559 | |
| 560 | // Process possible options. |
| 561 | if (!ParseOptions (cmd_args, result)) |
| 562 | return false; |
| 563 | |
| 564 | const size_t argc = cmd_args.GetArgumentCount (); |
| 565 | if (argc == 0) |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 566 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 567 | result.AppendError ("'settings set' takes an array or dictionary item, or an array followed by one or more indexes, or a dictionary followed by one or more key names to remove"); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 568 | result.SetStatus (eReturnStatusFailed); |
| 569 | return false; |
| 570 | } |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 571 | |
| 572 | const char *var_name = cmd_args.GetArgumentAtIndex (0); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 573 | if ((var_name == NULL) || (var_name[0] == '\0')) |
| 574 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 575 | result.AppendError ("'settings set' command requires a valid variable name"); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 576 | result.SetStatus (eReturnStatusFailed); |
| 577 | return false; |
| 578 | } |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 579 | |
| 580 | // Split the raw command into var_name and value pair. |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 581 | llvm::StringRef raw_str(command); |
Greg Clayton | 30820f0 | 2013-03-05 23:52:49 +0000 | [diff] [blame] | 582 | std::string var_value_string = raw_str.split(var_name).second.str(); |
| 583 | const char *var_value_cstr = Args::StripSpaces(var_value_string, true, true, false); |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 584 | |
Greg Clayton | f9fc609 | 2013-01-09 19:44:40 +0000 | [diff] [blame] | 585 | Error error (m_interpreter.GetDebugger().SetPropertyValue (&m_exe_ctx, |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 586 | eVarSetOperationRemove, |
| 587 | var_name, |
Greg Clayton | 30820f0 | 2013-03-05 23:52:49 +0000 | [diff] [blame] | 588 | var_value_cstr)); |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 589 | if (error.Fail()) |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 590 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 591 | result.AppendError (error.AsCString()); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 592 | result.SetStatus (eReturnStatusFailed); |
| 593 | return false; |
| 594 | } |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 595 | |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 596 | return result.Succeeded(); |
| 597 | } |
| 598 | }; |
| 599 | |
| 600 | //------------------------------------------------------------------------- |
| 601 | // CommandObjectSettingsReplace |
| 602 | //------------------------------------------------------------------------- |
| 603 | |
| 604 | class CommandObjectSettingsReplace : public CommandObjectRaw |
| 605 | { |
| 606 | public: |
| 607 | CommandObjectSettingsReplace (CommandInterpreter &interpreter) : |
| 608 | CommandObjectRaw (interpreter, |
| 609 | "settings replace", |
| 610 | "Replace the specified element from an internal debugger settings array or dictionary variable with the specified new value.", |
| 611 | NULL) |
| 612 | { |
| 613 | CommandArgumentEntry arg1; |
| 614 | CommandArgumentEntry arg2; |
| 615 | CommandArgumentEntry arg3; |
| 616 | CommandArgumentData var_name_arg; |
| 617 | CommandArgumentData index_arg; |
| 618 | CommandArgumentData key_arg; |
| 619 | CommandArgumentData value_arg; |
| 620 | |
| 621 | // Define the first (and only) variant of this arg. |
| 622 | var_name_arg.arg_type = eArgTypeSettingVariableName; |
| 623 | var_name_arg.arg_repetition = eArgRepeatPlain; |
| 624 | |
| 625 | // There is only one variant this argument could be; put it into the argument entry. |
| 626 | arg1.push_back (var_name_arg); |
| 627 | |
| 628 | // Define the first (variant of this arg. |
| 629 | index_arg.arg_type = eArgTypeSettingIndex; |
| 630 | index_arg.arg_repetition = eArgRepeatPlain; |
| 631 | |
| 632 | // Define the second (variant of this arg. |
| 633 | key_arg.arg_type = eArgTypeSettingKey; |
| 634 | key_arg.arg_repetition = eArgRepeatPlain; |
| 635 | |
| 636 | // Put both variants into this arg |
| 637 | arg2.push_back (index_arg); |
| 638 | arg2.push_back (key_arg); |
| 639 | |
| 640 | // Define the first (and only) variant of this arg. |
| 641 | value_arg.arg_type = eArgTypeValue; |
| 642 | value_arg.arg_repetition = eArgRepeatPlain; |
| 643 | |
| 644 | // There is only one variant this argument could be; put it into the argument entry. |
| 645 | arg3.push_back (value_arg); |
| 646 | |
| 647 | // Push the data for the first argument into the m_arguments vector. |
| 648 | m_arguments.push_back (arg1); |
| 649 | m_arguments.push_back (arg2); |
| 650 | m_arguments.push_back (arg3); |
| 651 | } |
| 652 | |
| 653 | |
| 654 | virtual |
| 655 | ~CommandObjectSettingsReplace () {} |
| 656 | |
| 657 | // Overrides base class's behavior where WantsCompletion = !WantsRawCommandString. |
| 658 | virtual bool |
| 659 | WantsCompletion() { return true; } |
| 660 | |
| 661 | virtual int |
| 662 | HandleArgumentCompletion (Args &input, |
| 663 | int &cursor_index, |
| 664 | int &cursor_char_position, |
| 665 | OptionElementVector &opt_element_vector, |
| 666 | int match_start_point, |
| 667 | int max_return_elements, |
| 668 | bool &word_complete, |
| 669 | StringList &matches) |
| 670 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 671 | std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 672 | |
| 673 | // Attempting to complete variable name |
| 674 | if (cursor_index < 2) |
| 675 | CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter, |
| 676 | CommandCompletions::eSettingsNameCompletion, |
| 677 | completion_str.c_str(), |
| 678 | match_start_point, |
| 679 | max_return_elements, |
| 680 | NULL, |
| 681 | word_complete, |
| 682 | matches); |
| 683 | |
| 684 | return matches.GetSize(); |
| 685 | } |
| 686 | |
| 687 | protected: |
| 688 | virtual bool |
| 689 | DoExecute (const char *command, CommandReturnObject &result) |
| 690 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 691 | result.SetStatus (eReturnStatusSuccessFinishNoResult); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 692 | |
| 693 | Args cmd_args(command); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 694 | const char *var_name = cmd_args.GetArgumentAtIndex (0); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 695 | if ((var_name == NULL) || (var_name[0] == '\0')) |
| 696 | { |
| 697 | result.AppendError ("'settings replace' command requires a valid variable name; No value supplied"); |
| 698 | result.SetStatus (eReturnStatusFailed); |
| 699 | return false; |
| 700 | } |
| 701 | |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 702 | |
| 703 | // Split the raw command into var_name, index_value, and value triple. |
| 704 | llvm::StringRef raw_str(command); |
Greg Clayton | 30820f0 | 2013-03-05 23:52:49 +0000 | [diff] [blame] | 705 | std::string var_value_string = raw_str.split(var_name).second.str(); |
| 706 | const char *var_value_cstr = Args::StripSpaces(var_value_string, true, true, false); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 707 | |
Greg Clayton | f9fc609 | 2013-01-09 19:44:40 +0000 | [diff] [blame] | 708 | Error error(m_interpreter.GetDebugger().SetPropertyValue (&m_exe_ctx, |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 709 | eVarSetOperationReplace, |
| 710 | var_name, |
Greg Clayton | 30820f0 | 2013-03-05 23:52:49 +0000 | [diff] [blame] | 711 | var_value_cstr)); |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 712 | if (error.Fail()) |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 713 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 714 | result.AppendError (error.AsCString()); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 715 | result.SetStatus (eReturnStatusFailed); |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 716 | return false; |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 717 | } |
| 718 | else |
| 719 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 720 | result.SetStatus (eReturnStatusSuccessFinishNoResult); |
| 721 | |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 722 | } |
| 723 | |
| 724 | return result.Succeeded(); |
| 725 | } |
| 726 | }; |
| 727 | |
| 728 | //------------------------------------------------------------------------- |
| 729 | // CommandObjectSettingsInsertBefore |
| 730 | //------------------------------------------------------------------------- |
| 731 | |
| 732 | class CommandObjectSettingsInsertBefore : public CommandObjectRaw |
| 733 | { |
| 734 | public: |
| 735 | CommandObjectSettingsInsertBefore (CommandInterpreter &interpreter) : |
| 736 | CommandObjectRaw (interpreter, |
| 737 | "settings insert-before", |
| 738 | "Insert value(s) into an internal debugger settings array variable, immediately before the specified element.", |
| 739 | NULL) |
| 740 | { |
| 741 | CommandArgumentEntry arg1; |
| 742 | CommandArgumentEntry arg2; |
| 743 | CommandArgumentEntry arg3; |
| 744 | CommandArgumentData var_name_arg; |
| 745 | CommandArgumentData index_arg; |
| 746 | CommandArgumentData value_arg; |
| 747 | |
| 748 | // Define the first (and only) variant of this arg. |
| 749 | var_name_arg.arg_type = eArgTypeSettingVariableName; |
| 750 | var_name_arg.arg_repetition = eArgRepeatPlain; |
| 751 | |
| 752 | // There is only one variant this argument could be; put it into the argument entry. |
| 753 | arg1.push_back (var_name_arg); |
| 754 | |
| 755 | // Define the first (variant of this arg. |
| 756 | index_arg.arg_type = eArgTypeSettingIndex; |
| 757 | index_arg.arg_repetition = eArgRepeatPlain; |
| 758 | |
| 759 | // There is only one variant this argument could be; put it into the argument entry. |
| 760 | arg2.push_back (index_arg); |
| 761 | |
| 762 | // Define the first (and only) variant of this arg. |
| 763 | value_arg.arg_type = eArgTypeValue; |
| 764 | value_arg.arg_repetition = eArgRepeatPlain; |
| 765 | |
| 766 | // There is only one variant this argument could be; put it into the argument entry. |
| 767 | arg3.push_back (value_arg); |
| 768 | |
| 769 | // Push the data for the first argument into the m_arguments vector. |
| 770 | m_arguments.push_back (arg1); |
| 771 | m_arguments.push_back (arg2); |
| 772 | m_arguments.push_back (arg3); |
| 773 | } |
| 774 | |
| 775 | virtual |
| 776 | ~CommandObjectSettingsInsertBefore () {} |
| 777 | |
| 778 | // Overrides base class's behavior where WantsCompletion = !WantsRawCommandString. |
| 779 | virtual bool |
| 780 | WantsCompletion() { return true; } |
| 781 | |
| 782 | virtual int |
| 783 | HandleArgumentCompletion (Args &input, |
| 784 | int &cursor_index, |
| 785 | int &cursor_char_position, |
| 786 | OptionElementVector &opt_element_vector, |
| 787 | int match_start_point, |
| 788 | int max_return_elements, |
| 789 | bool &word_complete, |
| 790 | StringList &matches) |
| 791 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 792 | std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 793 | |
| 794 | // Attempting to complete variable name |
| 795 | if (cursor_index < 2) |
| 796 | CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter, |
| 797 | CommandCompletions::eSettingsNameCompletion, |
| 798 | completion_str.c_str(), |
| 799 | match_start_point, |
| 800 | max_return_elements, |
| 801 | NULL, |
| 802 | word_complete, |
| 803 | matches); |
| 804 | |
| 805 | return matches.GetSize(); |
| 806 | } |
| 807 | |
| 808 | protected: |
| 809 | virtual bool |
| 810 | DoExecute (const char *command, CommandReturnObject &result) |
| 811 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 812 | result.SetStatus (eReturnStatusSuccessFinishNoResult); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 813 | |
| 814 | Args cmd_args(command); |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 815 | const size_t argc = cmd_args.GetArgumentCount (); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 816 | |
| 817 | if (argc < 3) |
| 818 | { |
| 819 | result.AppendError ("'settings insert-before' takes more arguments"); |
| 820 | result.SetStatus (eReturnStatusFailed); |
| 821 | return false; |
| 822 | } |
| 823 | |
| 824 | const char *var_name = cmd_args.GetArgumentAtIndex (0); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 825 | if ((var_name == NULL) || (var_name[0] == '\0')) |
| 826 | { |
| 827 | result.AppendError ("'settings insert-before' command requires a valid variable name; No value supplied"); |
| 828 | result.SetStatus (eReturnStatusFailed); |
| 829 | return false; |
| 830 | } |
| 831 | |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 832 | // Split the raw command into var_name, index_value, and value triple. |
| 833 | llvm::StringRef raw_str(command); |
Greg Clayton | 30820f0 | 2013-03-05 23:52:49 +0000 | [diff] [blame] | 834 | std::string var_value_string = raw_str.split(var_name).second.str(); |
| 835 | const char *var_value_cstr = Args::StripSpaces(var_value_string, true, true, false); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 836 | |
Greg Clayton | f9fc609 | 2013-01-09 19:44:40 +0000 | [diff] [blame] | 837 | Error error(m_interpreter.GetDebugger().SetPropertyValue (&m_exe_ctx, |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 838 | eVarSetOperationInsertBefore, |
| 839 | var_name, |
Greg Clayton | 30820f0 | 2013-03-05 23:52:49 +0000 | [diff] [blame] | 840 | var_value_cstr)); |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 841 | if (error.Fail()) |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 842 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 843 | result.AppendError (error.AsCString()); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 844 | result.SetStatus (eReturnStatusFailed); |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 845 | return false; |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 846 | } |
| 847 | |
| 848 | return result.Succeeded(); |
| 849 | } |
| 850 | }; |
| 851 | |
| 852 | //------------------------------------------------------------------------- |
| 853 | // CommandObjectSettingInsertAfter |
| 854 | //------------------------------------------------------------------------- |
| 855 | |
| 856 | class CommandObjectSettingsInsertAfter : public CommandObjectRaw |
| 857 | { |
| 858 | public: |
| 859 | CommandObjectSettingsInsertAfter (CommandInterpreter &interpreter) : |
| 860 | CommandObjectRaw (interpreter, |
| 861 | "settings insert-after", |
| 862 | "Insert value(s) into an internal debugger settings array variable, immediately after the specified element.", |
| 863 | NULL) |
| 864 | { |
| 865 | CommandArgumentEntry arg1; |
| 866 | CommandArgumentEntry arg2; |
| 867 | CommandArgumentEntry arg3; |
| 868 | CommandArgumentData var_name_arg; |
| 869 | CommandArgumentData index_arg; |
| 870 | CommandArgumentData value_arg; |
| 871 | |
| 872 | // Define the first (and only) variant of this arg. |
| 873 | var_name_arg.arg_type = eArgTypeSettingVariableName; |
| 874 | var_name_arg.arg_repetition = eArgRepeatPlain; |
| 875 | |
| 876 | // There is only one variant this argument could be; put it into the argument entry. |
| 877 | arg1.push_back (var_name_arg); |
| 878 | |
| 879 | // Define the first (variant of this arg. |
| 880 | index_arg.arg_type = eArgTypeSettingIndex; |
| 881 | index_arg.arg_repetition = eArgRepeatPlain; |
| 882 | |
| 883 | // There is only one variant this argument could be; put it into the argument entry. |
| 884 | arg2.push_back (index_arg); |
| 885 | |
| 886 | // Define the first (and only) variant of this arg. |
| 887 | value_arg.arg_type = eArgTypeValue; |
| 888 | value_arg.arg_repetition = eArgRepeatPlain; |
| 889 | |
| 890 | // There is only one variant this argument could be; put it into the argument entry. |
| 891 | arg3.push_back (value_arg); |
| 892 | |
| 893 | // Push the data for the first argument into the m_arguments vector. |
| 894 | m_arguments.push_back (arg1); |
| 895 | m_arguments.push_back (arg2); |
| 896 | m_arguments.push_back (arg3); |
| 897 | } |
| 898 | |
| 899 | virtual |
| 900 | ~CommandObjectSettingsInsertAfter () {} |
| 901 | |
| 902 | // Overrides base class's behavior where WantsCompletion = !WantsRawCommandString. |
| 903 | virtual bool |
| 904 | WantsCompletion() { return true; } |
| 905 | |
| 906 | virtual int |
| 907 | HandleArgumentCompletion (Args &input, |
| 908 | int &cursor_index, |
| 909 | int &cursor_char_position, |
| 910 | OptionElementVector &opt_element_vector, |
| 911 | int match_start_point, |
| 912 | int max_return_elements, |
| 913 | bool &word_complete, |
| 914 | StringList &matches) |
| 915 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 916 | std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 917 | |
| 918 | // Attempting to complete variable name |
| 919 | if (cursor_index < 2) |
| 920 | CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter, |
| 921 | CommandCompletions::eSettingsNameCompletion, |
| 922 | completion_str.c_str(), |
| 923 | match_start_point, |
| 924 | max_return_elements, |
| 925 | NULL, |
| 926 | word_complete, |
| 927 | matches); |
| 928 | |
| 929 | return matches.GetSize(); |
| 930 | } |
| 931 | |
| 932 | protected: |
| 933 | virtual bool |
| 934 | DoExecute (const char *command, CommandReturnObject &result) |
| 935 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 936 | result.SetStatus (eReturnStatusSuccessFinishNoResult); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 937 | |
| 938 | Args cmd_args(command); |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 939 | const size_t argc = cmd_args.GetArgumentCount (); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 940 | |
| 941 | if (argc < 3) |
| 942 | { |
| 943 | result.AppendError ("'settings insert-after' takes more arguments"); |
| 944 | result.SetStatus (eReturnStatusFailed); |
| 945 | return false; |
| 946 | } |
| 947 | |
| 948 | const char *var_name = cmd_args.GetArgumentAtIndex (0); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 949 | if ((var_name == NULL) || (var_name[0] == '\0')) |
| 950 | { |
| 951 | result.AppendError ("'settings insert-after' command requires a valid variable name; No value supplied"); |
| 952 | result.SetStatus (eReturnStatusFailed); |
| 953 | return false; |
| 954 | } |
| 955 | |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 956 | // Split the raw command into var_name, index_value, and value triple. |
| 957 | llvm::StringRef raw_str(command); |
Greg Clayton | 30820f0 | 2013-03-05 23:52:49 +0000 | [diff] [blame] | 958 | std::string var_value_string = raw_str.split(var_name).second.str(); |
| 959 | const char *var_value_cstr = Args::StripSpaces(var_value_string, true, true, false); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 960 | |
Greg Clayton | f9fc609 | 2013-01-09 19:44:40 +0000 | [diff] [blame] | 961 | Error error(m_interpreter.GetDebugger().SetPropertyValue (&m_exe_ctx, |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 962 | eVarSetOperationInsertAfter, |
| 963 | var_name, |
Greg Clayton | 30820f0 | 2013-03-05 23:52:49 +0000 | [diff] [blame] | 964 | var_value_cstr)); |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 965 | if (error.Fail()) |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 966 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 967 | result.AppendError (error.AsCString()); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 968 | result.SetStatus (eReturnStatusFailed); |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 969 | return false; |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 970 | } |
| 971 | |
| 972 | return result.Succeeded(); |
| 973 | } |
| 974 | }; |
| 975 | |
| 976 | //------------------------------------------------------------------------- |
| 977 | // CommandObjectSettingsAppend |
| 978 | //------------------------------------------------------------------------- |
| 979 | |
| 980 | class CommandObjectSettingsAppend : public CommandObjectRaw |
| 981 | { |
| 982 | public: |
| 983 | CommandObjectSettingsAppend (CommandInterpreter &interpreter) : |
| 984 | CommandObjectRaw (interpreter, |
| 985 | "settings append", |
| 986 | "Append a new value to the end of an internal debugger settings array, dictionary or string variable.", |
| 987 | NULL) |
| 988 | { |
| 989 | CommandArgumentEntry arg1; |
| 990 | CommandArgumentEntry arg2; |
| 991 | CommandArgumentData var_name_arg; |
| 992 | CommandArgumentData value_arg; |
| 993 | |
| 994 | // Define the first (and only) variant of this arg. |
| 995 | var_name_arg.arg_type = eArgTypeSettingVariableName; |
| 996 | var_name_arg.arg_repetition = eArgRepeatPlain; |
| 997 | |
| 998 | // There is only one variant this argument could be; put it into the argument entry. |
| 999 | arg1.push_back (var_name_arg); |
| 1000 | |
| 1001 | // Define the first (and only) variant of this arg. |
| 1002 | value_arg.arg_type = eArgTypeValue; |
| 1003 | value_arg.arg_repetition = eArgRepeatPlain; |
| 1004 | |
| 1005 | // There is only one variant this argument could be; put it into the argument entry. |
| 1006 | arg2.push_back (value_arg); |
| 1007 | |
| 1008 | // Push the data for the first argument into the m_arguments vector. |
| 1009 | m_arguments.push_back (arg1); |
| 1010 | m_arguments.push_back (arg2); |
| 1011 | } |
| 1012 | |
| 1013 | virtual |
| 1014 | ~CommandObjectSettingsAppend () {} |
| 1015 | |
| 1016 | // Overrides base class's behavior where WantsCompletion = !WantsRawCommandString. |
| 1017 | virtual bool |
| 1018 | WantsCompletion() { return true; } |
| 1019 | |
| 1020 | virtual int |
| 1021 | HandleArgumentCompletion (Args &input, |
| 1022 | int &cursor_index, |
| 1023 | int &cursor_char_position, |
| 1024 | OptionElementVector &opt_element_vector, |
| 1025 | int match_start_point, |
| 1026 | int max_return_elements, |
| 1027 | bool &word_complete, |
| 1028 | StringList &matches) |
| 1029 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 1030 | std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 1031 | |
| 1032 | // Attempting to complete variable name |
| 1033 | if (cursor_index < 2) |
| 1034 | CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter, |
| 1035 | CommandCompletions::eSettingsNameCompletion, |
| 1036 | completion_str.c_str(), |
| 1037 | match_start_point, |
| 1038 | max_return_elements, |
| 1039 | NULL, |
| 1040 | word_complete, |
| 1041 | matches); |
| 1042 | |
| 1043 | return matches.GetSize(); |
| 1044 | } |
| 1045 | |
| 1046 | protected: |
| 1047 | virtual bool |
| 1048 | DoExecute (const char *command, CommandReturnObject &result) |
| 1049 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 1050 | result.SetStatus (eReturnStatusSuccessFinishNoResult); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 1051 | Args cmd_args(command); |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 1052 | const size_t argc = cmd_args.GetArgumentCount (); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 1053 | |
| 1054 | if (argc < 2) |
| 1055 | { |
| 1056 | result.AppendError ("'settings append' takes more arguments"); |
| 1057 | result.SetStatus (eReturnStatusFailed); |
| 1058 | return false; |
| 1059 | } |
| 1060 | |
| 1061 | const char *var_name = cmd_args.GetArgumentAtIndex (0); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 1062 | if ((var_name == NULL) || (var_name[0] == '\0')) |
| 1063 | { |
| 1064 | result.AppendError ("'settings append' command requires a valid variable name; No value supplied"); |
| 1065 | result.SetStatus (eReturnStatusFailed); |
| 1066 | return false; |
| 1067 | } |
| 1068 | |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 1069 | // Do not perform cmd_args.Shift() since StringRef is manipulating the |
| 1070 | // raw character string later on. |
| 1071 | |
| 1072 | // Split the raw command into var_name and value pair. |
| 1073 | llvm::StringRef raw_str(command); |
Greg Clayton | 30820f0 | 2013-03-05 23:52:49 +0000 | [diff] [blame] | 1074 | std::string var_value_string = raw_str.split(var_name).second.str(); |
| 1075 | const char *var_value_cstr = Args::StripSpaces(var_value_string, true, true, false); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 1076 | |
Greg Clayton | f9fc609 | 2013-01-09 19:44:40 +0000 | [diff] [blame] | 1077 | Error error(m_interpreter.GetDebugger().SetPropertyValue (&m_exe_ctx, |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 1078 | eVarSetOperationAppend, |
| 1079 | var_name, |
Greg Clayton | 30820f0 | 2013-03-05 23:52:49 +0000 | [diff] [blame] | 1080 | var_value_cstr)); |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 1081 | if (error.Fail()) |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 1082 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 1083 | result.AppendError (error.AsCString()); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 1084 | result.SetStatus (eReturnStatusFailed); |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 1085 | return false; |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 1086 | } |
| 1087 | |
| 1088 | return result.Succeeded(); |
| 1089 | } |
| 1090 | }; |
| 1091 | |
| 1092 | //------------------------------------------------------------------------- |
| 1093 | // CommandObjectSettingsClear |
| 1094 | //------------------------------------------------------------------------- |
| 1095 | |
| 1096 | class CommandObjectSettingsClear : public CommandObjectParsed |
| 1097 | { |
| 1098 | public: |
| 1099 | CommandObjectSettingsClear (CommandInterpreter &interpreter) : |
| 1100 | CommandObjectParsed (interpreter, |
| 1101 | "settings clear", |
| 1102 | "Erase all the contents of an internal debugger settings variables; this is only valid for variables with clearable types, i.e. strings, arrays or dictionaries.", |
| 1103 | NULL) |
| 1104 | { |
| 1105 | CommandArgumentEntry arg; |
| 1106 | CommandArgumentData var_name_arg; |
| 1107 | |
| 1108 | // Define the first (and only) variant of this arg. |
| 1109 | var_name_arg.arg_type = eArgTypeSettingVariableName; |
| 1110 | var_name_arg.arg_repetition = eArgRepeatPlain; |
| 1111 | |
| 1112 | // There is only one variant this argument could be; put it into the argument entry. |
| 1113 | arg.push_back (var_name_arg); |
| 1114 | |
| 1115 | // Push the data for the first argument into the m_arguments vector. |
| 1116 | m_arguments.push_back (arg); |
| 1117 | } |
| 1118 | |
| 1119 | virtual |
| 1120 | ~CommandObjectSettingsClear () {} |
| 1121 | |
| 1122 | virtual int |
| 1123 | HandleArgumentCompletion (Args &input, |
| 1124 | int &cursor_index, |
| 1125 | int &cursor_char_position, |
| 1126 | OptionElementVector &opt_element_vector, |
| 1127 | int match_start_point, |
| 1128 | int max_return_elements, |
| 1129 | bool &word_complete, |
| 1130 | StringList &matches) |
| 1131 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 1132 | std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 1133 | |
| 1134 | // Attempting to complete variable name |
| 1135 | if (cursor_index < 2) |
| 1136 | CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter, |
| 1137 | CommandCompletions::eSettingsNameCompletion, |
| 1138 | completion_str.c_str(), |
| 1139 | match_start_point, |
| 1140 | max_return_elements, |
| 1141 | NULL, |
| 1142 | word_complete, |
| 1143 | matches); |
| 1144 | |
| 1145 | return matches.GetSize(); |
| 1146 | } |
| 1147 | |
| 1148 | protected: |
| 1149 | virtual bool |
| 1150 | DoExecute (Args& command, CommandReturnObject &result) |
| 1151 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 1152 | result.SetStatus (eReturnStatusSuccessFinishNoResult); |
| 1153 | const size_t argc = command.GetArgumentCount (); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 1154 | |
| 1155 | if (argc != 1) |
| 1156 | { |
Bruce Mitchener | d93c4a3 | 2014-07-01 21:22:11 +0000 | [diff] [blame] | 1157 | result.AppendError ("'settings clear' takes exactly one argument"); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 1158 | result.SetStatus (eReturnStatusFailed); |
| 1159 | return false; |
| 1160 | } |
| 1161 | |
| 1162 | const char *var_name = command.GetArgumentAtIndex (0); |
| 1163 | if ((var_name == NULL) || (var_name[0] == '\0')) |
| 1164 | { |
| 1165 | result.AppendError ("'settings clear' command requires a valid variable name; No value supplied"); |
| 1166 | result.SetStatus (eReturnStatusFailed); |
| 1167 | return false; |
| 1168 | } |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 1169 | |
Greg Clayton | f9fc609 | 2013-01-09 19:44:40 +0000 | [diff] [blame] | 1170 | Error error (m_interpreter.GetDebugger().SetPropertyValue (&m_exe_ctx, |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 1171 | eVarSetOperationClear, |
| 1172 | var_name, |
| 1173 | NULL)); |
| 1174 | if (error.Fail()) |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 1175 | { |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 1176 | result.AppendError (error.AsCString()); |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 1177 | result.SetStatus (eReturnStatusFailed); |
Greg Clayton | 67cc063 | 2012-08-22 17:17:09 +0000 | [diff] [blame] | 1178 | return false; |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 1179 | } |
Jim Ingham | 5a98841 | 2012-06-08 21:56:10 +0000 | [diff] [blame] | 1180 | |
| 1181 | return result.Succeeded(); |
| 1182 | } |
| 1183 | }; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1184 | |
| 1185 | //------------------------------------------------------------------------- |
Caroline Tice | 3df9a8d | 2010-09-04 00:03:46 +0000 | [diff] [blame] | 1186 | // CommandObjectMultiwordSettings |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1187 | //------------------------------------------------------------------------- |
| 1188 | |
Caroline Tice | 3df9a8d | 2010-09-04 00:03:46 +0000 | [diff] [blame] | 1189 | CommandObjectMultiwordSettings::CommandObjectMultiwordSettings (CommandInterpreter &interpreter) : |
Greg Clayton | a701509 | 2010-09-18 01:14:36 +0000 | [diff] [blame] | 1190 | CommandObjectMultiword (interpreter, |
| 1191 | "settings", |
Caroline Tice | 3df9a8d | 2010-09-04 00:03:46 +0000 | [diff] [blame] | 1192 | "A set of commands for manipulating internal settable debugger variables.", |
| 1193 | "settings <command> [<command-options>]") |
| 1194 | { |
Greg Clayton | 4c20717 | 2011-04-19 22:32:36 +0000 | [diff] [blame] | 1195 | LoadSubCommand ("set", CommandObjectSP (new CommandObjectSettingsSet (interpreter))); |
| 1196 | LoadSubCommand ("show", CommandObjectSP (new CommandObjectSettingsShow (interpreter))); |
| 1197 | LoadSubCommand ("list", CommandObjectSP (new CommandObjectSettingsList (interpreter))); |
| 1198 | LoadSubCommand ("remove", CommandObjectSP (new CommandObjectSettingsRemove (interpreter))); |
| 1199 | LoadSubCommand ("replace", CommandObjectSP (new CommandObjectSettingsReplace (interpreter))); |
| 1200 | LoadSubCommand ("insert-before", CommandObjectSP (new CommandObjectSettingsInsertBefore (interpreter))); |
| 1201 | LoadSubCommand ("insert-after", CommandObjectSP (new CommandObjectSettingsInsertAfter (interpreter))); |
| 1202 | LoadSubCommand ("append", CommandObjectSP (new CommandObjectSettingsAppend (interpreter))); |
| 1203 | LoadSubCommand ("clear", CommandObjectSP (new CommandObjectSettingsClear (interpreter))); |
Caroline Tice | 3df9a8d | 2010-09-04 00:03:46 +0000 | [diff] [blame] | 1204 | } |
| 1205 | |
| 1206 | CommandObjectMultiwordSettings::~CommandObjectMultiwordSettings () |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1207 | { |
| 1208 | } |