ThreadPlanCallFunction.h revision 15dcb7ca49b8d8f46910cf085b4c249aac5317fa
1//===-- ThreadPlanCallFunction.h --------------------------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef liblldb_ThreadPlanCallFunction_h_
11#define liblldb_ThreadPlanCallFunction_h_
12
13// C Includes
14// C++ Includes
15// Other libraries and framework includes
16// Project includes
17#include "lldb/lldb-private.h"
18#include "lldb/Target/Thread.h"
19#include "lldb/Target/ThreadPlan.h"
20
21namespace lldb_private {
22
23class ThreadPlanCallFunction : public ThreadPlan
24{
25public:
26    ThreadPlanCallFunction (Thread &thread,
27                            Address &function,
28                            lldb::addr_t arg,
29                            bool stop_other_threads,
30                            bool discard_on_error = true,
31                            lldb::addr_t *this_arg = 0,
32                            lldb::addr_t *cmd_arg = 0);
33
34    virtual
35    ~ThreadPlanCallFunction ();
36
37    virtual void
38    GetDescription (Stream *s, lldb::DescriptionLevel level);
39
40    virtual bool
41    ValidatePlan (Stream *error);
42
43    virtual bool
44    PlanExplainsStop ();
45
46    virtual bool
47    ShouldStop (Event *event_ptr);
48
49    virtual bool
50    StopOthers ();
51
52    virtual void
53    SetStopOthers (bool new_value);
54
55    virtual lldb::StateType
56    GetPlanRunState ();
57
58    virtual void
59    DidPush ();
60
61    virtual bool
62    WillStop ();
63
64    virtual bool
65    MischiefManaged ();
66
67    virtual bool
68    IsMasterPlan()
69    {
70        return true;
71    }
72
73    // Classes that derive from ClangFunction, and implement
74    // their own WillPop methods should call this so that the
75    // thread state gets restored if the plan gets discarded.
76    virtual void
77    WillPop ();
78
79protected:
80private:
81    void
82    DoTakedown ();
83
84    void
85    SetBreakpoints ();
86
87    void
88    ClearBreakpoints ();
89
90    bool
91    BreakpointsExplainStop ();
92
93    bool                                            m_use_abi;
94    bool                                            m_valid;
95    bool                                            m_stop_other_threads;
96    Address                                         m_function_addr;
97    Address                                         m_start_addr;
98    lldb::addr_t                                    m_arg_addr;
99    ValueList                                      *m_args;
100    Process                                        &m_process;
101    Thread                                         &m_thread;
102    Thread::RegisterCheckpoint                      m_register_backup;
103    lldb::ThreadPlanSP                              m_subplan_sp;
104    LanguageRuntime                                *m_cxx_language_runtime;
105    LanguageRuntime                                *m_objc_language_runtime;
106    Thread::ThreadStateCheckpoint                   m_stored_thread_state;
107
108    DISALLOW_COPY_AND_ASSIGN (ThreadPlanCallFunction);
109};
110
111} // namespace lldb_private
112
113#endif  // liblldb_ThreadPlanCallFunction_h_
114