diff options
author | Jim Ingham <jingham@apple.com> | 2014-03-28 21:58:28 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2014-03-28 21:58:28 +0000 |
commit | 914f4e7092ff922901b2fb5d7a9b7103f8f616ea (patch) | |
tree | 0a6a4b902cad7bd42d8289358910c711725c3941 /lldb/source/Target/Process.cpp | |
parent | dca7c7c5f12b6319813cadd7b159d1f5fd8f4323 (diff) | |
download | bcm5719-llvm-914f4e7092ff922901b2fb5d7a9b7103f8f616ea.tar.gz bcm5719-llvm-914f4e7092ff922901b2fb5d7a9b7103f8f616ea.zip |
Add the ability from the SB API's to set the "one thread" timeout
for expression evaluations that try one and then all threads.
<rdar://problem/15598528>
llvm-svn: 205060
Diffstat (limited to 'lldb/source/Target/Process.cpp')
-rw-r--r-- | lldb/source/Target/Process.cpp | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 32dda344a0f..3231e1edc08 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -5168,6 +5168,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, TimeValue final_timeout = one_thread_timeout; uint32_t timeout_usec = options.GetTimeoutUsec(); + if (!options.GetStopOthers()) { before_first_timeout = false; @@ -5175,16 +5176,37 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, } else if (options.GetTryAllThreads()) { - // If we are running all threads then we take half the time to run all threads, bounded by - // .25 sec. - if (options.GetTimeoutUsec() == 0) - one_thread_timeout.OffsetWithMicroSeconds(default_one_thread_timeout_usec); + uint64_t option_one_thread_timeout = options.GetOneThreadTimeoutUsec(); + + // If the overall wait is forever, then we only need to set the one thread timeout: + if (timeout_usec == 0) + { + if (option_one_thread_timeout == 0) + one_thread_timeout.OffsetWithMicroSeconds(option_one_thread_timeout); + else + one_thread_timeout.OffsetWithMicroSeconds(default_one_thread_timeout_usec); + } else { - uint64_t computed_timeout = timeout_usec / 2; - if (computed_timeout > default_one_thread_timeout_usec) - computed_timeout = default_one_thread_timeout_usec; - one_thread_timeout.OffsetWithMicroSeconds(computed_timeout); + // Otherwise, if the one thread timeout is set, make sure it isn't longer than the overall timeout, + // and use it, otherwise use half the total timeout, bounded by the default_one_thread_timeout_usec. + uint64_t computed_one_thread_timeout; + if (option_one_thread_timeout != 0) + { + if (timeout_usec < option_one_thread_timeout) + { + errors.Printf("RunThreadPlan called without one thread timeout greater than total timeout"); + return eExecutionSetupError; + } + computed_one_thread_timeout = option_one_thread_timeout; + } + else + { + computed_one_thread_timeout = timeout_usec / 2; + if (computed_one_thread_timeout > default_one_thread_timeout_usec) + computed_one_thread_timeout = default_one_thread_timeout_usec; + } + one_thread_timeout.OffsetWithMicroSeconds(computed_one_thread_timeout); } final_timeout.OffsetWithMicroSeconds (timeout_usec); } |