ThreadPlanRunToAddress.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. #ifndef LLDB_TARGET_THREADPLANRUNTOADDRESS_H
  9. #define LLDB_TARGET_THREADPLANRUNTOADDRESS_H
  10. #include <vector>
  11. #include "lldb/Target/ThreadPlan.h"
  12. #include "lldb/lldb-private.h"
  13. namespace lldb_private {
  14. class ThreadPlanRunToAddress : public ThreadPlan {
  15. public:
  16. ThreadPlanRunToAddress(Thread &thread, Address &address, bool stop_others);
  17. ThreadPlanRunToAddress(Thread &thread, lldb::addr_t address,
  18. bool stop_others);
  19. ThreadPlanRunToAddress(Thread &thread,
  20. const std::vector<lldb::addr_t> &addresses,
  21. bool stop_others);
  22. ~ThreadPlanRunToAddress() override;
  23. void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
  24. bool ValidatePlan(Stream *error) override;
  25. bool ShouldStop(Event *event_ptr) override;
  26. bool StopOthers() override;
  27. void SetStopOthers(bool new_value) override;
  28. lldb::StateType GetPlanRunState() override;
  29. bool WillStop() override;
  30. bool MischiefManaged() override;
  31. protected:
  32. bool DoPlanExplainsStop(Event *event_ptr) override;
  33. void SetInitialBreakpoints();
  34. bool AtOurAddress();
  35. private:
  36. bool m_stop_others;
  37. std::vector<lldb::addr_t>
  38. m_addresses; // This is the address we are going to run to.
  39. // TODO: Would it be useful to have multiple addresses?
  40. std::vector<lldb::break_id_t> m_break_ids; // This is the breakpoint we are
  41. // using to stop us at m_address.
  42. ThreadPlanRunToAddress(const ThreadPlanRunToAddress &) = delete;
  43. const ThreadPlanRunToAddress &
  44. operator=(const ThreadPlanRunToAddress &) = delete;
  45. };
  46. } // namespace lldb_private
  47. #endif // LLDB_TARGET_THREADPLANRUNTOADDRESS_H