ThreadPlanStepOut.h revision 88e3de205708f14431559072ca258899b5ac31cc
1//===-- ThreadPlanStepOut.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_ThreadPlanStepOut_h_
11#define liblldb_ThreadPlanStepOut_h_
12
13// C Includes
14// C++ Includes
15// Other libraries and framework includes
16// Project includes
17#include "lldb/Target/Thread.h"
18#include "lldb/Target/ThreadPlan.h"
19
20namespace lldb_private {
21
22class ThreadPlanStepOut : public ThreadPlan
23{
24public:
25    ThreadPlanStepOut (Thread &thread,
26                       SymbolContext *addr_context,
27                       bool first_insn,
28                       bool stop_others,
29                       Vote stop_vote,
30                       Vote run_vote,
31                       uint32_t frame_idx);
32
33    virtual ~ThreadPlanStepOut ();
34
35    virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
36    virtual bool ValidatePlan (Stream *error);
37    virtual bool PlanExplainsStop ();
38    virtual bool ShouldStop (Event *event_ptr);
39    virtual bool StopOthers ();
40    virtual lldb::StateType GetPlanRunState ();
41    virtual bool WillResume (lldb::StateType resume_state, bool current_plan);
42    virtual bool WillStop ();
43    virtual bool MischiefManaged ();
44    virtual void DidPush();
45    virtual bool IsPlanStale();
46
47    virtual lldb::ValueObjectSP GetReturnValueObject()
48    {
49        return m_return_valobj_sp;
50    }
51
52protected:
53    bool QueueInlinedStepPlan (bool queue_now);
54
55private:
56    SymbolContext *m_step_from_context;
57    lldb::addr_t m_step_from_insn;
58    StackID  m_step_out_to_id;
59    StackID  m_immediate_step_from_id;
60    lldb::break_id_t m_return_bp_id;
61    lldb::addr_t m_return_addr;
62    bool m_first_insn;
63    bool m_stop_others;
64    lldb::ThreadPlanSP m_step_through_inline_plan_sp;
65    lldb::ThreadPlanSP m_step_out_plan_sp;
66    Function          *m_immediate_step_from_function;
67    lldb::ValueObjectSP m_return_valobj_sp;
68
69    friend ThreadPlan *
70    Thread::QueueThreadPlanForStepOut (bool abort_other_plans,
71                                       SymbolContext *addr_context,
72                                       bool first_insn,
73                                       bool stop_others,
74                                       Vote stop_vote,
75                                       Vote run_vote,
76                                       uint32_t frame_idx);
77
78    // Need an appropriate marker for the current stack so we can tell step out
79    // from step in.
80
81    void
82    CalculateReturnValue();
83
84    DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepOut);
85
86};
87
88} // namespace lldb_private
89
90#endif  // liblldb_ThreadPlanStepOut_h_
91