LLDB mainline
BreakpointName.cpp
Go to the documentation of this file.
1//===-- BreakpointName.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 "llvm/Support/Casting.h"
10
16#include "lldb/Utility/Log.h"
17#include "lldb/Utility/Stream.h"
19
20using namespace lldb;
21using namespace lldb_private;
22
24 [BreakpointName::Permissions::PermissionKinds::allPerms + 1] = {
25 (1u << 0),
26 (1u << 1),
27 (1u << 2),
28 (0x5u)
29};
30
33 if (!AnySet())
34 return false;
35 s->IndentMore();
36 s->Indent();
37 if (IsSet(listPerm))
38 s->Printf("list: %s", GetAllowList() ? "allowed" : "disallowed");
39
40 if (IsSet(disablePerm))
41 s->Printf("disable: %s", GetAllowDisable() ? "allowed" : "disallowed");
42
43 if (IsSet(deletePerm))
44 s->Printf("delete: %s", GetAllowDelete() ? "allowed" : "disallowed");
45 s->IndentLess();
46 return true;
47}
48
50 bool printed_any = false;
51 if (!m_help.empty())
52 s->Printf("Help: %s\n", m_help.c_str());
53
54 if (GetOptions().AnySet())
55 {
56 s->PutCString("Options: \n");
57 s->IndentMore();
58 s->Indent();
59 GetOptions().GetDescription(s, level);
60 printed_any = true;
61 s->IndentLess();
62 }
63 if (GetPermissions().AnySet())
64 {
65 s->PutCString("Permissions: \n");
66 s->IndentMore();
67 s->Indent();
69 printed_any = true;
70 s->IndentLess();
71 }
72 return printed_any;
73}
74
76{
77 bp_sp->GetOptions().CopyOverSetOptions(GetOptions());
78 bp_sp->GetPermissions().MergeInto(GetPermissions());
79}
bool IsSet(enum PermissionKinds permission) const
bool GetDescription(Stream *s, lldb::DescriptionLevel level)
static const Flags::ValueType permissions_mask[allPerms+1]
bool GetDescription(Stream *s, lldb::DescriptionLevel level)
BreakpointOptions & GetOptions()
void ConfigureBreakpoint(lldb::BreakpointSP bp_sp)
void GetDescription(Stream *s, lldb::DescriptionLevel level) const
uint32_t ValueType
The value type for flags is a 32 bit unsigned integer type.
Definition: Flags.h:25
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
Definition: Stream.cpp:157
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition: Stream.cpp:134
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition: Stream.cpp:65
void IndentLess(unsigned amount=2)
Decrement the current indentation level.
Definition: Stream.cpp:198
void IndentMore(unsigned amount=2)
Increment the current indentation level.
Definition: Stream.cpp:195
A class that represents a running process on the host machine.
Definition: SBAddress.h:15
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
Definition: lldb-forward.h:321