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