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