summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/ClangUserExpression.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2011-05-09 22:04:36 +0000
committerSean Callanan <scallanan@apple.com>2011-05-09 22:04:36 +0000
commite359d9b771d8524b64a874bcb86ebac4c1a127be (patch)
tree51f0f45f09c46b6e2959c8f04008c2ac1f2c8a52 /lldb/source/Expression/ClangUserExpression.cpp
parent7adbed6b4da6cf5e91ceb0fbd0a0a7c78f3e13be (diff)
downloadbcm5719-llvm-e359d9b771d8524b64a874bcb86ebac4c1a127be.tar.gz
bcm5719-llvm-e359d9b771d8524b64a874bcb86ebac4c1a127be.zip
Fixed a bug in which expression-local variables were
treated as being permanently resident in target memory. In fact, since the expression's stack frame is deleted and potentially re-used after the expression completes, the variables need to be treated as being freeze-dried. llvm-svn: 131104
Diffstat (limited to 'lldb/source/Expression/ClangUserExpression.cpp')
-rw-r--r--lldb/source/Expression/ClangUserExpression.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/lldb/source/Expression/ClangUserExpression.cpp b/lldb/source/Expression/ClangUserExpression.cpp
index f1dd49f64dd..6eafd7be7fe 100644
--- a/lldb/source/Expression/ClangUserExpression.cpp
+++ b/lldb/source/Expression/ClangUserExpression.cpp
@@ -421,7 +421,8 @@ ClangUserExpression::GetThreadPlanToExecuteJITExpression (Stream &error_stream,
bool
ClangUserExpression::FinalizeJITExecution (Stream &error_stream,
ExecutionContext &exe_ctx,
- lldb::ClangExpressionVariableSP &result)
+ lldb::ClangExpressionVariableSP &result,
+ lldb::addr_t function_stack_pointer)
{
Error expr_error;
@@ -444,8 +445,11 @@ ClangUserExpression::FinalizeJITExecution (Stream &error_stream,
log->Printf(" Structure contents:\n%s", args.GetData());
}
}
+
+ lldb::addr_t function_stack_bottom = function_stack_pointer - Host::GetPageSize();
+
- if (!m_expr_decl_map->Dematerialize(exe_ctx, result, expr_error))
+ if (!m_expr_decl_map->Dematerialize(exe_ctx, result, function_stack_pointer, function_stack_bottom, expr_error))
{
error_stream.Printf ("Couldn't dematerialize struct : %s\n", expr_error.AsCString("unknown error"));
return false;
@@ -497,6 +501,8 @@ ClangUserExpression::Execute (Stream &error_stream,
if (call_plan_sp == NULL || !call_plan_sp->ValidatePlan (NULL))
return eExecutionSetupError;
+
+ lldb::addr_t function_stack_pointer = static_cast<ThreadPlanCallFunction *>(call_plan_sp.get())->GetFunctionStackPointer();
call_plan_sp->SetPrivate(true);
@@ -506,12 +512,12 @@ ClangUserExpression::Execute (Stream &error_stream,
log->Printf("-- [ClangUserExpression::Execute] Execution of expression begins --");
ExecutionResults execution_result = exe_ctx.process->RunThreadPlan (exe_ctx,
- call_plan_sp,
- stop_others,
- try_all_threads,
- discard_on_error,
- single_thread_timeout_usec,
- error_stream);
+ call_plan_sp,
+ stop_others,
+ try_all_threads,
+ discard_on_error,
+ single_thread_timeout_usec,
+ error_stream);
if (log)
log->Printf("-- [ClangUserExpression::Execute] Execution of expression completed --");
@@ -531,7 +537,7 @@ ClangUserExpression::Execute (Stream &error_stream,
return execution_result;
}
- if (FinalizeJITExecution (error_stream, exe_ctx, result))
+ if (FinalizeJITExecution (error_stream, exe_ctx, result, function_stack_pointer))
return eExecutionCompleted;
else
return eExecutionSetupError;
OpenPOWER on IntegriCloud