1 //===-- ThreadPlanRunToAddress.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_ThreadPlanRunToAddress_h_
11 #define liblldb_ThreadPlanRunToAddress_h_
12 
13 // C Includes
14 // C++ Includes
15 #include <vector>
16 
17 // Other libraries and framework includes
18 // Project includes
19 #include "lldb/lldb-private.h"
20 #include "lldb/Target/ThreadPlan.h"
21 
22 namespace lldb_private {
23 
24 class ThreadPlanRunToAddress : public ThreadPlan
25 {
26 public:
27     ThreadPlanRunToAddress (Thread &thread,
28                             Address &address,
29                             bool stop_others);
30 
31     ThreadPlanRunToAddress (Thread &thread,
32                             lldb::addr_t address,
33                             bool stop_others);
34 
35     ThreadPlanRunToAddress (Thread &thread,
36                             const std::vector<lldb::addr_t> &addresses,
37                             bool stop_others);
38 
39 
40     virtual
41     ~ThreadPlanRunToAddress ();
42 
43     virtual void
44     GetDescription (Stream *s, lldb::DescriptionLevel level);
45 
46     virtual bool
47     ValidatePlan (Stream *error);
48 
49     virtual bool
50     ShouldStop (Event *event_ptr);
51 
52     virtual bool
53     StopOthers ();
54 
55     virtual void
56     SetStopOthers (bool new_value);
57 
58     virtual lldb::StateType
59     GetPlanRunState ();
60 
61     virtual bool
62     WillStop ();
63 
64     virtual bool
65     MischiefManaged ();
66 
67 protected:
68     virtual bool
69     DoPlanExplainsStop (Event *event_ptr);
70 
71     void SetInitialBreakpoints();
72     bool AtOurAddress();
73 private:
74     bool m_stop_others;
75     std::vector<lldb::addr_t> m_addresses;   // This is the address we are going to run to.
76                           // TODO: Would it be useful to have multiple addresses?
77     std::vector<lldb::break_id_t> m_break_ids; // This is the breakpoint we are using to stop us at m_address.
78 
79     DISALLOW_COPY_AND_ASSIGN (ThreadPlanRunToAddress);
80 
81 };
82 
83 } // namespace lldb_private
84 
85 #endif  // liblldb_ThreadPlanRunToAddress_h_
86