1 //===-- ThreadPlanShouldStopHere.h ------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_ThreadPlanShouldStopHere_h_
11 #define liblldb_ThreadPlanShouldStopHere_h_
15 // Other libraries and framework includes
17 #include "lldb/Target/ThreadPlan.h"
19 namespace lldb_private {
21 // This is an interface that ThreadPlans can adopt to allow flexible modifications of the behavior
22 // when a thread plan comes to a place where it would ordinarily stop. If such modification makes
23 // sense for your plan, inherit from this class, and when you would be about to stop (in your ShouldStop
24 // method), call InvokeShouldStopHereCallback, and if that returns a non-NULL plan, execute that
25 // plan instead of stopping.
27 // The classic example of the use of this is ThreadPlanStepInRange not stopping in frames that have
28 // no debug information.
30 // This class also defines a set of flags to control general aspects of this "ShouldStop" behavior.
31 // A class implementing this protocol needs to define a default set of flags, and can provide access to
32 // changing that default flag set if it wishes.
34 class ThreadPlanShouldStopHere
40 eAvoidInlines = (1 << 0),
41 eAvoidNoDebug = (1 << 1)
44 //------------------------------------------------------------------
45 // Constructors and Destructors
46 //------------------------------------------------------------------
47 ThreadPlanShouldStopHere (ThreadPlan *owner,
48 ThreadPlanShouldStopHereCallback callback = NULL,
51 ~ThreadPlanShouldStopHere();
54 SetShouldStopHereCallback (ThreadPlanShouldStopHereCallback callback, void *baton);
57 InvokeShouldStopHereCallback ();
65 const lldb_private::Flags &
72 // Implement this, and call it in the plan's constructor to set the default flags.
73 virtual void SetFlagsToDefault () = 0;
75 //------------------------------------------------------------------
76 // Classes that inherit from ThreadPlanShouldStopHere can see and modify these
77 //------------------------------------------------------------------
78 ThreadPlanShouldStopHereCallback m_callback;
81 lldb_private::Flags m_flags;
84 //------------------------------------------------------------------
85 // For ThreadPlanShouldStopHere only
86 //------------------------------------------------------------------
88 DISALLOW_COPY_AND_ASSIGN (ThreadPlanShouldStopHere);
92 } // namespace lldb_private
94 #endif // liblldb_ThreadPlanShouldStopHere_h_