18876Srgrimes//===-- ThreadPlanShouldStopHere.h ------------------------------*- C++ -*-===//
24Srgrimes//
34Srgrimes//                     The LLVM Compiler Infrastructure
44Srgrimes//
58876Srgrimes// This file is distributed under the University of Illinois Open Source
64Srgrimes// License. See LICENSE.TXT for details.
74Srgrimes//
84Srgrimes//===----------------------------------------------------------------------===//
94Srgrimes
104Srgrimes#ifndef liblldb_ThreadPlanShouldStopHere_h_
118876Srgrimes#define liblldb_ThreadPlanShouldStopHere_h_
128876Srgrimes
134Srgrimes// C Includes
144Srgrimes// C++ Includes
158876Srgrimes// Other libraries and framework includes
164Srgrimes// Project includes
178876Srgrimes#include "lldb/Target/ThreadPlan.h"
184Srgrimes
194Srgrimesnamespace lldb_private {
204Srgrimes
214Srgrimes// This is an interface that ThreadPlans can adopt to allow flexible modifications of the behavior
228876Srgrimes// when a thread plan comes to a place where it would ordinarily stop.  If such modification makes
234Srgrimes// sense for your plan, inherit from this class, and when you would be about to stop (in your ShouldStop
244Srgrimes// method), call InvokeShouldStopHereCallback, and if that returns a non-NULL plan, execute that
254Srgrimes// plan instead of stopping.
264Srgrimes//
274Srgrimes// The classic example of the use of this is ThreadPlanStepInRange not stopping in frames that have
284Srgrimes// no debug information.
294Srgrimes//
304Srgrimes// This class also defines a set of flags to control general aspects of this "ShouldStop" behavior.
314Srgrimes// A class implementing this protocol needs to define a default set of flags, and can provide access to
324Srgrimes// changing that default flag set if it wishes.
33116176Sobrien
34116176Sobrienclass ThreadPlanShouldStopHere
35116176Sobrien{
36116176Sobrienpublic:
372056Swollman    enum
3842654Sjdp    {
3986998Sdd        eNone = 0,
40131952Smarcel        eAvoidInlines = (1 << 0),
4186998Sdd        eAvoidNoDebug = (1 << 1)
4286998Sdd    };
4317848Spst
4486998Sdd    //------------------------------------------------------------------
452056Swollman    // Constructors and Destructors
4649558Sphk    //------------------------------------------------------------------
47126399Sphk    ThreadPlanShouldStopHere (ThreadPlan *owner,
4812734Sbde                              ThreadPlanShouldStopHereCallback callback = NULL,
492056Swollman                              void *baton = NULL);
5012473Sbde    virtual
514Srgrimes    ~ThreadPlanShouldStopHere();
524Srgrimes
534Srgrimes    void
54118990Smarcel    SetShouldStopHereCallback (ThreadPlanShouldStopHereCallback callback, void *baton);
5579418Sjulian
564Srgrimes    lldb::ThreadPlanSP
574Srgrimes    InvokeShouldStopHereCallback ();
584Srgrimes
594Srgrimes    lldb_private::Flags &
604Srgrimes    GetFlags ()
6118296Sbde    {
624Srgrimes        return m_flags;
634Srgrimes    }
644Srgrimes
654Srgrimes    const lldb_private::Flags &
6678161Speter    GetFlags () const
6778161Speter    {
6878161Speter        return m_flags;
6912515Sphk    }
7086998Sdd
7185944Speterprotected:
72126399Sphk    // Implement this, and call it in the plan's constructor to set the default flags.
7317848Spst    virtual void SetFlagsToDefault () = 0;
7418296Sbde
7518296Sbde    //------------------------------------------------------------------
7618296Sbde    // Classes that inherit from ThreadPlanShouldStopHere can see and modify these
774Srgrimes    //------------------------------------------------------------------
784Srgrimes    ThreadPlanShouldStopHereCallback m_callback;
794Srgrimes    void * m_baton;
804Srgrimes    ThreadPlan *m_owner;
814Srgrimes    lldb_private::Flags m_flags;
8212515Sphk
834Srgrimesprivate:
844Srgrimes    //------------------------------------------------------------------
854Srgrimes    // For ThreadPlanShouldStopHere only
864Srgrimes    //------------------------------------------------------------------
874Srgrimes
884Srgrimes    DISALLOW_COPY_AND_ASSIGN (ThreadPlanShouldStopHere);
894Srgrimes
904Srgrimes};
914Srgrimes
924Srgrimes} // namespace lldb_private
934Srgrimes
944Srgrimes#endif  // liblldb_ThreadPlanShouldStopHere_h_
954Srgrimes