[Lldb-commits] [lldb] New ThreadPlanSingleThreadTimeout to resolve potential deadlock in single thread stepping (PR #90930)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Jun 28 15:22:21 PDT 2024
================
@@ -0,0 +1,217 @@
+//===-- ThreadPlanStepOverRange.cpp ---------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Target/ThreadPlanSingleThreadTimeout.h"
+#include "lldb/Symbol/Block.h"
+#include "lldb/Symbol/CompileUnit.h"
+#include "lldb/Symbol/Function.h"
+#include "lldb/Symbol/LineTable.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/Target.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Target/ThreadPlanStepOut.h"
+#include "lldb/Target/ThreadPlanStepThrough.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Stream.h"
+
+using namespace lldb_private;
+using namespace lldb;
+
+ThreadPlanSingleThreadTimeout::ThreadPlanSingleThreadTimeout(Thread &thread,
+ TimeoutInfo &info)
+ : ThreadPlan(ThreadPlan::eKindSingleThreadTimeout, "Single thread timeout",
+ thread, eVoteNo, eVoteNoOpinion),
+ m_info(info), m_state(State::WaitTimeout), m_exit_flag(false) {
+ m_timer_thread = std::thread(TimeoutThreadFunc, this);
+ m_info.m_instance = this;
+ m_state = m_info.m_last_state;
+}
+
+ThreadPlanSingleThreadTimeout::~ThreadPlanSingleThreadTimeout() {
+ m_info.m_instance = nullptr;
+ if (m_state == State::Done)
+ m_state = State::WaitTimeout;
+}
+
+void ThreadPlanSingleThreadTimeout::GetDescription(
+ Stream *s, lldb::DescriptionLevel level) {
+ s->Printf("Single thread timeout, state(%s)", StateToString(m_state).c_str());
----------------
jimingham wrote:
I think it would be super handy to print the time remaining here.
https://github.com/llvm/llvm-project/pull/90930
More information about the lldb-commits
mailing list