1 //===-- CommandObjectExpression.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 // C Includes 11 // C++ Includes 12 // Other libraries and framework includes 13 #include "llvm/ADT/STLExtras.h" 14 #include "llvm/ADT/StringRef.h" 15 16 // Project includes 17 #include "CommandObjectExpression.h" 18 #include "lldb/Core/Value.h" 19 #include "lldb/Core/ValueObjectVariable.h" 20 #include "lldb/DataFormatters/ValueObjectPrinter.h" 21 #include "Plugins/ExpressionParser/Clang/ClangExpressionVariable.h" 22 #include "lldb/Expression/UserExpression.h" 23 #include "lldb/Expression/DWARFExpression.h" 24 #include "lldb/Expression/REPL.h" 25 #include "lldb/Host/Host.h" 26 #include "lldb/Host/StringConvert.h" 27 #include "lldb/Core/Debugger.h" 28 #include "lldb/Interpreter/CommandInterpreter.h" 29 #include "lldb/Interpreter/CommandReturnObject.h" 30 #include "lldb/Target/Language.h" 31 #include "lldb/Symbol/ObjectFile.h" 32 #include "lldb/Symbol/Variable.h" 33 #include "lldb/Target/Process.h" 34 #include "lldb/Target/StackFrame.h" 35 #include "lldb/Target/Target.h" 36 #include "lldb/Target/Thread.h" 37 38 using namespace lldb; 39 using namespace lldb_private; 40 41 CommandObjectExpression::CommandOptions::CommandOptions () : 42 OptionGroup() 43 { 44 } 45 46 CommandObjectExpression::CommandOptions::~CommandOptions() = default; 47 48 static OptionEnumValueElement g_description_verbosity_type[] = 49 { 50 { eLanguageRuntimeDescriptionDisplayVerbosityCompact, "compact", "Only show the description string"}, 51 { eLanguageRuntimeDescriptionDisplayVerbosityFull, "full", "Show the full output, including persistent variable's name and type"}, 52 { 0, nullptr, nullptr } 53 }; 54 55 OptionDefinition 56 CommandObjectExpression::CommandOptions::g_option_table[] = 57 { 58 { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "all-threads", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Should we run all threads if the execution doesn't complete on one thread."}, 59 { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "ignore-breakpoints", 'i', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Ignore breakpoint hits while running expressions"}, 60 { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "timeout", 't', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeUnsignedInteger, "Timeout value (in microseconds) for running the expression."}, 61 { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "unwind-on-error", 'u', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Clean up program state if the expression causes a crash, or raises a signal. Note, unlike gdb hitting a breakpoint is controlled by another option (-i)."}, 62 { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "debug", 'g', OptionParser::eNoArgument , nullptr, nullptr, 0, eArgTypeNone, "When specified, debug the JIT code by setting a breakpoint on the first instruction and forcing breakpoints to not be ignored (-i0) and no unwinding to happen on error (-u0)."}, 63 { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "language", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLanguage, "Specifies the Language to use when parsing the expression. If not set the target.language setting is used." }, 64 { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "apply-fixits", 'X', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLanguage, "If true, simple FixIt hints will be automatically applied to the expression." }, 65 { LLDB_OPT_SET_1, false, "description-verbosity", 'v', OptionParser::eOptionalArgument, nullptr, g_description_verbosity_type, 0, eArgTypeDescriptionVerbosity, "How verbose should the output of this expression be, if the object description is asked for."}, 66 { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "top-level", 'p', OptionParser::eNoArgument , NULL, NULL, 0, eArgTypeNone, "Interpret the expression as top-level definitions rather than code to be immediately executed."}, 67 { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "allow-jit", 'j', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Controls whether the expression can fall back to being JITted if it's not supported by the interpreter (defaults to true)."} 68 }; 69 70 uint32_t 71 CommandObjectExpression::CommandOptions::GetNumDefinitions () 72 { 73 return llvm::array_lengthof(g_option_table); 74 } 75 76 Error 77 CommandObjectExpression::CommandOptions::SetOptionValue (CommandInterpreter &interpreter, 78 uint32_t option_idx, 79 const char *option_arg) 80 { 81 Error error; 82 83 const int short_option = g_option_table[option_idx].short_option; 84 85 switch (short_option) 86 { 87 case 'l': 88 language = Language::GetLanguageTypeFromString (option_arg); 89 if (language == eLanguageTypeUnknown) 90 error.SetErrorStringWithFormat ("unknown language type: '%s' for expression", option_arg); 91 break; 92 93 case 'a': 94 { 95 bool success; 96 bool result; 97 result = Args::StringToBoolean(option_arg, true, &success); 98 if (!success) 99 error.SetErrorStringWithFormat("invalid all-threads value setting: \"%s\"", option_arg); 100 else 101 try_all_threads = result; 102 } 103 break; 104 105 case 'i': 106 { 107 bool success; 108 bool tmp_value = Args::StringToBoolean(option_arg, true, &success); 109 if (success) 110 ignore_breakpoints = tmp_value; 111 else 112 error.SetErrorStringWithFormat("could not convert \"%s\" to a boolean value.", option_arg); 113 break; 114 } 115 116 case 'j': 117 { 118 bool success; 119 bool tmp_value = Args::StringToBoolean(option_arg, true, &success); 120 if (success) 121 allow_jit = tmp_value; 122 else 123 error.SetErrorStringWithFormat("could not convert \"%s\" to a boolean value.", option_arg); 124 break; 125 } 126 127 case 't': 128 { 129 bool success; 130 uint32_t result; 131 result = StringConvert::ToUInt32(option_arg, 0, 0, &success); 132 if (success) 133 timeout = result; 134 else 135 error.SetErrorStringWithFormat ("invalid timeout setting \"%s\"", option_arg); 136 } 137 break; 138 139 case 'u': 140 { 141 bool success; 142 bool tmp_value = Args::StringToBoolean(option_arg, true, &success); 143 if (success) 144 unwind_on_error = tmp_value; 145 else 146 error.SetErrorStringWithFormat("could not convert \"%s\" to a boolean value.", option_arg); 147 break; 148 } 149 150 case 'v': 151 if (!option_arg) 152 { 153 m_verbosity = eLanguageRuntimeDescriptionDisplayVerbosityFull; 154 break; 155 } 156 m_verbosity = (LanguageRuntimeDescriptionDisplayVerbosity) Args::StringToOptionEnum(option_arg, g_option_table[option_idx].enum_values, 0, error); 157 if (!error.Success()) 158 error.SetErrorStringWithFormat ("unrecognized value for description-verbosity '%s'", option_arg); 159 break; 160 161 case 'g': 162 debug = true; 163 unwind_on_error = false; 164 ignore_breakpoints = false; 165 break; 166 167 case 'p': 168 top_level = true; 169 break; 170 171 case 'X': 172 { 173 bool success; 174 bool tmp_value = Args::StringToBoolean(option_arg, true, &success); 175 if (success) 176 auto_apply_fixits = tmp_value ? eLazyBoolYes : eLazyBoolNo; 177 else 178 error.SetErrorStringWithFormat("could not convert \"%s\" to a boolean value.", option_arg); 179 break; 180 } 181 182 default: 183 error.SetErrorStringWithFormat("invalid short option character '%c'", short_option); 184 break; 185 } 186 187 return error; 188 } 189 190 void 191 CommandObjectExpression::CommandOptions::OptionParsingStarting (CommandInterpreter &interpreter) 192 { 193 Process *process = interpreter.GetExecutionContext().GetProcessPtr(); 194 if (process != nullptr) 195 { 196 ignore_breakpoints = process->GetIgnoreBreakpointsInExpressions(); 197 unwind_on_error = process->GetUnwindOnErrorInExpressions(); 198 } 199 else 200 { 201 ignore_breakpoints = true; 202 unwind_on_error = true; 203 } 204 205 show_summary = true; 206 try_all_threads = true; 207 timeout = 0; 208 debug = false; 209 language = eLanguageTypeUnknown; 210 m_verbosity = eLanguageRuntimeDescriptionDisplayVerbosityCompact; 211 auto_apply_fixits = eLazyBoolCalculate; 212 top_level = false; 213 allow_jit = true; 214 } 215 216 const OptionDefinition* 217 CommandObjectExpression::CommandOptions::GetDefinitions () 218 { 219 return g_option_table; 220 } 221 222 CommandObjectExpression::CommandObjectExpression (CommandInterpreter &interpreter) : 223 CommandObjectRaw(interpreter, 224 "expression", 225 "Evaluate an expression in the current program context, using user defined variables and variables currently in scope.", 226 nullptr, 227 eCommandProcessMustBePaused | eCommandTryTargetAPILock), 228 IOHandlerDelegate (IOHandlerDelegate::Completion::Expression), 229 m_option_group (interpreter), 230 m_format_options (eFormatDefault), 231 m_repl_option (LLDB_OPT_SET_1, false, "repl", 'r', "Drop into REPL", false, true), 232 m_command_options (), 233 m_expr_line_count (0), 234 m_expr_lines () 235 { 236 SetHelpLong( 237 R"( 238 Timeouts: 239 240 )" " If the expression can be evaluated statically (without running code) then it will be. \ 241 Otherwise, by default the expression will run on the current thread with a short timeout: \ 242 currently .25 seconds. If it doesn't return in that time, the evaluation will be interrupted \ 243 and resumed with all threads running. You can use the -a option to disable retrying on all \ 244 threads. You can use the -t option to set a shorter timeout." R"( 245 246 User defined variables: 247 248 )" " You can define your own variables for convenience or to be used in subsequent expressions. \ 249 You define them the same way you would define variables in C. If the first character of \ 250 your user defined variable is a $, then the variable's value will be available in future \ 251 expressions, otherwise it will just be available in the current expression." R"( 252 253 Continuing evaluation after a breakpoint: 254 255 )" " If the \"-i false\" option is used, and execution is interrupted by a breakpoint hit, once \ 256 you are done with your investigation, you can either remove the expression execution frames \ 257 from the stack with \"thread return -x\" or if you are still interested in the expression result \ 258 you can issue the \"continue\" command and the expression evaluation will complete and the \ 259 expression result will be available using the \"thread.completed-expression\" key in the thread \ 260 format." R"( 261 262 Examples: 263 264 expr my_struct->a = my_array[3] 265 expr -f bin -- (index * 8) + 5 266 expr unsigned int $foo = 5 267 expr char c[] = \"foo\"; c[0])" 268 ); 269 270 CommandArgumentEntry arg; 271 CommandArgumentData expression_arg; 272 273 // Define the first (and only) variant of this arg. 274 expression_arg.arg_type = eArgTypeExpression; 275 expression_arg.arg_repetition = eArgRepeatPlain; 276 277 // There is only one variant this argument could be; put it into the argument entry. 278 arg.push_back (expression_arg); 279 280 // Push the data for the first argument into the m_arguments vector. 281 m_arguments.push_back (arg); 282 283 // Add the "--format" and "--gdb-format" 284 m_option_group.Append (&m_format_options, OptionGroupFormat::OPTION_GROUP_FORMAT | OptionGroupFormat::OPTION_GROUP_GDB_FMT, LLDB_OPT_SET_1); 285 m_option_group.Append (&m_command_options); 286 m_option_group.Append (&m_varobj_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1 | LLDB_OPT_SET_2); 287 m_option_group.Append (&m_repl_option, LLDB_OPT_SET_ALL, LLDB_OPT_SET_3); 288 m_option_group.Finalize(); 289 } 290 291 CommandObjectExpression::~CommandObjectExpression() = default; 292 293 Options * 294 CommandObjectExpression::GetOptions () 295 { 296 return &m_option_group; 297 } 298 299 static lldb_private::Error 300 CanBeUsedForElementCountPrinting (ValueObject& valobj) 301 { 302 CompilerType type(valobj.GetCompilerType()); 303 CompilerType pointee; 304 if (!type.IsPointerType(&pointee)) 305 return Error("as it does not refer to a pointer"); 306 if (pointee.IsVoidType()) 307 return Error("as it refers to a pointer to void"); 308 return Error(); 309 } 310 311 bool 312 CommandObjectExpression::EvaluateExpression(const char *expr, 313 Stream *output_stream, 314 Stream *error_stream, 315 CommandReturnObject *result) 316 { 317 // Don't use m_exe_ctx as this might be called asynchronously 318 // after the command object DoExecute has finished when doing 319 // multi-line expression that use an input reader... 320 ExecutionContext exe_ctx (m_interpreter.GetExecutionContext()); 321 322 Target *target = exe_ctx.GetTargetPtr(); 323 324 if (!target) 325 target = GetDummyTarget(); 326 327 if (target) 328 { 329 lldb::ValueObjectSP result_valobj_sp; 330 bool keep_in_memory = true; 331 StackFrame *frame = exe_ctx.GetFramePtr(); 332 333 EvaluateExpressionOptions options; 334 options.SetCoerceToId(m_varobj_options.use_objc); 335 options.SetUnwindOnError(m_command_options.unwind_on_error); 336 options.SetIgnoreBreakpoints (m_command_options.ignore_breakpoints); 337 options.SetKeepInMemory(keep_in_memory); 338 options.SetUseDynamic(m_varobj_options.use_dynamic); 339 options.SetTryAllThreads(m_command_options.try_all_threads); 340 options.SetDebug(m_command_options.debug); 341 options.SetLanguage(m_command_options.language); 342 options.SetExecutionPolicy(m_command_options.allow_jit ? 343 EvaluateExpressionOptions::default_execution_policy : 344 lldb_private::eExecutionPolicyNever); 345 346 bool auto_apply_fixits; 347 if (m_command_options.auto_apply_fixits == eLazyBoolCalculate) 348 auto_apply_fixits = target->GetEnableAutoApplyFixIts(); 349 else 350 auto_apply_fixits = m_command_options.auto_apply_fixits == eLazyBoolYes ? true : false; 351 352 options.SetAutoApplyFixIts(auto_apply_fixits); 353 354 if (m_command_options.top_level) 355 options.SetExecutionPolicy(eExecutionPolicyTopLevel); 356 357 // If there is any chance we are going to stop and want to see 358 // what went wrong with our expression, we should generate debug info 359 if (!m_command_options.ignore_breakpoints || 360 !m_command_options.unwind_on_error) 361 options.SetGenerateDebugInfo(true); 362 363 if (m_command_options.timeout > 0) 364 options.SetTimeoutUsec(m_command_options.timeout); 365 else 366 options.SetTimeoutUsec(0); 367 368 ExpressionResults success = target->EvaluateExpression(expr, frame, result_valobj_sp, options, &m_fixed_expression); 369 370 // We only tell you about the FixIt if we applied it. The compiler errors will suggest the FixIt if it parsed. 371 if (error_stream && !m_fixed_expression.empty() && target->GetEnableNotifyAboutFixIts()) 372 { 373 if (success == eExpressionCompleted) 374 error_stream->Printf (" Fixit applied, fixed expression was: \n %s\n", m_fixed_expression.c_str()); 375 } 376 377 if (result_valobj_sp) 378 { 379 Format format = m_format_options.GetFormat(); 380 381 if (result_valobj_sp->GetError().Success()) 382 { 383 if (format != eFormatVoid) 384 { 385 if (format != eFormatDefault) 386 result_valobj_sp->SetFormat (format); 387 388 if (m_varobj_options.elem_count > 0) 389 { 390 Error error(CanBeUsedForElementCountPrinting(*result_valobj_sp)); 391 if (error.Fail()) 392 { 393 result->AppendErrorWithFormat("expression cannot be used with --element-count %s\n", error.AsCString("")); 394 result->SetStatus(eReturnStatusFailed); 395 return false; 396 } 397 } 398 399 DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions(m_command_options.m_verbosity,format)); 400 options.SetVariableFormatDisplayLanguage(result_valobj_sp->GetPreferredDisplayLanguage()); 401 402 result_valobj_sp->Dump(*output_stream,options); 403 404 if (result) 405 result->SetStatus (eReturnStatusSuccessFinishResult); 406 } 407 } 408 else 409 { 410 if (result_valobj_sp->GetError().GetError() == UserExpression::kNoResult) 411 { 412 if (format != eFormatVoid && m_interpreter.GetDebugger().GetNotifyVoid()) 413 { 414 error_stream->PutCString("(void)\n"); 415 } 416 417 if (result) 418 result->SetStatus (eReturnStatusSuccessFinishResult); 419 } 420 else 421 { 422 const char *error_cstr = result_valobj_sp->GetError().AsCString(); 423 if (error_cstr && error_cstr[0]) 424 { 425 const size_t error_cstr_len = strlen (error_cstr); 426 const bool ends_with_newline = error_cstr[error_cstr_len - 1] == '\n'; 427 if (strstr(error_cstr, "error:") != error_cstr) 428 error_stream->PutCString ("error: "); 429 error_stream->Write(error_cstr, error_cstr_len); 430 if (!ends_with_newline) 431 error_stream->EOL(); 432 } 433 else 434 { 435 error_stream->PutCString ("error: unknown error\n"); 436 } 437 438 if (result) 439 result->SetStatus (eReturnStatusFailed); 440 } 441 } 442 } 443 } 444 else 445 { 446 error_stream->Printf ("error: invalid execution context for expression\n"); 447 return false; 448 } 449 450 return true; 451 } 452 453 void 454 CommandObjectExpression::IOHandlerInputComplete (IOHandler &io_handler, std::string &line) 455 { 456 io_handler.SetIsDone(true); 457 // StreamSP output_stream = io_handler.GetDebugger().GetAsyncOutputStream(); 458 // StreamSP error_stream = io_handler.GetDebugger().GetAsyncErrorStream(); 459 StreamFileSP output_sp(io_handler.GetOutputStreamFile()); 460 StreamFileSP error_sp(io_handler.GetErrorStreamFile()); 461 462 EvaluateExpression (line.c_str(), 463 output_sp.get(), 464 error_sp.get()); 465 if (output_sp) 466 output_sp->Flush(); 467 if (error_sp) 468 error_sp->Flush(); 469 } 470 471 bool 472 CommandObjectExpression::IOHandlerIsInputComplete (IOHandler &io_handler, 473 StringList &lines) 474 { 475 // An empty lines is used to indicate the end of input 476 const size_t num_lines = lines.GetSize(); 477 if (num_lines > 0 && lines[num_lines - 1].empty()) 478 { 479 // Remove the last empty line from "lines" so it doesn't appear 480 // in our resulting input and return true to indicate we are done 481 // getting lines 482 lines.PopBack(); 483 return true; 484 } 485 return false; 486 } 487 488 void 489 CommandObjectExpression::GetMultilineExpression () 490 { 491 m_expr_lines.clear(); 492 m_expr_line_count = 0; 493 494 Debugger &debugger = GetCommandInterpreter().GetDebugger(); 495 bool color_prompt = debugger.GetUseColor(); 496 const bool multiple_lines = true; // Get multiple lines 497 IOHandlerSP io_handler_sp(new IOHandlerEditline(debugger, 498 IOHandler::Type::Expression, 499 "lldb-expr", // Name of input reader for history 500 nullptr, // No prompt 501 nullptr, // Continuation prompt 502 multiple_lines, 503 color_prompt, 504 1, // Show line numbers starting at 1 505 *this)); 506 507 StreamFileSP output_sp(io_handler_sp->GetOutputStreamFile()); 508 if (output_sp) 509 { 510 output_sp->PutCString("Enter expressions, then terminate with an empty line to evaluate:\n"); 511 output_sp->Flush(); 512 } 513 debugger.PushIOHandler(io_handler_sp); 514 } 515 516 bool 517 CommandObjectExpression::DoExecute(const char *command, 518 CommandReturnObject &result) 519 { 520 m_fixed_expression.clear(); 521 m_option_group.NotifyOptionParsingStarting(); 522 523 const char * expr = nullptr; 524 525 if (command[0] == '\0') 526 { 527 GetMultilineExpression (); 528 return result.Succeeded(); 529 } 530 531 if (command[0] == '-') 532 { 533 // We have some options and these options MUST end with --. 534 const char *end_options = nullptr; 535 const char *s = command; 536 while (s && s[0]) 537 { 538 end_options = ::strstr (s, "--"); 539 if (end_options) 540 { 541 end_options += 2; // Get past the "--" 542 if (::isspace (end_options[0])) 543 { 544 expr = end_options; 545 while (::isspace (*expr)) 546 ++expr; 547 break; 548 } 549 } 550 s = end_options; 551 } 552 553 if (end_options) 554 { 555 Args args (llvm::StringRef(command, end_options - command)); 556 if (!ParseOptions (args, result)) 557 return false; 558 559 Error error (m_option_group.NotifyOptionParsingFinished()); 560 if (error.Fail()) 561 { 562 result.AppendError (error.AsCString()); 563 result.SetStatus (eReturnStatusFailed); 564 return false; 565 } 566 567 if (m_repl_option.GetOptionValue().GetCurrentValue()) 568 { 569 Target *target = m_interpreter.GetExecutionContext().GetTargetPtr(); 570 if (target) 571 { 572 // Drop into REPL 573 m_expr_lines.clear(); 574 m_expr_line_count = 0; 575 576 Debugger &debugger = target->GetDebugger(); 577 578 // Check if the LLDB command interpreter is sitting on top of a REPL that 579 // launched it... 580 if (debugger.CheckTopIOHandlerTypes(IOHandler::Type::CommandInterpreter, IOHandler::Type::REPL)) 581 { 582 // the LLDB command interpreter is sitting on top of a REPL that launched it, 583 // so just say the command interpreter is done and fall back to the existing REPL 584 m_interpreter.GetIOHandler(false)->SetIsDone(true); 585 } 586 else 587 { 588 // We are launching the REPL on top of the current LLDB command interpreter, 589 // so just push one 590 bool initialize = false; 591 Error repl_error; 592 REPLSP repl_sp (target->GetREPL(repl_error, m_command_options.language, nullptr, false)); 593 594 if (!repl_sp) 595 { 596 initialize = true; 597 repl_sp = target->GetREPL(repl_error, m_command_options.language, nullptr, true); 598 if (!repl_error.Success()) 599 { 600 result.SetError(repl_error); 601 return result.Succeeded(); 602 } 603 } 604 605 if (repl_sp) 606 { 607 if (initialize) 608 { 609 repl_sp->SetCommandOptions(m_command_options); 610 repl_sp->SetFormatOptions(m_format_options); 611 repl_sp->SetValueObjectDisplayOptions(m_varobj_options); 612 } 613 614 IOHandlerSP io_handler_sp (repl_sp->GetIOHandler()); 615 616 io_handler_sp->SetIsDone(false); 617 618 debugger.PushIOHandler(io_handler_sp); 619 } 620 else 621 { 622 repl_error.SetErrorStringWithFormat("Couldn't create a REPL for %s", Language::GetNameForLanguageType(m_command_options.language)); 623 result.SetError(repl_error); 624 return result.Succeeded(); 625 } 626 } 627 } 628 } 629 // No expression following options 630 else if (expr == nullptr || expr[0] == '\0') 631 { 632 GetMultilineExpression (); 633 return result.Succeeded(); 634 } 635 } 636 } 637 638 if (expr == nullptr) 639 expr = command; 640 641 if (EvaluateExpression (expr, &(result.GetOutputStream()), &(result.GetErrorStream()), &result)) 642 { 643 Target *target = m_interpreter.GetExecutionContext().GetTargetPtr(); 644 if (!m_fixed_expression.empty() && target->GetEnableNotifyAboutFixIts()) 645 { 646 CommandHistory &history = m_interpreter.GetCommandHistory(); 647 // FIXME: Can we figure out what the user actually typed (e.g. some alias for expr???) 648 // If we can it would be nice to show that. 649 std::string fixed_command("expression "); 650 if (expr == command) 651 fixed_command.append(m_fixed_expression); 652 else 653 { 654 // Add in any options that might have been in the original command: 655 fixed_command.append(command, expr - command); 656 fixed_command.append(m_fixed_expression); 657 } 658 history.AppendString(fixed_command); 659 } 660 return true; 661 } 662 663 result.SetStatus (eReturnStatusFailed); 664 return false; 665 } 666