summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Expression')
-rw-r--r--lldb/source/Expression/ClangExpressionParser.cpp2
-rw-r--r--lldb/source/Expression/ClangFunction.cpp6
-rw-r--r--lldb/source/Expression/ClangUserExpression.cpp87
3 files changed, 69 insertions, 26 deletions
diff --git a/lldb/source/Expression/ClangExpressionParser.cpp b/lldb/source/Expression/ClangExpressionParser.cpp
index 7085f407170..506f2f5ffd9 100644
--- a/lldb/source/Expression/ClangExpressionParser.cpp
+++ b/lldb/source/Expression/ClangExpressionParser.cpp
@@ -447,7 +447,7 @@ ClangExpressionParser::MakeJIT (lldb::addr_t &func_addr,
return err;
}
- if (m_expr.NeedsValidation())
+ if (m_expr.NeedsValidation() && exe_ctx.process->GetDynamicCheckers())
{
/*
Disabled temporarily - TODO Centralize and re-enable this inside Process to avoid race conditions
diff --git a/lldb/source/Expression/ClangFunction.cpp b/lldb/source/Expression/ClangFunction.cpp
index 3d5e8383f9a..4ef26d1cb2e 100644
--- a/lldb/source/Expression/ClangFunction.cpp
+++ b/lldb/source/Expression/ClangFunction.cpp
@@ -539,9 +539,11 @@ ClangFunction::ExecuteFunction (
// Not really sure what to do if Halt fails here...
if (log)
if (try_all_threads)
- log->Printf ("Running function with timeout: %d timed out, trying with all threads enabled.", single_thread_timeout_usec);
+ log->Printf ("Running function with timeout: %d timed out, trying with all threads enabled.",
+ single_thread_timeout_usec);
else
- log->Printf ("Running function with timeout: %d timed out, abandoning execution.", single_thread_timeout_usec);
+ log->Printf ("Running function with timeout: %d timed out, abandoning execution.",
+ single_thread_timeout_usec);
if (exe_ctx.process->Halt().Success())
{
diff --git a/lldb/source/Expression/ClangUserExpression.cpp b/lldb/source/Expression/ClangUserExpression.cpp
index 4aabf521511..c1eeb24e273 100644
--- a/lldb/source/Expression/ClangUserExpression.cpp
+++ b/lldb/source/Expression/ClangUserExpression.cpp
@@ -215,27 +215,18 @@ ClangUserExpression::Parse (Stream &error_stream, ExecutionContext &exe_ctx)
}
bool
-ClangUserExpression::Execute (Stream &error_stream,
- ExecutionContext &exe_ctx,
- ClangExpressionVariable *&result)
+ClangUserExpression::PrepareToExecuteJITExpression (Stream &error_stream,
+ ExecutionContext &exe_ctx,
+ lldb::addr_t &struct_address,
+ lldb::addr_t object_ptr)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
- if (m_dwarf_opcodes.get())
- {
- // TODO execute the JITted opcodes
-
- error_stream.Printf("We don't currently support executing DWARF expressions");
-
- return false;
- }
- else if (m_jit_addr != LLDB_INVALID_ADDRESS)
+ if (m_jit_addr != LLDB_INVALID_ADDRESS)
{
- lldb::addr_t struct_address;
Error materialize_error;
- lldb::addr_t object_ptr = NULL;
if (m_needs_object_ptr && !(m_expr_decl_map->GetObjectPointer(object_ptr, &exe_ctx, materialize_error)))
{
@@ -274,6 +265,64 @@ ClangUserExpression::Execute (Stream &error_stream,
}
}
}
+ }
+ return true;
+}
+
+ThreadPlan *
+ClangUserExpression::GetThreadPlanToExecuteJITExpression (Stream &error_stream,
+ ExecutionContext &exe_ctx)
+{
+ lldb::addr_t struct_address;
+
+ lldb::addr_t object_ptr = NULL;
+
+ PrepareToExecuteJITExpression (error_stream, exe_ctx, struct_address, object_ptr);
+
+ return ClangFunction::GetThreadPlanToCallFunction (exe_ctx,
+ m_jit_addr,
+ struct_address,
+ error_stream,
+ true,
+ true,
+ (m_needs_object_ptr ? &object_ptr : NULL));
+}
+
+bool
+ClangUserExpression::FinalizeJITExecution (Stream &error_stream,
+ ExecutionContext &exe_ctx,
+ ClangExpressionVariable *&result)
+{
+ Error expr_error;
+
+ if (!m_expr_decl_map->Dematerialize(&exe_ctx, result, expr_error))
+ {
+ error_stream.Printf ("Couldn't dematerialize struct : %s\n", expr_error.AsCString("unknown error"));
+ return false;
+ }
+ return true;
+}
+
+bool
+ClangUserExpression::Execute (Stream &error_stream,
+ ExecutionContext &exe_ctx,
+ ClangExpressionVariable *&result)
+{
+ if (m_dwarf_opcodes.get())
+ {
+ // TODO execute the JITted opcodes
+
+ error_stream.Printf("We don't currently support executing DWARF expressions");
+
+ return false;
+ }
+ else if (m_jit_addr != LLDB_INVALID_ADDRESS)
+ {
+ lldb::addr_t struct_address;
+
+ lldb::addr_t object_ptr = NULL;
+
+ PrepareToExecuteJITExpression (error_stream, exe_ctx, struct_address, object_ptr);
ClangFunction::ExecutionResults execution_result =
ClangFunction::ExecuteFunction (exe_ctx,
@@ -312,15 +361,7 @@ ClangUserExpression::Execute (Stream &error_stream,
return false;
}
- Error expr_error;
-
- if (!m_expr_decl_map->Dematerialize(&exe_ctx, result, expr_error))
- {
- error_stream.Printf ("Couldn't dematerialize struct : %s\n", expr_error.AsCString("unknown error"));
- return false;
- }
-
- return true;
+ return FinalizeJITExecution (error_stream, exe_ctx, result);
}
else
{
OpenPOWER on IntegriCloud