SBBreakpoint.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. //===-- SBBreakpoint.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_SBBREAKPOINT_H
  9. #define LLDB_API_SBBREAKPOINT_H
  10. #include "lldb/API/SBDefines.h"
  11. class SBBreakpointListImpl;
  12. namespace lldb {
  13. class LLDB_API SBBreakpoint {
  14. public:
  15. SBBreakpoint();
  16. SBBreakpoint(const lldb::SBBreakpoint &rhs);
  17. SBBreakpoint(const lldb::BreakpointSP &bp_sp);
  18. ~SBBreakpoint();
  19. const lldb::SBBreakpoint &operator=(const lldb::SBBreakpoint &rhs);
  20. // Tests to see if the opaque breakpoint object in this object matches the
  21. // opaque breakpoint object in "rhs".
  22. bool operator==(const lldb::SBBreakpoint &rhs);
  23. bool operator!=(const lldb::SBBreakpoint &rhs);
  24. break_id_t GetID() const;
  25. explicit operator bool() const;
  26. bool IsValid() const;
  27. void ClearAllBreakpointSites();
  28. lldb::SBTarget GetTarget() const;
  29. lldb::SBBreakpointLocation FindLocationByAddress(lldb::addr_t vm_addr);
  30. lldb::break_id_t FindLocationIDByAddress(lldb::addr_t vm_addr);
  31. lldb::SBBreakpointLocation FindLocationByID(lldb::break_id_t bp_loc_id);
  32. lldb::SBBreakpointLocation GetLocationAtIndex(uint32_t index);
  33. void SetEnabled(bool enable);
  34. bool IsEnabled();
  35. void SetOneShot(bool one_shot);
  36. bool IsOneShot() const;
  37. bool IsInternal();
  38. uint32_t GetHitCount() const;
  39. void SetIgnoreCount(uint32_t count);
  40. uint32_t GetIgnoreCount() const;
  41. void SetCondition(const char *condition);
  42. const char *GetCondition();
  43. void SetAutoContinue(bool auto_continue);
  44. bool GetAutoContinue();
  45. void SetThreadID(lldb::tid_t sb_thread_id);
  46. lldb::tid_t GetThreadID();
  47. void SetThreadIndex(uint32_t index);
  48. uint32_t GetThreadIndex() const;
  49. void SetThreadName(const char *thread_name);
  50. const char *GetThreadName() const;
  51. void SetQueueName(const char *queue_name);
  52. const char *GetQueueName() const;
  53. void SetCallback(SBBreakpointHitCallback callback, void *baton);
  54. void SetScriptCallbackFunction(const char *callback_function_name);
  55. SBError SetScriptCallbackFunction(const char *callback_function_name,
  56. SBStructuredData &extra_args);
  57. void SetCommandLineCommands(SBStringList &commands);
  58. bool GetCommandLineCommands(SBStringList &commands);
  59. SBError SetScriptCallbackBody(const char *script_body_text);
  60. bool AddName(const char *new_name);
  61. SBError AddNameWithErrorHandling(const char *new_name);
  62. void RemoveName(const char *name_to_remove);
  63. bool MatchesName(const char *name);
  64. void GetNames(SBStringList &names);
  65. size_t GetNumResolvedLocations() const;
  66. size_t GetNumLocations() const;
  67. bool GetDescription(lldb::SBStream &description);
  68. bool GetDescription(lldb::SBStream &description, bool include_locations);
  69. static bool EventIsBreakpointEvent(const lldb::SBEvent &event);
  70. static lldb::BreakpointEventType
  71. GetBreakpointEventTypeFromEvent(const lldb::SBEvent &event);
  72. static lldb::SBBreakpoint GetBreakpointFromEvent(const lldb::SBEvent &event);
  73. static lldb::SBBreakpointLocation
  74. GetBreakpointLocationAtIndexFromEvent(const lldb::SBEvent &event,
  75. uint32_t loc_idx);
  76. static uint32_t
  77. GetNumBreakpointLocationsFromEvent(const lldb::SBEvent &event_sp);
  78. bool IsHardware() const;
  79. // Can only be called from a ScriptedBreakpointResolver...
  80. SBError
  81. AddLocation(SBAddress &address);
  82. SBStructuredData SerializeToStructuredData();
  83. private:
  84. friend class SBBreakpointList;
  85. friend class SBBreakpointLocation;
  86. friend class SBBreakpointName;
  87. friend class SBTarget;
  88. lldb::BreakpointSP GetSP() const;
  89. lldb::BreakpointWP m_opaque_wp;
  90. };
  91. class LLDB_API SBBreakpointList {
  92. public:
  93. SBBreakpointList(SBTarget &target);
  94. ~SBBreakpointList();
  95. size_t GetSize() const;
  96. SBBreakpoint GetBreakpointAtIndex(size_t idx);
  97. SBBreakpoint FindBreakpointByID(lldb::break_id_t);
  98. void Append(const SBBreakpoint &sb_bkpt);
  99. bool AppendIfUnique(const SBBreakpoint &sb_bkpt);
  100. void AppendByID(lldb::break_id_t id);
  101. void Clear();
  102. protected:
  103. friend class SBTarget;
  104. void CopyToBreakpointIDList(lldb_private::BreakpointIDList &bp_id_list);
  105. private:
  106. std::shared_ptr<SBBreakpointListImpl> m_opaque_sp;
  107. };
  108. } // namespace lldb
  109. #endif // LLDB_API_SBBREAKPOINT_H