1//===-- ThreadPlanRunToAddress.h --------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef liblldb_ThreadPlanRunToAddress_h_
10#define liblldb_ThreadPlanRunToAddress_h_
11
12#include <vector>
13
14#include "lldb/Target/ThreadPlan.h"
15#include "lldb/lldb-private.h"
16
17namespace lldb_private {
18
19class ThreadPlanRunToAddress : public ThreadPlan {
20public:
21  ThreadPlanRunToAddress(Thread &thread, Address &address, bool stop_others);
22
23  ThreadPlanRunToAddress(Thread &thread, lldb::addr_t address,
24                         bool stop_others);
25
26  ThreadPlanRunToAddress(Thread &thread,
27                         const std::vector<lldb::addr_t> &addresses,
28                         bool stop_others);
29
30  ~ThreadPlanRunToAddress() override;
31
32  void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
33
34  bool ValidatePlan(Stream *error) override;
35
36  bool ShouldStop(Event *event_ptr) override;
37
38  bool StopOthers() override;
39
40  void SetStopOthers(bool new_value) override;
41
42  lldb::StateType GetPlanRunState() override;
43
44  bool WillStop() override;
45
46  bool MischiefManaged() override;
47
48protected:
49  bool DoPlanExplainsStop(Event *event_ptr) override;
50
51  void SetInitialBreakpoints();
52  bool AtOurAddress();
53
54private:
55  bool m_stop_others;
56  std::vector<lldb::addr_t>
57      m_addresses; // This is the address we are going to run to.
58                   // TODO: Would it be useful to have multiple addresses?
59  std::vector<lldb::break_id_t> m_break_ids; // This is the breakpoint we are
60                                             // using to stop us at m_address.
61
62  DISALLOW_COPY_AND_ASSIGN(ThreadPlanRunToAddress);
63};
64
65} // namespace lldb_private
66
67#endif // liblldb_ThreadPlanRunToAddress_h_
68