aboutsummaryrefslogtreecommitdiff
path: root/include/lldb/Target/ThreadPlanShouldStopHere.h
blob: 62068b78ae4e2cae4539e1a2f5dd3aa501a417c4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//===-- ThreadPlanShouldStopHere.h ------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef liblldb_ThreadPlanShouldStopHere_h_
#define liblldb_ThreadPlanShouldStopHere_h_

// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Target/ThreadPlan.h"

namespace lldb_private {

// This is an interface that ThreadPlans can adopt to allow flexible modifications of the behavior
// when a thread plan comes to a place where it would ordinarily stop.  If such modification makes
// sense for your plan, inherit from this class, and when you would be about to stop (in your ShouldStop
// method), call InvokeShouldStopHereCallback, and if that returns a non-NULL plan, execute that
// plan instead of stopping.
//
// The classic example of the use of this is ThreadPlanStepInRange not stopping in frames that have
// no debug information.
//
// This class also defines a set of flags to control general aspects of this "ShouldStop" behavior.
// A class implementing this protocol needs to define a default set of flags, and can provide access to
// changing that default flag set if it wishes.

class ThreadPlanShouldStopHere
{
public:
    enum
    {
        eNone = 0,
        eAvoidInlines = (1 << 0),
        eAvoidNoDebug = (1 << 1)
    };

    //------------------------------------------------------------------
    // Constructors and Destructors
    //------------------------------------------------------------------
    ThreadPlanShouldStopHere (ThreadPlan *owner,
                              ThreadPlanShouldStopHereCallback callback = NULL,
                              void *baton = NULL);
    virtual
    ~ThreadPlanShouldStopHere();

    void
    SetShouldStopHereCallback (ThreadPlanShouldStopHereCallback callback, void *baton);

    lldb::ThreadPlanSP
    InvokeShouldStopHereCallback ();

    lldb_private::Flags &
    GetFlags ()
    {
        return m_flags;
    }

    const lldb_private::Flags &
    GetFlags () const
    {
        return m_flags;
    }

protected:
    // Implement this, and call it in the plan's constructor to set the default flags.
    virtual void SetFlagsToDefault () = 0;

    //------------------------------------------------------------------
    // Classes that inherit from ThreadPlanShouldStopHere can see and modify these
    //------------------------------------------------------------------
    ThreadPlanShouldStopHereCallback m_callback;
    void * m_baton;
    ThreadPlan *m_owner;
    lldb_private::Flags m_flags;

private:
    //------------------------------------------------------------------
    // For ThreadPlanShouldStopHere only
    //------------------------------------------------------------------

    DISALLOW_COPY_AND_ASSIGN (ThreadPlanShouldStopHere);

};

} // namespace lldb_private

#endif  // liblldb_ThreadPlanShouldStopHere_h_