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