24 s.
Printf(
"Element %d: ", elem_idx);
25 plan->GetDescription(&s, desc_level);
41 bool include_internal)
const {
55 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);
138 assert((
m_plans.size() > 0 || new_plan_sp->IsBasePlan()) &&
139 "Zeroth plan must be a base plan");
141 if (!new_plan_sp->GetThreadPlanTracer()) {
143 new_plan_sp->SetThreadPlanTracer(
m_plans.back()->GetThreadPlanTracer());
145 m_plans.push_back(new_plan_sp);
146 new_plan_sp->DidPush();
151 assert(
m_plans.size() > 1 &&
"Can't pop the base thread plan");
165 assert(
m_plans.size() > 1 &&
"Can't discard the base thread plan");
181 int stack_size =
m_plans.size();
183 if (up_to_plan_ptr ==
nullptr) {
184 for (
int i = stack_size - 1; i > 0; i--)
189 bool found_it =
false;
190 for (
int i = stack_size - 1; i > 0; i--) {
191 if (
m_plans[i].get() == up_to_plan_ptr) {
198 bool last_one =
false;
199 for (
int i = stack_size - 1; i > 0 && !last_one; i--) {
209 int stack_size =
m_plans.size();
210 for (
int i = stack_size - 1; i > 0; i--) {
218 int controlling_plan_idx;
223 for (controlling_plan_idx =
m_plans.size() - 1; controlling_plan_idx >= 0;
224 controlling_plan_idx--) {
225 if (
m_plans[controlling_plan_idx]->IsControllingPlan()) {
226 discard =
m_plans[controlling_plan_idx]->OkayToDiscard();
236 for (
int i =
m_plans.size() - 1; i > controlling_plan_idx; i--) {
243 if (controlling_plan_idx > 0) {
251 assert(
m_plans.size() != 0 &&
"There will always be a base plan.");
266 if (!completed_plan_sp->GetPrivate())
267 return completed_plan_sp;
273 bool skip_private)
const {
278 if (skip_private && plan_sp->GetPrivate())
295 if (return_valobj_sp)
296 return return_valobj_sp;
309 if (expression_variable_sp)
310 return expression_variable_sp;
333 if (plan.get() == in_plan)
342 if (plan.get() == in_plan)
350 if (current_plan ==
nullptr)
356 for (
int i = stack_size - 1; i > 0; i--) {
369 for (
int i = stack_size - 1; i > 0; i--) {
370 if (current_plan ==
m_plans[i].get())
378 int stack_size =
m_plans.size();
380 for (
int i = stack_size - 1; i > 0; i--) {
390 thread_plan_sp->ClearThreadCache();
401 bool check_for_new) {
406 for (
auto thread : current_threads.
Threads()) {
408 if (!
Find(cur_tid)) {
410 thread->QueueBasePlan(
true);
420 std::vector<lldb::tid_t> missing_threads;
427 missing_threads.push_back(cur_tid);
436 bool internal,
bool condense_if_trivial,
437 bool skip_unreported) {
441 uint32_t index_id = 0;
444 if (skip_unreported) {
449 index_id = thread_sp->GetIndexID();
451 if (condense_if_trivial) {
452 if (!elem.second.AnyPlans() && !elem.second.AnyCompletedPlans() &&
453 !elem.second.AnyDiscardedPlans()) {
454 strm.
Printf(
"thread #%u: tid = 0x%4.4" PRIx64
"\n", index_id, tid);
457 strm.
Printf(
"No active thread plans\n");
464 strm.
Printf(
"thread #%u: tid = 0x%4.4" PRIx64
":\n", index_id, tid);
466 elem.second.DumpThreadPlans(strm, desc_level, internal);
473 bool condense_if_trivial,
474 bool skip_unreported) {
476 uint32_t index_id = 0;
479 if (skip_unreported) {
481 strm.
Format(
"Unknown TID: {0}", tid);
487 index_id = thread_sp->GetIndexID();
490 strm.
Format(
"Unknown TID: {0}\n", tid);
494 if (condense_if_trivial) {
497 strm.
Printf(
"thread #%u: tid = 0x%4.4" PRIx64
"\n", index_id, tid);
500 strm.
Printf(
"No active thread plans\n");
507 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)
void PrintOneStack(Stream &s, llvm::StringRef stack_name, const PlanStack &stack, lldb::DescriptionLevel desc_level, bool include_internal) const
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)
std::recursive_mutex m_stack_mutex
bool AnyDiscardedPlans() 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)
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)
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