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