[Lldb-commits] [lldb] 7822e5d - [LLDB] Allow expression evaluators to set arbitrary timeouts
walter erquinigo via lldb-commits
lldb-commits at lists.llvm.org
Tue Aug 22 14:41:20 PDT 2023
Author: walter erquinigo
Date: 2023-08-22T17:41:14-04:00
New Revision: 7822e5dbf1cb4be2d73eb13da27b04de684c318b
URL: https://github.com/llvm/llvm-project/commit/7822e5dbf1cb4be2d73eb13da27b04de684c318b
DIFF: https://github.com/llvm/llvm-project/commit/7822e5dbf1cb4be2d73eb13da27b04de684c318b.diff
LOG: [LLDB] Allow expression evaluators to set arbitrary timeouts
https://github.com/llvm/llvm-project/commit/59237bb52c9483fce395428bfab5996eabe54ed0 changed the behavior of the `SetTimeout` and `GetTimeout` methods of `EvaluateExpressionOptions`, which broke the Mojo REPL and related services (https://docs.modular.com/mojo/) because it relies on having infinite timeouts. That's a necessity because developers often use the REPL for executing extremely long-running numeric jobs. Having said that, `EvaluateExpressionOptions` shouldn't be that opinionated on this matter anyway. Instead, it should be the responsibility of the evaluator to define which timeout to use for each specific case.
Differential Revision: https://reviews.llvm.org/D157764
Added:
Modified:
lldb/include/lldb/Target/Target.h
lldb/test/API/commands/expression/ir-interpreter/TestIRInterpreter.py
Removed:
################################################################################
diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h
index f86bd3cb4ee55d..ed0ecbbddbf814 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -346,16 +346,9 @@ class EvaluateExpressionOptions {
m_use_dynamic = dynamic;
}
- const Timeout<std::micro> &GetTimeout() const {
- assert(m_timeout && m_timeout->count() > 0);
- return m_timeout;
- }
+ const Timeout<std::micro> &GetTimeout() const { return m_timeout; }
- void SetTimeout(const Timeout<std::micro> &timeout) {
- // Disallow setting a non-zero timeout.
- if (timeout && timeout->count() > 0)
- m_timeout = timeout;
- }
+ void SetTimeout(const Timeout<std::micro> &timeout) { m_timeout = timeout; }
const Timeout<std::micro> &GetOneThreadTimeout() const {
return m_one_thread_timeout;
diff --git a/lldb/test/API/commands/expression/ir-interpreter/TestIRInterpreter.py b/lldb/test/API/commands/expression/ir-interpreter/TestIRInterpreter.py
index 5f98bb51a49c1b..0515876734ca49 100644
--- a/lldb/test/API/commands/expression/ir-interpreter/TestIRInterpreter.py
+++ b/lldb/test/API/commands/expression/ir-interpreter/TestIRInterpreter.py
@@ -31,8 +31,8 @@ def test_interpreter_timeout(self):
# This is an IRInterpreter specific test, so disable the JIT.
options.SetAllowJIT(False)
- # No timeout means a 500ms.
- options.SetTimeoutInMicroSeconds(0)
+ # We use a 500ms timeout.
+ options.SetTimeoutInMicroSeconds(500000)
res, duration_sec = self.time_expression(inf_loop, options)
self.assertIn(timeout_error, str(res.GetError()))
More information about the lldb-commits
mailing list