blob: 4ed06b20213465c981a782ec0ec65c6a8aadb765 [file] [log] [blame]
Chris Lattner24943d22010-06-08 16:52:24 +00001//===-- 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 Claytonc7f5d5c2010-07-23 23:33:17 +000013#include "lldb/API/SBEvent.h"
Chris Lattner24943d22010-06-08 16:52:24 +000014#include "lldb/API/SBProcess.h"
Caroline Tice98f930f2010-09-20 05:20:02 +000015#include "lldb/API/SBStream.h"
Chris Lattner24943d22010-06-08 16:52:24 +000016#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 Tice7826c882010-10-26 03:11:13 +000022#include "lldb/Core/Log.h"
Chris Lattner24943d22010-06-08 16:52:24 +000023#include "lldb/Core/Stream.h"
24#include "lldb/Core/StreamFile.h"
25#include "lldb/Target/Process.h"
Chris Lattner24943d22010-06-08 16:52:24 +000026#include "lldb/Target/Target.h"
Jim Ingham8e5e38f2010-06-18 01:47:08 +000027#include "lldb/Target/Thread.h"
28#include "lldb/Target/ThreadSpec.h"
Chris Lattner24943d22010-06-08 16:52:24 +000029
30
31#include "lldb/lldb-enumerations.h"
32
33using namespace lldb;
34using namespace lldb_private;
35
36struct CallbackData
37{
38 SBBreakpoint::BreakpointHitCallback callback;
39 void *callback_baton;
40};
41
42class SBBreakpointCallbackBaton : public Baton
43{
44public:
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
67SBBreakpoint::SBBreakpoint () :
Greg Clayton63094e02010-06-23 01:19:29 +000068 m_opaque_sp ()
Chris Lattner24943d22010-06-08 16:52:24 +000069{
70}
71
72SBBreakpoint::SBBreakpoint (const SBBreakpoint& rhs) :
Greg Clayton63094e02010-06-23 01:19:29 +000073 m_opaque_sp (rhs.m_opaque_sp)
Chris Lattner24943d22010-06-08 16:52:24 +000074{
Caroline Tice61ba7ec2010-10-26 23:49:36 +000075 Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
Caroline Tice7826c882010-10-26 03:11:13 +000076
77 if (log)
78 {
79 SBStream sstr;
80 GetDescription (sstr);
Caroline Tice61ba7ec2010-10-26 23:49:36 +000081 log->Printf ("SBBreakpoint::SBBreakpoint (const SBBreakpoint rhs.sp=%p) "
82 "=> this.sp = %p (%s)",
83 rhs.m_opaque_sp.get(), m_opaque_sp.get(), sstr.GetData());
Caroline Tice7826c882010-10-26 03:11:13 +000084 }
Chris Lattner24943d22010-06-08 16:52:24 +000085}
86
87
88SBBreakpoint::SBBreakpoint (const lldb::BreakpointSP &bp_sp) :
Greg Clayton63094e02010-06-23 01:19:29 +000089 m_opaque_sp (bp_sp)
Chris Lattner24943d22010-06-08 16:52:24 +000090{
Caroline Tice61ba7ec2010-10-26 23:49:36 +000091 Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
Caroline Tice7826c882010-10-26 03:11:13 +000092
93 if (log)
94 {
95 SBStream sstr;
96 GetDescription (sstr);
Caroline Tice61ba7ec2010-10-26 23:49:36 +000097 log->Printf("SBBreakpoint::SBBreakpoint (const lldb::BreakpointSP &bp_sp=%p) => this.sp = %p (%s)",
98 bp_sp.get(), m_opaque_sp.get(), sstr.GetData());
Caroline Tice7826c882010-10-26 03:11:13 +000099 }
Chris Lattner24943d22010-06-08 16:52:24 +0000100}
101
102SBBreakpoint::~SBBreakpoint()
103{
104}
105
106const SBBreakpoint &
107SBBreakpoint::operator = (const SBBreakpoint& rhs)
108{
Caroline Tice7826c882010-10-26 03:11:13 +0000109 Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
110
Caroline Tice61ba7ec2010-10-26 23:49:36 +0000111 //if (log)
112 // log->Printf ("SBBreakpoint::operator=");
Caroline Tice7826c882010-10-26 03:11:13 +0000113
Chris Lattner24943d22010-06-08 16:52:24 +0000114 if (this != &rhs)
115 {
Greg Clayton63094e02010-06-23 01:19:29 +0000116 m_opaque_sp = rhs.m_opaque_sp;
Chris Lattner24943d22010-06-08 16:52:24 +0000117 }
Caroline Tice7826c882010-10-26 03:11:13 +0000118
119 if (log)
Caroline Tice61ba7ec2010-10-26 23:49:36 +0000120 log->Printf ("SBBreakpoint::operator= (const SBBreakpoint &rhs.sp=%p) => this.sp = %p",
121 rhs.m_opaque_sp.get(), m_opaque_sp.get());
Caroline Tice7826c882010-10-26 03:11:13 +0000122
Chris Lattner24943d22010-06-08 16:52:24 +0000123 return *this;
124}
125
126break_id_t
127SBBreakpoint::GetID () const
128{
Caroline Tice7826c882010-10-26 03:11:13 +0000129 Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
130
Caroline Tice61ba7ec2010-10-26 23:49:36 +0000131 //if (log)
132 // log->Printf ("SBBreakpoint::GetID");
Caroline Tice7826c882010-10-26 03:11:13 +0000133
Greg Clayton63094e02010-06-23 01:19:29 +0000134 if (m_opaque_sp)
Caroline Tice7826c882010-10-26 03:11:13 +0000135 {
136 break_id_t id = m_opaque_sp->GetID();
137 if (log)
Caroline Tice61ba7ec2010-10-26 23:49:36 +0000138 log->Printf ("SBBreakpoint::GetID (this.sp=%p) => %d", m_opaque_sp.get(), id);
Caroline Tice7826c882010-10-26 03:11:13 +0000139 return id;
140 }
141
142 if (log)
Caroline Tice61ba7ec2010-10-26 23:49:36 +0000143 log->Printf ("SBBreakpoint::GetID (this.sp=%p) => LLDB_INVALID_BREAK_ID", m_opaque_sp.get());
Caroline Tice7826c882010-10-26 03:11:13 +0000144
Chris Lattner24943d22010-06-08 16:52:24 +0000145 return LLDB_INVALID_BREAK_ID;
146}
147
148
149bool
150SBBreakpoint::IsValid() const
151{
Greg Clayton63094e02010-06-23 01:19:29 +0000152 return m_opaque_sp;
Chris Lattner24943d22010-06-08 16:52:24 +0000153}
154
155void
Chris Lattner24943d22010-06-08 16:52:24 +0000156SBBreakpoint::ClearAllBreakpointSites ()
157{
Greg Clayton63094e02010-06-23 01:19:29 +0000158 if (m_opaque_sp)
159 m_opaque_sp->ClearAllBreakpointSites ();
Chris Lattner24943d22010-06-08 16:52:24 +0000160}
161
162SBBreakpointLocation
163SBBreakpoint::FindLocationByAddress (addr_t vm_addr)
164{
165 SBBreakpointLocation sb_bp_location;
166
Greg Clayton63094e02010-06-23 01:19:29 +0000167 if (m_opaque_sp)
Chris Lattner24943d22010-06-08 16:52:24 +0000168 {
169 if (vm_addr != LLDB_INVALID_ADDRESS)
170 {
171 Address address;
Greg Claytoneea26402010-09-14 23:36:40 +0000172 Target &target = m_opaque_sp->GetTarget();
173 if (target.GetSectionLoadList().ResolveLoadAddress (vm_addr, address) == false)
Chris Lattner24943d22010-06-08 16:52:24 +0000174 {
175 address.SetSection (NULL);
176 address.SetOffset (vm_addr);
177 }
Greg Clayton63094e02010-06-23 01:19:29 +0000178 sb_bp_location.SetLocation (m_opaque_sp->FindLocationByAddress (address));
Chris Lattner24943d22010-06-08 16:52:24 +0000179 }
180 }
181 return sb_bp_location;
182}
183
184break_id_t
185SBBreakpoint::FindLocationIDByAddress (addr_t vm_addr)
186{
187 break_id_t lldb_id = (break_id_t) 0;
188
Greg Clayton63094e02010-06-23 01:19:29 +0000189 if (m_opaque_sp)
Chris Lattner24943d22010-06-08 16:52:24 +0000190 {
191 if (vm_addr != LLDB_INVALID_ADDRESS)
192 {
193 Address address;
Greg Claytoneea26402010-09-14 23:36:40 +0000194 Target &target = m_opaque_sp->GetTarget();
195 if (target.GetSectionLoadList().ResolveLoadAddress (vm_addr, address) == false)
Chris Lattner24943d22010-06-08 16:52:24 +0000196 {
197 address.SetSection (NULL);
198 address.SetOffset (vm_addr);
199 }
Greg Clayton63094e02010-06-23 01:19:29 +0000200 lldb_id = m_opaque_sp->FindLocationIDByAddress (address);
Chris Lattner24943d22010-06-08 16:52:24 +0000201 }
202 }
203
204 return lldb_id;
205}
206
207SBBreakpointLocation
208SBBreakpoint::FindLocationByID (break_id_t bp_loc_id)
209{
210 SBBreakpointLocation sb_bp_location;
211
Greg Clayton63094e02010-06-23 01:19:29 +0000212 if (m_opaque_sp)
213 sb_bp_location.SetLocation (m_opaque_sp->FindLocationByID (bp_loc_id));
Chris Lattner24943d22010-06-08 16:52:24 +0000214
215 return sb_bp_location;
216}
217
218SBBreakpointLocation
219SBBreakpoint::GetLocationAtIndex (uint32_t index)
220{
221 SBBreakpointLocation sb_bp_location;
222
Greg Clayton63094e02010-06-23 01:19:29 +0000223 if (m_opaque_sp)
224 sb_bp_location.SetLocation (m_opaque_sp->GetLocationAtIndex (index));
Chris Lattner24943d22010-06-08 16:52:24 +0000225
226 return sb_bp_location;
227}
228
229void
Chris Lattner24943d22010-06-08 16:52:24 +0000230SBBreakpoint::SetEnabled (bool enable)
231{
Caroline Tice7826c882010-10-26 03:11:13 +0000232 Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
233
234 if (log)
Caroline Tice61ba7ec2010-10-26 23:49:36 +0000235 log->Printf ("SBBreakpoint::SetEnabled (this.sp=%p, enable='%s')", m_opaque_sp.get(),
236 (enable ? "true" : "false"));
Caroline Tice7826c882010-10-26 03:11:13 +0000237
Greg Clayton63094e02010-06-23 01:19:29 +0000238 if (m_opaque_sp)
239 m_opaque_sp->SetEnabled (enable);
Chris Lattner24943d22010-06-08 16:52:24 +0000240}
241
242bool
243SBBreakpoint::IsEnabled ()
244{
Greg Clayton63094e02010-06-23 01:19:29 +0000245 if (m_opaque_sp)
246 return m_opaque_sp->IsEnabled();
Chris Lattner24943d22010-06-08 16:52:24 +0000247 else
248 return false;
249}
250
251void
Greg Clayton54e7afa2010-07-09 20:39:50 +0000252SBBreakpoint::SetIgnoreCount (uint32_t count)
Chris Lattner24943d22010-06-08 16:52:24 +0000253{
Caroline Tice7826c882010-10-26 03:11:13 +0000254 Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
255
256 if (log)
Caroline Tice61ba7ec2010-10-26 23:49:36 +0000257 log->Printf ("SBBreakpoint::SetIgnoreCount (this.sp=%p, count='%d')", m_opaque_sp.get(), count);
Caroline Tice7826c882010-10-26 03:11:13 +0000258
Greg Clayton63094e02010-06-23 01:19:29 +0000259 if (m_opaque_sp)
260 m_opaque_sp->SetIgnoreCount (count);
Chris Lattner24943d22010-06-08 16:52:24 +0000261}
262
Jim Inghame3740832010-10-22 01:15:49 +0000263void
264SBBreakpoint::SetCondition (const char *condition)
265{
266 m_opaque_sp->SetCondition (condition);
267}
268
269const char *
270SBBreakpoint::GetCondition ()
271{
272 return m_opaque_sp->GetConditionText ();
273}
274
Greg Clayton54e7afa2010-07-09 20:39:50 +0000275uint32_t
Greg Claytonc7f5d5c2010-07-23 23:33:17 +0000276SBBreakpoint::GetHitCount () const
277{
Caroline Tice7826c882010-10-26 03:11:13 +0000278 Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
279
Caroline Tice61ba7ec2010-10-26 23:49:36 +0000280 //if (log)
281 // log->Printf ("SBBreakpoint::GetHitCount");
Caroline Tice7826c882010-10-26 03:11:13 +0000282
Greg Claytonc7f5d5c2010-07-23 23:33:17 +0000283 if (m_opaque_sp)
Caroline Tice7826c882010-10-26 03:11:13 +0000284 {
285 uint32_t hit_count = m_opaque_sp->GetHitCount();
286 if (log)
Caroline Tice61ba7ec2010-10-26 23:49:36 +0000287 log->Printf ("SBBreakpoint::GetHitCount (this.sp=%p) => '%d'", m_opaque_sp.get(), hit_count);
Greg Claytonc7f5d5c2010-07-23 23:33:17 +0000288 return m_opaque_sp->GetHitCount();
Caroline Tice7826c882010-10-26 03:11:13 +0000289 }
Greg Claytonc7f5d5c2010-07-23 23:33:17 +0000290 else
Caroline Tice7826c882010-10-26 03:11:13 +0000291 {
292 if (log)
Caroline Tice61ba7ec2010-10-26 23:49:36 +0000293 log->Printf ("SBBreakpoint::GetHitCount (this.sp=%p) => '0'", m_opaque_sp.get());
Greg Claytonc7f5d5c2010-07-23 23:33:17 +0000294 return 0;
Caroline Tice7826c882010-10-26 03:11:13 +0000295 }
Greg Claytonc7f5d5c2010-07-23 23:33:17 +0000296}
297
298uint32_t
Chris Lattner24943d22010-06-08 16:52:24 +0000299SBBreakpoint::GetIgnoreCount () const
300{
Greg Clayton63094e02010-06-23 01:19:29 +0000301 if (m_opaque_sp)
302 return m_opaque_sp->GetIgnoreCount();
Chris Lattner24943d22010-06-08 16:52:24 +0000303 else
304 return 0;
305}
306
307void
308SBBreakpoint::SetThreadID (tid_t sb_thread_id)
309{
Greg Clayton63094e02010-06-23 01:19:29 +0000310 if (m_opaque_sp)
311 m_opaque_sp->SetThreadID (sb_thread_id);
Chris Lattner24943d22010-06-08 16:52:24 +0000312}
313
314tid_t
315SBBreakpoint::GetThreadID ()
316{
317 tid_t lldb_thread_id = LLDB_INVALID_THREAD_ID;
Greg Clayton63094e02010-06-23 01:19:29 +0000318 if (m_opaque_sp)
319 lldb_thread_id = m_opaque_sp->GetThreadID();
Chris Lattner24943d22010-06-08 16:52:24 +0000320
321 return lldb_thread_id;
322}
323
Jim Ingham8e5e38f2010-06-18 01:47:08 +0000324void
325SBBreakpoint::SetThreadIndex (uint32_t index)
326{
Greg Clayton63094e02010-06-23 01:19:29 +0000327 if (m_opaque_sp)
328 m_opaque_sp->GetOptions()->GetThreadSpec()->SetIndex (index);
Jim Ingham8e5e38f2010-06-18 01:47:08 +0000329}
330
331uint32_t
332SBBreakpoint::GetThreadIndex() const
333{
Greg Clayton63094e02010-06-23 01:19:29 +0000334 if (m_opaque_sp)
Jim Ingham8e5e38f2010-06-18 01:47:08 +0000335 {
Greg Clayton63094e02010-06-23 01:19:29 +0000336 const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpec();
Jim Ingham8e5e38f2010-06-18 01:47:08 +0000337 if (thread_spec == NULL)
338 return 0;
339 else
340 return thread_spec->GetIndex();
341 }
342 return 0;
343}
344
345
346void
347SBBreakpoint::SetThreadName (const char *thread_name)
348{
Greg Clayton63094e02010-06-23 01:19:29 +0000349 if (m_opaque_sp)
350 m_opaque_sp->GetOptions()->GetThreadSpec()->SetName (thread_name);
Jim Ingham8e5e38f2010-06-18 01:47:08 +0000351}
352
353const char *
354SBBreakpoint::GetThreadName () const
355{
Greg Clayton63094e02010-06-23 01:19:29 +0000356 if (m_opaque_sp)
Jim Ingham8e5e38f2010-06-18 01:47:08 +0000357 {
Greg Clayton63094e02010-06-23 01:19:29 +0000358 const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpec();
Jim Ingham8e5e38f2010-06-18 01:47:08 +0000359 if (thread_spec == NULL)
360 return NULL;
361 else
362 return thread_spec->GetName();
363 }
364 return NULL;
365}
366
367void
368SBBreakpoint::SetQueueName (const char *queue_name)
369{
Greg Clayton63094e02010-06-23 01:19:29 +0000370 if (m_opaque_sp)
371 m_opaque_sp->GetOptions()->GetThreadSpec()->SetQueueName (queue_name);
Jim Ingham8e5e38f2010-06-18 01:47:08 +0000372}
373
374const char *
375SBBreakpoint::GetQueueName () const
376{
Greg Clayton63094e02010-06-23 01:19:29 +0000377 if (m_opaque_sp)
Jim Ingham8e5e38f2010-06-18 01:47:08 +0000378 {
Greg Clayton63094e02010-06-23 01:19:29 +0000379 const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpec();
Jim Ingham8e5e38f2010-06-18 01:47:08 +0000380 if (thread_spec == NULL)
381 return NULL;
382 else
383 return thread_spec->GetQueueName();
384 }
385 return NULL;
386}
387
Chris Lattner24943d22010-06-08 16:52:24 +0000388size_t
389SBBreakpoint::GetNumResolvedLocations() const
390{
Greg Clayton63094e02010-06-23 01:19:29 +0000391 if (m_opaque_sp)
392 return m_opaque_sp->GetNumResolvedLocations();
Chris Lattner24943d22010-06-08 16:52:24 +0000393 else
394 return 0;
395}
396
397size_t
398SBBreakpoint::GetNumLocations() const
399{
Greg Clayton63094e02010-06-23 01:19:29 +0000400 if (m_opaque_sp)
401 return m_opaque_sp->GetNumLocations();
Chris Lattner24943d22010-06-08 16:52:24 +0000402 else
403 return 0;
404}
405
Caroline Tice98f930f2010-09-20 05:20:02 +0000406bool
Greg Claytond8c62532010-10-07 04:19:01 +0000407SBBreakpoint::GetDescription (SBStream &s)
Chris Lattner24943d22010-06-08 16:52:24 +0000408{
Greg Clayton63094e02010-06-23 01:19:29 +0000409 if (m_opaque_sp)
Chris Lattner24943d22010-06-08 16:52:24 +0000410 {
Greg Claytond8c62532010-10-07 04:19:01 +0000411 s.Printf("SBBreakpoint: id = %i, ", m_opaque_sp->GetID());
412 m_opaque_sp->GetResolverDescription (s.get());
413 m_opaque_sp->GetFilterDescription (s.get());
414 const size_t num_locations = m_opaque_sp->GetNumLocations ();
415 s.Printf(", locations = %zu", num_locations);
416 return true;
Chris Lattner24943d22010-06-08 16:52:24 +0000417 }
Greg Claytond8c62532010-10-07 04:19:01 +0000418 s.Printf ("No value");
419 return false;
Caroline Tice98f930f2010-09-20 05:20:02 +0000420}
421
Chris Lattner24943d22010-06-08 16:52:24 +0000422bool
423SBBreakpoint::PrivateBreakpointHitCallback
424(
425 void *baton,
426 StoppointCallbackContext *ctx,
427 lldb::user_id_t break_id,
428 lldb::user_id_t break_loc_id
429)
430{
Greg Clayton63094e02010-06-23 01:19:29 +0000431 BreakpointSP bp_sp(ctx->exe_ctx.target->GetBreakpointList().FindBreakpointByID(break_id));
Chris Lattner24943d22010-06-08 16:52:24 +0000432 if (baton && bp_sp)
433 {
434 CallbackData *data = (CallbackData *)baton;
435 lldb_private::Breakpoint *bp = bp_sp.get();
436 if (bp && data->callback)
437 {
Greg Clayton63094e02010-06-23 01:19:29 +0000438 if (ctx->exe_ctx.process)
Chris Lattner24943d22010-06-08 16:52:24 +0000439 {
Greg Clayton63094e02010-06-23 01:19:29 +0000440 SBProcess sb_process (ctx->exe_ctx.process->GetSP());
Chris Lattner24943d22010-06-08 16:52:24 +0000441 SBThread sb_thread;
442 SBBreakpointLocation sb_location;
443 assert (bp_sp);
444 sb_location.SetLocation (bp_sp->FindLocationByID (break_loc_id));
Greg Clayton63094e02010-06-23 01:19:29 +0000445 if (ctx->exe_ctx.thread)
446 sb_thread.SetThread(ctx->exe_ctx.thread->GetSP());
Chris Lattner24943d22010-06-08 16:52:24 +0000447
448 return data->callback (data->callback_baton,
449 sb_process,
450 sb_thread,
451 sb_location);
452 }
453 }
454 }
455 return true; // Return true if we should stop at this breakpoint
456}
457
458void
459SBBreakpoint::SetCallback (BreakpointHitCallback callback, void *baton)
460{
Caroline Tice7826c882010-10-26 03:11:13 +0000461 Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
462
463 if (log)
Caroline Tice61ba7ec2010-10-26 23:49:36 +0000464 log->Printf ("SBBreakpoint::SetCallback (this.sp=%p, :", m_opaque_sp.get());
Caroline Tice7826c882010-10-26 03:11:13 +0000465
Greg Clayton63094e02010-06-23 01:19:29 +0000466 if (m_opaque_sp.get())
Chris Lattner24943d22010-06-08 16:52:24 +0000467 {
468 BatonSP baton_sp(new SBBreakpointCallbackBaton (callback, baton));
Caroline Tice7826c882010-10-26 03:11:13 +0000469 if (log)
470 {
471 // CAROLINE: FIXME!!
472 //StreamString sstr;
473 //baton_sp->GetDescription (sstr, lldb::eDescriptionLevelFull);
474 //log->Printf ("%s", sstr.GetData());
475 }
Greg Clayton63094e02010-06-23 01:19:29 +0000476 m_opaque_sp->SetCallback (SBBreakpoint::PrivateBreakpointHitCallback, baton_sp, false);
Chris Lattner24943d22010-06-08 16:52:24 +0000477 }
478}
479
480
481lldb_private::Breakpoint *
482SBBreakpoint::operator->() const
483{
Greg Clayton63094e02010-06-23 01:19:29 +0000484 return m_opaque_sp.get();
Chris Lattner24943d22010-06-08 16:52:24 +0000485}
486
487lldb_private::Breakpoint *
488SBBreakpoint::get() const
489{
Greg Clayton63094e02010-06-23 01:19:29 +0000490 return m_opaque_sp.get();
Chris Lattner24943d22010-06-08 16:52:24 +0000491}
492
493lldb::BreakpointSP &
494SBBreakpoint::operator *()
495{
Greg Clayton63094e02010-06-23 01:19:29 +0000496 return m_opaque_sp;
Chris Lattner24943d22010-06-08 16:52:24 +0000497}
498
499const lldb::BreakpointSP &
500SBBreakpoint::operator *() const
501{
Greg Clayton63094e02010-06-23 01:19:29 +0000502 return m_opaque_sp;
Chris Lattner24943d22010-06-08 16:52:24 +0000503}
504
Greg Claytonc7f5d5c2010-07-23 23:33:17 +0000505BreakpointEventType
506SBBreakpoint::GetBreakpointEventTypeFromEvent (const SBEvent& event)
507{
508 if (event.IsValid())
509 return Breakpoint::BreakpointEventData::GetBreakpointEventTypeFromEvent (event.GetSP());
510 return eBreakpointEventTypeInvalidType;
511}
512
513SBBreakpoint
514SBBreakpoint::GetBreakpointFromEvent (const lldb::SBEvent& event)
515{
516 SBBreakpoint sb_breakpoint;
517 if (event.IsValid())
518 sb_breakpoint.m_opaque_sp = Breakpoint::BreakpointEventData::GetBreakpointFromEvent (event.GetSP());
519 return sb_breakpoint;
520}
521
522SBBreakpointLocation
523SBBreakpoint::GetBreakpointLocationAtIndexFromEvent (const lldb::SBEvent& event, uint32_t loc_idx)
524{
525 SBBreakpointLocation sb_breakpoint_loc;
526 if (event.IsValid())
527 sb_breakpoint_loc.SetLocation (Breakpoint::BreakpointEventData::GetBreakpointLocationAtIndexFromEvent (event.GetSP(), loc_idx));
528 return sb_breakpoint_loc;
529}
530
531