/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/include/lldb/Core/UserSettingsController.h
Line | Count | Source |
1 | | //====-- UserSettingsController.h --------------------------------*- 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 | | #ifndef LLDB_CORE_USERSETTINGSCONTROLLER_H |
10 | | #define LLDB_CORE_USERSETTINGSCONTROLLER_H |
11 | | |
12 | | #include "lldb/Interpreter/OptionValueProperties.h" |
13 | | #include "lldb/Utility/Status.h" |
14 | | #include "lldb/lldb-forward.h" |
15 | | #include "lldb/lldb-private-enumerations.h" |
16 | | |
17 | | #include "llvm/ADT/StringRef.h" |
18 | | |
19 | | #include <vector> |
20 | | |
21 | | #include <cstddef> |
22 | | #include <cstdint> |
23 | | |
24 | | namespace lldb_private { |
25 | | class CommandInterpreter; |
26 | | class ExecutionContext; |
27 | | class Property; |
28 | | class Stream; |
29 | | } |
30 | | |
31 | | namespace lldb_private { |
32 | | |
33 | | class Properties { |
34 | | public: |
35 | | Properties(); |
36 | | |
37 | | Properties(const lldb::OptionValuePropertiesSP &collection_sp); |
38 | | |
39 | | virtual ~Properties(); |
40 | | |
41 | 285k | virtual lldb::OptionValuePropertiesSP GetValueProperties() const { |
42 | | // This function is virtual in case subclasses want to lazily implement |
43 | | // creating the properties. |
44 | 285k | return m_collection_sp; |
45 | 285k | } |
46 | | |
47 | | virtual lldb::OptionValueSP GetPropertyValue(const ExecutionContext *exe_ctx, |
48 | | llvm::StringRef property_path, |
49 | | Status &error) const; |
50 | | |
51 | | virtual Status SetPropertyValue(const ExecutionContext *exe_ctx, |
52 | | VarSetOperationType op, |
53 | | llvm::StringRef property_path, |
54 | | llvm::StringRef value); |
55 | | |
56 | | virtual Status DumpPropertyValue(const ExecutionContext *exe_ctx, |
57 | | Stream &strm, llvm::StringRef property_path, |
58 | | uint32_t dump_mask, bool is_json = false); |
59 | | |
60 | | virtual void DumpAllPropertyValues(const ExecutionContext *exe_ctx, |
61 | | Stream &strm, uint32_t dump_mask, |
62 | | bool is_json = false); |
63 | | |
64 | | virtual void DumpAllDescriptions(CommandInterpreter &interpreter, |
65 | | Stream &strm) const; |
66 | | |
67 | | size_t Apropos(llvm::StringRef keyword, |
68 | | std::vector<const Property *> &matching_properties) const; |
69 | | |
70 | | // We sometimes need to introduce a setting to enable experimental features, |
71 | | // but then we don't want the setting for these to cause errors when the |
72 | | // setting goes away. Add a sub-topic of the settings using this |
73 | | // experimental name, and two things will happen. One is that settings that |
74 | | // don't find the name will not be treated as errors. Also, if you decide to |
75 | | // keep the settings just move them into the containing properties, and we |
76 | | // will auto-forward the experimental settings to the real one. |
77 | | static llvm::StringRef GetExperimentalSettingsName(); |
78 | | |
79 | | static bool IsSettingExperimental(llvm::StringRef setting); |
80 | | |
81 | | template <typename T> |
82 | | T GetPropertyAtIndexAs(uint32_t idx, T default_value, |
83 | 10.3M | const ExecutionContext *exe_ctx = nullptr) const { |
84 | 10.3M | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) |
85 | 10.3M | .value_or(default_value); |
86 | 10.3M | } lldb::ScriptLanguage lldb_private::Properties::GetPropertyAtIndexAs<lldb::ScriptLanguage>(unsigned int, lldb::ScriptLanguage, lldb_private::ExecutionContext const*) const Line | Count | Source | 83 | 509k | const ExecutionContext *exe_ctx = nullptr) const { | 84 | 509k | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) | 85 | 509k | .value_or(default_value); | 86 | 509k | } |
lldb::StopShowColumn lldb_private::Properties::GetPropertyAtIndexAs<lldb::StopShowColumn>(unsigned int, lldb::StopShowColumn, lldb_private::ExecutionContext const*) const Line | Count | Source | 83 | 1.49k | const ExecutionContext *exe_ctx = nullptr) const { | 84 | 1.49k | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) | 85 | 1.49k | .value_or(default_value); | 86 | 1.49k | } |
lldb_private::Debugger::StopDisassemblyType lldb_private::Properties::GetPropertyAtIndexAs<lldb_private::Debugger::StopDisassemblyType>(unsigned int, lldb_private::Debugger::StopDisassemblyType, lldb_private::ExecutionContext const*) const Line | Count | Source | 83 | 1.58k | const ExecutionContext *exe_ctx = nullptr) const { | 84 | 1.58k | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) | 85 | 1.58k | .value_or(default_value); | 86 | 1.58k | } |
lldb::DWIMPrintVerbosity lldb_private::Properties::GetPropertyAtIndexAs<lldb::DWIMPrintVerbosity>(unsigned int, lldb::DWIMPrintVerbosity, lldb_private::ExecutionContext const*) const Line | Count | Source | 83 | 74 | const ExecutionContext *exe_ctx = nullptr) const { | 84 | 74 | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) | 85 | 74 | .value_or(default_value); | 86 | 74 | } |
bool lldb_private::Properties::GetPropertyAtIndexAs<bool>(unsigned int, bool, lldb_private::ExecutionContext const*) const Line | Count | Source | 83 | 7.31M | const ExecutionContext *exe_ctx = nullptr) const { | 84 | 7.31M | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) | 85 | 7.31M | .value_or(default_value); | 86 | 7.31M | } |
lldb_private::FileSpec lldb_private::Properties::GetPropertyAtIndexAs<lldb_private::FileSpec>(unsigned int, lldb_private::FileSpec, lldb_private::ExecutionContext const*) const Line | Count | Source | 83 | 58.5k | const ExecutionContext *exe_ctx = nullptr) const { | 84 | 58.5k | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) | 85 | 58.5k | .value_or(default_value); | 86 | 58.5k | } |
unsigned long long lldb_private::Properties::GetPropertyAtIndexAs<unsigned long long>(unsigned int, unsigned long long, lldb_private::ExecutionContext const*) const Line | Count | Source | 83 | 744k | const ExecutionContext *exe_ctx = nullptr) const { | 84 | 744k | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) | 85 | 744k | .value_or(default_value); | 86 | 744k | } |
lldb_private::FileSpecList lldb_private::Properties::GetPropertyAtIndexAs<lldb_private::FileSpecList>(unsigned int, lldb_private::FileSpecList, lldb_private::ExecutionContext const*) const Line | Count | Source | 83 | 346k | const ExecutionContext *exe_ctx = nullptr) const { | 84 | 346k | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) | 85 | 346k | .value_or(default_value); | 86 | 346k | } |
lldb_private::FollowForkMode lldb_private::Properties::GetPropertyAtIndexAs<lldb_private::FollowForkMode>(unsigned int, lldb_private::FollowForkMode, lldb_private::ExecutionContext const*) const Line | Count | Source | 83 | 13 | const ExecutionContext *exe_ctx = nullptr) const { | 84 | 13 | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) | 85 | 13 | .value_or(default_value); | 86 | 13 | } |
lldb_private::ArchSpec lldb_private::Properties::GetPropertyAtIndexAs<lldb_private::ArchSpec>(unsigned int, lldb_private::ArchSpec, lldb_private::ExecutionContext const*) const Line | Count | Source | 83 | 6.29k | const ExecutionContext *exe_ctx = nullptr) const { | 84 | 6.29k | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) | 85 | 6.29k | .value_or(default_value); | 86 | 6.29k | } |
lldb::DynamicValueType lldb_private::Properties::GetPropertyAtIndexAs<lldb::DynamicValueType>(unsigned int, lldb::DynamicValueType, lldb_private::ExecutionContext const*) const Line | Count | Source | 83 | 51.6k | const ExecutionContext *exe_ctx = nullptr) const { | 84 | 51.6k | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) | 85 | 51.6k | .value_or(default_value); | 86 | 51.6k | } |
x86DisassemblyFlavor lldb_private::Properties::GetPropertyAtIndexAs<x86DisassemblyFlavor>(unsigned int, x86DisassemblyFlavor, lldb_private::ExecutionContext const*) const Line | Count | Source | 83 | 46.4k | const ExecutionContext *exe_ctx = nullptr) const { | 84 | 46.4k | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) | 85 | 46.4k | .value_or(default_value); | 86 | 46.4k | } |
lldb_private::InlineStrategy lldb_private::Properties::GetPropertyAtIndexAs<lldb_private::InlineStrategy>(unsigned int, lldb_private::InlineStrategy, lldb_private::ExecutionContext const*) const Line | Count | Source | 83 | 1.15k | const ExecutionContext *exe_ctx = nullptr) const { | 84 | 1.15k | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) | 85 | 1.15k | .value_or(default_value); | 86 | 1.15k | } |
llvm::StringRef lldb_private::Properties::GetPropertyAtIndexAs<llvm::StringRef>(unsigned int, llvm::StringRef, lldb_private::ExecutionContext const*) const Line | Count | Source | 83 | 32.1k | const ExecutionContext *exe_ctx = nullptr) const { | 84 | 32.1k | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) | 85 | 32.1k | .value_or(default_value); | 86 | 32.1k | } |
lldb_private::ImportStdModule lldb_private::Properties::GetPropertyAtIndexAs<lldb_private::ImportStdModule>(unsigned int, lldb_private::ImportStdModule, lldb_private::ExecutionContext const*) const Line | Count | Source | 83 | 7.55k | const ExecutionContext *exe_ctx = nullptr) const { | 84 | 7.55k | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) | 85 | 7.55k | .value_or(default_value); | 86 | 7.55k | } |
lldb_private::DynamicClassInfoHelper lldb_private::Properties::GetPropertyAtIndexAs<lldb_private::DynamicClassInfoHelper>(unsigned int, lldb_private::DynamicClassInfoHelper, lldb_private::ExecutionContext const*) const Line | Count | Source | 83 | 985 | const ExecutionContext *exe_ctx = nullptr) const { | 84 | 985 | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) | 85 | 985 | .value_or(default_value); | 86 | 985 | } |
long long lldb_private::Properties::GetPropertyAtIndexAs<long long>(unsigned int, long long, lldb_private::ExecutionContext const*) const Line | Count | Source | 83 | 9.73k | const ExecutionContext *exe_ctx = nullptr) const { | 84 | 9.73k | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) | 85 | 9.73k | .value_or(default_value); | 86 | 9.73k | } |
lldb::LanguageType lldb_private::Properties::GetPropertyAtIndexAs<lldb::LanguageType>(unsigned int, lldb::LanguageType, lldb_private::ExecutionContext const*) const Line | Count | Source | 83 | 11.4k | const ExecutionContext *exe_ctx = nullptr) const { | 84 | 11.4k | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) | 85 | 11.4k | .value_or(default_value); | 86 | 11.4k | } |
lldb_private::LoadScriptFromSymFile lldb_private::Properties::GetPropertyAtIndexAs<lldb_private::LoadScriptFromSymFile>(unsigned int, lldb_private::LoadScriptFromSymFile, lldb_private::ExecutionContext const*) const Line | Count | Source | 83 | 233k | const ExecutionContext *exe_ctx = nullptr) const { | 84 | 233k | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) | 85 | 233k | .value_or(default_value); | 86 | 233k | } |
lldb_private::LoadCWDlldbinitFile lldb_private::Properties::GetPropertyAtIndexAs<lldb_private::LoadCWDlldbinitFile>(unsigned int, lldb_private::LoadCWDlldbinitFile, lldb_private::ExecutionContext const*) const Line | Count | Source | 83 | 2 | const ExecutionContext *exe_ctx = nullptr) const { | 84 | 2 | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) | 85 | 2 | .value_or(default_value); | 86 | 2 | } |
lldb_private::Disassembler::HexImmediateStyle lldb_private::Properties::GetPropertyAtIndexAs<lldb_private::Disassembler::HexImmediateStyle>(unsigned int, lldb_private::Disassembler::HexImmediateStyle, lldb_private::ExecutionContext const*) const Line | Count | Source | 83 | 975k | const ExecutionContext *exe_ctx = nullptr) const { | 84 | 975k | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) | 85 | 975k | .value_or(default_value); | 86 | 975k | } |
lldb_private::MemoryModuleLoadLevel lldb_private::Properties::GetPropertyAtIndexAs<lldb_private::MemoryModuleLoadLevel>(unsigned int, lldb_private::MemoryModuleLoadLevel, lldb_private::ExecutionContext const*) const Line | Count | Source | 83 | 6 | const ExecutionContext *exe_ctx = nullptr) const { | 84 | 6 | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) | 85 | 6 | .value_or(default_value); | 86 | 6 | } |
KASLRScanType lldb_private::Properties::GetPropertyAtIndexAs<KASLRScanType>(unsigned int, KASLRScanType, lldb_private::ExecutionContext const*) const Line | Count | Source | 83 | 284 | const ExecutionContext *exe_ctx = nullptr) const { | 84 | 284 | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) | 85 | 284 | .value_or(default_value); | 86 | 284 | } |
JITLoaderGDB.cpp:(anonymous namespace)::EnableJITLoaderGDB lldb_private::Properties::GetPropertyAtIndexAs<(anonymous namespace)::EnableJITLoaderGDB>(unsigned int, (anonymous namespace)::EnableJITLoaderGDB, lldb_private::ExecutionContext const*) const Line | Count | Source | 83 | 2.32k | const ExecutionContext *exe_ctx = nullptr) const { | 84 | 2.32k | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) | 85 | 2.32k | .value_or(default_value); | 86 | 2.32k | } |
llvm::Triple::EnvironmentType lldb_private::Properties::GetPropertyAtIndexAs<llvm::Triple::EnvironmentType>(unsigned int, llvm::Triple::EnvironmentType, lldb_private::ExecutionContext const*) const Line | Count | Source | 83 | 45 | const ExecutionContext *exe_ctx = nullptr) const { | 84 | 45 | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx) | 85 | 45 | .value_or(default_value); | 86 | 45 | } |
|
87 | | |
88 | | template <typename T, typename U = typename std::remove_pointer<T>::type, |
89 | | std::enable_if_t<std::is_pointer_v<T>, bool> = true> |
90 | | const U * |
91 | | GetPropertyAtIndexAs(uint32_t idx, |
92 | 1.00M | const ExecutionContext *exe_ctx = nullptr) const { |
93 | 1.00M | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx); |
94 | 1.00M | } _ZNK12lldb_private10Properties20GetPropertyAtIndexAsIPKNS_12FormatEntity5EntryES4_TnNSt3__19enable_ifIXsr3stdE12is_pointer_vIT_EEbE4typeELb1EEEPKT0_jPKNS_16ExecutionContextE Line | Count | Source | 92 | 1.00M | const ExecutionContext *exe_ctx = nullptr) const { | 93 | 1.00M | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx); | 94 | 1.00M | } |
_ZNK12lldb_private10Properties20GetPropertyAtIndexAsIPKNS_17RegularExpressionES3_TnNSt3__19enable_ifIXsr3stdE12is_pointer_vIT_EEbE4typeELb1EEEPKT0_jPKNS_16ExecutionContextE Line | Count | Source | 92 | 227 | const ExecutionContext *exe_ctx = nullptr) const { | 93 | 227 | return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx); | 94 | 227 | } |
|
95 | | |
96 | | template <typename T> |
97 | | bool SetPropertyAtIndex(uint32_t idx, T t, |
98 | 26.4k | const ExecutionContext *exe_ctx = nullptr) const { |
99 | 26.4k | return m_collection_sp->SetPropertyAtIndex<T>(idx, t, exe_ctx); |
100 | 26.4k | } bool lldb_private::Properties::SetPropertyAtIndex<lldb::ScriptLanguage>(unsigned int, lldb::ScriptLanguage, lldb_private::ExecutionContext const*) const Line | Count | Source | 98 | 18 | const ExecutionContext *exe_ctx = nullptr) const { | 99 | 18 | return m_collection_sp->SetPropertyAtIndex<T>(idx, t, exe_ctx); | 100 | 18 | } |
bool lldb_private::Properties::SetPropertyAtIndex<lldb::LanguageType>(unsigned int, lldb::LanguageType, lldb_private::ExecutionContext const*) const Line | Count | Source | 98 | 2 | const ExecutionContext *exe_ctx = nullptr) const { | 99 | 2 | return m_collection_sp->SetPropertyAtIndex<T>(idx, t, exe_ctx); | 100 | 2 | } |
bool lldb_private::Properties::SetPropertyAtIndex<bool>(unsigned int, bool, lldb_private::ExecutionContext const*) const Line | Count | Source | 98 | 6.61k | const ExecutionContext *exe_ctx = nullptr) const { | 99 | 6.61k | return m_collection_sp->SetPropertyAtIndex<T>(idx, t, exe_ctx); | 100 | 6.61k | } |
bool lldb_private::Properties::SetPropertyAtIndex<lldb_private::FileSpec>(unsigned int, lldb_private::FileSpec, lldb_private::ExecutionContext const*) const Line | Count | Source | 98 | 7.91k | const ExecutionContext *exe_ctx = nullptr) const { | 99 | 7.91k | return m_collection_sp->SetPropertyAtIndex<T>(idx, t, exe_ctx); | 100 | 7.91k | } |
bool lldb_private::Properties::SetPropertyAtIndex<unsigned long long>(unsigned int, unsigned long long, lldb_private::ExecutionContext const*) const Line | Count | Source | 98 | 15 | const ExecutionContext *exe_ctx = nullptr) const { | 99 | 15 | return m_collection_sp->SetPropertyAtIndex<T>(idx, t, exe_ctx); | 100 | 15 | } |
bool lldb_private::Properties::SetPropertyAtIndex<lldb_private::ArchSpec>(unsigned int, lldb_private::ArchSpec, lldb_private::ExecutionContext const*) const Line | Count | Source | 98 | 4 | const ExecutionContext *exe_ctx = nullptr) const { | 99 | 4 | return m_collection_sp->SetPropertyAtIndex<T>(idx, t, exe_ctx); | 100 | 4 | } |
bool lldb_private::Properties::SetPropertyAtIndex<lldb::DynamicValueType>(unsigned int, lldb::DynamicValueType, lldb_private::ExecutionContext const*) const Line | Count | Source | 98 | 32 | const ExecutionContext *exe_ctx = nullptr) const { | 99 | 32 | return m_collection_sp->SetPropertyAtIndex<T>(idx, t, exe_ctx); | 100 | 32 | } |
bool lldb_private::Properties::SetPropertyAtIndex<llvm::StringRef>(unsigned int, llvm::StringRef, lldb_private::ExecutionContext const*) const Line | Count | Source | 98 | 11.7k | const ExecutionContext *exe_ctx = nullptr) const { | 99 | 11.7k | return m_collection_sp->SetPropertyAtIndex<T>(idx, t, exe_ctx); | 100 | 11.7k | } |
|
101 | | |
102 | | protected: |
103 | | lldb::OptionValuePropertiesSP m_collection_sp; |
104 | | }; |
105 | | |
106 | | } // namespace lldb_private |
107 | | |
108 | | #endif // LLDB_CORE_USERSETTINGSCONTROLLER_H |