LLDB mainline
Policy.cpp
Go to the documentation of this file.
1//===-- Policy.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
11#include "lldb/Utility/Log.h"
12#include "lldb/Utility/Stream.h"
14
15using namespace lldb_private;
16
18 Policy p = m_stack.back();
19 if (Log *log = GetLog(LLDBLog::Process)) {
21 p.Dump(s);
22 LLDB_LOG(log, "{0}", s.GetData());
23 }
24 return p;
25}
26
27void Policy::Dump(Stream &s) const {
28 s << "policy: view=" << (view == View::Public ? "public" : "private");
29 s << ", capabilities={";
30 s << "eval_expr=" << capabilities.can_evaluate_expressions;
31 s << " run_all=" << capabilities.can_run_all_threads;
32 s << " try_all=" << capabilities.can_try_all_threads;
33 s << " bp_actions=" << capabilities.can_run_breakpoint_actions;
34 s << " frame_providers=" << capabilities.can_load_frame_providers;
35 s << " frame_recognizers=" << capabilities.can_run_frame_recognizers;
36 s << '}';
37}
38
39void PolicyStack::Dump(Stream &s) const {
40 s.Printf("PolicyStack depth=%zu\n", m_stack.size());
41 for (size_t i = 0; i < m_stack.size(); i++) {
42 s.Printf(" [%zu] ", i);
43 m_stack[i].Dump(s);
44 s << '\n';
45 }
46}
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
Definition Log.h:364
void Dump(Stream &s) const
Definition Policy.cpp:39
llvm::SmallVector< Policy > m_stack
Definition Policy.h:114
Policy Current() const
Definition Policy.cpp:17
const char * GetData() const
A stream class that can stream formatted output to a file.
Definition Stream.h:28
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition Stream.cpp:134
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition Log.h:327
Describes what view of the process a thread should see and what operations it is allowed to perform.
Definition Policy.h:32
Capabilities capabilities
Definition Policy.h:55
@ Public
Provider-augmented frames, public state, public run lock.
Definition Policy.h:35
void Dump(Stream &s) const
Definition Policy.cpp:27