Raphael Isemann | 8081428 | 2020-01-24 07:23:27 | [diff] [blame] | 1 | //===-- ThreadPlan.cpp ----------------------------------------------------===// |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 | [diff] [blame] | 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
Eugene Zelenko | e65b2cf | 2015-12-15 01:33:19 | [diff] [blame] | 9 | #include "lldb/Target/ThreadPlan.h" |
Jim Ingham | 06e827c | 2010-11-11 19:26:09 | [diff] [blame] | 10 | #include "lldb/Core/Debugger.h" |
Jim Ingham | 06e827c | 2010-11-11 19:26:09 | [diff] [blame] | 11 | #include "lldb/Target/Process.h" |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 12 | #include "lldb/Target/RegisterContext.h" |
Jim Ingham | 06e827c | 2010-11-11 19:26:09 | [diff] [blame] | 13 | #include "lldb/Target/Target.h" |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 14 | #include "lldb/Target/Thread.h" |
Zachary Turner | 6f9e690 | 2017-03-03 20:56:28 | [diff] [blame] | 15 | #include "lldb/Utility/Log.h" |
Pavel Labath | d821c99 | 2018-08-07 11:07:21 | [diff] [blame] | 16 | #include "lldb/Utility/State.h" |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 17 | |
| 18 | using namespace lldb; |
| 19 | using namespace lldb_private; |
| 20 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 21 | // ThreadPlan constructor |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 22 | ThreadPlan::ThreadPlan(ThreadPlanKind kind, const char *name, Thread &thread, |
| 23 | Vote stop_vote, Vote run_vote) |
Jim Ingham | 1893065 | 2020-03-18 19:05:08 | [diff] [blame] | 24 | : m_process(*thread.GetProcess().get()), m_tid(thread.GetID()), |
Jim Ingham | e4598dc | 2020-03-10 21:03:53 | [diff] [blame] | 25 | m_stop_vote(stop_vote), m_run_vote(run_vote), |
Jonas Devlieghere | e103ae9 | 2018-11-15 01:18:15 | [diff] [blame] | 26 | m_takes_iteration_count(false), m_could_not_resolve_hw_bp(false), |
Eric Christopher | 3ccd454 | 2020-04-04 00:58:59 | [diff] [blame] | 27 | m_thread(&thread), m_kind(kind), m_name(name), m_plan_complete_mutex(), |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 28 | m_cached_plan_explains_stop(eLazyBoolCalculate), m_plan_complete(false), |
| 29 | m_plan_private(false), m_okay_to_discard(true), m_is_master_plan(false), |
| 30 | m_plan_succeeded(true) { |
| 31 | SetID(GetNextID()); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 32 | } |
| 33 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 34 | // Destructor |
Eugene Zelenko | e65b2cf | 2015-12-15 01:33:19 | [diff] [blame] | 35 | ThreadPlan::~ThreadPlan() = default; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 36 | |
Jim Ingham | 61e8e68 | 2020-03-10 23:18:11 | [diff] [blame] | 37 | Target &ThreadPlan::GetTarget() { return m_process.GetTarget(); } |
| 38 | |
| 39 | const Target &ThreadPlan::GetTarget() const { return m_process.GetTarget(); } |
| 40 | |
Jim Ingham | e4598dc | 2020-03-10 21:03:53 | [diff] [blame] | 41 | Thread &ThreadPlan::GetThread() { |
| 42 | if (m_thread) |
| 43 | return *m_thread; |
Jim Ingham | 1893065 | 2020-03-18 19:05:08 | [diff] [blame] | 44 | |
Jim Ingham | e4598dc | 2020-03-10 21:03:53 | [diff] [blame] | 45 | ThreadSP thread_sp = m_process.GetThreadList().FindThreadByID(m_tid); |
| 46 | m_thread = thread_sp.get(); |
| 47 | return *m_thread; |
| 48 | } |
| 49 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 50 | bool ThreadPlan::PlanExplainsStop(Event *event_ptr) { |
| 51 | if (m_cached_plan_explains_stop == eLazyBoolCalculate) { |
| 52 | bool actual_value = DoPlanExplainsStop(event_ptr); |
Dave Lee | 606c3be | 2021-02-08 04:16:48 | [diff] [blame^] | 53 | CachePlanExplainsStop(actual_value); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 54 | return actual_value; |
| 55 | } else { |
| 56 | return m_cached_plan_explains_stop == eLazyBoolYes; |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | bool ThreadPlan::IsPlanComplete() { |
| 61 | std::lock_guard<std::recursive_mutex> guard(m_plan_complete_mutex); |
| 62 | return m_plan_complete; |
| 63 | } |
| 64 | |
| 65 | void ThreadPlan::SetPlanComplete(bool success) { |
| 66 | std::lock_guard<std::recursive_mutex> guard(m_plan_complete_mutex); |
| 67 | m_plan_complete = true; |
| 68 | m_plan_succeeded = success; |
| 69 | } |
| 70 | |
| 71 | bool ThreadPlan::MischiefManaged() { |
| 72 | std::lock_guard<std::recursive_mutex> guard(m_plan_complete_mutex); |
| 73 | // Mark the plan is complete, but don't override the success flag. |
| 74 | m_plan_complete = true; |
| 75 | return true; |
| 76 | } |
| 77 | |
| 78 | Vote ThreadPlan::ShouldReportStop(Event *event_ptr) { |
| 79 | Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); |
| 80 | |
| 81 | if (m_stop_vote == eVoteNoOpinion) { |
| 82 | ThreadPlan *prev_plan = GetPreviousPlan(); |
| 83 | if (prev_plan) { |
| 84 | Vote prev_vote = prev_plan->ShouldReportStop(event_ptr); |
Pavel Labath | 05d382c | 2017-02-03 18:50:45 | [diff] [blame] | 85 | LLDB_LOG(log, "returning previous thread plan vote: {0}", prev_vote); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 86 | return prev_vote; |
Jim Ingham | 221d51c | 2013-05-08 00:35:16 | [diff] [blame] | 87 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 88 | } |
Pavel Labath | 05d382c | 2017-02-03 18:50:45 | [diff] [blame] | 89 | LLDB_LOG(log, "Returning vote: {0}", m_stop_vote); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 90 | return m_stop_vote; |
| 91 | } |
| 92 | |
| 93 | Vote ThreadPlan::ShouldReportRun(Event *event_ptr) { |
| 94 | if (m_run_vote == eVoteNoOpinion) { |
| 95 | ThreadPlan *prev_plan = GetPreviousPlan(); |
| 96 | if (prev_plan) |
| 97 | return prev_plan->ShouldReportRun(event_ptr); |
| 98 | } |
| 99 | return m_run_vote; |
| 100 | } |
| 101 | |
Walter Erquinigo | 4bb6244 | 2021-01-22 18:22:26 | [diff] [blame] | 102 | void ThreadPlan::ClearThreadCache() { m_thread = nullptr; } |
| 103 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 104 | bool ThreadPlan::StopOthers() { |
| 105 | ThreadPlan *prev_plan; |
| 106 | prev_plan = GetPreviousPlan(); |
| 107 | return (prev_plan == nullptr) ? false : prev_plan->StopOthers(); |
| 108 | } |
| 109 | |
| 110 | void ThreadPlan::SetStopOthers(bool new_value) { |
Adrian Prantl | 0509724 | 2018-04-30 16:49:04 | [diff] [blame] | 111 | // SetStopOthers doesn't work up the hierarchy. You have to set the explicit |
| 112 | // ThreadPlan you want to affect. |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | bool ThreadPlan::WillResume(StateType resume_state, bool current_plan) { |
| 116 | m_cached_plan_explains_stop = eLazyBoolCalculate; |
| 117 | |
| 118 | if (current_plan) { |
| 119 | Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); |
| 120 | |
| 121 | if (log) { |
Jim Ingham | e4598dc | 2020-03-10 21:03:53 | [diff] [blame] | 122 | RegisterContext *reg_ctx = GetThread().GetRegisterContext().get(); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 123 | assert(reg_ctx); |
| 124 | addr_t pc = reg_ctx->GetPC(); |
| 125 | addr_t sp = reg_ctx->GetSP(); |
| 126 | addr_t fp = reg_ctx->GetFP(); |
Jonas Devlieghere | 63e5fb7 | 2019-07-24 17:56:10 | [diff] [blame] | 127 | LLDB_LOGF( |
| 128 | log, |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 129 | "%s Thread #%u (0x%p): tid = 0x%4.4" PRIx64 ", pc = 0x%8.8" PRIx64 |
| 130 | ", sp = 0x%8.8" PRIx64 ", fp = 0x%8.8" PRIx64 ", " |
| 131 | "plan = '%s', state = %s, stop others = %d", |
Jim Ingham | 1893065 | 2020-03-18 19:05:08 | [diff] [blame] | 132 | __FUNCTION__, GetThread().GetIndexID(), |
Jim Ingham | e4598dc | 2020-03-10 21:03:53 | [diff] [blame] | 133 | static_cast<void *>(&GetThread()), m_tid, static_cast<uint64_t>(pc), |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 134 | static_cast<uint64_t>(sp), static_cast<uint64_t>(fp), m_name.c_str(), |
| 135 | StateAsCString(resume_state), StopOthers()); |
Jim Ingham | 221d51c | 2013-05-08 00:35:16 | [diff] [blame] | 136 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 137 | } |
Jim Ingham | 1893065 | 2020-03-18 19:05:08 | [diff] [blame] | 138 | bool success = DoWillResume(resume_state, current_plan); |
Walter Erquinigo | 4bb6244 | 2021-01-22 18:22:26 | [diff] [blame] | 139 | ClearThreadCache(); // We don't cache the thread pointer over resumes. This |
Jim Ingham | 1893065 | 2020-03-18 19:05:08 | [diff] [blame] | 140 | // Thread might go away, and another Thread represent |
| 141 | // the same underlying object on a later stop. |
| 142 | return success; |
Jim Ingham | 221d51c | 2013-05-08 00:35:16 | [diff] [blame] | 143 | } |
| 144 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 145 | lldb::user_id_t ThreadPlan::GetNextID() { |
| 146 | static uint32_t g_nextPlanID = 0; |
| 147 | return ++g_nextPlanID; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 148 | } |
| 149 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 150 | void ThreadPlan::DidPush() {} |
| 151 | |
| 152 | void ThreadPlan::WillPop() {} |
| 153 | |
| 154 | bool ThreadPlan::OkayToDiscard() { |
| 155 | return IsMasterPlan() ? m_okay_to_discard : true; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 156 | } |
| 157 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 158 | lldb::StateType ThreadPlan::RunState() { |
| 159 | if (m_tracer_sp && m_tracer_sp->TracingEnabled() && |
| 160 | m_tracer_sp->SingleStepEnabled()) |
| 161 | return eStateStepping; |
| 162 | else |
| 163 | return GetPlanRunState(); |
| 164 | } |
| 165 | |
| 166 | bool ThreadPlan::IsUsuallyUnexplainedStopReason(lldb::StopReason reason) { |
| 167 | switch (reason) { |
| 168 | case eStopReasonWatchpoint: |
| 169 | case eStopReasonSignal: |
| 170 | case eStopReasonException: |
| 171 | case eStopReasonExec: |
| 172 | case eStopReasonThreadExiting: |
| 173 | case eStopReasonInstrumentation: |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 | [diff] [blame] | 174 | return true; |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 175 | default: |
| 176 | return false; |
| 177 | } |
Jim Ingham | 9b03fa0 | 2015-07-23 19:55:02 | [diff] [blame] | 178 | } |
| 179 | |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 180 | // ThreadPlanNull |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 181 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 182 | ThreadPlanNull::ThreadPlanNull(Thread &thread) |
| 183 | : ThreadPlan(ThreadPlan::eKindNull, "Null Thread Plan", thread, |
| 184 | eVoteNoOpinion, eVoteNoOpinion) {} |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 185 | |
Eugene Zelenko | e65b2cf | 2015-12-15 01:33:19 | [diff] [blame] | 186 | ThreadPlanNull::~ThreadPlanNull() = default; |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 187 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 188 | void ThreadPlanNull::GetDescription(Stream *s, lldb::DescriptionLevel level) { |
| 189 | s->PutCString("Null thread plan - thread has been destroyed."); |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 190 | } |
| 191 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 192 | bool ThreadPlanNull::ValidatePlan(Stream *error) { |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 193 | #ifdef LLDB_CONFIGURATION_DEBUG |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 194 | fprintf(stderr, |
| 195 | "error: %s called on thread that has been destroyed (tid = 0x%" PRIx64 |
| 196 | ", ptid = 0x%" PRIx64 ")", |
Jim Ingham | e4598dc | 2020-03-10 21:03:53 | [diff] [blame] | 197 | LLVM_PRETTY_FUNCTION, m_tid, GetThread().GetProtocolID()); |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 198 | #else |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 199 | Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); |
| 200 | if (log) |
| 201 | log->Error("%s called on thread that has been destroyed (tid = 0x%" PRIx64 |
| 202 | ", ptid = 0x%" PRIx64 ")", |
Jim Ingham | e4598dc | 2020-03-10 21:03:53 | [diff] [blame] | 203 | LLVM_PRETTY_FUNCTION, m_tid, GetThread().GetProtocolID()); |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 204 | #endif |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 205 | return true; |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 206 | } |
| 207 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 208 | bool ThreadPlanNull::ShouldStop(Event *event_ptr) { |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 209 | #ifdef LLDB_CONFIGURATION_DEBUG |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 210 | fprintf(stderr, |
| 211 | "error: %s called on thread that has been destroyed (tid = 0x%" PRIx64 |
| 212 | ", ptid = 0x%" PRIx64 ")", |
Jim Ingham | e4598dc | 2020-03-10 21:03:53 | [diff] [blame] | 213 | LLVM_PRETTY_FUNCTION, m_tid, GetThread().GetProtocolID()); |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 214 | #else |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 215 | Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); |
| 216 | if (log) |
| 217 | log->Error("%s called on thread that has been destroyed (tid = 0x%" PRIx64 |
| 218 | ", ptid = 0x%" PRIx64 ")", |
Jim Ingham | e4598dc | 2020-03-10 21:03:53 | [diff] [blame] | 219 | LLVM_PRETTY_FUNCTION, m_tid, GetThread().GetProtocolID()); |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 220 | #endif |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 221 | return true; |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 222 | } |
| 223 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 224 | bool ThreadPlanNull::WillStop() { |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 225 | #ifdef LLDB_CONFIGURATION_DEBUG |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 226 | fprintf(stderr, |
| 227 | "error: %s called on thread that has been destroyed (tid = 0x%" PRIx64 |
| 228 | ", ptid = 0x%" PRIx64 ")", |
Jim Ingham | e4598dc | 2020-03-10 21:03:53 | [diff] [blame] | 229 | LLVM_PRETTY_FUNCTION, m_tid, GetThread().GetProtocolID()); |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 230 | #else |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 231 | Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); |
| 232 | if (log) |
| 233 | log->Error("%s called on thread that has been destroyed (tid = 0x%" PRIx64 |
| 234 | ", ptid = 0x%" PRIx64 ")", |
Jim Ingham | e4598dc | 2020-03-10 21:03:53 | [diff] [blame] | 235 | LLVM_PRETTY_FUNCTION, m_tid, GetThread().GetProtocolID()); |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 236 | #endif |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 237 | return true; |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 238 | } |
| 239 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 240 | bool ThreadPlanNull::DoPlanExplainsStop(Event *event_ptr) { |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 241 | #ifdef LLDB_CONFIGURATION_DEBUG |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 242 | fprintf(stderr, |
| 243 | "error: %s called on thread that has been destroyed (tid = 0x%" PRIx64 |
| 244 | ", ptid = 0x%" PRIx64 ")", |
Walter Erquinigo | 9661225 | 2020-04-04 02:49:07 | [diff] [blame] | 245 | LLVM_PRETTY_FUNCTION, GetThread().GetID(), GetThread().GetProtocolID()); |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 246 | #else |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 247 | Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); |
| 248 | if (log) |
| 249 | log->Error("%s called on thread that has been destroyed (tid = 0x%" PRIx64 |
| 250 | ", ptid = 0x%" PRIx64 ")", |
Jim Ingham | e4598dc | 2020-03-10 21:03:53 | [diff] [blame] | 251 | LLVM_PRETTY_FUNCTION, m_tid, GetThread().GetProtocolID()); |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 252 | #endif |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 253 | return true; |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 254 | } |
| 255 | |
| 256 | // The null plan is never done. |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 257 | bool ThreadPlanNull::MischiefManaged() { |
| 258 | // The null plan is never done. |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 259 | #ifdef LLDB_CONFIGURATION_DEBUG |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 260 | fprintf(stderr, |
| 261 | "error: %s called on thread that has been destroyed (tid = 0x%" PRIx64 |
| 262 | ", ptid = 0x%" PRIx64 ")", |
Jim Ingham | e4598dc | 2020-03-10 21:03:53 | [diff] [blame] | 263 | LLVM_PRETTY_FUNCTION, m_tid, GetThread().GetProtocolID()); |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 264 | #else |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 265 | Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); |
| 266 | if (log) |
| 267 | log->Error("%s called on thread that has been destroyed (tid = 0x%" PRIx64 |
| 268 | ", ptid = 0x%" PRIx64 ")", |
Jim Ingham | e4598dc | 2020-03-10 21:03:53 | [diff] [blame] | 269 | LLVM_PRETTY_FUNCTION, m_tid, GetThread().GetProtocolID()); |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 270 | #endif |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 271 | return false; |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 272 | } |
| 273 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 274 | lldb::StateType ThreadPlanNull::GetPlanRunState() { |
| 275 | // Not sure what to return here. This is a dead thread. |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 276 | #ifdef LLDB_CONFIGURATION_DEBUG |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 277 | fprintf(stderr, |
| 278 | "error: %s called on thread that has been destroyed (tid = 0x%" PRIx64 |
| 279 | ", ptid = 0x%" PRIx64 ")", |
Jim Ingham | e4598dc | 2020-03-10 21:03:53 | [diff] [blame] | 280 | LLVM_PRETTY_FUNCTION, m_tid, GetThread().GetProtocolID()); |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 281 | #else |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 282 | Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); |
| 283 | if (log) |
| 284 | log->Error("%s called on thread that has been destroyed (tid = 0x%" PRIx64 |
| 285 | ", ptid = 0x%" PRIx64 ")", |
Jim Ingham | e4598dc | 2020-03-10 21:03:53 | [diff] [blame] | 286 | LLVM_PRETTY_FUNCTION, m_tid, GetThread().GetProtocolID()); |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 287 | #endif |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 | [diff] [blame] | 288 | return eStateRunning; |
Greg Clayton | 6e10f14 | 2013-07-30 00:23:06 | [diff] [blame] | 289 | } |