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