Path: blob/main/contrib/llvm-project/lldb/source/Breakpoint/BreakpointName.cpp
39587 views
//===-- BreakpointName.cpp ------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "llvm/Support/Casting.h"910#include "lldb/Breakpoint/Breakpoint.h"11#include "lldb/Breakpoint/BreakpointOptions.h"12#include "lldb/Breakpoint/BreakpointLocationCollection.h"13#include "lldb/Breakpoint/BreakpointResolver.h"14#include "lldb/Breakpoint/BreakpointResolverFileLine.h"15#include "lldb/Utility/Log.h"16#include "lldb/Utility/Stream.h"17#include "lldb/Utility/StreamString.h"1819using namespace lldb;20using namespace lldb_private;2122const Flags::ValueType BreakpointName::Permissions::permissions_mask23[BreakpointName::Permissions::PermissionKinds::allPerms + 1] = {24(1u << 0),25(1u << 1),26(1u << 2),27(0x5u)28};2930bool BreakpointName::Permissions::GetDescription(Stream *s,31lldb::DescriptionLevel level) {32if (!AnySet())33return false;34s->IndentMore();35s->Indent();36if (IsSet(listPerm))37s->Printf("list: %s", GetAllowList() ? "allowed" : "disallowed");3839if (IsSet(disablePerm))40s->Printf("disable: %s", GetAllowDisable() ? "allowed" : "disallowed");4142if (IsSet(deletePerm))43s->Printf("delete: %s", GetAllowDelete() ? "allowed" : "disallowed");44s->IndentLess();45return true;46}4748bool BreakpointName::GetDescription(Stream *s, lldb::DescriptionLevel level) {49bool printed_any = false;50if (!m_help.empty())51s->Printf("Help: %s\n", m_help.c_str());5253if (GetOptions().AnySet())54{55s->PutCString("Options: \n");56s->IndentMore();57s->Indent();58GetOptions().GetDescription(s, level);59printed_any = true;60s->IndentLess();61}62if (GetPermissions().AnySet())63{64s->PutCString("Permissions: \n");65s->IndentMore();66s->Indent();67GetPermissions().GetDescription(s, level);68printed_any = true;69s->IndentLess();70}71return printed_any;72}7374void BreakpointName::ConfigureBreakpoint(lldb::BreakpointSP bp_sp)75{76bp_sp->GetOptions().CopyOverSetOptions(GetOptions());77bp_sp->GetPermissions().MergeInto(GetPermissions());78}798081