1 //===-- BreakpointName.cpp --------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #include "llvm/Support/Casting.h"
11 #include "lldb/Breakpoint/Breakpoint.h"
12 #include "lldb/Breakpoint/BreakpointOptions.h"
13 #include "lldb/Breakpoint/BreakpointLocationCollection.h"
14 #include "lldb/Breakpoint/BreakpointResolver.h"
15 #include "lldb/Breakpoint/BreakpointResolverFileLine.h"
16 #include "lldb/Utility/Log.h"
17 #include "lldb/Utility/Stream.h"
18 #include "lldb/Utility/StreamString.h"
21 using namespace lldb_private;
23 const Flags::ValueType BreakpointName::Permissions::permissions_mask
24 [BreakpointName::Permissions::PermissionKinds::allPerms + 1] = {
31 BreakpointName::BreakpointName(ConstString name, const Breakpoint &bkpt,
33 m_name(name), m_options(bkpt.GetOptions())
38 bool BreakpointName::Permissions::GetDescription(Stream *s,
39 lldb::DescriptionLevel level) {
45 s->Printf("list: %s", GetAllowList() ? "allowed" : "disallowed");
47 if (IsSet(disablePerm))
48 s->Printf("disable: %s", GetAllowDisable() ? "allowed" : "disallowed");
50 if (IsSet(deletePerm))
51 s->Printf("delete: %s", GetAllowDelete() ? "allowed" : "disallowed");
56 bool BreakpointName::GetDescription(Stream *s, lldb::DescriptionLevel level) {
57 bool printed_any = false;
59 s->Printf("Help: %s\n", m_help.c_str());
61 if (GetOptions().AnySet())
63 s->PutCString("Options: \n");
66 GetOptions().GetDescription(s, level);
70 if (GetPermissions().AnySet())
72 s->PutCString("Permissions: \n");
75 GetPermissions().GetDescription(s, level);
82 void BreakpointName::ConfigureBreakpoint(lldb::BreakpointSP bp_sp)
84 bp_sp->GetOptions()->CopyOverSetOptions(GetOptions());
85 bp_sp->GetPermissions().MergeInto(GetPermissions());