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