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