diff options
author | Adrian Prantl <aprantl@apple.com> | 2024-06-18 12:19:28 -0700 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2024-06-20 10:32:06 -0700 |
commit | b8f0ca09b66716fc337448a2e43146038bf115ab (patch) | |
tree | 25c0b01152a18ccf942312682b5b152207380a20 /lldb/source/Interpreter/CommandInterpreter.cpp | |
parent | f900644ae2b6c7a485673974688a62c3f3301dcc (diff) | |
download | llvm-b8f0ca09b66716fc337448a2e43146038bf115ab.zip llvm-b8f0ca09b66716fc337448a2e43146038bf115ab.tar.gz llvm-b8f0ca09b66716fc337448a2e43146038bf115ab.tar.bz2 |
Factor out expression result error strings.
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r-- | lldb/source/Interpreter/CommandInterpreter.cpp | 48 |
1 files changed, 3 insertions, 45 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index da995de..40c915b 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -48,6 +48,7 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/PluginManager.h" #include "lldb/Host/StreamFile.h" +#include "lldb/Utility/ErrorMessages.h" #include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/State.h" @@ -1817,51 +1818,8 @@ CommandInterpreter::PreprocessToken(std::string &expr_str) { error = expr_result_valobj_sp->GetError(); if (error.Success()) { - switch (expr_result) { - case eExpressionSetupError: - error.SetErrorStringWithFormat( - "expression setup error for the expression '%s'", expr_str.c_str()); - break; - case eExpressionParseError: - error.SetErrorStringWithFormat( - "expression parse error for the expression '%s'", expr_str.c_str()); - break; - case eExpressionResultUnavailable: - error.SetErrorStringWithFormat( - "expression error fetching result for the expression '%s'", - expr_str.c_str()); - break; - case eExpressionCompleted: - break; - case eExpressionDiscarded: - error.SetErrorStringWithFormat( - "expression discarded for the expression '%s'", expr_str.c_str()); - break; - case eExpressionInterrupted: - error.SetErrorStringWithFormat( - "expression interrupted for the expression '%s'", expr_str.c_str()); - break; - case eExpressionHitBreakpoint: - error.SetErrorStringWithFormat( - "expression hit breakpoint for the expression '%s'", - expr_str.c_str()); - break; - case eExpressionTimedOut: - error.SetErrorStringWithFormat( - "expression timed out for the expression '%s'", expr_str.c_str()); - break; - case eExpressionStoppedForDebug: - error.SetErrorStringWithFormat("expression stop at entry point " - "for debugging for the " - "expression '%s'", - expr_str.c_str()); - break; - case eExpressionThreadVanished: - error.SetErrorStringWithFormat( - "expression thread vanished for the expression '%s'", - expr_str.c_str()); - break; - } + std::string result = lldb_private::toString(expr_result); + error.SetErrorString(result + "for the expression '" + expr_str + "'"); } return error; } |