<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
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@160326 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectExpression.cpp b/source/Commands/CommandObjectExpression.cpp
index 3c04eb3..4fecc6b 100644
--- a/source/Commands/CommandObjectExpression.cpp
+++ b/source/Commands/CommandObjectExpression.cpp
@@ -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)
{
diff --git a/source/Commands/CommandObjectWatchpoint.cpp b/source/Commands/CommandObjectWatchpoint.cpp
index bb7ce45..973b9d4 100644
--- a/source/Commands/CommandObjectWatchpoint.cpp
+++ b/source/Commands/CommandObjectWatchpoint.cpp
@@ -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());
diff --git a/source/Expression/ClangUserExpression.cpp b/source/Expression/ClangUserExpression.cpp
index 4fed841..029b153 100644
--- a/source/Expression/ClangUserExpression.cpp
+++ b/source/Expression/ClangUserExpression.cpp
@@ -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)
{
diff --git a/source/Interpreter/CommandInterpreter.cpp b/source/Interpreter/CommandInterpreter.cpp
index 2879ec4..b807e61 100644
--- a/source/Interpreter/CommandInterpreter.cpp
+++ b/source/Interpreter/CommandInterpreter.cpp
@@ -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;
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
index a2bc888..4d001d8 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -142,7 +142,7 @@
&wrapper_struct_addr,
error_stream,
stop_others,
- 100000,
+ 0 /* no timeout */,
try_all_threads,
unwind_on_error,
ret);
diff --git a/source/Target/Process.cpp b/source/Target/Process.cpp
index 531b56c..61da768 100644
--- a/source/Target/Process.cpp
+++ b/source/Target/Process.cpp
@@ -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
{
diff --git a/source/Target/StopInfo.cpp b/source/Target/StopInfo.cpp
index 5b782be..fe4f795 100644
--- a/source/Target/StopInfo.cpp
+++ b/source/Target/StopInfo.cpp
@@ -520,7 +520,8 @@
wp_sp->GetConditionText(),
NULL,
result_value_sp,
- error);
+ error,
+ 500000);
if (result_code == eExecutionCompleted)
{
if (result_value_sp)
diff --git a/source/Target/Target.cpp b/source/Target/Target.cpp
index c5c0a18..5b56827 100644
--- a/source/Target/Target.cpp
+++ b/source/Target/Target.cpp
@@ -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);
}
}