10b57cec5SDimitry Andric //===-- ThreadPlanRunToAddress.h --------------------------------*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric 
90b57cec5SDimitry Andric #ifndef LLDB_TARGET_THREADPLANRUNTOADDRESS_H
100b57cec5SDimitry Andric #define LLDB_TARGET_THREADPLANRUNTOADDRESS_H
110b57cec5SDimitry Andric 
120b57cec5SDimitry Andric #include <vector>
130b57cec5SDimitry Andric 
140b57cec5SDimitry Andric #include "lldb/Target/ThreadPlan.h"
150b57cec5SDimitry Andric #include "lldb/lldb-private.h"
160b57cec5SDimitry Andric 
170b57cec5SDimitry Andric namespace lldb_private {
180b57cec5SDimitry Andric 
190b57cec5SDimitry Andric class ThreadPlanRunToAddress : public ThreadPlan {
200b57cec5SDimitry Andric public:
210b57cec5SDimitry Andric   ThreadPlanRunToAddress(Thread &thread, Address &address, bool stop_others);
220b57cec5SDimitry Andric 
230b57cec5SDimitry Andric   ThreadPlanRunToAddress(Thread &thread, lldb::addr_t address,
240b57cec5SDimitry Andric                          bool stop_others);
250b57cec5SDimitry Andric 
260b57cec5SDimitry Andric   ThreadPlanRunToAddress(Thread &thread,
270b57cec5SDimitry Andric                          const std::vector<lldb::addr_t> &addresses,
280b57cec5SDimitry Andric                          bool stop_others);
290b57cec5SDimitry Andric 
300b57cec5SDimitry Andric   ~ThreadPlanRunToAddress() override;
310b57cec5SDimitry Andric 
320b57cec5SDimitry Andric   void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
330b57cec5SDimitry Andric 
340b57cec5SDimitry Andric   bool ValidatePlan(Stream *error) override;
350b57cec5SDimitry Andric 
360b57cec5SDimitry Andric   bool ShouldStop(Event *event_ptr) override;
370b57cec5SDimitry Andric 
380b57cec5SDimitry Andric   bool StopOthers() override;
390b57cec5SDimitry Andric 
400b57cec5SDimitry Andric   void SetStopOthers(bool new_value) override;
410b57cec5SDimitry Andric 
420b57cec5SDimitry Andric   lldb::StateType GetPlanRunState() override;
430b57cec5SDimitry Andric 
440b57cec5SDimitry Andric   bool WillStop() override;
450b57cec5SDimitry Andric 
460b57cec5SDimitry Andric   bool MischiefManaged() override;
470b57cec5SDimitry Andric 
480b57cec5SDimitry Andric protected:
490b57cec5SDimitry Andric   bool DoPlanExplainsStop(Event *event_ptr) override;
500b57cec5SDimitry Andric 
510b57cec5SDimitry Andric   void SetInitialBreakpoints();
520b57cec5SDimitry Andric   bool AtOurAddress();
530b57cec5SDimitry Andric 
540b57cec5SDimitry Andric private:
550b57cec5SDimitry Andric   bool m_stop_others;
560b57cec5SDimitry Andric   std::vector<lldb::addr_t>
570b57cec5SDimitry Andric       m_addresses; // This is the address we are going to run to.
580b57cec5SDimitry Andric                    // TODO: Would it be useful to have multiple addresses?
590b57cec5SDimitry Andric   std::vector<lldb::break_id_t> m_break_ids; // This is the breakpoint we are
600b57cec5SDimitry Andric                                              // using to stop us at m_address.
610b57cec5SDimitry Andric 
620b57cec5SDimitry Andric   ThreadPlanRunToAddress(const ThreadPlanRunToAddress &) = delete;
630b57cec5SDimitry Andric   const ThreadPlanRunToAddress &
640b57cec5SDimitry Andric   operator=(const ThreadPlanRunToAddress &) = delete;
650b57cec5SDimitry Andric };
660b57cec5SDimitry Andric 
670b57cec5SDimitry Andric } // namespace lldb_private
68 
69 #endif // LLDB_TARGET_THREADPLANRUNTOADDRESS_H
70