Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1 | //===-- SBBreakpoint.cpp ----------------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #include "lldb/API/SBBreakpoint.h" |
| 11 | #include "lldb/API/SBBreakpointLocation.h" |
| 12 | #include "lldb/API/SBDebugger.h" |
Greg Clayton | c7f5d5c | 2010-07-23 23:33:17 +0000 | [diff] [blame] | 13 | #include "lldb/API/SBEvent.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 14 | #include "lldb/API/SBProcess.h" |
Caroline Tice | 98f930f | 2010-09-20 05:20:02 +0000 | [diff] [blame] | 15 | #include "lldb/API/SBStream.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 16 | #include "lldb/API/SBThread.h" |
| 17 | |
| 18 | #include "lldb/Breakpoint/Breakpoint.h" |
| 19 | #include "lldb/Breakpoint/BreakpointLocation.h" |
| 20 | #include "lldb/Breakpoint/StoppointCallbackContext.h" |
| 21 | #include "lldb/Core/Address.h" |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 22 | #include "lldb/Core/Log.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 23 | #include "lldb/Core/Stream.h" |
| 24 | #include "lldb/Core/StreamFile.h" |
| 25 | #include "lldb/Target/Process.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 26 | #include "lldb/Target/Target.h" |
Jim Ingham | 8e5e38f | 2010-06-18 01:47:08 +0000 | [diff] [blame] | 27 | #include "lldb/Target/Thread.h" |
| 28 | #include "lldb/Target/ThreadSpec.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 29 | |
| 30 | |
| 31 | #include "lldb/lldb-enumerations.h" |
| 32 | |
| 33 | using namespace lldb; |
| 34 | using namespace lldb_private; |
| 35 | |
| 36 | struct CallbackData |
| 37 | { |
| 38 | SBBreakpoint::BreakpointHitCallback callback; |
| 39 | void *callback_baton; |
| 40 | }; |
| 41 | |
| 42 | class SBBreakpointCallbackBaton : public Baton |
| 43 | { |
| 44 | public: |
| 45 | |
| 46 | SBBreakpointCallbackBaton (SBBreakpoint::BreakpointHitCallback callback, void *baton) : |
| 47 | Baton (new CallbackData) |
| 48 | { |
| 49 | CallbackData *data = (CallbackData *)m_data; |
| 50 | data->callback = callback; |
| 51 | data->callback_baton = baton; |
| 52 | } |
| 53 | |
| 54 | virtual ~SBBreakpointCallbackBaton() |
| 55 | { |
| 56 | CallbackData *data = (CallbackData *)m_data; |
| 57 | |
| 58 | if (data) |
| 59 | { |
| 60 | delete data; |
| 61 | m_data = NULL; |
| 62 | } |
| 63 | } |
| 64 | }; |
| 65 | |
| 66 | |
| 67 | SBBreakpoint::SBBreakpoint () : |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 68 | m_opaque_sp () |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 69 | { |
| 70 | } |
| 71 | |
| 72 | SBBreakpoint::SBBreakpoint (const SBBreakpoint& rhs) : |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 73 | m_opaque_sp (rhs.m_opaque_sp) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 74 | { |
| 75 | } |
| 76 | |
| 77 | |
| 78 | SBBreakpoint::SBBreakpoint (const lldb::BreakpointSP &bp_sp) : |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 79 | m_opaque_sp (bp_sp) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 80 | { |
| 81 | } |
| 82 | |
| 83 | SBBreakpoint::~SBBreakpoint() |
| 84 | { |
| 85 | } |
| 86 | |
| 87 | const SBBreakpoint & |
| 88 | SBBreakpoint::operator = (const SBBreakpoint& rhs) |
| 89 | { |
| 90 | if (this != &rhs) |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 91 | m_opaque_sp = rhs.m_opaque_sp; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 92 | return *this; |
| 93 | } |
| 94 | |
Greg Clayton | ea49cc7 | 2010-12-12 19:25:26 +0000 | [diff] [blame] | 95 | bool |
| 96 | SBBreakpoint::operator == (const lldb::SBBreakpoint& rhs) |
| 97 | { |
| 98 | if (m_opaque_sp && rhs.m_opaque_sp) |
| 99 | return m_opaque_sp.get() == rhs.m_opaque_sp.get(); |
| 100 | return false; |
| 101 | } |
| 102 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 103 | break_id_t |
| 104 | SBBreakpoint::GetID () const |
| 105 | { |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 106 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 107 | |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 108 | break_id_t break_id = LLDB_INVALID_BREAK_ID; |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 109 | if (m_opaque_sp) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 110 | break_id = m_opaque_sp->GetID(); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 111 | |
| 112 | if (log) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 113 | { |
| 114 | if (break_id == LLDB_INVALID_BREAK_ID) |
| 115 | log->Printf ("SBBreakpoint(%p)::GetID () => LLDB_INVALID_BREAK_ID", m_opaque_sp.get()); |
| 116 | else |
| 117 | log->Printf ("SBBreakpoint(%p)::GetID () => %u", m_opaque_sp.get(), break_id); |
| 118 | } |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 119 | |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 120 | return break_id; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | |
| 124 | bool |
| 125 | SBBreakpoint::IsValid() const |
| 126 | { |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 127 | return m_opaque_sp; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 128 | } |
| 129 | |
| 130 | void |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 131 | SBBreakpoint::ClearAllBreakpointSites () |
| 132 | { |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 133 | if (m_opaque_sp) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 134 | { |
| 135 | Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 136 | m_opaque_sp->ClearAllBreakpointSites (); |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 137 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 138 | } |
| 139 | |
| 140 | SBBreakpointLocation |
| 141 | SBBreakpoint::FindLocationByAddress (addr_t vm_addr) |
| 142 | { |
| 143 | SBBreakpointLocation sb_bp_location; |
| 144 | |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 145 | if (m_opaque_sp) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 146 | { |
| 147 | if (vm_addr != LLDB_INVALID_ADDRESS) |
| 148 | { |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 149 | Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 150 | Address address; |
Greg Clayton | eea2640 | 2010-09-14 23:36:40 +0000 | [diff] [blame] | 151 | Target &target = m_opaque_sp->GetTarget(); |
| 152 | if (target.GetSectionLoadList().ResolveLoadAddress (vm_addr, address) == false) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 153 | { |
| 154 | address.SetSection (NULL); |
| 155 | address.SetOffset (vm_addr); |
| 156 | } |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 157 | sb_bp_location.SetLocation (m_opaque_sp->FindLocationByAddress (address)); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 158 | } |
| 159 | } |
| 160 | return sb_bp_location; |
| 161 | } |
| 162 | |
| 163 | break_id_t |
| 164 | SBBreakpoint::FindLocationIDByAddress (addr_t vm_addr) |
| 165 | { |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 166 | break_id_t break_id = LLDB_INVALID_BREAK_ID; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 167 | |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 168 | if (m_opaque_sp && vm_addr != LLDB_INVALID_ADDRESS) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 169 | { |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 170 | Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); |
| 171 | Address address; |
| 172 | Target &target = m_opaque_sp->GetTarget(); |
| 173 | if (target.GetSectionLoadList().ResolveLoadAddress (vm_addr, address) == false) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 174 | { |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 175 | address.SetSection (NULL); |
| 176 | address.SetOffset (vm_addr); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 177 | } |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 178 | break_id = m_opaque_sp->FindLocationIDByAddress (address); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 179 | } |
| 180 | |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 181 | return break_id; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 182 | } |
| 183 | |
| 184 | SBBreakpointLocation |
| 185 | SBBreakpoint::FindLocationByID (break_id_t bp_loc_id) |
| 186 | { |
| 187 | SBBreakpointLocation sb_bp_location; |
| 188 | |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 189 | if (m_opaque_sp) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 190 | { |
| 191 | Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 192 | sb_bp_location.SetLocation (m_opaque_sp->FindLocationByID (bp_loc_id)); |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 193 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 194 | |
| 195 | return sb_bp_location; |
| 196 | } |
| 197 | |
| 198 | SBBreakpointLocation |
| 199 | SBBreakpoint::GetLocationAtIndex (uint32_t index) |
| 200 | { |
| 201 | SBBreakpointLocation sb_bp_location; |
| 202 | |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 203 | if (m_opaque_sp) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 204 | { |
| 205 | Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 206 | sb_bp_location.SetLocation (m_opaque_sp->GetLocationAtIndex (index)); |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 207 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 208 | |
| 209 | return sb_bp_location; |
| 210 | } |
| 211 | |
| 212 | void |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 213 | SBBreakpoint::SetEnabled (bool enable) |
| 214 | { |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 215 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 216 | |
| 217 | if (log) |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 218 | log->Printf ("SBBreakpoint(%p)::SetEnabled (enabled=%i)", m_opaque_sp.get(), enable); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 219 | |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 220 | if (m_opaque_sp) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 221 | { |
| 222 | Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 223 | m_opaque_sp->SetEnabled (enable); |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 224 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 225 | } |
| 226 | |
| 227 | bool |
| 228 | SBBreakpoint::IsEnabled () |
| 229 | { |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 230 | if (m_opaque_sp) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 231 | { |
| 232 | Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 233 | return m_opaque_sp->IsEnabled(); |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 234 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 235 | else |
| 236 | return false; |
| 237 | } |
| 238 | |
| 239 | void |
Greg Clayton | 54e7afa | 2010-07-09 20:39:50 +0000 | [diff] [blame] | 240 | SBBreakpoint::SetIgnoreCount (uint32_t count) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 241 | { |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 242 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 243 | |
| 244 | if (log) |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 245 | log->Printf ("SBBreakpoint(%p)::SetIgnoreCount (count=%u)", m_opaque_sp.get(), count); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 246 | |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 247 | if (m_opaque_sp) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 248 | { |
| 249 | Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 250 | m_opaque_sp->SetIgnoreCount (count); |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 251 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 252 | } |
| 253 | |
Jim Ingham | e374083 | 2010-10-22 01:15:49 +0000 | [diff] [blame] | 254 | void |
| 255 | SBBreakpoint::SetCondition (const char *condition) |
| 256 | { |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 257 | if (m_opaque_sp) |
| 258 | { |
| 259 | Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); |
| 260 | m_opaque_sp->SetCondition (condition); |
| 261 | } |
Jim Ingham | e374083 | 2010-10-22 01:15:49 +0000 | [diff] [blame] | 262 | } |
| 263 | |
| 264 | const char * |
| 265 | SBBreakpoint::GetCondition () |
| 266 | { |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 267 | if (m_opaque_sp) |
| 268 | { |
| 269 | Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); |
| 270 | return m_opaque_sp->GetConditionText (); |
| 271 | } |
| 272 | return NULL; |
Jim Ingham | e374083 | 2010-10-22 01:15:49 +0000 | [diff] [blame] | 273 | } |
| 274 | |
Greg Clayton | 54e7afa | 2010-07-09 20:39:50 +0000 | [diff] [blame] | 275 | uint32_t |
Greg Clayton | c7f5d5c | 2010-07-23 23:33:17 +0000 | [diff] [blame] | 276 | SBBreakpoint::GetHitCount () const |
| 277 | { |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 278 | uint32_t count = 0; |
Greg Clayton | c7f5d5c | 2010-07-23 23:33:17 +0000 | [diff] [blame] | 279 | if (m_opaque_sp) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 280 | { |
| 281 | Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 282 | count = m_opaque_sp->GetHitCount(); |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 283 | } |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 284 | |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 285 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 286 | if (log) |
| 287 | log->Printf ("SBBreakpoint(%p)::GetHitCount () => %u", m_opaque_sp.get(), count); |
| 288 | |
| 289 | return count; |
Greg Clayton | c7f5d5c | 2010-07-23 23:33:17 +0000 | [diff] [blame] | 290 | } |
| 291 | |
| 292 | uint32_t |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 293 | SBBreakpoint::GetIgnoreCount () const |
| 294 | { |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 295 | uint32_t count = 0; |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 296 | if (m_opaque_sp) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 297 | { |
| 298 | Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 299 | count = m_opaque_sp->GetIgnoreCount(); |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 300 | } |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 301 | |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 302 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 303 | if (log) |
| 304 | log->Printf ("SBBreakpoint(%p)::GetIgnoreCount () => %u", m_opaque_sp.get(), count); |
| 305 | |
| 306 | return count; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 307 | } |
| 308 | |
| 309 | void |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 310 | SBBreakpoint::SetThreadID (tid_t tid) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 311 | { |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 312 | if (m_opaque_sp) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 313 | { |
| 314 | Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 315 | m_opaque_sp->SetThreadID (tid); |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 316 | } |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 317 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 318 | if (log) |
| 319 | log->Printf ("SBBreakpoint(%p)::SetThreadID (tid=0x%4.4x)", m_opaque_sp.get(), tid); |
| 320 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 321 | } |
| 322 | |
| 323 | tid_t |
| 324 | SBBreakpoint::GetThreadID () |
| 325 | { |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 326 | tid_t tid = LLDB_INVALID_THREAD_ID; |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 327 | if (m_opaque_sp) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 328 | { |
| 329 | Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 330 | tid = m_opaque_sp->GetThreadID(); |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 331 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 332 | |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 333 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 334 | if (log) |
| 335 | log->Printf ("SBBreakpoint(%p)::GetThreadID () => 0x%4.4x", m_opaque_sp.get(), tid); |
| 336 | return tid; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 337 | } |
| 338 | |
Jim Ingham | 8e5e38f | 2010-06-18 01:47:08 +0000 | [diff] [blame] | 339 | void |
| 340 | SBBreakpoint::SetThreadIndex (uint32_t index) |
| 341 | { |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 342 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 343 | if (log) |
| 344 | log->Printf ("SBBreakpoint(%p)::SetThreadIndex (%u)", m_opaque_sp.get(), index); |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 345 | if (m_opaque_sp) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 346 | { |
| 347 | Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 348 | m_opaque_sp->GetOptions()->GetThreadSpec()->SetIndex (index); |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 349 | } |
Jim Ingham | 8e5e38f | 2010-06-18 01:47:08 +0000 | [diff] [blame] | 350 | } |
| 351 | |
| 352 | uint32_t |
| 353 | SBBreakpoint::GetThreadIndex() const |
| 354 | { |
Greg Clayton | a625387 | 2010-12-15 20:50:06 +0000 | [diff] [blame] | 355 | uint32_t thread_idx = UINT32_MAX; |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 356 | if (m_opaque_sp) |
Jim Ingham | 8e5e38f | 2010-06-18 01:47:08 +0000 | [diff] [blame] | 357 | { |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 358 | Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); |
| 359 | const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpecNoCreate(); |
Johnny Chen | b3e7181 | 2010-12-15 21:39:37 +0000 | [diff] [blame] | 360 | if (thread_spec != NULL) |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 361 | thread_idx = thread_spec->GetIndex(); |
Jim Ingham | 8e5e38f | 2010-06-18 01:47:08 +0000 | [diff] [blame] | 362 | } |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 363 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 364 | if (log) |
Greg Clayton | a625387 | 2010-12-15 20:50:06 +0000 | [diff] [blame] | 365 | log->Printf ("SBBreakpoint(%p)::GetThreadIndex () => %u", m_opaque_sp.get(), thread_idx); |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 366 | |
Johnny Chen | b3e7181 | 2010-12-15 21:39:37 +0000 | [diff] [blame] | 367 | return thread_idx; |
Jim Ingham | 8e5e38f | 2010-06-18 01:47:08 +0000 | [diff] [blame] | 368 | } |
| 369 | |
| 370 | |
| 371 | void |
| 372 | SBBreakpoint::SetThreadName (const char *thread_name) |
| 373 | { |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 374 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 375 | if (log) |
| 376 | log->Printf ("SBBreakpoint(%p)::SetThreadName (%s)", m_opaque_sp.get(), thread_name); |
| 377 | |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 378 | if (m_opaque_sp) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 379 | { |
| 380 | Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 381 | m_opaque_sp->GetOptions()->GetThreadSpec()->SetName (thread_name); |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 382 | } |
Jim Ingham | 8e5e38f | 2010-06-18 01:47:08 +0000 | [diff] [blame] | 383 | } |
| 384 | |
| 385 | const char * |
| 386 | SBBreakpoint::GetThreadName () const |
| 387 | { |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 388 | const char *name = NULL; |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 389 | if (m_opaque_sp) |
Jim Ingham | 8e5e38f | 2010-06-18 01:47:08 +0000 | [diff] [blame] | 390 | { |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 391 | Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); |
| 392 | const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpecNoCreate(); |
Johnny Chen | b3e7181 | 2010-12-15 21:39:37 +0000 | [diff] [blame] | 393 | if (thread_spec != NULL) |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 394 | name = thread_spec->GetName(); |
Jim Ingham | 8e5e38f | 2010-06-18 01:47:08 +0000 | [diff] [blame] | 395 | } |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 396 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 397 | if (log) |
| 398 | log->Printf ("SBBreakpoint(%p)::GetThreadName () => %s", m_opaque_sp.get(), name); |
| 399 | |
| 400 | return name; |
Jim Ingham | 8e5e38f | 2010-06-18 01:47:08 +0000 | [diff] [blame] | 401 | } |
| 402 | |
| 403 | void |
| 404 | SBBreakpoint::SetQueueName (const char *queue_name) |
| 405 | { |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 406 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 407 | if (log) |
| 408 | log->Printf ("SBBreakpoint(%p)::SetQueueName (%s)", m_opaque_sp.get(), queue_name); |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 409 | if (m_opaque_sp) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 410 | { |
| 411 | Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 412 | m_opaque_sp->GetOptions()->GetThreadSpec()->SetQueueName (queue_name); |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 413 | } |
Jim Ingham | 8e5e38f | 2010-06-18 01:47:08 +0000 | [diff] [blame] | 414 | } |
| 415 | |
| 416 | const char * |
| 417 | SBBreakpoint::GetQueueName () const |
| 418 | { |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 419 | const char *name = NULL; |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 420 | if (m_opaque_sp) |
Jim Ingham | 8e5e38f | 2010-06-18 01:47:08 +0000 | [diff] [blame] | 421 | { |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 422 | Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); |
| 423 | const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpecNoCreate(); |
| 424 | if (thread_spec) |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 425 | name = thread_spec->GetQueueName(); |
Jim Ingham | 8e5e38f | 2010-06-18 01:47:08 +0000 | [diff] [blame] | 426 | } |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 427 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 428 | if (log) |
| 429 | log->Printf ("SBBreakpoint(%p)::GetQueueName () => %s", m_opaque_sp.get(), name); |
| 430 | |
| 431 | return name; |
Jim Ingham | 8e5e38f | 2010-06-18 01:47:08 +0000 | [diff] [blame] | 432 | } |
| 433 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 434 | size_t |
| 435 | SBBreakpoint::GetNumResolvedLocations() const |
| 436 | { |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 437 | size_t num_resolved = 0; |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 438 | if (m_opaque_sp) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 439 | { |
| 440 | Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 441 | num_resolved = m_opaque_sp->GetNumResolvedLocations(); |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 442 | } |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 443 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 444 | if (log) |
| 445 | log->Printf ("SBBreakpoint(%p)::GetNumResolvedLocations () => %zu", m_opaque_sp.get(), num_resolved); |
| 446 | return num_resolved; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 447 | } |
| 448 | |
| 449 | size_t |
| 450 | SBBreakpoint::GetNumLocations() const |
| 451 | { |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 452 | size_t num_locs = 0; |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 453 | if (m_opaque_sp) |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 454 | { |
| 455 | Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 456 | num_locs = m_opaque_sp->GetNumLocations(); |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 457 | } |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 458 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 459 | if (log) |
| 460 | log->Printf ("SBBreakpoint(%p)::GetNumLocations () => %zu", m_opaque_sp.get(), num_locs); |
| 461 | return num_locs; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 462 | } |
| 463 | |
Caroline Tice | 98f930f | 2010-09-20 05:20:02 +0000 | [diff] [blame] | 464 | bool |
Greg Clayton | d8c6253 | 2010-10-07 04:19:01 +0000 | [diff] [blame] | 465 | SBBreakpoint::GetDescription (SBStream &s) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 466 | { |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 467 | if (m_opaque_sp) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 468 | { |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 469 | Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); |
Greg Clayton | d8c6253 | 2010-10-07 04:19:01 +0000 | [diff] [blame] | 470 | s.Printf("SBBreakpoint: id = %i, ", m_opaque_sp->GetID()); |
| 471 | m_opaque_sp->GetResolverDescription (s.get()); |
| 472 | m_opaque_sp->GetFilterDescription (s.get()); |
| 473 | const size_t num_locations = m_opaque_sp->GetNumLocations (); |
| 474 | s.Printf(", locations = %zu", num_locations); |
| 475 | return true; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 476 | } |
Greg Clayton | d8c6253 | 2010-10-07 04:19:01 +0000 | [diff] [blame] | 477 | s.Printf ("No value"); |
| 478 | return false; |
Caroline Tice | 98f930f | 2010-09-20 05:20:02 +0000 | [diff] [blame] | 479 | } |
| 480 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 481 | bool |
| 482 | SBBreakpoint::PrivateBreakpointHitCallback |
| 483 | ( |
| 484 | void *baton, |
| 485 | StoppointCallbackContext *ctx, |
| 486 | lldb::user_id_t break_id, |
| 487 | lldb::user_id_t break_loc_id |
| 488 | ) |
| 489 | { |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 490 | BreakpointSP bp_sp(ctx->exe_ctx.target->GetBreakpointList().FindBreakpointByID(break_id)); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 491 | if (baton && bp_sp) |
| 492 | { |
| 493 | CallbackData *data = (CallbackData *)baton; |
| 494 | lldb_private::Breakpoint *bp = bp_sp.get(); |
| 495 | if (bp && data->callback) |
| 496 | { |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 497 | if (ctx->exe_ctx.process) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 498 | { |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 499 | SBProcess sb_process (ctx->exe_ctx.process->GetSP()); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 500 | SBThread sb_thread; |
| 501 | SBBreakpointLocation sb_location; |
| 502 | assert (bp_sp); |
| 503 | sb_location.SetLocation (bp_sp->FindLocationByID (break_loc_id)); |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 504 | if (ctx->exe_ctx.thread) |
| 505 | sb_thread.SetThread(ctx->exe_ctx.thread->GetSP()); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 506 | |
| 507 | return data->callback (data->callback_baton, |
| 508 | sb_process, |
| 509 | sb_thread, |
| 510 | sb_location); |
| 511 | } |
| 512 | } |
| 513 | } |
| 514 | return true; // Return true if we should stop at this breakpoint |
| 515 | } |
| 516 | |
| 517 | void |
| 518 | SBBreakpoint::SetCallback (BreakpointHitCallback callback, void *baton) |
| 519 | { |
Greg Clayton | e005f2c | 2010-11-06 01:53:30 +0000 | [diff] [blame] | 520 | LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 521 | |
| 522 | if (log) |
Greg Clayton | a66ba46 | 2010-10-30 04:51:46 +0000 | [diff] [blame] | 523 | log->Printf ("SBBreakpoint(%p)::SetCallback (callback=%p, baton=%p)", m_opaque_sp.get(), callback, baton); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 524 | |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 525 | if (m_opaque_sp.get()) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 526 | { |
Greg Clayton | bdcda46 | 2010-12-20 20:49:23 +0000 | [diff] [blame^] | 527 | Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 528 | BatonSP baton_sp(new SBBreakpointCallbackBaton (callback, baton)); |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 529 | m_opaque_sp->SetCallback (SBBreakpoint::PrivateBreakpointHitCallback, baton_sp, false); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 530 | } |
| 531 | } |
| 532 | |
| 533 | |
| 534 | lldb_private::Breakpoint * |
| 535 | SBBreakpoint::operator->() const |
| 536 | { |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 537 | return m_opaque_sp.get(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 538 | } |
| 539 | |
| 540 | lldb_private::Breakpoint * |
| 541 | SBBreakpoint::get() const |
| 542 | { |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 543 | return m_opaque_sp.get(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 544 | } |
| 545 | |
| 546 | lldb::BreakpointSP & |
| 547 | SBBreakpoint::operator *() |
| 548 | { |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 549 | return m_opaque_sp; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 550 | } |
| 551 | |
| 552 | const lldb::BreakpointSP & |
| 553 | SBBreakpoint::operator *() const |
| 554 | { |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 555 | return m_opaque_sp; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 556 | } |
| 557 | |
Greg Clayton | c7f5d5c | 2010-07-23 23:33:17 +0000 | [diff] [blame] | 558 | BreakpointEventType |
| 559 | SBBreakpoint::GetBreakpointEventTypeFromEvent (const SBEvent& event) |
| 560 | { |
| 561 | if (event.IsValid()) |
| 562 | return Breakpoint::BreakpointEventData::GetBreakpointEventTypeFromEvent (event.GetSP()); |
| 563 | return eBreakpointEventTypeInvalidType; |
| 564 | } |
| 565 | |
| 566 | SBBreakpoint |
| 567 | SBBreakpoint::GetBreakpointFromEvent (const lldb::SBEvent& event) |
| 568 | { |
| 569 | SBBreakpoint sb_breakpoint; |
| 570 | if (event.IsValid()) |
| 571 | sb_breakpoint.m_opaque_sp = Breakpoint::BreakpointEventData::GetBreakpointFromEvent (event.GetSP()); |
| 572 | return sb_breakpoint; |
| 573 | } |
| 574 | |
| 575 | SBBreakpointLocation |
| 576 | SBBreakpoint::GetBreakpointLocationAtIndexFromEvent (const lldb::SBEvent& event, uint32_t loc_idx) |
| 577 | { |
| 578 | SBBreakpointLocation sb_breakpoint_loc; |
| 579 | if (event.IsValid()) |
| 580 | sb_breakpoint_loc.SetLocation (Breakpoint::BreakpointEventData::GetBreakpointLocationAtIndexFromEvent (event.GetSP(), loc_idx)); |
| 581 | return sb_breakpoint_loc; |
| 582 | } |
| 583 | |
| 584 | |