ThreadPlanStepInRange.h revision 276479
1254721Semaste//===-- ThreadPlanStepInRange.h ---------------------------------*- C++ -*-===//
2254721Semaste//
3254721Semaste//                     The LLVM Compiler Infrastructure
4254721Semaste//
5254721Semaste// This file is distributed under the University of Illinois Open Source
6254721Semaste// License. See LICENSE.TXT for details.
7254721Semaste//
8254721Semaste//===----------------------------------------------------------------------===//
9254721Semaste
10254721Semaste#ifndef liblldb_ThreadPlanStepInRange_h_
11254721Semaste#define liblldb_ThreadPlanStepInRange_h_
12254721Semaste
13254721Semaste// C Includes
14254721Semaste// C++ Includes
15254721Semaste// Other libraries and framework includes
16254721Semaste// Project includes
17254721Semaste#include "lldb/Core/AddressRange.h"
18254721Semaste#include "lldb/Target/StackID.h"
19254721Semaste#include "lldb/Target/Thread.h"
20254721Semaste#include "lldb/Target/ThreadPlanStepRange.h"
21254721Semaste#include "lldb/Target/ThreadPlanShouldStopHere.h"
22254721Semaste
23254721Semastenamespace lldb_private {
24254721Semaste
25254721Semasteclass ThreadPlanStepInRange :
26254721Semaste    public ThreadPlanStepRange,
27254721Semaste    public ThreadPlanShouldStopHere
28254721Semaste{
29254721Semastepublic:
30254721Semaste    ThreadPlanStepInRange (Thread &thread,
31254721Semaste                           const AddressRange &range,
32254721Semaste                           const SymbolContext &addr_context,
33276479Sdim                           lldb::RunMode stop_others,
34276479Sdim                            LazyBool step_in_avoids_code_without_debug_info,
35276479Sdim                            LazyBool step_out_avoids_code_without_debug_info);
36276479Sdim
37254721Semaste    ThreadPlanStepInRange (Thread &thread,
38254721Semaste                           const AddressRange &range,
39254721Semaste                           const SymbolContext &addr_context,
40254721Semaste                           const char *step_into_function_name,
41276479Sdim                           lldb::RunMode stop_others,
42276479Sdim                            LazyBool step_in_avoids_code_without_debug_info,
43276479Sdim                            LazyBool step_out_avoids_code_without_debug_info);
44254721Semaste
45254721Semaste    virtual
46254721Semaste    ~ThreadPlanStepInRange ();
47254721Semaste
48254721Semaste    virtual void
49254721Semaste    GetDescription (Stream *s, lldb::DescriptionLevel level);
50254721Semaste
51254721Semaste    virtual bool
52254721Semaste    ShouldStop (Event *event_ptr);
53254721Semaste
54254721Semaste    void SetAvoidRegexp(const char *name);
55254721Semaste
56254721Semaste    void SetStepInTarget (const char *target)
57254721Semaste    {
58254721Semaste        m_step_into_target.SetCString(target);
59254721Semaste    }
60254721Semaste
61254721Semaste    static void
62254721Semaste    SetDefaultFlagValue (uint32_t new_value);
63254721Semaste
64254721Semaste    bool
65254721Semaste    IsVirtualStep();
66254721Semaste
67254721Semasteprotected:
68276479Sdim    static bool
69276479Sdim    DefaultShouldStopHereCallback (ThreadPlan *current_plan, Flags &flags, lldb::FrameComparison operation, void *baton);
70276479Sdim
71254721Semaste    virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
72254721Semaste
73254721Semaste    virtual bool
74254721Semaste    DoPlanExplainsStop (Event *event_ptr);
75254721Semaste
76254721Semaste    virtual void
77276479Sdim    SetFlagsToDefault ()
78276479Sdim    {
79276479Sdim        GetFlags().Set(ThreadPlanStepInRange::s_default_flag_values);
80276479Sdim    }
81254721Semaste
82276479Sdim    void
83276479Sdim    SetCallbacks()
84276479Sdim    {
85276479Sdim        ThreadPlanShouldStopHere::ThreadPlanShouldStopHereCallbacks callbacks(ThreadPlanStepInRange::DefaultShouldStopHereCallback, nullptr);
86276479Sdim        SetShouldStopHereCallbacks (&callbacks, nullptr);
87276479Sdim    }
88276479Sdim
89254721Semaste    bool
90262528Semaste    FrameMatchesAvoidCriteria ();
91254721Semaste
92254721Semasteprivate:
93254721Semaste
94254721Semaste    friend lldb::ThreadPlanSP
95254721Semaste    Thread::QueueThreadPlanForStepOverRange (bool abort_other_plans,
96254721Semaste                                         const AddressRange &range,
97254721Semaste                                         const SymbolContext &addr_context,
98276479Sdim                                         lldb::RunMode stop_others,
99276479Sdim                                         LazyBool avoid_code_without_debug_info);
100254721Semaste    friend lldb::ThreadPlanSP
101254721Semaste    Thread::QueueThreadPlanForStepInRange (bool abort_other_plans,
102254721Semaste                                         const AddressRange &range,
103254721Semaste                                         const SymbolContext &addr_context,
104254721Semaste                                         const char *step_in_target,
105254721Semaste                                         lldb::RunMode stop_others,
106276479Sdim                                         LazyBool step_in_avoids_code_without_debug_info,
107276479Sdim                                         LazyBool step_out_avoids_code_without_debug_info);
108254721Semaste
109276479Sdim    void SetupAvoidNoDebug(LazyBool step_in_avoids_code_without_debug_info,
110276479Sdim                           LazyBool step_out_avoids_code_without_debug_info);
111254721Semaste    // Need an appropriate marker for the current stack so we can tell step out
112254721Semaste    // from step in.
113254721Semaste
114276479Sdim    static uint32_t s_default_flag_values;  // These are the default flag values for the ThreadPlanStepThrough.
115254721Semaste    lldb::ThreadPlanSP m_sub_plan_sp;  // Keep track of the last plan we were running.  If it fails, we should stop.
116254721Semaste    std::unique_ptr<RegularExpression> m_avoid_regexp_ap;
117254721Semaste    bool m_step_past_prologue;  // FIXME: For now hard-coded to true, we could put a switch in for this if there's
118254721Semaste                                // demand for that.
119254721Semaste    bool m_virtual_step;        // true if we've just done a "virtual step", i.e. just moved the inline stack depth.
120254721Semaste    ConstString m_step_into_target;
121254721Semaste    DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepInRange);
122254721Semaste
123254721Semaste};
124254721Semaste
125254721Semaste} // namespace lldb_private
126254721Semaste
127254721Semaste#endif  // liblldb_ThreadPlanStepInRange_h_
128