[Lldb-commits] [lldb] r173596 - Make sure that multi-line expressions don't create a default target. We recently switched to using a built-in m_exe_ctx when running commands in the DoExecute() so that we can have common code where commands can required having a valid target/process/thread/frame by specifying flags, this caused multi-line expression to always create a new dummy target because m_exe_ctx gets cleared when DoExecute exits. A new input reader has been pushed to handle the input for the expression, which wil...
Greg Clayton
gclayton at apple.com
Sat Jan 26 15:54:29 PST 2013
Author: gclayton
Date: Sat Jan 26 17:54:29 2013
New Revision: 173596
URL: http://llvm.org/viewvc/llvm-project?rev=173596&view=rev
Log:
Make sure that multi-line expressions don't create a default target. We recently switched to using a built-in m_exe_ctx when running commands in the DoExecute() so that we can have common code where commands can required having a valid target/process/thread/frame by specifying flags, this caused multi-line expression to always create a new dummy target because m_exe_ctx gets cleared when DoExecute exits. A new input reader has been pushed to handle the input for the expression, which will get popped off and then it was checking the target in m_exe_ctx (which was cleared).
Modified:
lldb/trunk/source/Commands/CommandObjectExpression.cpp
Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=173596&r1=173595&r2=173596&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Sat Jan 26 17:54:29 2013
@@ -314,7 +314,12 @@ CommandObjectExpression::EvaluateExpress
CommandReturnObject *result
)
{
- Target *target = m_exe_ctx.GetTargetPtr();
+ // Don't use m_exe_ctx as this might be called asynchronously
+ // after the command object DoExecute has finished when doing
+ // multi-line expression that use an input reader...
+ ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
+
+ Target *target = exe_ctx.GetTargetPtr();
if (!target)
target = Host::GetDummyTarget(m_interpreter.GetDebugger()).get();
@@ -337,7 +342,7 @@ CommandObjectExpression::EvaluateExpress
.SetTimeoutUsec(m_command_options.timeout);
exe_results = target->EvaluateExpression (expr,
- m_exe_ctx.GetFramePtr(),
+ exe_ctx.GetFramePtr(),
result_valobj_sp,
options);
@@ -347,7 +352,7 @@ CommandObjectExpression::EvaluateExpress
uint32_t start_frame = 0;
uint32_t num_frames = 1;
uint32_t num_frames_with_source = 0;
- Thread *thread = m_exe_ctx.GetThreadPtr();
+ Thread *thread = exe_ctx.GetThreadPtr();
if (thread)
{
thread->GetStatus (result->GetOutputStream(),
@@ -357,7 +362,7 @@ CommandObjectExpression::EvaluateExpress
}
else
{
- Process *process = m_exe_ctx.GetProcessPtr();
+ Process *process = exe_ctx.GetProcessPtr();
if (process)
{
bool only_threads_with_stop_reason = true;
More information about the lldb-commits
mailing list