Skip to content

Commit 7822e5d

Browse files
author
walter erquinigo
committed
[LLDB] Allow expression evaluators to set arbitrary timeouts
llvm@59237bb 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
1 parent 9b6b6bb commit 7822e5d

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

lldb/include/lldb/Target/Target.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -346,16 +346,9 @@ class EvaluateExpressionOptions {
346346
m_use_dynamic = dynamic;
347347
}
348348

349-
const Timeout<std::micro> &GetTimeout() const {
350-
assert(m_timeout && m_timeout->count() > 0);
351-
return m_timeout;
352-
}
349+
const Timeout<std::micro> &GetTimeout() const { return m_timeout; }
353350

354-
void SetTimeout(const Timeout<std::micro> &timeout) {
355-
// Disallow setting a non-zero timeout.
356-
if (timeout && timeout->count() > 0)
357-
m_timeout = timeout;
358-
}
351+
void SetTimeout(const Timeout<std::micro> &timeout) { m_timeout = timeout; }
359352

360353
const Timeout<std::micro> &GetOneThreadTimeout() const {
361354
return m_one_thread_timeout;

lldb/test/API/commands/expression/ir-interpreter/TestIRInterpreter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ def test_interpreter_timeout(self):
3131
# This is an IRInterpreter specific test, so disable the JIT.
3232
options.SetAllowJIT(False)
3333

34-
# No timeout means a 500ms.
35-
options.SetTimeoutInMicroSeconds(0)
34+
# We use a 500ms timeout.
35+
options.SetTimeoutInMicroSeconds(500000)
3636
res, duration_sec = self.time_expression(inf_loop, options)
3737
self.assertIn(timeout_error, str(res.GetError()))
3838

0 commit comments

Comments
 (0)