diff options
| author | Pavel Labath <labath@google.com> | 2016-12-06 11:24:51 +0000 |
|---|---|---|
| committer | Pavel Labath <labath@google.com> | 2016-12-06 11:24:51 +0000 |
| commit | 43d354182f44fac52247a4340462e7471e59a00a (patch) | |
| tree | 2caef34124c24c3bf8d636da465758edfdc3cce3 /lldb/source/Target/Process.cpp | |
| parent | 9335c020c61addbcb8de944d3f44dbfa4a1abafc (diff) | |
| download | bcm5719-llvm-43d354182f44fac52247a4340462e7471e59a00a.tar.gz bcm5719-llvm-43d354182f44fac52247a4340462e7471e59a00a.zip | |
Use Timeout<> in EvaluateExpressionOptions class
llvm-svn: 288797
Diffstat (limited to 'lldb/source/Target/Process.cpp')
| -rw-r--r-- | lldb/source/Target/Process.cpp | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 7031267711d..76b95f23b15 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -70,18 +70,8 @@ using namespace lldb; using namespace lldb_private; using namespace std::chrono; -// A temporary function to convert between old representations of timeouts (0 -// means infinite wait) and new Timeout class (0 means "poll"). -// TODO(labath): Fix up all callers and remove this. -static Timeout<std::micro> ConvertTimeout(std::chrono::microseconds t) { - if (t == std::chrono::microseconds(0)) - return llvm::None; - return t; -} - // Comment out line below to disable memory caching, overriding the process -// setting -// target.process.disable-memory-cache +// setting target.process.disable-memory-cache #define ENABLE_MEMORY_CACHING #ifdef ENABLE_MEMORY_CACHING @@ -4805,20 +4795,19 @@ GetOneThreadExpressionTimeout(const EvaluateExpressionOptions &options) { const milliseconds default_one_thread_timeout(250); // If the overall wait is forever, then we don't need to worry about it. - if (options.GetTimeoutUsec() == 0) { - if (options.GetOneThreadTimeoutUsec() != 0) - return microseconds(options.GetOneThreadTimeoutUsec()); - return default_one_thread_timeout; + if (!options.GetTimeout()) { + return options.GetOneThreadTimeout() ? *options.GetOneThreadTimeout() + : default_one_thread_timeout; } // If the one thread timeout is set, use it. - if (options.GetOneThreadTimeoutUsec() != 0) - return microseconds(options.GetOneThreadTimeoutUsec()); + if (options.GetOneThreadTimeout()) + return *options.GetOneThreadTimeout(); // Otherwise use half the total timeout, bounded by the // default_one_thread_timeout. return std::min<microseconds>(default_one_thread_timeout, - microseconds(options.GetTimeoutUsec()) / 2); + *options.GetTimeout() / 2); } static Timeout<std::micro> @@ -4827,16 +4816,15 @@ GetExpressionTimeout(const EvaluateExpressionOptions &options, // If we are going to run all threads the whole time, or if we are only // going to run one thread, we can just return the overall timeout. if (!options.GetStopOthers() || !options.GetTryAllThreads()) - return ConvertTimeout(microseconds(options.GetTimeoutUsec())); + return options.GetTimeout(); if (before_first_timeout) return GetOneThreadExpressionTimeout(options); - if (options.GetTimeoutUsec() == 0) + if (!options.GetTimeout()) return llvm::None; else - return microseconds(options.GetTimeoutUsec()) - - GetOneThreadExpressionTimeout(options); + return *options.GetTimeout() - GetOneThreadExpressionTimeout(options); } ExpressionResults @@ -4921,8 +4909,8 @@ Process::RunThreadPlan(ExecutionContext &exe_ctx, // Make sure the timeout values make sense. The one thread timeout needs to be // smaller than the overall timeout. - if (options.GetOneThreadTimeoutUsec() != 0 && options.GetTimeoutUsec() != 0 && - options.GetTimeoutUsec() < options.GetOneThreadTimeoutUsec()) { + if (options.GetOneThreadTimeout() && options.GetTimeout() && + *options.GetTimeout() < *options.GetOneThreadTimeout()) { diagnostic_manager.PutString(eDiagnosticSeverityError, "RunThreadPlan called with one thread " "timeout greater than total timeout"); |

