SBThreadPlan.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. //===-- SBThreadPlan.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_API_SBTHREADPLAN_H
  9. #define LLDB_API_SBTHREADPLAN_H
  10. #include "lldb/API/SBDefines.h"
  11. #include <cstdio>
  12. namespace lldb {
  13. class LLDB_API SBThreadPlan {
  14. public:
  15. SBThreadPlan();
  16. SBThreadPlan(const lldb::SBThreadPlan &threadPlan);
  17. SBThreadPlan(const lldb::ThreadPlanSP &lldb_object_sp);
  18. SBThreadPlan(lldb::SBThread &thread, const char *class_name);
  19. SBThreadPlan(lldb::SBThread &thread, const char *class_name,
  20. lldb::SBStructuredData &args_data);
  21. ~SBThreadPlan();
  22. explicit operator bool() const;
  23. bool IsValid() const;
  24. void Clear();
  25. lldb::StopReason GetStopReason();
  26. /// Get the number of words associated with the stop reason.
  27. /// See also GetStopReasonDataAtIndex().
  28. size_t GetStopReasonDataCount();
  29. /// Get information associated with a stop reason.
  30. ///
  31. /// Breakpoint stop reasons will have data that consists of pairs of
  32. /// breakpoint IDs followed by the breakpoint location IDs (they always come
  33. /// in pairs).
  34. ///
  35. /// Stop Reason Count Data Type
  36. /// ======================== ===== =========================================
  37. /// eStopReasonNone 0
  38. /// eStopReasonTrace 0
  39. /// eStopReasonBreakpoint N duple: {breakpoint id, location id}
  40. /// eStopReasonWatchpoint 1 watchpoint id
  41. /// eStopReasonSignal 1 unix signal number
  42. /// eStopReasonException N exception data
  43. /// eStopReasonExec 0
  44. /// eStopReasonFork 1 pid of the child process
  45. /// eStopReasonVFork 1 pid of the child process
  46. /// eStopReasonVForkDone 0
  47. /// eStopReasonPlanComplete 0
  48. uint64_t GetStopReasonDataAtIndex(uint32_t idx);
  49. SBThread GetThread() const;
  50. const lldb::SBThreadPlan &operator=(const lldb::SBThreadPlan &rhs);
  51. bool GetDescription(lldb::SBStream &description) const;
  52. void SetPlanComplete(bool success);
  53. bool IsPlanComplete();
  54. bool IsPlanStale();
  55. bool IsValid();
  56. bool GetStopOthers();
  57. void SetStopOthers(bool stop_others);
  58. // This section allows an SBThreadPlan to push another of the common types of
  59. // plans...
  60. SBThreadPlan QueueThreadPlanForStepOverRange(SBAddress &start_address,
  61. lldb::addr_t range_size);
  62. SBThreadPlan QueueThreadPlanForStepOverRange(SBAddress &start_address,
  63. lldb::addr_t range_size,
  64. SBError &error);
  65. SBThreadPlan QueueThreadPlanForStepInRange(SBAddress &start_address,
  66. lldb::addr_t range_size);
  67. SBThreadPlan QueueThreadPlanForStepInRange(SBAddress &start_address,
  68. lldb::addr_t range_size,
  69. SBError &error);
  70. SBThreadPlan QueueThreadPlanForStepOut(uint32_t frame_idx_to_step_to,
  71. bool first_insn = false);
  72. SBThreadPlan QueueThreadPlanForStepOut(uint32_t frame_idx_to_step_to,
  73. bool first_insn, SBError &error);
  74. SBThreadPlan QueueThreadPlanForRunToAddress(SBAddress address);
  75. SBThreadPlan QueueThreadPlanForRunToAddress(SBAddress address,
  76. SBError &error);
  77. SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name);
  78. SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name,
  79. SBError &error);
  80. SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name,
  81. lldb::SBStructuredData &args_data,
  82. SBError &error);
  83. private:
  84. friend class SBBreakpoint;
  85. friend class SBBreakpointLocation;
  86. friend class SBFrame;
  87. friend class SBProcess;
  88. friend class SBDebugger;
  89. friend class SBValue;
  90. friend class lldb_private::QueueImpl;
  91. friend class SBQueueItem;
  92. lldb::ThreadPlanSP GetSP() const { return m_opaque_wp.lock(); }
  93. lldb_private::ThreadPlan *get() const { return GetSP().get(); }
  94. void SetThreadPlan(const lldb::ThreadPlanSP &lldb_object_sp);
  95. lldb::ThreadPlanWP m_opaque_wp;
  96. };
  97. } // namespace lldb
  98. #endif // LLDB_API_SBTHREADPLAN_H