diff options
Diffstat (limited to 'lldb/source')
-rw-r--r-- | lldb/source/API/SBFrame.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectExpression.cpp | 13 | ||||
-rw-r--r-- | lldb/source/Core/ValueObject.cpp | 5 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectConstResult.cpp | 10 | ||||
-rw-r--r-- | lldb/source/Expression/ClangUserExpression.cpp | 13 |
5 files changed, 32 insertions, 13 deletions
diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp index 0b2db3328dd..9ca92fc9b6b 100644 --- a/lldb/source/API/SBFrame.cpp +++ b/lldb/source/API/SBFrame.cpp @@ -20,6 +20,7 @@ #include "lldb/Core/StreamFile.h" #include "lldb/Core/ValueObjectRegister.h" #include "lldb/Core/ValueObjectVariable.h" +#include "lldb/Expression/ClangUserExpression.h" #include "lldb/Symbol/Block.h" #include "lldb/Symbol/SymbolContext.h" #include "lldb/Symbol/VariableList.h" @@ -416,6 +417,9 @@ SBFrame::EvaluateExpression (const char *expr) lldb::SBValue expr_result_value; if (m_opaque_sp) { + ExecutionContext exe_ctx; + m_opaque_sp->CalculateExecutionContext (exe_ctx); + *expr_result_value = ClangUserExpression::Evaluate (exe_ctx, expr); } return expr_result_value; } diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index a02451ceb46..1f6c3de1903 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -233,13 +233,10 @@ CommandObjectExpression::EvaluateExpression m_exe_ctx.process->SetDynamicCheckers(dynamic_checkers); } - lldb::ValueObjectSP result_valobj_sp; - - Error expr_error (ClangUserExpression::Evaluate (m_exe_ctx, expr, result_valobj_sp)); - - if (expr_error.Success()) + lldb::ValueObjectSP result_valobj_sp (ClangUserExpression::Evaluate (m_exe_ctx, expr)); + assert (result_valobj_sp.get()); + if (result_valobj_sp->GetError().Success()) { - assert (result_valobj_sp.get() != NULL); ValueObject::DumpValueObject (output_stream, m_exe_ctx.GetBestExecutionContextScope(), result_valobj_sp.get(), // Variable object to dump @@ -257,9 +254,9 @@ CommandObjectExpression::EvaluateExpression } else { - error_stream.PutCString(expr_error.AsCString()); + error_stream.PutCString(result_valobj_sp->GetError().AsCString()); if (result) - result->SetStatus (eReturnStatusSuccessFinishNoResult); + result->SetStatus (eReturnStatusFailed); } return true; diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index 4b7f0d70807..cc7f40887b8 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -79,6 +79,11 @@ ValueObject::GetUpdateID() const bool ValueObject::UpdateValueIfNeeded (ExecutionContextScope *exe_scope) { + // If this is a constant value, then our success is predicated on whether + // we have an error or not + if (GetIsConstant()) + return m_error.Success(); + if (exe_scope) { Process *process = exe_scope->CalculateProcess(); diff --git a/lldb/source/Core/ValueObjectConstResult.cpp b/lldb/source/Core/ValueObjectConstResult.cpp index d2317dfde41..103edadddbe 100644 --- a/lldb/source/Core/ValueObjectConstResult.cpp +++ b/lldb/source/Core/ValueObjectConstResult.cpp @@ -46,6 +46,16 @@ ValueObjectConstResult::ValueObjectConstResult m_value.SetValueType(Value::eValueTypeHostAddress); m_value.SetContext(Value::eContextTypeOpaqueClangQualType, clang_type); m_name = name; + SetIsConstant (); +} + +ValueObjectConstResult::ValueObjectConstResult (const Error& error) : + ValueObject (), + m_clang_ast (NULL), + m_type_name () +{ + m_error = error; + SetIsConstant (); } ValueObjectConstResult::~ValueObjectConstResult() diff --git a/lldb/source/Expression/ClangUserExpression.cpp b/lldb/source/Expression/ClangUserExpression.cpp index ed50ea0d0a1..888a2666679 100644 --- a/lldb/source/Expression/ClangUserExpression.cpp +++ b/lldb/source/Expression/ClangUserExpression.cpp @@ -21,6 +21,7 @@ #include "lldb/Core/ConstString.h" #include "lldb/Core/Log.h" #include "lldb/Core/StreamString.h" +#include "lldb/Core/ValueObjectConstResult.h" #include "lldb/Expression/ClangExpressionDeclMap.h" #include "lldb/Expression/ClangExpressionParser.h" #include "lldb/Expression/ClangFunction.h" @@ -338,12 +339,11 @@ ClangUserExpression::DwarfOpcodeStream () } -Error -ClangUserExpression::Evaluate (ExecutionContext &exe_ctx, const char *expr_cstr, lldb::ValueObjectSP &result_valobj_sp) +lldb::ValueObjectSP +ClangUserExpression::Evaluate (ExecutionContext &exe_ctx, const char *expr_cstr) { Error error; - result_valobj_sp.reset(); - + lldb::ValueObjectSP result_valobj_sp; ClangUserExpression user_expression (expr_cstr); StreamString error_stream; @@ -385,6 +385,9 @@ ClangUserExpression::Evaluate (ExecutionContext &exe_ctx, const char *expr_cstr, } } } - return error; + if (result_valobj_sp.get() == NULL) + result_valobj_sp.reset (new ValueObjectConstResult (error)); + + return result_valobj_sp; }
\ No newline at end of file |