summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/API/SBFrame.cpp15
-rw-r--r--lldb/source/API/SBValue.cpp10
-rw-r--r--lldb/source/Commands/CommandObjectExpression.cpp14
-rw-r--r--lldb/source/Commands/CommandObjectWatchpoint.cpp16
-rw-r--r--lldb/source/Core/CXXFormatterFunctions.cpp30
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp20
-rw-r--r--lldb/source/Target/Target.cpp23
7 files changed, 61 insertions, 67 deletions
diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp
index ca451918c39..b94a0ce9267 100644
--- a/lldb/source/API/SBFrame.cpp
+++ b/lldb/source/API/SBFrame.cpp
@@ -1082,17 +1082,14 @@ SBFrame::EvaluateExpression (const char *expr, lldb::DynamicValueType fetch_dyna
Host::SetCrashDescriptionWithFormat ("SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value = %u) %s",
expr, fetch_dynamic_value, frame_description.GetString().c_str());
#endif
- const bool coerce_to_id = false;
- const bool keep_in_memory = false;
-
+ Target::EvaluateExpressionOptions options;
+ options.SetUnwindOnError(unwind_on_error)
+ .SetUseDynamic(fetch_dynamic_value);
+
exe_results = target->EvaluateExpression (expr,
frame,
- eExecutionPolicyOnlyWhenNeeded,
- coerce_to_id,
- unwind_on_error,
- keep_in_memory,
- fetch_dynamic_value,
- expr_value_sp);
+ expr_value_sp,
+ options);
expr_result.SetSP(expr_value_sp);
#ifdef LLDB_CONFIGURATION_DEBUG
Host::SetCrashDescription (NULL);
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index 21f24a28993..46f5e07ebdc 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -732,14 +732,12 @@ SBValue::CreateValueFromExpression (const char *name, const char* expression)
Target* target = exe_ctx.GetTargetPtr();
if (target)
{
+ Target::EvaluateExpressionOptions options;
+ options.SetKeepInMemory(true);
target->EvaluateExpression (expression,
exe_ctx.GetFramePtr(),
- eExecutionPolicyOnlyWhenNeeded,
- false, // coerce to id
- true, // unwind on error
- true, // keep in memory
- eNoDynamicValues,
- new_value_sp);
+ new_value_sp,
+ options);
if (new_value_sp)
{
new_value_sp->SetName(ConstString(name));
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp
index d192c072b94..23c9dc10373 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -298,15 +298,17 @@ CommandObjectExpression::EvaluateExpression
break;
}
+ Target::EvaluateExpressionOptions options;
+ options.SetCoerceToId(m_command_options.print_object)
+ .SetUnwindOnError(m_command_options.unwind_on_error)
+ .SetKeepInMemory(keep_in_memory)
+ .SetUseDynamic(use_dynamic)
+ .SetSingleThreadTimeoutUsec(0);
+
exe_results = target->EvaluateExpression (expr,
m_interpreter.GetExecutionContext().GetFramePtr(),
- eExecutionPolicyOnlyWhenNeeded,
- m_command_options.print_object,
- m_command_options.unwind_on_error,
- keep_in_memory,
- use_dynamic,
result_valobj_sp,
- 0 /* no timeout */);
+ options);
if (exe_results == eExecutionInterrupted && !m_command_options.unwind_on_error)
{
diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp
index ff59e318d8d..f7f4b69ea73 100644
--- a/lldb/source/Commands/CommandObjectWatchpoint.cpp
+++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp
@@ -1201,18 +1201,16 @@ protected:
}
// Use expression evaluation to arrive at the address to watch.
- const bool coerce_to_id = true;
- const bool unwind_on_error = true;
- const bool keep_in_memory = false;
+ Target::EvaluateExpressionOptions options;
+ options.SetCoerceToId(false)
+ .SetUnwindOnError(true)
+ .SetKeepInMemory(false)
+ .SetSingleThreadTimeoutUsec(0);
+
ExecutionResults expr_result = target->EvaluateExpression (expr_str.c_str(),
frame,
- eExecutionPolicyOnlyWhenNeeded,
- coerce_to_id,
- unwind_on_error,
- keep_in_memory,
- eNoDynamicValues,
valobj_sp,
- 0 /* no timeout */);
+ options);
if (expr_result != eExecutionCompleted) {
result.GetErrorStream().Printf("error: expression evaluation of address to watch failed\n");
result.GetErrorStream().Printf("expression evaluated: %s\n", expr_str.c_str());
diff --git a/lldb/source/Core/CXXFormatterFunctions.cpp b/lldb/source/Core/CXXFormatterFunctions.cpp
index e022d742123..4646a09758a 100644
--- a/lldb/source/Core/CXXFormatterFunctions.cpp
+++ b/lldb/source/Core/CXXFormatterFunctions.cpp
@@ -42,14 +42,17 @@ lldb_private::formatters::CodeRunning_Fetcher (ValueObject &valobj,
StackFrame* stack_frame = exe_ctx.GetFramePtr();
if (!target || !stack_frame)
return false;
+
+ Target::EvaluateExpressionOptions options;
+ options.SetCoerceToId(false)
+ .SetUnwindOnError(true)
+ .SetKeepInMemory(true)
+ .SetUseDynamic(lldb::eDynamicCanRunTarget);
+
target->EvaluateExpression(expr.GetData(),
stack_frame,
- eExecutionPolicyOnlyWhenNeeded,
- false,
- true,
- true,
- lldb::eDynamicCanRunTarget,
- result_sp);
+ result_sp,
+ options);
if (!result_sp)
return false;
value = result_sp->GetValueAsUnsigned(0);
@@ -364,14 +367,17 @@ lldb_private::formatters::NSNumber_SummaryProvider (ValueObject& valobj, Stream&
StackFrame* stack_frame = exe_ctx.GetFramePtr();
if (!target || !stack_frame)
return false;
+
+ Target::EvaluateExpressionOptions options;
+ options.SetCoerceToId(false)
+ .SetUnwindOnError(true)
+ .SetKeepInMemory(true)
+ .SetUseDynamic(lldb::eDynamicCanRunTarget);
+
target->EvaluateExpression(expr.GetData(),
stack_frame,
- eExecutionPolicyOnlyWhenNeeded,
- false,
- true,
- true,
- lldb::eDynamicCanRunTarget,
- result_sp);
+ result_sp,
+ options);
if (!result_sp)
return false;
stream.Printf("%s",result_sp->GetSummaryAsCString());
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index bbd18b94c12..18db69c327b 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -1193,19 +1193,19 @@ CommandInterpreter::PreprocessCommand (std::string &command)
target = Host::GetDummyTarget(GetDebugger()).get();
if (target)
{
- const bool coerce_to_id = false;
- const bool unwind_on_error = true;
- const bool keep_in_memory = false;
ValueObjectSP expr_result_valobj_sp;
+
+ Target::EvaluateExpressionOptions options;
+ options.SetCoerceToId(false)
+ .SetUnwindOnError(true)
+ .SetKeepInMemory(false)
+ .SetSingleThreadTimeoutUsec(0);
+
ExecutionResults expr_result = target->EvaluateExpression (expr_str.c_str(),
- exe_ctx.GetFramePtr(),
- eExecutionPolicyOnlyWhenNeeded,
- coerce_to_id,
- unwind_on_error,
- keep_in_memory,
- eNoDynamicValues,
+ exe_ctx.GetFramePtr(),
expr_result_valobj_sp,
- 0 /* no timeout */);
+ options);
+
if (expr_result == eExecutionCompleted)
{
Scalar scalar;
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 23c8678c47e..bfd222accd4 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -1606,19 +1606,12 @@ Target::EvaluateExpression
(
const char *expr_cstr,
StackFrame *frame,
- lldb_private::ExecutionPolicy execution_policy,
- bool coerce_to_id,
- bool unwind_on_error,
- bool keep_in_memory,
- lldb::DynamicValueType use_dynamic,
lldb::ValueObjectSP &result_valobj_sp,
- uint32_t single_thread_timeout_usec
+ const EvaluateExpressionOptions& options
)
{
ExecutionResults execution_results = eExecutionSetupError;
- result_valobj_sp.reset();
-
if (expr_cstr == NULL || expr_cstr[0] == '\0')
return execution_results;
@@ -1645,7 +1638,7 @@ Target::EvaluateExpression
if (::strcspn (expr_cstr, "()+*&|!~<=/^%,?") == expr_cstr_len)
{
result_valobj_sp = frame->GetValueForVariableExpressionPath (expr_cstr,
- use_dynamic,
+ options.GetUseDynamic(),
expr_path_options,
var_sp,
error);
@@ -1679,9 +1672,9 @@ Target::EvaluateExpression
}
else
{
- if (use_dynamic != lldb::eNoDynamicValues)
+ if (options.GetUseDynamic() != lldb::eNoDynamicValues)
{
- ValueObjectSP dynamic_sp = result_valobj_sp->GetDynamicValue(use_dynamic);
+ ValueObjectSP dynamic_sp = result_valobj_sp->GetDynamicValue(options.GetUseDynamic());
if (dynamic_sp)
result_valobj_sp = dynamic_sp;
}
@@ -1735,14 +1728,14 @@ Target::EvaluateExpression
const char *prefix = GetExpressionPrefixContentsAsCString();
execution_results = ClangUserExpression::Evaluate (exe_ctx,
- execution_policy,
+ options.GetExecutionPolicy(),
lldb::eLanguageTypeUnknown,
- coerce_to_id ? ClangUserExpression::eResultTypeId : ClangUserExpression::eResultTypeAny,
- unwind_on_error,
+ options.DoesCoerceToId() ? ClangUserExpression::eResultTypeId : ClangUserExpression::eResultTypeAny,
+ options.DoesUnwindOnError(),
expr_cstr,
prefix,
result_valobj_sp,
- single_thread_timeout_usec);
+ options.GetSingleThreadTimeoutUsec());
}
}
OpenPOWER on IntegriCloud