xref: /freebsd/contrib/llvm-project/lldb/include/lldb/Target/ThreadPlanRunToAddress.h (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
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 LLDB_TARGET_THREADPLANRUNTOADDRESS_H
10 #define LLDB_TARGET_THREADPLANRUNTOADDRESS_H
11 
12 #include <vector>
13 
14 #include "lldb/Target/ThreadPlan.h"
15 #include "lldb/lldb-private.h"
16 
17 namespace lldb_private {
18 
19 class ThreadPlanRunToAddress : public ThreadPlan {
20 public:
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 
48 protected:
49   bool DoPlanExplainsStop(Event *event_ptr) override;
50 
51   void SetInitialBreakpoints();
52   bool AtOurAddress();
53 
54 private:
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   ThreadPlanRunToAddress(const ThreadPlanRunToAddress &) = delete;
63   const ThreadPlanRunToAddress &
64   operator=(const ThreadPlanRunToAddress &) = delete;
65 };
66 
67 } // namespace lldb_private
68 
69 #endif // LLDB_TARGET_THREADPLANRUNTOADDRESS_H
70