LLDB mainline
ThreadPlan.h
Go to the documentation of this file.
1//===-- ThreadPlan.h --------------------------------------------*- C++ -*-===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_TARGET_THREADPLAN_H
10#define LLDB_TARGET_THREADPLAN_H
11
12#include <mutex>
13#include <string>
14#include <vector>
15
16#include "lldb/Target/Process.h"
18#include "lldb/Target/Target.h"
19#include "lldb/Target/Thread.h"
21#include "lldb/Utility/UserID.h"
22#include "lldb/lldb-private.h"
23#include "llvm/ADT/ArrayRef.h"
24#include "llvm/Support/Error.h"
25
26namespace lldb_private {
27
28// ThreadPlan:
29//
30// This is the pure virtual base class for thread plans.
31//
32// The thread plans provide the "atoms" of behavior that all the logical
33// process control, either directly from commands or through more complex
34// composite plans will rely on.
35//
36// Plan Stack:
37//
38// The thread maintaining a thread plan stack, and you program the actions of
39// a particular thread by pushing plans onto the plan stack. There is always
40// a "Current" plan, which is the top of the plan stack, though in some cases
41// a plan may defer to plans higher in the stack for some piece of information
42// (let us define that the plan stack grows downwards).
43//
44// The plan stack is never empty, there is always a Base Plan which persists
45// through the life of the running process.
46//
47//
48// Creating Plans:
49//
50// The thread plan is generally created and added to the plan stack through
51// the QueueThreadPlanFor... API in lldb::Thread. Those API's will return the
52// plan that performs the named operation in a manner appropriate for the
53// current process. The plans in lldb/source/Target are generic
54// implementations, but a Process plugin can override them.
55//
56// ValidatePlan is then called. If it returns false, the plan is unshipped.
57// This is a little convenience which keeps us from having to error out of the
58// constructor.
59//
60// Then the plan is added to the plan stack. When the plan is added to the
61// plan stack its DidPush will get called. This is useful if a plan wants to
62// push any additional plans as it is constructed, since you need to make sure
63// you're already on the stack before you push additional plans.
64//
65// Completed Plans:
66//
67// When the target process stops the plans are queried, among other things,
68// for whether their job is done. If it is they are moved from the plan stack
69// to the Completed Plan stack in reverse order from their position on the
70// plan stack (since multiple plans may be done at a given stop.) This is
71// used primarily so that the lldb::Thread::StopInfo for the thread can be set
72// properly. If one plan pushes another to achieve part of its job, but it
73// doesn't want that sub-plan to be the one that sets the StopInfo, then call
74// SetPrivate on the sub-plan when you create it, and the Thread will pass
75// over that plan in reporting the reason for the stop.
76//
77// Discarded plans:
78//
79// Your plan may also get discarded, i.e. moved from the plan stack to the
80// "discarded plan stack". This can happen, for instance, if the plan is
81// calling a function and the function call crashes and you want to unwind the
82// attempt to call. So don't assume that your plan will always successfully
83// stop. Which leads to:
84//
85// Cleaning up after your plans:
86//
87// When the plan is moved from the plan stack its DidPop method is always
88// called, no matter why. Once it is moved off the plan stack it is done, and
89// won't get a chance to run again. So you should undo anything that affects
90// target state in this method. But be sure to leave the plan able to
91// correctly fill the StopInfo, however. N.B. Don't wait to do clean up
92// target state till the destructor, since that will usually get called when
93// the target resumes, and you want to leave the target state correct for new
94// plans in the time between when your plan gets unshipped and the next
95// resume.
96//
97// Thread State Checkpoint:
98//
99// Note that calling functions on target process (ThreadPlanCallFunction)
100// changes current thread state. The function can be called either by direct
101// user demand or internally, for example lldb allocates memory on device to
102// calculate breakpoint condition expression - on Linux it is performed by
103// calling mmap on device. ThreadStateCheckpoint saves Thread state (stop
104// info and completed plan stack) to restore it after completing function
105// call.
106//
107// Over the lifetime of the plan, various methods of the ThreadPlan are then
108// called in response to changes of state in the process we are debugging as
109// follows:
110//
111// Resuming:
112//
113// When the target process is about to be restarted, the plan's WillResume
114// method is called, giving the plan a chance to prepare for the run. If
115// WillResume returns false, then the process is not restarted. Be sure to
116// set an appropriate error value in the Process if you have to do this.
117// Note, ThreadPlans actually implement DoWillResume, WillResume wraps that
118// call.
119//
120// Next the "StopOthers" method of all the threads are polled, and if one
121// thread's Current plan returns "true" then only that thread gets to run. If
122// more than one returns "true" the threads that want to run solo get run one
123// by one round robin fashion. Otherwise all are let to run.
124//
125// Note, the way StopOthers is implemented, the base class implementation just
126// asks the previous plan. So if your plan has no opinion about whether it
127// should run stopping others or not, just don't implement StopOthers, and the
128// parent will be asked.
129//
130// Finally, for each thread that is running, it run state is set to the return
131// of RunState from the thread's Current plan.
132//
133// Responding to a stop:
134//
135// When the target process stops, the plan is called in the following stages:
136//
137// First the thread asks the Current Plan if it can handle this stop by
138// calling PlanExplainsStop. If the Current plan answers "true" then it is
139// asked if the stop should percolate all the way to the user by calling the
140// ShouldStop method. If the current plan doesn't explain the stop, then we
141// query up the plan stack for a plan that does explain the stop. The plan
142// that does explain the stop then needs to figure out what to do about the
143// plans below it in the stack. If the stop is recoverable, then the plan
144// that understands it can just do what it needs to set up to restart, and
145// then continue. Otherwise, the plan that understood the stop should call
146// DiscardPlanStack to clean up the stack below it. Note, plans actually
147// implement DoPlanExplainsStop, the result is cached in PlanExplainsStop so
148// the DoPlanExplainsStop itself will only get called once per stop.
149//
150// Controlling plans:
151//
152// In the normal case, when we decide to stop, we will collapse the plan
153// stack up to the point of the plan that understood the stop reason.
154// However, if a plan wishes to stay on the stack after an event it didn't
155// directly handle it can designate itself a "Controlling" plan by responding
156// true to IsControllingPlan, and then if it wants not to be discarded, it can
157// return false to OkayToDiscard, and it and all its dependent plans will be
158// preserved when we resume execution.
159//
160// The other effect of being a controlling plan is that when the Controlling
161// plan is
162// done , if it has set "OkayToDiscard" to false, then it will be popped &
163// execution will stop and return to the user. Remember that if OkayToDiscard
164// is false, the plan will be popped and control will be given to the next
165// plan above it on the stack So setting OkayToDiscard to false means the
166// user will regain control when the ControllingPlan is completed.
167//
168// Between these two controls this allows things like: a
169// ControllingPlan/DontDiscard Step Over to hit a breakpoint, stop and return
170// control to the user, but then when the user continues, the step out
171// succeeds. Even more tricky, when the breakpoint is hit, the user can
172// continue to step in/step over/etc, and finally when they continue, they
173// will finish up the Step Over.
174//
175// FIXME: ControllingPlan & OkayToDiscard aren't really orthogonal.
176// ControllingPlan
177// designation means that this plan controls it's fate and the fate of plans
178// below it. OkayToDiscard tells whether the ControllingPlan wants to stay on
179// the stack. I originally thought "ControllingPlan-ness" would need to be a
180// fixed
181// characteristic of a ThreadPlan, in which case you needed the extra control.
182// But that doesn't seem to be true. So we should be able to convert to only
183// ControllingPlan status to mean the current "ControllingPlan/DontDiscard".
184// Then no plans would be ControllingPlans by default, and you would set the
185// ones you wanted to be "user level" in this way.
186//
187//
188// Actually Stopping:
189//
190// If a plan says responds "true" to ShouldStop, then it is asked if it's job
191// is complete by calling MischiefManaged. If that returns true, the plan is
192// popped from the plan stack and added to the Completed Plan Stack. Then the
193// next plan in the stack is asked if it ShouldStop, and it returns "true",
194// it is asked if it is done, and if yes popped, and so on till we reach a
195// plan that is not done.
196//
197// Since you often know in the ShouldStop method whether your plan is
198// complete, as a convenience you can call SetPlanComplete and the ThreadPlan
199// implementation of MischiefManaged will return "true", without your having
200// to redo the calculation when your sub-classes MischiefManaged is called.
201// If you call SetPlanComplete, you can later use IsPlanComplete to determine
202// whether the plan is complete. This is only a convenience for sub-classes,
203// the logic in lldb::Thread will only call MischiefManaged.
204//
205// One slightly tricky point is you have to be careful using SetPlanComplete
206// in PlanExplainsStop because you are not guaranteed that PlanExplainsStop
207// for a plan will get called before ShouldStop gets called. If your sub-plan
208// explained the stop and then popped itself, only your ShouldStop will get
209// called.
210//
211// If ShouldStop for any thread returns "true", then the WillStop method of
212// the Current plan of all threads will be called, the stop event is placed on
213// the Process's public broadcaster, and control returns to the upper layers
214// of the debugger.
215//
216// Reporting the stop:
217//
218// When the process stops, the thread is given a StopReason, in the form of a
219// StopInfo object. If there is a completed plan corresponding to the stop,
220// then the "actual" stop reason can be suppressed, and instead a
221// StopInfoThreadPlan object will be cons'ed up from the top completed plan in
222// the stack. However, if the plan doesn't want to be the stop reason, then
223// it can call SetPlanComplete and pass in "false" for the "success"
224// parameter. In that case, the real stop reason will be used instead. One
225// example of this is the "StepRangeStepIn" thread plan. If it stops because
226// of a crash or breakpoint hit, it wants to unship itself, because it isn't
227// so useful to have step in keep going after a breakpoint hit. But it can't
228// be the reason for the stop or no-one would see that they had hit a
229// breakpoint.
230//
231// Cleaning up the plan stack:
232//
233// One of the complications of ControllingPlans is that you may get past the
234// limits
235// of a plan without triggering it to clean itself up. For instance, if you
236// are doing a ControllingPlan StepOver, and hit a breakpoint in a called
237// function,
238// then step over enough times to step out of the initial StepOver range, each
239// of the step overs will explain the stop & take themselves off the stack,
240// but control would never be returned to the original StepOver. Eventually,
241// the user will continue, and when that continue stops, the old stale
242// StepOver plan that was left on the stack will get woken up and notice it is
243// done. But that can leave junk on the stack for a while. To avoid that, the
244// plans implement a "IsPlanStale" method, that can check whether it is
245// relevant anymore. On stop, after the regular plan negotiation, the
246// remaining plan stack is consulted and if any plan says it is stale, it and
247// the plans below it are discarded from the stack.
248//
249// Automatically Resuming:
250//
251// If ShouldStop for all threads returns "false", then the target process will
252// resume. This then cycles back to Resuming above.
253//
254// Reporting eStateStopped events when the target is restarted:
255//
256// If a plan decides to auto-continue the target by returning "false" from
257// ShouldStop, then it will be asked whether the Stopped event should still be
258// reported. For instance, if you hit a breakpoint that is a User set
259// breakpoint, but the breakpoint callback said to continue the target
260// process, you might still want to inform the upper layers of lldb that the
261// stop had happened. The way this works is every thread gets to vote on
262// whether to report the stop. If all votes are eVoteNoOpinion, then the
263// thread list will decide what to do (at present it will pretty much always
264// suppress these stopped events.) If there is an eVoteYes, then the event
265// will be reported regardless of the other votes. If there is an eVoteNo and
266// no eVoteYes's, then the event won't be reported.
267//
268// One other little detail here, sometimes a plan will push another plan onto
269// the plan stack to do some part of the first plan's job, and it would be
270// convenient to tell that plan how it should respond to ShouldReportStop.
271// You can do that by setting the report_stop_vote in the child plan when you
272// create it.
273//
274// Suppressing the initial eStateRunning event:
275//
276// The private process running thread will take care of ensuring that only one
277// "eStateRunning" event will be delivered to the public Process broadcaster
278// per public eStateStopped event. However there are some cases where the
279// public state of this process is eStateStopped, but a thread plan needs to
280// restart the target, but doesn't want the running event to be publicly
281// broadcast. The obvious example of this is running functions by hand as
282// part of expression evaluation. To suppress the running event return
283// eVoteNo from ShouldReportStop, to force a running event to be reported
284// return eVoteYes, in general though you should return eVoteNoOpinion which
285// will allow the ThreadList to figure out the right thing to do. The
286// report_run_vote argument to the constructor works like report_stop_vote, and
287// is a way for a plan to instruct a sub-plan on how to respond to
288// ShouldReportStop.
289//
290// Reverse execution:
291//
292// Every thread plan has an associated RunDirection (forward or backward).
293// For ThreadPlanBase, this direction is the Process's base direction.
294// Whenever we resume the target, we need to ensure that the topmost thread
295// plans for each runnable thread all agree on their direction. This is
296// ensured in ThreadList::WillResume(), which chooses a direction and then
297// discards thread plans incompatible with that direction.
298
299class ThreadPlan : public std::enable_shared_from_this<ThreadPlan>,
300 public UserID {
301public:
302 // We use these enums so that we can cast a base thread plan to it's real
303 // type without having to resort to dynamic casting.
321
322 virtual ~ThreadPlan();
323
324 /// Returns the name of this thread plan.
325 ///
326 /// \return
327 /// A const char * pointer to the thread plan's name.
328 const char *GetName() const { return m_name.c_str(); }
329
330 /// Returns the Thread that is using this thread plan.
331 ///
332 /// \return
333 /// A pointer to the thread plan's owning thread.
334 Thread &GetThread();
335
336 Target &GetTarget();
337
338 const Target &GetTarget() const;
339
340 /// Clear the Thread* cache.
341 ///
342 /// This is useful in situations like when a new Thread list is being
343 /// generated.
344 void ClearThreadCache();
345
346 /// Print a description of this thread to the stream \a s.
347 /// \a thread. Don't expect that the result of GetThread is valid in
348 /// the description method. This might get called when the underlying
349 /// Thread has not been reported, so we only know the TID and not the thread.
350 ///
351 /// \param[in] s
352 /// The stream to which to print the description.
353 ///
354 /// \param[in] level
355 /// The level of description desired. Note that eDescriptionLevelBrief
356 /// will be used in the stop message printed when the plan is complete.
357 virtual void GetDescription(Stream *s, lldb::DescriptionLevel level) = 0;
358
359 /// Returns whether this plan could be successfully created.
360 ///
361 /// \param[in] error
362 /// A stream to which to print some reason why the plan could not be
363 /// created.
364 /// Can be NULL.
365 ///
366 /// \return
367 /// \b true if the plan should be queued, \b false otherwise.
368 virtual bool ValidatePlan(Stream *error) = 0;
369
371 if (!m_tracer_sp)
372 return false;
373 else
374 return m_tracer_sp->TracerExplainsStop();
375 }
376
378
379 bool PlanExplainsStop(Event *event_ptr);
380
381 virtual bool ShouldStop(Event *event_ptr) = 0;
382
383 /// Returns whether this thread plan overrides the `ShouldStop` of
384 /// subsequently processed plans.
385 ///
386 /// When processing the thread plan stack, this function gives plans the
387 /// ability to continue. If it returns true, the `ShouldStop` of
388 /// subsequently processed plans is not consulted. \see Thread::ShouldStop
389 virtual bool ShouldAutoContinue(Event *event_ptr) { return false; }
390
391 // Whether a "stop class" event should be reported to the "outside world".
392 // In general if a thread plan is active, events should not be reported.
393
394 virtual Vote ShouldReportStop(Event *event_ptr);
395
396 Vote ShouldReportRun(Event *event_ptr);
397
398 virtual void SetStopOthers(bool new_value);
399
400 virtual bool StopOthers();
401
402 // Returns true if the thread plan supports ThreadPlanSingleThreadTimeout to
403 // resume other threads after timeout. If the thread plan returns false it
404 // will prevent ThreadPlanSingleThreadTimeout from being created when this
405 // thread plan is alive.
406 virtual bool SupportsResumeOthers() { return true; }
407
408 virtual bool ShouldRunBeforePublicStop() { return false; }
409
410 // This is the wrapper for DoWillResume that does generic ThreadPlan logic,
411 // then calls DoWillResume.
412 bool WillResume(lldb::StateType resume_state, bool current_plan);
413
414 virtual bool WillStop() = 0;
415
417
418 // Returns true if this plan is a leaf plan, meaning the plan will be popped
419 // during each stop if it does not explain the stop and re-pushed before
420 // resuming to stay at the top of the stack.
421 virtual bool IsLeafPlan() { return false; }
422
423 bool SetIsControllingPlan(bool value) {
424 bool old_value = m_is_controlling_plan;
425 m_is_controlling_plan = value;
426 return old_value;
427 }
428
429 virtual bool OkayToDiscard();
430
431 void SetOkayToDiscard(bool value) { m_okay_to_discard = value; }
432
433 // The base class MischiefManaged does some cleanup - so you have to call it
434 // in your MischiefManaged derived class.
435 virtual bool MischiefManaged();
436
437 virtual void ThreadDestroyed() {
438 // Any cleanup that a plan might want to do in case the thread goes away in
439 // the middle of the plan being queued on a thread can be done here.
440 }
441
442 bool GetPrivate() { return m_plan_private; }
443
444 void SetPrivate(bool input) { m_plan_private = input; }
445
446 virtual void DidPush();
447
448 virtual void DidPop();
449
450 ThreadPlanKind GetKind() const { return m_kind; }
451
452 bool IsPlanComplete();
453
454 void SetPlanComplete(bool success = true);
455
456 virtual bool IsPlanStale() { return false; }
457
459
460 virtual bool IsBasePlan() { return false; }
461
463
465 m_tracer_sp = new_tracer_sp;
466 }
467
468 void DoTraceLog() {
469 if (m_tracer_sp && m_tracer_sp->TracingEnabled())
470 m_tracer_sp->Log();
471 }
472
473 // If the completion of the thread plan stepped out of a function, the return
474 // value of the function might have been captured by the thread plan
475 // (currently only ThreadPlanStepOut does this.) If so, the ReturnValueObject
476 // can be retrieved from here.
477
481
482 // If the thread plan managing the evaluation of a user expression lives
483 // longer than the command that instigated the expression (generally because
484 // the expression evaluation hit a breakpoint, and the user regained control
485 // at that point) a subsequent process control command step/continue/etc.
486 // might complete the expression evaluations. If so, the result of the
487 // expression evaluation will show up here.
488
492
493 // If a thread plan stores the state before it was run, then you might want
494 // to restore the state when it is done. This will do that job. This is
495 // mostly useful for artificial plans like CallFunction plans.
496
497 virtual void RestoreThreadState() {}
498
499 virtual bool IsVirtualStep() { return false; }
500
501 bool SetIterationCount(size_t count) {
503 // Don't tell me to do something 0 times...
504 if (count == 0)
505 return false;
506 m_iteration_count = count;
507 }
509 }
510
512
516
517protected:
518 // Constructors and Destructors
519 ThreadPlan(ThreadPlanKind kind, const char *name, Thread &thread,
520 Vote report_stop_vote, Vote report_run_vote);
521
522 // Classes that inherit from ThreadPlan can see and modify these
523
524 virtual bool DoWillResume(lldb::StateType resume_state, bool current_plan) {
525 return true;
526 }
527
528 virtual bool DoPlanExplainsStop(Event *event_ptr) = 0;
529
530 // This pushes a plan onto the plan stack of the current plan's thread.
531 // Also sets the plans to private and not controlling plans. A plan pushed by
532 // another thread plan is never either of the above.
533 void PushPlan(lldb::ThreadPlanSP &thread_plan_sp) {
534 GetThread().PushPlan(thread_plan_sp);
535 thread_plan_sp->SetPrivate(true);
536 thread_plan_sp->SetIsControllingPlan(false);
537 }
538
539 // This gets the previous plan to the current plan (for forwarding requests).
540 // This is mostly a formal requirement, it allows us to make the Thread's
541 // GetPreviousPlan protected, but only friend ThreadPlan to thread.
542
544
545 // This forwards the private Thread::GetPrivateStopInfo which is generally
546 // what ThreadPlan's need to know.
547
551
552 void SetStopInfo(lldb::StopInfoSP stop_reason_sp) {
553 GetThread().SetStopInfo(stop_reason_sp);
554 }
555
557
565 int32_t m_iteration_count = 1;
566
567private:
568 void CachePlanExplainsStop(bool does_explain) {
570 }
571
572 // For ThreadPlan only
573 static lldb::user_id_t GetNextID();
574
575 Thread *m_thread; // Stores a cached value of the thread, which is set to
576 // nullptr when the thread resumes. Don't use this anywhere
577 // but ThreadPlan::GetThread().
579 std::string m_name;
580 std::recursive_mutex m_plan_complete_mutex;
587
589
590 ThreadPlan(const ThreadPlan &) = delete;
591 const ThreadPlan &operator=(const ThreadPlan &) = delete;
592};
593
594// ThreadPlanNull:
595// Threads are assumed to always have at least one plan on the plan stack. This
596// is put on the plan stack when a thread is destroyed so that if you
597// accidentally access a thread after it is destroyed you won't crash. But
598// asking questions of the ThreadPlanNull is definitely an error.
599
601public:
602 ThreadPlanNull(Thread &thread);
603 ~ThreadPlanNull() override;
604
605 void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
606
607 bool ValidatePlan(Stream *error) override;
608
609 bool ShouldStop(Event *event_ptr) override;
610
611 bool MischiefManaged() override;
612
613 bool WillStop() override;
614
615 bool IsBasePlan() override { return true; }
616
617 bool OkayToDiscard() override { return false; }
618
619 const Status &GetStatus() { return m_status; }
620
621protected:
622 bool DoPlanExplainsStop(Event *event_ptr) override;
623
625
627 const ThreadPlanNull &operator=(const ThreadPlanNull &) = delete;
628};
629
630/// Returns the load addresses of the line table entries for \p lines in
631/// \p file, and of \p addresses, that are in the scope of \p frame. A
632/// line without entries resolves to the nearest following line with
633/// entries. Fails if no address is left.
634llvm::Expected<std::vector<lldb::addr_t>>
636 llvm::ArrayRef<uint32_t> lines,
637 llvm::ArrayRef<lldb::addr_t> requested_addresses);
638
639} // namespace lldb_private
640
641#endif // LLDB_TARGET_THREADPLAN_H
static llvm::raw_ostream & error(Stream &strm)
A file utility class.
Definition FileSpec.h:56
A plug-in interface definition class for debugging a process.
Definition Process.h:368
This base class provides an interface to stack frames.
Definition StackFrame.h:44
An error handling class.
Definition Status.h:118
A stream class that can stream formatted output to a file.
Definition Stream.h:28
bool MischiefManaged() override
lldb::StateType GetPlanRunState() override
bool OkayToDiscard() override
Definition ThreadPlan.h:617
const ThreadPlanNull & operator=(const ThreadPlanNull &)=delete
bool DoPlanExplainsStop(Event *event_ptr) override
void GetDescription(Stream *s, lldb::DescriptionLevel level) override
Print a description of this thread to the stream s.
bool ValidatePlan(Stream *error) override
Returns whether this plan could be successfully created.
const Status & GetStatus()
Definition ThreadPlan.h:619
ThreadPlanNull(const ThreadPlanNull &)=delete
bool ShouldStop(Event *event_ptr) override
virtual bool IsLeafPlan()
Definition ThreadPlan.h:421
virtual void GetDescription(Stream *s, lldb::DescriptionLevel level)=0
Print a description of this thread to the stream s.
virtual Vote ShouldReportStop(Event *event_ptr)
ThreadPlanKind m_kind
Definition ThreadPlan.h:578
virtual lldb::RunDirection GetDirection() const
Definition ThreadPlan.h:513
virtual void ThreadDestroyed()
Definition ThreadPlan.h:437
ThreadPlan(const ThreadPlan &)=delete
virtual bool DoPlanExplainsStop(Event *event_ptr)=0
void SetPrivate(bool input)
Definition ThreadPlan.h:444
virtual bool OkayToDiscard()
ThreadPlan(ThreadPlanKind kind, const char *name, Thread &thread, Vote report_stop_vote, Vote report_run_vote)
virtual bool DoWillResume(lldb::StateType resume_state, bool current_plan)
Definition ThreadPlan.h:524
virtual lldb::StateType GetPlanRunState()=0
virtual bool ShouldAutoContinue(Event *event_ptr)
Returns whether this thread plan overrides the ShouldStop of subsequently processed plans.
Definition ThreadPlan.h:389
void SetStopInfo(lldb::StopInfoSP stop_reason_sp)
Definition ThreadPlan.h:552
virtual lldb::ValueObjectSP GetReturnValueObject()
Definition ThreadPlan.h:478
Vote ShouldReportRun(Event *event_ptr)
const char * GetName() const
Returns the name of this thread plan.
Definition ThreadPlan.h:328
bool IsUsuallyUnexplainedStopReason(lldb::StopReason)
ThreadPlanKind GetKind() const
Definition ThreadPlan.h:450
virtual bool SupportsResumeOthers()
Definition ThreadPlan.h:406
LazyBool m_cached_plan_explains_stop
Definition ThreadPlan.h:581
void PushPlan(lldb::ThreadPlanSP &thread_plan_sp)
Definition ThreadPlan.h:533
void SetPlanComplete(bool success=true)
Thread & GetThread()
Returns the Thread that is using this thread plan.
virtual bool ShouldRunBeforePublicStop()
Definition ThreadPlan.h:408
bool PlanExplainsStop(Event *event_ptr)
virtual bool IsVirtualStep()
Definition ThreadPlan.h:499
virtual lldb::ExpressionVariableSP GetExpressionVariable()
Definition ThreadPlan.h:489
virtual bool StopOthers()
lldb::ThreadPlanTracerSP & GetThreadPlanTracer()
Definition ThreadPlan.h:462
const ThreadPlan & operator=(const ThreadPlan &)=delete
void SetOkayToDiscard(bool value)
Definition ThreadPlan.h:431
bool SetIterationCount(size_t count)
Definition ThreadPlan.h:501
static lldb::user_id_t GetNextID()
void SetThreadPlanTracer(lldb::ThreadPlanTracerSP new_tracer_sp)
Definition ThreadPlan.h:464
virtual void RestoreThreadState()
Definition ThreadPlan.h:497
virtual bool ValidatePlan(Stream *error)=0
Returns whether this plan could be successfully created.
ThreadPlan * GetPreviousPlan()
Definition ThreadPlan.h:543
void ClearThreadCache()
Clear the Thread* cache.
bool WillResume(lldb::StateType resume_state, bool current_plan)
virtual bool MischiefManaged()
virtual bool IsPlanStale()
Definition ThreadPlan.h:456
lldb::ThreadPlanTracerSP m_tracer_sp
Definition ThreadPlan.h:588
virtual bool WillStop()=0
lldb::StateType RunState()
virtual void SetStopOthers(bool new_value)
bool SetIsControllingPlan(bool value)
Definition ThreadPlan.h:423
void CachePlanExplainsStop(bool does_explain)
Definition ThreadPlan.h:568
virtual bool ShouldStop(Event *event_ptr)=0
std::recursive_mutex m_plan_complete_mutex
Definition ThreadPlan.h:580
virtual bool IsBasePlan()
Definition ThreadPlan.h:460
lldb::StopInfoSP GetPrivateStopInfo()
Definition ThreadPlan.h:548
virtual lldb::StopInfoSP GetPrivateStopInfo(bool calculate=true)
Definition Thread.cpp:401
void SetStopInfo(const lldb::StopInfoSP &stop_info_sp)
Definition Thread.cpp:479
ThreadPlan * GetPreviousPlan(ThreadPlan *plan) const
Definition Thread.cpp:1220
void PushPlan(lldb::ThreadPlanSP plan_sp)
Definition Thread.cpp:1136
A class that represents a running process on the host machine.
llvm::Expected< std::vector< lldb::addr_t > > GetStepUntilAddresses(StackFrame &frame, const FileSpec &file, llvm::ArrayRef< uint32_t > lines, llvm::ArrayRef< lldb::addr_t > requested_addresses)
Returns the load addresses of the line table entries for lines in file, and of addresses,...
std::shared_ptr< lldb_private::ThreadPlan > ThreadPlanSP
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
RunDirection
Execution directions.
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::ExpressionVariable > ExpressionVariableSP
StateType
Process and Thread States.
uint64_t user_id_t
Definition lldb-types.h:83
std::shared_ptr< lldb_private::StopInfo > StopInfoSP
StopReason
Thread stop reasons.
uint64_t tid_t
Definition lldb-types.h:85
std::shared_ptr< lldb_private::ThreadPlanTracer > ThreadPlanTracerSP
UserID(lldb::user_id_t uid=LLDB_INVALID_UID)
Construct with optional user ID.
Definition UserID.h:33