24 s.
Printf(
"Element %d: ", elem_idx);
25 plan->GetDescription(&s, desc_level);
41 bool include_internal)
const {
56 bool include_internal)
const {
62 bool any_public =
false;
63 if (!include_internal) {
64 for (
auto plan : stack) {
65 if (!plan->GetPrivate()) {
72 if (include_internal || any_public) {
75 s << stack_name <<
":\n";
76 for (
auto plan : stack) {
77 if (!include_internal && plan->GetPrivate())
96 "Asked for a checkpoint that didn't exist");
110 plan->ThreadDestroyed();
113 plan->ThreadDestroyed();
116 plan->ThreadDestroyed();
127 if (thread !=
nullptr) {
129 m_plans.push_back(null_plan_sp);
139 assert((
m_plans.size() > 0 || new_plan_sp->IsBasePlan()) &&
140 "Zeroth plan must be a base plan");
142 if (!new_plan_sp->GetThreadPlanTracer()) {
144 new_plan_sp->SetThreadPlanTracer(
m_plans.back()->GetThreadPlanTracer());
146 m_plans.push_back(new_plan_sp);
148 new_plan_sp->DidPush();
153 assert(
m_plans.size() > 1 &&
"Can't pop the base thread plan");
171 assert(
m_plans.size() > 1 &&
"Can't discard the base thread plan");
187 int stack_size =
m_plans.size();
189 if (up_to_plan_ptr ==
nullptr) {
190 for (
int i = stack_size - 1; i > 0; i--)
195 bool found_it =
false;
196 for (
int i = stack_size - 1; i > 0; i--) {
197 if (
m_plans[i].get() == up_to_plan_ptr) {
204 bool last_one =
false;
205 for (
int i = stack_size - 1; i > 0 && !last_one; i--) {
215 int stack_size =
m_plans.size();
216 for (
int i = stack_size - 1; i > 0; i--) {
224 int controlling_plan_idx;
229 for (controlling_plan_idx =
m_plans.size() - 1; controlling_plan_idx >= 0;
230 controlling_plan_idx--) {
231 if (
m_plans[controlling_plan_idx]->IsControllingPlan()) {
232 discard =
m_plans[controlling_plan_idx]->OkayToDiscard();
242 for (
int i =
m_plans.size() - 1; i > controlling_plan_idx; i--) {
249 if (controlling_plan_idx > 0) {
261 assert(
m_plans.size() != 0 &&
"There will always be a base plan.");
276 if (!completed_plan_sp->GetPrivate())
277 return completed_plan_sp;
283 bool skip_private)
const {
288 if (skip_private && plan_sp->GetPrivate())
305 if (return_valobj_sp)
306 return return_valobj_sp;
319 if (expression_variable_sp)
320 return expression_variable_sp;
343 if (plan.get() == in_plan)
352 if (plan.get() == in_plan)
360 if (current_plan ==
nullptr)
366 for (
int i = stack_size - 1; i > 0; i--) {
379 for (
int i = stack_size - 1; i > 0; i--) {
380 if (current_plan ==
m_plans[i].get())
388 int stack_size =
m_plans.size();
390 for (
int i = stack_size - 1; i > 0; i--) {
400 thread_plan_sp->ClearThreadCache();
411 bool check_for_new) {
416 for (
auto thread : current_threads.
Threads()) {
418 if (!
Find(cur_tid)) {
420 thread->QueueBasePlan(
true);
430 std::vector<lldb::tid_t> missing_threads;
437 missing_threads.push_back(cur_tid);
446 bool internal,
bool condense_if_trivial,
447 bool skip_unreported) {
451 uint32_t index_id = 0;
454 if (skip_unreported) {
459 index_id = thread_sp->GetIndexID();
461 if (condense_if_trivial) {
462 if (!elem.second.AnyPlans() && !elem.second.AnyCompletedPlans() &&
463 !elem.second.AnyDiscardedPlans()) {
464 strm.
Printf(
"thread #%u: tid = 0x%4.4" PRIx64
"\n", index_id, tid);
467 strm.
Printf(
"No active thread plans\n");
474 strm.
Printf(
"thread #%u: tid = 0x%4.4" PRIx64
":\n", index_id, tid);
476 elem.second.DumpThreadPlans(strm, desc_level, internal);
483 bool condense_if_trivial,
484 bool skip_unreported) {
486 uint32_t index_id = 0;
489 if (skip_unreported) {
491 strm.
Format(
"Unknown TID: {0}", tid);
497 index_id = thread_sp->GetIndexID();
500 strm.
Format(
"Unknown TID: {0}\n", tid);
504 if (condense_if_trivial) {
507 strm.
Printf(
"thread #%u: tid = 0x%4.4" PRIx64
"\n", index_id, tid);
510 strm.
Printf(
"No active thread plans\n");
517 strm.
Printf(
"thread #%u: tid = 0x%4.4" PRIx64
":\n", index_id, tid);
uint32_t GetKind(uint32_t data)
Return the type kind encoded in the given data.
static void PrintPlanElement(Stream &s, const ThreadPlanSP &plan, lldb::DescriptionLevel desc_level, int32_t elem_idx)
ThreadList & GetThreadList()
A stream class that can stream formatted output to a file.
void Format(const char *format, Args &&... args)
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t EOL()
Output and End of Line character to the stream.
void IndentLess(unsigned amount=2)
Decrement the current indentation level.
void IndentMore(unsigned amount=2)
Increment the current indentation level.
virtual ThreadIterable Threads()
lldb::ThreadSP FindThreadByID(lldb::tid_t tid, bool can_update=true)
bool RemoveTID(lldb::tid_t tid)
std::recursive_mutex m_stack_map_mutex
void DumpPlans(Stream &strm, lldb::DescriptionLevel desc_level, bool internal, bool ignore_boring, bool skip_unreported)
void AddThread(Thread &thread)
bool PrunePlansForTID(lldb::tid_t tid)
ThreadPlanStack * Find(lldb::tid_t tid)
void Update(ThreadList ¤t_threads, bool delete_missing, bool check_for_new=true)
bool DumpPlansForTID(Stream &strm, lldb::tid_t tid, lldb::DescriptionLevel desc_level, bool internal, bool ignore_boring, bool skip_unreported)
PlanStack m_discarded_plans
Plans that have been discarded by this stop.
size_t m_completed_plan_checkpoint
void DiscardPlansUpToPlan(ThreadPlan *up_to_plan_ptr)
lldb::ThreadPlanSP PopPlan()
bool AnyCompletedPlans() const
void DumpThreadPlans(Stream &s, lldb::DescriptionLevel desc_level, bool include_internal) const
lldb::ThreadPlanSP GetCompletedPlan(bool skip_private=true) const
lldb::ExpressionVariableSP GetExpressionVariable() const
PlanStack m_completed_plans
Plans that have been completed by this stop.
void ThreadDestroyed(Thread *thread)
ThreadPlanStack(const Thread &thread, bool make_empty=false)
llvm::sys::RWMutex m_stack_mutex
bool AnyDiscardedPlans() const
lldb::ThreadPlanSP GetCurrentPlanNoLock() const
bool IsPlanDone(ThreadPlan *plan) const
void RestoreCompletedPlanCheckpoint(size_t checkpoint)
lldb::ThreadPlanSP GetPlanByIndex(uint32_t plan_idx, bool skip_private=true) const
lldb::ValueObjectSP GetReturnValueObject() const
void PushPlan(lldb::ThreadPlanSP new_plan_sp)
lldb::ThreadPlanSP DiscardPlanNoLock()
void DiscardConsultingControllingPlans()
lldb::ThreadPlanSP DiscardPlan()
std::unordered_map< size_t, PlanStack > m_completed_plan_store
bool WasPlanDiscarded(ThreadPlan *plan) const
void ClearThreadCache()
Clear the Thread* cache that each ThreadPlan contains.
void DiscardCompletedPlanCheckpoint(size_t checkpoint)
void PrintOneStackNoLock(Stream &s, llvm::StringRef stack_name, const PlanStack &stack, lldb::DescriptionLevel desc_level, bool include_internal) const
size_t CheckpointCompletedPlans()
ThreadPlan * GetInnermostExpression() const
PlanStack m_plans
The stack of plans this thread is executing.
lldb::ThreadPlanSP GetCurrentPlan() const
ThreadPlan * GetPreviousPlan(ThreadPlan *current_plan) const
std::vector< lldb::ThreadPlanSP > PlanStack
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::ThreadPlan > ThreadPlanSP
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::ExpressionVariable > ExpressionVariableSP