summaryrefslogtreecommitdiffstats
path: root/lldb/include/lldb/Target/ThreadPlanCallFunction.h
blob: cb081aad6f3a9353aff8b5f99817519f12b140d2 (plain)
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
//===-- ThreadPlanCallFunction.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_ThreadPlanCallFunction_h_
#define liblldb_ThreadPlanCallFunction_h_

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

namespace lldb_private {

class ThreadPlanCallFunction : public ThreadPlan
{
public:
    ThreadPlanCallFunction (Thread &thread,
                            Address &function,
                            lldb::addr_t arg,
                            bool stop_other_threads,
                            bool discard_on_error = true,
                            lldb::addr_t *this_arg = 0,
                            lldb::addr_t *cmd_arg = 0);
    
    virtual
    ~ThreadPlanCallFunction ();

    virtual void
    GetDescription (Stream *s, lldb::DescriptionLevel level);

    virtual bool
    ValidatePlan (Stream *error);

    virtual bool
    PlanExplainsStop ();

    virtual bool
    ShouldStop (Event *event_ptr);

    virtual bool
    StopOthers ();
    
    virtual void
    SetStopOthers (bool new_value);

    virtual lldb::StateType
    GetPlanRunState ();

    virtual void
    DidPush ();

    virtual bool
    WillStop ();

    virtual bool
    MischiefManaged ();

    virtual bool
    IsMasterPlan()
    {
        return true;
    }
    
    // Classes that derive from ClangFunction, and implement
    // their own WillPop methods should call this so that the
    // thread state gets restored if the plan gets discarded.
    virtual void
    WillPop ();

protected:
    void ReportRegisterState (const char *message);
private:
    void
    DoTakedown ();
    
    void
    SetBreakpoints ();
    
    void
    ClearBreakpoints ();
    
    bool
    BreakpointsExplainStop ();
    
    bool                                            m_use_abi;
    bool                                            m_valid;
    bool                                            m_stop_other_threads;
    Address                                         m_function_addr;
    Address                                         m_start_addr;
    lldb::addr_t                                    m_arg_addr;
    ValueList                                      *m_args;
    Process                                        &m_process;
    Thread                                         &m_thread;
    Thread::RegisterCheckpoint                      m_register_backup;
    lldb::ThreadPlanSP                              m_subplan_sp;
    LanguageRuntime                                *m_cxx_language_runtime;
    LanguageRuntime                                *m_objc_language_runtime;
    Thread::ThreadStateCheckpoint                   m_stored_thread_state;
    bool                                            m_takedown_done;    // We want to ensure we only do the takedown once.  This ensures that.

    DISALLOW_COPY_AND_ASSIGN (ThreadPlanCallFunction);
};

} // namespace lldb_private

#endif  // liblldb_ThreadPlanCallFunction_h_
OpenPOWER on IntegriCloud