[Lldb-commits] [lldb] r160326 - in /lldb/trunk: include/lldb/Expression/ClangUserExpression.h include/lldb/Target/Target.h source/Commands/CommandObjectExpression.cpp source/Commands/CommandObjectWatchpoint.cpp source/Expression/ClangUserExpression.cpp source/Interpreter/CommandInterpreter.cpp source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp source/Target/Process.cpp source/Target/StopInfo.cpp source/Target/Target.cpp
Enrico Granata
egranata at apple.com
Mon Jul 16 16:10:35 PDT 2012
Author: enrico
Date: Mon Jul 16 18:10:35 2012
New Revision: 160326
URL: http://llvm.org/viewvc/llvm-project?rev=160326&view=rev
Log:
<rdar://problem/11672978> Fixing an issue where an ObjC object might come out without a description because the expression used to obtain it would timeout before running to completion
Modified:
lldb/trunk/include/lldb/Expression/ClangUserExpression.h
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/source/Commands/CommandObjectExpression.cpp
lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
lldb/trunk/source/Expression/ClangUserExpression.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/StopInfo.cpp
lldb/trunk/source/Target/Target.cpp
Modified: lldb/trunk/include/lldb/Expression/ClangUserExpression.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangUserExpression.h?rev=160326&r1=160325&r2=160326&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangUserExpression.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangUserExpression.h Mon Jul 16 18:10:35 2012
@@ -132,6 +132,10 @@
/// A pointer to direct at the persistent variable in which the
/// expression's result is stored.
///
+ /// @param[in] single_thread_timeout_usec
+ /// The amount of time (in usec) that we are willing to wait for this
+ /// expression to complete, before assuming that we are blocked and giving up
+ ///
/// @return
/// A Process::Execution results value.
//------------------------------------------------------------------
@@ -140,7 +144,8 @@
ExecutionContext &exe_ctx,
bool discard_on_error,
ClangUserExpressionSP &shared_ptr_to_me,
- lldb::ClangExpressionVariableSP &result);
+ lldb::ClangExpressionVariableSP &result,
+ uint32_t single_thread_timeout_usec = 500000);
ThreadPlan *
GetThreadPlanToExecuteJITExpression (Stream &error_stream,
@@ -309,6 +314,10 @@
/// @param[in/out] result_valobj_sp
/// If execution is successful, the result valobj is placed here.
///
+ /// @param[in] single_thread_timeout_usec
+ /// The amount of time (in usec) that we are willing to wait for this
+ /// expression to complete, before assuming that we are blocked and giving up
+ ///
/// @result
/// A Process::ExecutionResults value. eExecutionCompleted for success.
//------------------------------------------------------------------
@@ -320,7 +329,8 @@
bool discard_on_error,
const char *expr_cstr,
const char *expr_prefix,
- lldb::ValueObjectSP &result_valobj_sp);
+ lldb::ValueObjectSP &result_valobj_sp,
+ uint32_t single_thread_timeout_usec = 500000);
static ExecutionResults
EvaluateWithError (ExecutionContext &exe_ctx,
@@ -331,7 +341,8 @@
const char *expr_cstr,
const char *expr_prefix,
lldb::ValueObjectSP &result_valobj_sp,
- Error &error);
+ Error &error,
+ uint32_t single_thread_timeout_usec = 500000);
static const Error::ValueType kNoResult = 0x1001; ///< ValueObject::GetError() returns this if there is no result from the expression.
private:
Modified: lldb/trunk/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=160326&r1=160325&r2=160326&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Mon Jul 16 18:10:35 2012
@@ -898,7 +898,8 @@
bool unwind_on_error,
bool keep_in_memory,
lldb::DynamicValueType use_dynamic,
- lldb::ValueObjectSP &result_valobj_sp);
+ lldb::ValueObjectSP &result_valobj_sp,
+ uint32_t single_thread_timeout_usec = 500000);
ClangPersistentVariables &
GetPersistentVariables()
Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=160326&r1=160325&r2=160326&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Mon Jul 16 18:10:35 2012
@@ -305,7 +305,8 @@
m_command_options.unwind_on_error,
keep_in_memory,
use_dynamic,
- result_valobj_sp);
+ result_valobj_sp,
+ 0 /* no timeout */);
if (exe_results == eExecutionInterrupted && !m_command_options.unwind_on_error)
{
Modified: lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp?rev=160326&r1=160325&r2=160326&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp Mon Jul 16 18:10:35 2012
@@ -1206,7 +1206,8 @@
unwind_on_error,
keep_in_memory,
eNoDynamicValues,
- valobj_sp);
+ valobj_sp,
+ 0 /* no timeout */);
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());
Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=160326&r1=160325&r2=160326&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangUserExpression.cpp Mon Jul 16 18:10:35 2012
@@ -542,7 +542,8 @@
ExecutionContext &exe_ctx,
bool discard_on_error,
ClangUserExpression::ClangUserExpressionSP &shared_ptr_to_me,
- lldb::ClangExpressionVariableSP &result)
+ lldb::ClangExpressionVariableSP &result,
+ uint32_t single_thread_timeout_usec)
{
// The expression log is quite verbose, and if you're just tracking the execution of the
// expression, it's quite convenient to have these logs come out with the STEP log as well.
@@ -578,8 +579,6 @@
call_plan_sp->SetPrivate(true);
- uint32_t single_thread_timeout_usec = 500000;
-
if (log)
log->Printf("-- [ClangUserExpression::Execute] Execution of expression begins --");
@@ -648,10 +647,11 @@
bool discard_on_error,
const char *expr_cstr,
const char *expr_prefix,
- lldb::ValueObjectSP &result_valobj_sp)
+ lldb::ValueObjectSP &result_valobj_sp,
+ uint32_t single_thread_timeout_usec)
{
Error error;
- return EvaluateWithError (exe_ctx, execution_policy, language, desired_type, discard_on_error, expr_cstr, expr_prefix, result_valobj_sp, error);
+ return EvaluateWithError (exe_ctx, execution_policy, language, desired_type, discard_on_error, expr_cstr, expr_prefix, result_valobj_sp, error, single_thread_timeout_usec);
}
ExecutionResults
@@ -663,7 +663,8 @@
const char *expr_cstr,
const char *expr_prefix,
lldb::ValueObjectSP &result_valobj_sp,
- Error &error)
+ Error &error,
+ uint32_t single_thread_timeout_usec)
{
lldb::LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_EXPRESSIONS | LIBLLDB_LOG_STEP));
@@ -738,7 +739,8 @@
exe_ctx,
discard_on_error,
user_expression_sp,
- expr_result);
+ expr_result,
+ single_thread_timeout_usec);
if (execution_results != eExecutionCompleted)
{
Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=160326&r1=160325&r2=160326&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Mon Jul 16 18:10:35 2012
@@ -1162,7 +1162,8 @@
unwind_on_error,
keep_in_memory,
eNoDynamicValues,
- expr_result_valobj_sp);
+ expr_result_valobj_sp,
+ 0 /* no timeout */);
if (expr_result == eExecutionCompleted)
{
Scalar scalar;
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp?rev=160326&r1=160325&r2=160326&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp Mon Jul 16 18:10:35 2012
@@ -142,7 +142,7 @@
&wrapper_struct_addr,
error_stream,
stop_others,
- 100000,
+ 0 /* no timeout */,
try_all_threads,
unwind_on_error,
ret);
Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=160326&r1=160325&r2=160326&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Mon Jul 16 18:10:35 2012
@@ -4228,11 +4228,27 @@
if (single_thread_timeout_usec != 0)
{
+ // we have a > 0 timeout, let us set it so that we stop after the deadline
real_timeout = TimeValue::Now();
real_timeout.OffsetWithMicroSeconds(single_thread_timeout_usec);
timeout_ptr = &real_timeout;
}
+ else if (first_timeout)
+ {
+ // if we are willing to wait "forever" we still need to have an initial timeout
+ // this timeout is going to induce all threads to run when hit. we do this so that
+ // we can avoid ending locked up because of multithreaded contention issues
+ real_timeout = TimeValue::Now();
+ real_timeout.OffsetWithNanoSeconds(500000000UL);
+ timeout_ptr = &real_timeout;
+ }
+ else
+ {
+ timeout_ptr = NULL; // if we are in a no-timeout scenario, then we only need a fake timeout the first time through
+ // at this point in the code, all threads will be running so we are willing to wait forever, and do not
+ // need a timeout
+ }
}
else
{
Modified: lldb/trunk/source/Target/StopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StopInfo.cpp?rev=160326&r1=160325&r2=160326&view=diff
==============================================================================
--- lldb/trunk/source/Target/StopInfo.cpp (original)
+++ lldb/trunk/source/Target/StopInfo.cpp Mon Jul 16 18:10:35 2012
@@ -520,7 +520,8 @@
wp_sp->GetConditionText(),
NULL,
result_value_sp,
- error);
+ error,
+ 500000);
if (result_code == eExecutionCompleted)
{
if (result_value_sp)
Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=160326&r1=160325&r2=160326&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Mon Jul 16 18:10:35 2012
@@ -1652,7 +1652,8 @@
bool unwind_on_error,
bool keep_in_memory,
lldb::DynamicValueType use_dynamic,
- lldb::ValueObjectSP &result_valobj_sp
+ lldb::ValueObjectSP &result_valobj_sp,
+ uint32_t single_thread_timeout_usec
)
{
ExecutionResults execution_results = eExecutionSetupError;
@@ -1781,7 +1782,8 @@
unwind_on_error,
expr_cstr,
prefix,
- result_valobj_sp);
+ result_valobj_sp,
+ single_thread_timeout_usec);
}
}
More information about the lldb-commits
mailing list