]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/API/SBBreakpointName.cpp
Update OpenSSL to 1.1.1.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / API / SBBreakpointName.cpp
1 //===-- SBBreakpointName.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 // C Includes
11 // C++ Includes
12 // Other libraries and framework includes
13 // Project includes
14 #include "lldb/API/SBBreakpointName.h"
15 #include "lldb/API/SBDebugger.h"
16 #include "lldb/API/SBError.h"
17 #include "lldb/API/SBStream.h"
18 #include "lldb/API/SBStringList.h"
19 #include "lldb/API/SBTarget.h"
20
21 #include "lldb/Breakpoint/BreakpointName.h"
22 #include "lldb/Breakpoint/StoppointCallbackContext.h"
23 #include "lldb/Core/Debugger.h"
24 #include "lldb/Interpreter/CommandInterpreter.h"
25 #include "lldb/Interpreter/ScriptInterpreter.h"
26 #include "lldb/Target/Target.h"
27 #include "lldb/Target/ThreadSpec.h"
28 #include "lldb/Utility/Log.h"
29 #include "lldb/Utility/Stream.h"
30
31 #include "SBBreakpointOptionCommon.h"
32
33 using namespace lldb;
34 using namespace lldb_private;
35
36 namespace lldb
37 {
38 class SBBreakpointNameImpl {
39 public:
40   SBBreakpointNameImpl(TargetSP target_sp, const char *name) {
41     if (!name || name[0] == '\0')
42       return;
43     m_name.assign(name);
44     
45     if (!target_sp)
46       return;
47     
48     m_target_wp = target_sp;
49   }
50
51   SBBreakpointNameImpl(SBTarget &sb_target, const char *name);
52   bool operator==(const SBBreakpointNameImpl &rhs);
53   bool operator!=(const SBBreakpointNameImpl &rhs);
54
55   // For now we take a simple approach and only keep the name, and relook
56   // up the location when we need it.
57   
58   TargetSP GetTarget() const {
59     return m_target_wp.lock();
60   }
61   
62   const char *GetName() const {
63     return m_name.c_str();
64   }
65   
66   bool IsValid() const {
67     return !m_name.empty() && m_target_wp.lock();
68   }
69
70   lldb_private::BreakpointName *GetBreakpointName() const;
71
72 private:
73   TargetWP m_target_wp;
74   std::string m_name;
75 };
76
77 SBBreakpointNameImpl::SBBreakpointNameImpl(SBTarget &sb_target,
78                                            const char *name) {
79   if (!name || name[0] == '\0')
80     return;
81   m_name.assign(name);
82
83   if (!sb_target.IsValid())
84     return;
85
86   TargetSP target_sp = sb_target.GetSP();
87   if (!target_sp)
88     return;
89
90   m_target_wp = target_sp;
91 }
92
93 bool SBBreakpointNameImpl::operator==(const SBBreakpointNameImpl &rhs) {
94   return m_name == rhs.m_name && m_target_wp.lock() == rhs.m_target_wp.lock();
95 }
96
97 bool SBBreakpointNameImpl::operator!=(const SBBreakpointNameImpl &rhs) {
98   return m_name != rhs.m_name || m_target_wp.lock() != rhs.m_target_wp.lock();
99 }
100
101 lldb_private::BreakpointName *SBBreakpointNameImpl::GetBreakpointName() const {
102   if (!IsValid())
103     return nullptr;
104   TargetSP target_sp = GetTarget();
105   if (!target_sp)
106     return nullptr;
107   Status error;
108   return target_sp->FindBreakpointName(ConstString(m_name), true, error);
109 }
110
111 } // namespace lldb
112
113 SBBreakpointName::SBBreakpointName() {}
114
115 SBBreakpointName::SBBreakpointName(SBTarget &sb_target, const char *name)
116 {
117   m_impl_up.reset(new SBBreakpointNameImpl(sb_target, name));
118   // Call FindBreakpointName here to make sure the name is valid, reset if
119   // not:
120   BreakpointName *bp_name = GetBreakpointName();
121   if (!bp_name)
122     m_impl_up.reset();
123 }
124
125 SBBreakpointName::SBBreakpointName(SBBreakpoint &sb_bkpt, const char *name)
126 {
127   if (!sb_bkpt.IsValid()) {
128     m_impl_up.reset();
129     return;
130   }
131   BreakpointSP bkpt_sp = sb_bkpt.GetSP();
132   Target &target = bkpt_sp->GetTarget();
133
134   m_impl_up.reset(new SBBreakpointNameImpl(target.shared_from_this(), name));
135   
136   // Call FindBreakpointName here to make sure the name is valid, reset if
137   // not:
138   BreakpointName *bp_name = GetBreakpointName();
139   if (!bp_name) {
140     m_impl_up.reset();
141     return;
142   }
143   
144   // Now copy over the breakpoint's options:
145   target.ConfigureBreakpointName(*bp_name, *bkpt_sp->GetOptions(),
146                                  BreakpointName::Permissions());
147 }
148
149 SBBreakpointName::SBBreakpointName(const SBBreakpointName &rhs)
150 {
151   if (!rhs.m_impl_up)
152     return;
153   else
154     m_impl_up.reset(new SBBreakpointNameImpl(rhs.m_impl_up->GetTarget(),
155                                              rhs.m_impl_up->GetName()));
156 }
157
158 SBBreakpointName::~SBBreakpointName() = default;
159
160 const SBBreakpointName &SBBreakpointName::operator=(const SBBreakpointName &rhs) 
161 {
162   if (!rhs.m_impl_up) {
163     m_impl_up.reset();
164     return *this;
165   }
166   
167   m_impl_up.reset(new SBBreakpointNameImpl(rhs.m_impl_up->GetTarget(),
168                                            rhs.m_impl_up->GetName()));
169   return *this;
170 }
171
172 bool SBBreakpointName::operator==(const lldb::SBBreakpointName &rhs) {
173   return *m_impl_up.get() == *rhs.m_impl_up.get();
174 }
175
176 bool SBBreakpointName::operator!=(const lldb::SBBreakpointName &rhs) {
177   return *m_impl_up.get() != *rhs.m_impl_up.get();
178 }
179
180 bool SBBreakpointName::IsValid() const {
181   if (!m_impl_up)
182     return false;
183   return m_impl_up->IsValid();
184 }
185
186 const char *SBBreakpointName::GetName() const {
187   if (!m_impl_up)
188     return "<Invalid Breakpoint Name Object>";
189   return m_impl_up->GetName();
190 }
191
192 void SBBreakpointName::SetEnabled(bool enable) {
193   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
194   
195   BreakpointName *bp_name = GetBreakpointName();
196   if (!bp_name)
197     return;
198  
199   LLDB_LOG(log, "Name: {0} enabled: {1}\n", bp_name->GetName(), enable);
200   std::lock_guard<std::recursive_mutex> guard(
201         m_impl_up->GetTarget()->GetAPIMutex());
202
203   bp_name->GetOptions().SetEnabled(enable);
204 }
205
206 void SBBreakpointName::UpdateName(BreakpointName &bp_name) {
207   if (!IsValid())
208     return;
209
210   TargetSP target_sp = m_impl_up->GetTarget();
211   if (!target_sp)
212     return;
213   target_sp->ApplyNameToBreakpoints(bp_name);
214
215 }
216
217 bool SBBreakpointName::IsEnabled() {
218   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
219   
220   BreakpointName *bp_name = GetBreakpointName();
221   if (!bp_name)
222     return false;
223  
224   LLDB_LOG(log, "Name: {0}\n", bp_name->GetName());
225   std::lock_guard<std::recursive_mutex> guard(
226         m_impl_up->GetTarget()->GetAPIMutex());
227
228   return bp_name->GetOptions().IsEnabled();
229 }
230
231 void SBBreakpointName::SetOneShot(bool one_shot) {
232   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
233   
234   BreakpointName *bp_name = GetBreakpointName();
235   if (!bp_name)
236     return;
237  
238   LLDB_LOG(log, "Name: {0} one_shot: {1}\n", bp_name->GetName(), one_shot);
239   std::lock_guard<std::recursive_mutex> guard(
240         m_impl_up->GetTarget()->GetAPIMutex());
241
242   bp_name->GetOptions().SetOneShot(one_shot);
243   UpdateName(*bp_name);
244 }
245
246 bool SBBreakpointName::IsOneShot() const {
247   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
248   
249   const BreakpointName *bp_name = GetBreakpointName();
250   if (!bp_name)
251     return false;
252  
253   LLDB_LOG(log, "Name: {0}\n", bp_name->GetName());
254   std::lock_guard<std::recursive_mutex> guard(
255         m_impl_up->GetTarget()->GetAPIMutex());
256
257   return bp_name->GetOptions().IsOneShot();
258 }
259
260 void SBBreakpointName::SetIgnoreCount(uint32_t count) {
261   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
262   
263   BreakpointName *bp_name = GetBreakpointName();
264   if (!bp_name)
265     return;
266  
267   LLDB_LOG(log, "Name: {0} one_shot: {1}\n", bp_name->GetName(), count);
268   std::lock_guard<std::recursive_mutex> guard(
269         m_impl_up->GetTarget()->GetAPIMutex());
270
271   bp_name->GetOptions().SetIgnoreCount(count);
272   UpdateName(*bp_name);
273 }
274
275 uint32_t SBBreakpointName::GetIgnoreCount() const {
276   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
277   
278   BreakpointName *bp_name = GetBreakpointName();
279   if (!bp_name)
280     return false;
281  
282   LLDB_LOG(log, "Name: {0}\n", bp_name->GetName());
283   std::lock_guard<std::recursive_mutex> guard(
284         m_impl_up->GetTarget()->GetAPIMutex());
285
286   return bp_name->GetOptions().GetIgnoreCount();
287 }
288
289 void SBBreakpointName::SetCondition(const char *condition) {
290   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
291   
292   BreakpointName *bp_name = GetBreakpointName();
293   if (!bp_name)
294     return;
295  
296   LLDB_LOG(log, "Name: {0} one_shot: {1}\n", bp_name->GetName(),
297           condition ? condition : "<NULL>");
298   
299   std::lock_guard<std::recursive_mutex> guard(
300         m_impl_up->GetTarget()->GetAPIMutex());
301
302   bp_name->GetOptions().SetCondition(condition);
303   UpdateName(*bp_name);
304 }
305
306 const char *SBBreakpointName::GetCondition() {
307   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
308   
309   BreakpointName *bp_name = GetBreakpointName();
310   if (!bp_name)
311     return nullptr;
312  
313   LLDB_LOG(log, "Name: {0}\n", bp_name->GetName());
314   std::lock_guard<std::recursive_mutex> guard(
315         m_impl_up->GetTarget()->GetAPIMutex());
316
317   return bp_name->GetOptions().GetConditionText();
318 }
319
320 void SBBreakpointName::SetAutoContinue(bool auto_continue) {
321   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
322   
323   BreakpointName *bp_name = GetBreakpointName();
324   if (!bp_name)
325     return;
326  
327   LLDB_LOG(log, "Name: {0} auto-continue: {1}\n", bp_name->GetName(), auto_continue);
328   
329   std::lock_guard<std::recursive_mutex> guard(
330         m_impl_up->GetTarget()->GetAPIMutex());
331
332   bp_name->GetOptions().SetAutoContinue(auto_continue);
333   UpdateName(*bp_name);
334 }
335
336 bool SBBreakpointName::GetAutoContinue() {
337   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
338   
339   BreakpointName *bp_name = GetBreakpointName();
340   if (!bp_name)
341     return false;
342  
343   LLDB_LOG(log, "Name: {0}\n", bp_name->GetName());
344   std::lock_guard<std::recursive_mutex> guard(
345         m_impl_up->GetTarget()->GetAPIMutex());
346
347   return bp_name->GetOptions().IsAutoContinue();
348 }
349
350 void SBBreakpointName::SetThreadID(tid_t tid) {
351   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
352   
353   BreakpointName *bp_name = GetBreakpointName();
354   if (!bp_name)
355     return;
356  
357   LLDB_LOG(log, "Name: {0} tid: {1:x}\n", bp_name->GetName(), tid);
358   
359   std::lock_guard<std::recursive_mutex> guard(
360         m_impl_up->GetTarget()->GetAPIMutex());
361
362   bp_name->GetOptions().SetThreadID(tid);
363   UpdateName(*bp_name);
364 }
365
366 tid_t SBBreakpointName::GetThreadID() {
367   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
368   
369   BreakpointName *bp_name = GetBreakpointName();
370   if (!bp_name)
371     return LLDB_INVALID_THREAD_ID;
372  
373   LLDB_LOG(log, "Name: {0}\n", bp_name->GetName());
374   std::lock_guard<std::recursive_mutex> guard(
375         m_impl_up->GetTarget()->GetAPIMutex());
376
377   return bp_name->GetOptions().GetThreadSpec()->GetTID();
378 }
379
380 void SBBreakpointName::SetThreadIndex(uint32_t index) {
381   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
382   
383   BreakpointName *bp_name = GetBreakpointName();
384   if (!bp_name)
385     return;
386  
387   LLDB_LOG(log, "Name: {0} thread index: {1}\n", bp_name->GetName(), index);
388   
389   std::lock_guard<std::recursive_mutex> guard(
390         m_impl_up->GetTarget()->GetAPIMutex());
391
392   bp_name->GetOptions().GetThreadSpec()->SetIndex(index);
393   UpdateName(*bp_name);
394 }
395
396 uint32_t SBBreakpointName::GetThreadIndex() const {
397   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
398   
399   BreakpointName *bp_name = GetBreakpointName();
400   if (!bp_name)
401     return LLDB_INVALID_THREAD_ID;
402  
403   LLDB_LOG(log, "Name: {0}\n", bp_name->GetName());
404   std::lock_guard<std::recursive_mutex> guard(
405         m_impl_up->GetTarget()->GetAPIMutex());
406
407   return bp_name->GetOptions().GetThreadSpec()->GetIndex();
408 }
409
410 void SBBreakpointName::SetThreadName(const char *thread_name) {
411   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
412   
413   BreakpointName *bp_name = GetBreakpointName();
414   if (!bp_name)
415     return;
416  
417   LLDB_LOG(log, "Name: {0} thread name: {1}\n", bp_name->GetName(), thread_name);
418   
419   std::lock_guard<std::recursive_mutex> guard(
420         m_impl_up->GetTarget()->GetAPIMutex());
421
422   bp_name->GetOptions().GetThreadSpec()->SetName(thread_name);
423   UpdateName(*bp_name);
424 }
425
426 const char *SBBreakpointName::GetThreadName() const {
427   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
428   
429   BreakpointName *bp_name = GetBreakpointName();
430   if (!bp_name)
431     return nullptr;
432  
433   LLDB_LOG(log, "Name: {0}\n", bp_name->GetName());
434   std::lock_guard<std::recursive_mutex> guard(
435         m_impl_up->GetTarget()->GetAPIMutex());
436
437   return bp_name->GetOptions().GetThreadSpec()->GetName();
438 }
439
440 void SBBreakpointName::SetQueueName(const char *queue_name) {
441   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
442   
443   BreakpointName *bp_name = GetBreakpointName();
444   if (!bp_name)
445     return;
446  
447   LLDB_LOG(log, "Name: {0} queue name: {1}\n", bp_name->GetName(), queue_name);
448   
449   std::lock_guard<std::recursive_mutex> guard(
450         m_impl_up->GetTarget()->GetAPIMutex());
451
452   bp_name->GetOptions().GetThreadSpec()->SetQueueName(queue_name);
453   UpdateName(*bp_name);
454 }
455
456 const char *SBBreakpointName::GetQueueName() const {
457   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
458   
459   BreakpointName *bp_name = GetBreakpointName();
460   if (!bp_name)
461     return nullptr;
462  
463   LLDB_LOG(log, "Name: {0}\n", bp_name->GetName());
464   std::lock_guard<std::recursive_mutex> guard(
465         m_impl_up->GetTarget()->GetAPIMutex());
466
467   return bp_name->GetOptions().GetThreadSpec()->GetQueueName();
468 }
469
470 void SBBreakpointName::SetCommandLineCommands(SBStringList &commands) {
471   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
472   BreakpointName *bp_name = GetBreakpointName();
473   if (!bp_name)
474     return;
475   if (commands.GetSize() == 0)
476     return;
477
478   LLDB_LOG(log, "Name: {0} commands\n", bp_name->GetName());
479
480   std::lock_guard<std::recursive_mutex> guard(
481         m_impl_up->GetTarget()->GetAPIMutex());
482   std::unique_ptr<BreakpointOptions::CommandData> cmd_data_up(
483       new BreakpointOptions::CommandData(*commands, eScriptLanguageNone));
484
485   bp_name->GetOptions().SetCommandDataCallback(cmd_data_up);
486   UpdateName(*bp_name);
487 }
488
489 bool SBBreakpointName::GetCommandLineCommands(SBStringList &commands) {
490   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
491   
492   BreakpointName *bp_name = GetBreakpointName();
493   if (!bp_name)
494     return false;
495  
496   LLDB_LOG(log, "Name: {0}\n", bp_name->GetName());
497   StringList command_list;
498   bool has_commands =
499       bp_name->GetOptions().GetCommandLineCallbacks(command_list);
500   if (has_commands)
501     commands.AppendList(command_list);
502   return has_commands;
503 }
504
505 const char *SBBreakpointName::GetHelpString() const {
506   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
507   
508   BreakpointName *bp_name = GetBreakpointName();
509   if (!bp_name)
510     return "";
511  
512   LLDB_LOG(log, "Help: {0}\n", bp_name->GetHelp());
513   return bp_name->GetHelp();
514 }
515
516 void SBBreakpointName::SetHelpString(const char *help_string) {
517   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
518   BreakpointName *bp_name = GetBreakpointName();
519   if (!bp_name)
520     return;
521
522   LLDB_LOG(log, "Name: {0} help: {1}\n", bp_name->GetName(), help_string);
523
524   std::lock_guard<std::recursive_mutex> guard(
525         m_impl_up->GetTarget()->GetAPIMutex());
526   bp_name->SetHelp(help_string);
527 }
528
529 bool SBBreakpointName::GetDescription(SBStream &s) {
530   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
531   
532   BreakpointName *bp_name = GetBreakpointName();
533   if (!bp_name)
534   {
535     s.Printf("No value");
536     return false;
537   }
538  
539   LLDB_LOG(log, "Name: {0}\n", bp_name->GetName());
540   std::lock_guard<std::recursive_mutex> guard(
541         m_impl_up->GetTarget()->GetAPIMutex());
542   bp_name->GetDescription(s.get(), eDescriptionLevelFull);
543   return true;
544 }
545
546 void SBBreakpointName::SetCallback(SBBreakpointHitCallback callback,
547                                    void *baton) {
548   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
549   BreakpointName *bp_name = GetBreakpointName();
550   if (!bp_name)
551     return;
552   LLDB_LOG(log, "callback = {1}, baton = {2}", callback, baton);
553   std::lock_guard<std::recursive_mutex> guard(
554         m_impl_up->GetTarget()->GetAPIMutex());
555
556   BatonSP baton_sp(new SBBreakpointCallbackBaton(callback, baton));
557   bp_name->GetOptions().SetCallback(SBBreakpointCallbackBaton
558                                        ::PrivateBreakpointHitCallback,
559                                     baton_sp,
560                                     false);
561   UpdateName(*bp_name);
562 }
563
564 void SBBreakpointName::SetScriptCallbackFunction(
565     const char *callback_function_name) {
566   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
567   
568   BreakpointName *bp_name = GetBreakpointName();
569   if (!bp_name)
570     return;
571  
572   LLDB_LOG(log, "Name: {0} callback: {1}\n", bp_name->GetName(),
573            callback_function_name);
574   
575   std::lock_guard<std::recursive_mutex> guard(
576         m_impl_up->GetTarget()->GetAPIMutex());
577
578   BreakpointOptions &bp_options = bp_name->GetOptions();
579   m_impl_up->GetTarget()
580       ->GetDebugger()
581       .GetCommandInterpreter()
582       .GetScriptInterpreter()
583       ->SetBreakpointCommandCallbackFunction(&bp_options,
584                                              callback_function_name);
585   UpdateName(*bp_name);
586 }
587
588 SBError SBBreakpointName::SetScriptCallbackBody(const char *callback_body_text)
589 {
590   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
591   SBError sb_error;
592   BreakpointName *bp_name = GetBreakpointName();
593   if (!bp_name)
594     return sb_error;
595  
596   LLDB_LOG(log, "Name: {0} callback: {1}\n", bp_name->GetName(),
597            callback_body_text);
598   
599   std::lock_guard<std::recursive_mutex> guard(
600         m_impl_up->GetTarget()->GetAPIMutex());
601
602   BreakpointOptions &bp_options = bp_name->GetOptions();
603   Status error =
604       m_impl_up->GetTarget()
605           ->GetDebugger()
606           .GetCommandInterpreter()
607           .GetScriptInterpreter()
608           ->SetBreakpointCommandCallback(&bp_options, callback_body_text);
609   sb_error.SetError(error);
610   if (!sb_error.Fail())
611     UpdateName(*bp_name);
612
613   return sb_error;
614 }
615
616 bool SBBreakpointName::GetAllowList() const
617 {
618   BreakpointName *bp_name = GetBreakpointName();
619   if (!bp_name)
620     return false;
621   return bp_name->GetPermissions().GetAllowList();
622 }
623
624 void SBBreakpointName::SetAllowList(bool value)
625 {
626   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
627
628   BreakpointName *bp_name = GetBreakpointName();
629   if (!bp_name)
630     return;
631   if (log)
632     log->Printf("Setting allow list to %u for %s.", value, 
633                 bp_name->GetName().AsCString());
634   bp_name->GetPermissions().SetAllowList(value);
635 }
636   
637 bool SBBreakpointName::GetAllowDelete()
638 {
639   BreakpointName *bp_name = GetBreakpointName();
640   if (!bp_name)
641     return false;
642   return bp_name->GetPermissions().GetAllowDelete();
643 }
644
645 void SBBreakpointName::SetAllowDelete(bool value)
646 {
647   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
648
649   BreakpointName *bp_name = GetBreakpointName();
650   if (!bp_name)
651     return;
652   if (log)
653     log->Printf("Setting allow delete to %u for %s.", value, 
654                 bp_name->GetName().AsCString());
655   bp_name->GetPermissions().SetAllowDelete(value);
656 }
657   
658 bool SBBreakpointName::GetAllowDisable()
659 {
660   BreakpointName *bp_name = GetBreakpointName();
661   if (!bp_name)
662     return false;
663   return bp_name->GetPermissions().GetAllowDisable();
664 }
665
666 void SBBreakpointName::SetAllowDisable(bool value)
667 {
668   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
669
670   BreakpointName *bp_name = GetBreakpointName();
671   if (!bp_name)
672     return;
673   if (log)
674     log->Printf("Setting allow disable to %u for %s.", value, 
675                 bp_name->GetName().AsCString());
676   bp_name->GetPermissions().SetAllowDisable(value);
677 }
678
679 lldb_private::BreakpointName *SBBreakpointName::GetBreakpointName() const
680 {
681   if (!IsValid())
682     return nullptr;
683   return m_impl_up->GetBreakpointName();
684 }
685