[lldb] Use templates to simplify {Get,Set}PropertyAtIndex (NFC)
Use templates to simplify {Get,Set}PropertyAtIndex. It has always
bothered me how cumbersome those calls are when adding new properties.
After this patch, SetPropertyAtIndex infers the type from its arguments
and GetPropertyAtIndex required a single template argument for the
return value. As an added benefit, this enables us to remove a bunch of
wrappers from UserSettingsController and OptionValueProperties.
Differential revision: https://reviews.llvm.org/D149774
This commit is contained in:
@@ -269,7 +269,7 @@ public:
|
||||
|
||||
const FormatEntity::Entry *GetFrameFormatUnique() const;
|
||||
|
||||
uint32_t GetStopDisassemblyMaxSize() const;
|
||||
uint64_t GetStopDisassemblyMaxSize() const;
|
||||
|
||||
const FormatEntity::Entry *GetThreadFormat() const;
|
||||
|
||||
@@ -283,7 +283,7 @@ public:
|
||||
|
||||
bool SetREPLLanguage(lldb::LanguageType repl_lang);
|
||||
|
||||
uint32_t GetTerminalWidth() const;
|
||||
uint64_t GetTerminalWidth() const;
|
||||
|
||||
bool SetTerminalWidth(uint32_t term_width);
|
||||
|
||||
@@ -329,11 +329,11 @@ public:
|
||||
|
||||
llvm::StringRef GetStopShowColumnAnsiSuffix() const;
|
||||
|
||||
uint32_t GetStopSourceLineCount(bool before) const;
|
||||
uint64_t GetStopSourceLineCount(bool before) const;
|
||||
|
||||
StopDisassemblyType GetStopDisassemblyDisplay() const;
|
||||
|
||||
uint32_t GetDisassemblyLineCount() const;
|
||||
uint64_t GetDisassemblyLineCount() const;
|
||||
|
||||
llvm::StringRef GetStopShowLineMarkerAnsiPrefix() const;
|
||||
|
||||
@@ -349,7 +349,7 @@ public:
|
||||
|
||||
bool SetPrintDecls(bool b);
|
||||
|
||||
uint32_t GetTabSize() const;
|
||||
uint64_t GetTabSize() const;
|
||||
|
||||
bool SetTabSize(uint32_t tab_size);
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#ifndef LLDB_CORE_USERSETTINGSCONTROLLER_H
|
||||
#define LLDB_CORE_USERSETTINGSCONTROLLER_H
|
||||
|
||||
#include "lldb/Interpreter/OptionValueProperties.h"
|
||||
#include "lldb/Utility/Status.h"
|
||||
#include "lldb/lldb-forward.h"
|
||||
#include "lldb/lldb-private-enumerations.h"
|
||||
@@ -82,6 +83,27 @@ public:
|
||||
|
||||
static bool IsSettingExperimental(llvm::StringRef setting);
|
||||
|
||||
template <typename T>
|
||||
T GetPropertyAtIndexAs(uint32_t idx, T default_value,
|
||||
const ExecutionContext *exe_ctx = nullptr) const {
|
||||
return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx)
|
||||
.value_or(default_value);
|
||||
}
|
||||
|
||||
template <typename T, typename U = typename std::remove_pointer<T>::type,
|
||||
std::enable_if_t<std::is_pointer_v<T>, bool> = true>
|
||||
const U *
|
||||
GetPropertyAtIndexAs(uint32_t idx,
|
||||
const ExecutionContext *exe_ctx = nullptr) const {
|
||||
return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool SetPropertyAtIndex(uint32_t idx, T t,
|
||||
const ExecutionContext *exe_ctx = nullptr) const {
|
||||
return m_collection_sp->SetPropertyAtIndex<T>(idx, t, exe_ctx);
|
||||
}
|
||||
|
||||
protected:
|
||||
lldb::OptionValuePropertiesSP m_collection_sp;
|
||||
};
|
||||
|
||||
@@ -322,6 +322,51 @@ public:
|
||||
m_callback();
|
||||
}
|
||||
|
||||
template <typename T, std::enable_if_t<!std::is_pointer_v<T>, bool> = true>
|
||||
std::optional<T> GetValueAs() const {
|
||||
if constexpr (std::is_same_v<T, uint64_t>)
|
||||
return GetUInt64Value();
|
||||
if constexpr (std::is_same_v<T, int64_t>)
|
||||
return GetSInt64Value();
|
||||
if constexpr (std::is_same_v<T, bool>)
|
||||
return GetBooleanValue();
|
||||
if constexpr (std::is_same_v<T, char>)
|
||||
return GetCharValue();
|
||||
if constexpr (std::is_same_v<T, lldb::Format>)
|
||||
return GetFormatValue();
|
||||
if constexpr (std::is_same_v<T, lldb::LanguageType>)
|
||||
return GetLanguageValue();
|
||||
if constexpr (std::is_same_v<T, llvm::StringRef>)
|
||||
return GetStringValue();
|
||||
if constexpr (std::is_enum_v<T>)
|
||||
if (std::optional<int64_t> value = GetEnumerationValue())
|
||||
return static_cast<T>(*value);
|
||||
return {};
|
||||
}
|
||||
|
||||
template <typename T,
|
||||
typename U = typename std::remove_const<
|
||||
typename std::remove_pointer<T>::type>::type,
|
||||
std::enable_if_t<std::is_pointer_v<T>, bool> = true>
|
||||
T GetValueAs() const {
|
||||
if constexpr (std::is_same_v<U, FormatEntity::Entry>)
|
||||
return GetFormatEntity();
|
||||
if constexpr (std::is_same_v<U, RegularExpression>)
|
||||
return GetRegexValue();
|
||||
return {};
|
||||
}
|
||||
|
||||
bool SetValueAs(bool v) { return SetBooleanValue(v); }
|
||||
|
||||
bool SetValueAs(llvm::StringRef v) { return SetStringValue(v); }
|
||||
|
||||
bool SetValueAs(lldb::LanguageType v) { return SetLanguageValue(v); }
|
||||
|
||||
template <typename T, std::enable_if_t<std::is_enum_v<T>, bool> = true>
|
||||
bool SetValueAs(T t) {
|
||||
return SetEnumerationValue(t);
|
||||
}
|
||||
|
||||
protected:
|
||||
using TopmostBase = OptionValue;
|
||||
|
||||
|
||||
@@ -122,57 +122,15 @@ public:
|
||||
bool SetPropertyAtIndexFromArgs(uint32_t idx, const Args &args,
|
||||
const ExecutionContext *exe_ctx = nullptr);
|
||||
|
||||
std::optional<bool>
|
||||
GetPropertyAtIndexAsBoolean(uint32_t idx,
|
||||
const ExecutionContext *exe_ctx = nullptr) const;
|
||||
|
||||
bool SetPropertyAtIndexAsBoolean(uint32_t idx, bool new_value,
|
||||
const ExecutionContext *exe_ctx = nullptr);
|
||||
|
||||
OptionValueDictionary *GetPropertyAtIndexAsOptionValueDictionary(
|
||||
uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
|
||||
|
||||
std::optional<int64_t> GetPropertyAtIndexAsEnumeration(
|
||||
uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
|
||||
|
||||
bool
|
||||
SetPropertyAtIndexAsEnumeration(uint32_t idx, int64_t new_value,
|
||||
const ExecutionContext *exe_ctx = nullptr);
|
||||
|
||||
const FormatEntity::Entry *
|
||||
GetPropertyAtIndexAsFormatEntity(uint32_t idx,
|
||||
const ExecutionContext *exe_ctx = nullptr);
|
||||
|
||||
const RegularExpression *GetPropertyAtIndexAsOptionValueRegex(
|
||||
uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
|
||||
|
||||
OptionValueSInt64 *GetPropertyAtIndexAsOptionValueSInt64(
|
||||
uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
|
||||
|
||||
OptionValueUInt64 *GetPropertyAtIndexAsOptionValueUInt64(
|
||||
uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
|
||||
|
||||
std::optional<int64_t>
|
||||
GetPropertyAtIndexAsSInt64(uint32_t idx,
|
||||
const ExecutionContext *exe_ctx = nullptr) const;
|
||||
|
||||
bool SetPropertyAtIndexAsSInt64(uint32_t idx, int64_t new_value,
|
||||
const ExecutionContext *exe_ctx = nullptr);
|
||||
|
||||
std::optional<uint64_t>
|
||||
GetPropertyAtIndexAsUInt64(uint32_t idx,
|
||||
const ExecutionContext *exe_ctx = nullptr) const;
|
||||
|
||||
bool SetPropertyAtIndexAsUInt64(uint32_t idx, uint64_t new_value,
|
||||
const ExecutionContext *exe_ctx = nullptr);
|
||||
|
||||
std::optional<llvm::StringRef>
|
||||
GetPropertyAtIndexAsString(uint32_t idx,
|
||||
const ExecutionContext *exe_ctx = nullptr) const;
|
||||
|
||||
bool SetPropertyAtIndexAsString(uint32_t idx, llvm::StringRef new_value,
|
||||
const ExecutionContext *exe_ctx = nullptr);
|
||||
|
||||
OptionValueString *GetPropertyAtIndexAsOptionValueString(
|
||||
uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
|
||||
|
||||
@@ -201,6 +159,31 @@ public:
|
||||
void SetValueChangedCallback(uint32_t property_idx,
|
||||
std::function<void()> callback);
|
||||
|
||||
template <typename T>
|
||||
auto GetPropertyAtIndexAs(uint32_t idx,
|
||||
const ExecutionContext *exe_ctx = nullptr) const {
|
||||
if (const Property *property = GetPropertyAtIndex(idx, exe_ctx)) {
|
||||
if (OptionValue *value = property->GetValue().get())
|
||||
return value->GetValueAs<T>();
|
||||
}
|
||||
if constexpr (std::is_pointer_v<T>)
|
||||
return T{nullptr};
|
||||
else
|
||||
return std::optional<T>{std::nullopt};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool SetPropertyAtIndex(uint32_t idx, T t,
|
||||
const ExecutionContext *exe_ctx = nullptr) const {
|
||||
if (const Property *property = GetPropertyAtIndex(idx, exe_ctx)) {
|
||||
if (OptionValue *value = property->GetValue().get()) {
|
||||
value->SetValueAs(t);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
Property *ProtectedGetPropertyAtIndex(uint32_t idx) {
|
||||
assert(idx < m_properties.size() && "invalid property index");
|
||||
|
||||
@@ -74,7 +74,7 @@ let Definition = "debugger" in {
|
||||
Global,
|
||||
DefaultEnumValue<"eLanguageTypeUnknown">,
|
||||
Desc<"The language to use for the REPL.">;
|
||||
def StopDisassemblyCount: Property<"stop-disassembly-count", "SInt64">,
|
||||
def StopDisassemblyCount: Property<"stop-disassembly-count", "UInt64">,
|
||||
Global,
|
||||
DefaultUnsignedValue<4>,
|
||||
Desc<"The number of disassembly lines to show when displaying a stopped context.">;
|
||||
@@ -87,11 +87,11 @@ let Definition = "debugger" in {
|
||||
Global,
|
||||
DefaultUnsignedValue<32000>,
|
||||
Desc<"The size limit to use when disassembling large functions (default: 32KB).">;
|
||||
def StopLineCountAfter: Property<"stop-line-count-after", "SInt64">,
|
||||
def StopLineCountAfter: Property<"stop-line-count-after", "UInt64">,
|
||||
Global,
|
||||
DefaultUnsignedValue<3>,
|
||||
Desc<"The number of sources lines to display that come after the current source line when displaying a stopped context.">;
|
||||
def StopLineCountBefore: Property<"stop-line-count-before", "SInt64">,
|
||||
def StopLineCountBefore: Property<"stop-line-count-before", "UInt64">,
|
||||
Global,
|
||||
DefaultUnsignedValue<3>,
|
||||
Desc<"The number of sources lines to display that come before the current source line when displaying a stopped context.">;
|
||||
|
||||
@@ -262,47 +262,47 @@ Status Debugger::SetPropertyValue(const ExecutionContext *exe_ctx,
|
||||
}
|
||||
|
||||
bool Debugger::GetAutoConfirm() const {
|
||||
const uint32_t idx = ePropertyAutoConfirm;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_debugger_properties[idx].default_uint_value != 0);
|
||||
constexpr uint32_t idx = ePropertyAutoConfirm;
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_debugger_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
const FormatEntity::Entry *Debugger::GetDisassemblyFormat() const {
|
||||
const uint32_t idx = ePropertyDisassemblyFormat;
|
||||
return m_collection_sp->GetPropertyAtIndexAsFormatEntity(idx);
|
||||
constexpr uint32_t idx = ePropertyDisassemblyFormat;
|
||||
return GetPropertyAtIndexAs<const FormatEntity::Entry *>(idx);
|
||||
}
|
||||
|
||||
const FormatEntity::Entry *Debugger::GetFrameFormat() const {
|
||||
const uint32_t idx = ePropertyFrameFormat;
|
||||
return m_collection_sp->GetPropertyAtIndexAsFormatEntity(idx);
|
||||
constexpr uint32_t idx = ePropertyFrameFormat;
|
||||
return GetPropertyAtIndexAs<const FormatEntity::Entry *>(idx);
|
||||
}
|
||||
|
||||
const FormatEntity::Entry *Debugger::GetFrameFormatUnique() const {
|
||||
const uint32_t idx = ePropertyFrameFormatUnique;
|
||||
return m_collection_sp->GetPropertyAtIndexAsFormatEntity(idx);
|
||||
constexpr uint32_t idx = ePropertyFrameFormatUnique;
|
||||
return GetPropertyAtIndexAs<const FormatEntity::Entry *>(idx);
|
||||
}
|
||||
|
||||
uint32_t Debugger::GetStopDisassemblyMaxSize() const {
|
||||
const uint32_t idx = ePropertyStopDisassemblyMaxSize;
|
||||
return m_collection_sp->GetPropertyAtIndexAsUInt64(idx).value_or(
|
||||
g_debugger_properties[idx].default_uint_value);
|
||||
uint64_t Debugger::GetStopDisassemblyMaxSize() const {
|
||||
constexpr uint32_t idx = ePropertyStopDisassemblyMaxSize;
|
||||
return GetPropertyAtIndexAs<uint64_t>(
|
||||
idx, g_debugger_properties[idx].default_uint_value);
|
||||
}
|
||||
|
||||
bool Debugger::GetNotifyVoid() const {
|
||||
const uint32_t idx = ePropertyNotiftVoid;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_debugger_properties[idx].default_uint_value != 0);
|
||||
constexpr uint32_t idx = ePropertyNotiftVoid;
|
||||
return GetPropertyAtIndexAs<uint64_t>(
|
||||
idx, g_debugger_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
llvm::StringRef Debugger::GetPrompt() const {
|
||||
const uint32_t idx = ePropertyPrompt;
|
||||
return m_collection_sp->GetPropertyAtIndexAsString(idx).value_or(
|
||||
g_debugger_properties[idx].default_cstr_value);
|
||||
constexpr uint32_t idx = ePropertyPrompt;
|
||||
return GetPropertyAtIndexAs<llvm::StringRef>(
|
||||
idx, g_debugger_properties[idx].default_cstr_value);
|
||||
}
|
||||
|
||||
void Debugger::SetPrompt(llvm::StringRef p) {
|
||||
const uint32_t idx = ePropertyPrompt;
|
||||
m_collection_sp->SetPropertyAtIndexAsString(idx, p);
|
||||
constexpr uint32_t idx = ePropertyPrompt;
|
||||
SetPropertyAtIndex(idx, p);
|
||||
llvm::StringRef new_prompt = GetPrompt();
|
||||
std::string str =
|
||||
lldb_private::ansi::FormatAnsiTerminalCodes(new_prompt, GetUseColor());
|
||||
@@ -312,25 +312,25 @@ void Debugger::SetPrompt(llvm::StringRef p) {
|
||||
}
|
||||
|
||||
const FormatEntity::Entry *Debugger::GetThreadFormat() const {
|
||||
const uint32_t idx = ePropertyThreadFormat;
|
||||
return m_collection_sp->GetPropertyAtIndexAsFormatEntity(idx);
|
||||
constexpr uint32_t idx = ePropertyThreadFormat;
|
||||
return GetPropertyAtIndexAs<const FormatEntity::Entry *>(idx);
|
||||
}
|
||||
|
||||
const FormatEntity::Entry *Debugger::GetThreadStopFormat() const {
|
||||
const uint32_t idx = ePropertyThreadStopFormat;
|
||||
return m_collection_sp->GetPropertyAtIndexAsFormatEntity(idx);
|
||||
constexpr uint32_t idx = ePropertyThreadStopFormat;
|
||||
return GetPropertyAtIndexAs<const FormatEntity::Entry *>(idx);
|
||||
}
|
||||
|
||||
lldb::ScriptLanguage Debugger::GetScriptLanguage() const {
|
||||
const uint32_t idx = ePropertyScriptLanguage;
|
||||
return (lldb::ScriptLanguage)m_collection_sp
|
||||
->GetPropertyAtIndexAsEnumeration(idx)
|
||||
.value_or(g_debugger_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<lldb::ScriptLanguage>(
|
||||
idx, static_cast<lldb::ScriptLanguage>(
|
||||
g_debugger_properties[idx].default_uint_value));
|
||||
}
|
||||
|
||||
bool Debugger::SetScriptLanguage(lldb::ScriptLanguage script_lang) {
|
||||
const uint32_t idx = ePropertyScriptLanguage;
|
||||
return m_collection_sp->SetPropertyAtIndexAsEnumeration(idx, script_lang);
|
||||
return SetPropertyAtIndex(idx, script_lang);
|
||||
}
|
||||
|
||||
lldb::LanguageType Debugger::GetREPLLanguage() const {
|
||||
@@ -344,13 +344,13 @@ lldb::LanguageType Debugger::GetREPLLanguage() const {
|
||||
|
||||
bool Debugger::SetREPLLanguage(lldb::LanguageType repl_lang) {
|
||||
const uint32_t idx = ePropertyREPLLanguage;
|
||||
return m_collection_sp->SetPropertyAtIndexAsLanguage(idx, repl_lang);
|
||||
return SetPropertyAtIndex(idx, repl_lang);
|
||||
}
|
||||
|
||||
uint32_t Debugger::GetTerminalWidth() const {
|
||||
uint64_t Debugger::GetTerminalWidth() const {
|
||||
const uint32_t idx = ePropertyTerminalWidth;
|
||||
return m_collection_sp->GetPropertyAtIndexAsSInt64(idx).value_or(
|
||||
g_debugger_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<int64_t>(
|
||||
idx, g_debugger_properties[idx].default_uint_value);
|
||||
}
|
||||
|
||||
bool Debugger::SetTerminalWidth(uint32_t term_width) {
|
||||
@@ -358,94 +358,94 @@ bool Debugger::SetTerminalWidth(uint32_t term_width) {
|
||||
handler_sp->TerminalSizeChanged();
|
||||
|
||||
const uint32_t idx = ePropertyTerminalWidth;
|
||||
return m_collection_sp->SetPropertyAtIndexAsSInt64(idx, term_width);
|
||||
return SetPropertyAtIndex(idx, term_width);
|
||||
}
|
||||
|
||||
bool Debugger::GetUseExternalEditor() const {
|
||||
const uint32_t idx = ePropertyUseExternalEditor;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_debugger_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_debugger_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
bool Debugger::SetUseExternalEditor(bool b) {
|
||||
const uint32_t idx = ePropertyUseExternalEditor;
|
||||
return m_collection_sp->SetPropertyAtIndexAsBoolean(idx, b);
|
||||
return SetPropertyAtIndex(idx, b);
|
||||
}
|
||||
|
||||
llvm::StringRef Debugger::GetExternalEditor() const {
|
||||
const uint32_t idx = ePropertyExternalEditor;
|
||||
return m_collection_sp->GetPropertyAtIndexAsString(idx).value_or(
|
||||
g_debugger_properties[idx].default_cstr_value);
|
||||
return GetPropertyAtIndexAs<llvm::StringRef>(
|
||||
idx, g_debugger_properties[idx].default_cstr_value);
|
||||
}
|
||||
|
||||
bool Debugger::SetExternalEditor(llvm::StringRef editor) {
|
||||
const uint32_t idx = ePropertyExternalEditor;
|
||||
return m_collection_sp->SetPropertyAtIndexAsString(idx, editor);
|
||||
return SetPropertyAtIndex(idx, editor);
|
||||
}
|
||||
|
||||
bool Debugger::GetUseColor() const {
|
||||
const uint32_t idx = ePropertyUseColor;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_debugger_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_debugger_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
bool Debugger::SetUseColor(bool b) {
|
||||
const uint32_t idx = ePropertyUseColor;
|
||||
bool ret = m_collection_sp->SetPropertyAtIndexAsBoolean(idx, b);
|
||||
bool ret = SetPropertyAtIndex(idx, b);
|
||||
SetPrompt(GetPrompt());
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool Debugger::GetShowProgress() const {
|
||||
const uint32_t idx = ePropertyShowProgress;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_debugger_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_debugger_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
bool Debugger::SetShowProgress(bool show_progress) {
|
||||
const uint32_t idx = ePropertyShowProgress;
|
||||
return m_collection_sp->SetPropertyAtIndexAsBoolean(idx, show_progress);
|
||||
return SetPropertyAtIndex(idx, show_progress);
|
||||
}
|
||||
|
||||
llvm::StringRef Debugger::GetShowProgressAnsiPrefix() const {
|
||||
const uint32_t idx = ePropertyShowProgressAnsiPrefix;
|
||||
return m_collection_sp->GetPropertyAtIndexAsString(idx).value_or(
|
||||
g_debugger_properties[idx].default_cstr_value);
|
||||
return GetPropertyAtIndexAs<llvm::StringRef>(
|
||||
idx, g_debugger_properties[idx].default_cstr_value);
|
||||
}
|
||||
|
||||
llvm::StringRef Debugger::GetShowProgressAnsiSuffix() const {
|
||||
const uint32_t idx = ePropertyShowProgressAnsiSuffix;
|
||||
return m_collection_sp->GetPropertyAtIndexAsString(idx).value_or(
|
||||
g_debugger_properties[idx].default_cstr_value);
|
||||
return GetPropertyAtIndexAs<llvm::StringRef>(
|
||||
idx, g_debugger_properties[idx].default_cstr_value);
|
||||
}
|
||||
|
||||
bool Debugger::GetUseAutosuggestion() const {
|
||||
const uint32_t idx = ePropertyShowAutosuggestion;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_debugger_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_debugger_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
llvm::StringRef Debugger::GetAutosuggestionAnsiPrefix() const {
|
||||
const uint32_t idx = ePropertyShowAutosuggestionAnsiPrefix;
|
||||
return m_collection_sp->GetPropertyAtIndexAsString(idx).value_or(
|
||||
g_debugger_properties[idx].default_cstr_value);
|
||||
return GetPropertyAtIndexAs<llvm::StringRef>(
|
||||
idx, g_debugger_properties[idx].default_cstr_value);
|
||||
}
|
||||
|
||||
llvm::StringRef Debugger::GetAutosuggestionAnsiSuffix() const {
|
||||
const uint32_t idx = ePropertyShowAutosuggestionAnsiSuffix;
|
||||
return m_collection_sp->GetPropertyAtIndexAsString(idx).value_or(
|
||||
g_debugger_properties[idx].default_cstr_value);
|
||||
return GetPropertyAtIndexAs<llvm::StringRef>(
|
||||
idx, g_debugger_properties[idx].default_cstr_value);
|
||||
}
|
||||
|
||||
bool Debugger::GetUseSourceCache() const {
|
||||
const uint32_t idx = ePropertyUseSourceCache;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_debugger_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_debugger_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
bool Debugger::SetUseSourceCache(bool b) {
|
||||
const uint32_t idx = ePropertyUseSourceCache;
|
||||
bool ret = m_collection_sp->SetPropertyAtIndexAsBoolean(idx, b);
|
||||
bool ret = SetPropertyAtIndex(idx, b);
|
||||
if (!ret) {
|
||||
m_source_file_cache.Clear();
|
||||
}
|
||||
@@ -453,111 +453,111 @@ bool Debugger::SetUseSourceCache(bool b) {
|
||||
}
|
||||
bool Debugger::GetHighlightSource() const {
|
||||
const uint32_t idx = ePropertyHighlightSource;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_debugger_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_debugger_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
StopShowColumn Debugger::GetStopShowColumn() const {
|
||||
const uint32_t idx = ePropertyStopShowColumn;
|
||||
return (lldb::StopShowColumn)m_collection_sp
|
||||
->GetPropertyAtIndexAsEnumeration(idx)
|
||||
.value_or(g_debugger_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<lldb::StopShowColumn>(
|
||||
idx, static_cast<lldb::StopShowColumn>(
|
||||
g_debugger_properties[idx].default_uint_value));
|
||||
}
|
||||
|
||||
llvm::StringRef Debugger::GetStopShowColumnAnsiPrefix() const {
|
||||
const uint32_t idx = ePropertyStopShowColumnAnsiPrefix;
|
||||
return m_collection_sp->GetPropertyAtIndexAsString(idx).value_or(
|
||||
g_debugger_properties[idx].default_cstr_value);
|
||||
return GetPropertyAtIndexAs<llvm::StringRef>(
|
||||
idx, g_debugger_properties[idx].default_cstr_value);
|
||||
}
|
||||
|
||||
llvm::StringRef Debugger::GetStopShowColumnAnsiSuffix() const {
|
||||
const uint32_t idx = ePropertyStopShowColumnAnsiSuffix;
|
||||
return m_collection_sp->GetPropertyAtIndexAsString(idx).value_or(
|
||||
g_debugger_properties[idx].default_cstr_value);
|
||||
return GetPropertyAtIndexAs<llvm::StringRef>(
|
||||
idx, g_debugger_properties[idx].default_cstr_value);
|
||||
}
|
||||
|
||||
llvm::StringRef Debugger::GetStopShowLineMarkerAnsiPrefix() const {
|
||||
const uint32_t idx = ePropertyStopShowLineMarkerAnsiPrefix;
|
||||
return m_collection_sp->GetPropertyAtIndexAsString(idx).value_or(
|
||||
g_debugger_properties[idx].default_cstr_value);
|
||||
return GetPropertyAtIndexAs<llvm::StringRef>(
|
||||
idx, g_debugger_properties[idx].default_cstr_value);
|
||||
}
|
||||
|
||||
llvm::StringRef Debugger::GetStopShowLineMarkerAnsiSuffix() const {
|
||||
const uint32_t idx = ePropertyStopShowLineMarkerAnsiSuffix;
|
||||
return m_collection_sp->GetPropertyAtIndexAsString(idx).value_or(
|
||||
g_debugger_properties[idx].default_cstr_value);
|
||||
return GetPropertyAtIndexAs<llvm::StringRef>(
|
||||
idx, g_debugger_properties[idx].default_cstr_value);
|
||||
}
|
||||
|
||||
uint32_t Debugger::GetStopSourceLineCount(bool before) const {
|
||||
uint64_t Debugger::GetStopSourceLineCount(bool before) const {
|
||||
const uint32_t idx =
|
||||
before ? ePropertyStopLineCountBefore : ePropertyStopLineCountAfter;
|
||||
return m_collection_sp->GetPropertyAtIndexAsSInt64(idx).value_or(
|
||||
g_debugger_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<uint64_t>(
|
||||
idx, g_debugger_properties[idx].default_uint_value);
|
||||
}
|
||||
|
||||
Debugger::StopDisassemblyType Debugger::GetStopDisassemblyDisplay() const {
|
||||
const uint32_t idx = ePropertyStopDisassemblyDisplay;
|
||||
return (Debugger::StopDisassemblyType)m_collection_sp
|
||||
->GetPropertyAtIndexAsEnumeration(idx)
|
||||
.value_or(g_debugger_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<Debugger::StopDisassemblyType>(
|
||||
idx, static_cast<Debugger::StopDisassemblyType>(
|
||||
g_debugger_properties[idx].default_uint_value));
|
||||
}
|
||||
|
||||
uint32_t Debugger::GetDisassemblyLineCount() const {
|
||||
uint64_t Debugger::GetDisassemblyLineCount() const {
|
||||
const uint32_t idx = ePropertyStopDisassemblyCount;
|
||||
return m_collection_sp->GetPropertyAtIndexAsSInt64(idx).value_or(
|
||||
g_debugger_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<uint64_t>(
|
||||
idx, g_debugger_properties[idx].default_uint_value);
|
||||
}
|
||||
|
||||
bool Debugger::GetAutoOneLineSummaries() const {
|
||||
const uint32_t idx = ePropertyAutoOneLineSummaries;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_debugger_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_debugger_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
bool Debugger::GetEscapeNonPrintables() const {
|
||||
const uint32_t idx = ePropertyEscapeNonPrintables;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_debugger_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_debugger_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
bool Debugger::GetAutoIndent() const {
|
||||
const uint32_t idx = ePropertyAutoIndent;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_debugger_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_debugger_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
bool Debugger::SetAutoIndent(bool b) {
|
||||
const uint32_t idx = ePropertyAutoIndent;
|
||||
return m_collection_sp->SetPropertyAtIndexAsBoolean(idx, b);
|
||||
return SetPropertyAtIndex(idx, b);
|
||||
}
|
||||
|
||||
bool Debugger::GetPrintDecls() const {
|
||||
const uint32_t idx = ePropertyPrintDecls;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_debugger_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_debugger_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
bool Debugger::SetPrintDecls(bool b) {
|
||||
const uint32_t idx = ePropertyPrintDecls;
|
||||
return m_collection_sp->SetPropertyAtIndexAsBoolean(idx, b);
|
||||
return SetPropertyAtIndex(idx, b);
|
||||
}
|
||||
|
||||
uint32_t Debugger::GetTabSize() const {
|
||||
uint64_t Debugger::GetTabSize() const {
|
||||
const uint32_t idx = ePropertyTabSize;
|
||||
return m_collection_sp->GetPropertyAtIndexAsUInt64(idx).value_or(
|
||||
g_debugger_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<uint64_t>(
|
||||
idx, g_debugger_properties[idx].default_uint_value);
|
||||
}
|
||||
|
||||
bool Debugger::SetTabSize(uint32_t tab_size) {
|
||||
const uint32_t idx = ePropertyTabSize;
|
||||
return m_collection_sp->SetPropertyAtIndexAsUInt64(idx, tab_size);
|
||||
return SetPropertyAtIndex(idx, tab_size);
|
||||
}
|
||||
|
||||
lldb::DWIMPrintVerbosity Debugger::GetDWIMPrintVerbosity() const {
|
||||
const uint32_t idx = ePropertyDWIMPrintVerbosity;
|
||||
return (lldb::DWIMPrintVerbosity)m_collection_sp
|
||||
->GetPropertyAtIndexAsEnumeration(idx)
|
||||
.value_or(g_debugger_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<lldb::DWIMPrintVerbosity>(
|
||||
idx, static_cast<lldb::DWIMPrintVerbosity>(
|
||||
g_debugger_properties[idx].default_uint_value));
|
||||
}
|
||||
|
||||
#pragma mark Debugger
|
||||
@@ -815,6 +815,21 @@ Debugger::Debugger(lldb::LogOutputCallback log_callback, void *baton)
|
||||
// Initialize the debugger properties as early as possible as other parts of
|
||||
// LLDB will start querying them during construction.
|
||||
m_collection_sp->Initialize(g_debugger_properties);
|
||||
m_collection_sp->AppendProperty(
|
||||
ConstString("target"), "Settings specify to debugging targets.", true,
|
||||
Target::GetGlobalProperties().GetValueProperties());
|
||||
m_collection_sp->AppendProperty(
|
||||
ConstString("platform"), "Platform settings.", true,
|
||||
Platform::GetGlobalPlatformProperties().GetValueProperties());
|
||||
m_collection_sp->AppendProperty(
|
||||
ConstString("symbols"), "Symbol lookup and cache settings.", true,
|
||||
ModuleList::GetGlobalModuleListProperties().GetValueProperties());
|
||||
if (m_command_interpreter_up) {
|
||||
m_collection_sp->AppendProperty(
|
||||
ConstString("interpreter"),
|
||||
"Settings specify to the debugger's command interpreter.", true,
|
||||
m_command_interpreter_up->GetValueProperties());
|
||||
}
|
||||
if (log_callback)
|
||||
m_callback_handler_sp =
|
||||
std::make_shared<CallbackLogHandler>(log_callback, baton);
|
||||
@@ -836,21 +851,6 @@ Debugger::Debugger(lldb::LogOutputCallback log_callback, void *baton)
|
||||
}
|
||||
assert(m_dummy_target_sp.get() && "Couldn't construct dummy target?");
|
||||
|
||||
m_collection_sp->AppendProperty(
|
||||
ConstString("target"), "Settings specify to debugging targets.", true,
|
||||
Target::GetGlobalProperties().GetValueProperties());
|
||||
m_collection_sp->AppendProperty(
|
||||
ConstString("platform"), "Platform settings.", true,
|
||||
Platform::GetGlobalPlatformProperties().GetValueProperties());
|
||||
m_collection_sp->AppendProperty(
|
||||
ConstString("symbols"), "Symbol lookup and cache settings.", true,
|
||||
ModuleList::GetGlobalModuleListProperties().GetValueProperties());
|
||||
if (m_command_interpreter_up) {
|
||||
m_collection_sp->AppendProperty(
|
||||
ConstString("interpreter"),
|
||||
"Settings specify to the debugger's command interpreter.", true,
|
||||
m_command_interpreter_up->GetValueProperties());
|
||||
}
|
||||
OptionValueSInt64 *term_width =
|
||||
m_collection_sp->GetPropertyAtIndexAsOptionValueSInt64(
|
||||
ePropertyTerminalWidth);
|
||||
|
||||
@@ -97,19 +97,18 @@ ModuleListProperties::ModuleListProperties() {
|
||||
|
||||
bool ModuleListProperties::GetEnableExternalLookup() const {
|
||||
const uint32_t idx = ePropertyEnableExternalLookup;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_modulelist_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_modulelist_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
bool ModuleListProperties::SetEnableExternalLookup(bool new_value) {
|
||||
return m_collection_sp->SetPropertyAtIndexAsBoolean(
|
||||
ePropertyEnableExternalLookup, new_value);
|
||||
return SetPropertyAtIndex(ePropertyEnableExternalLookup, new_value);
|
||||
}
|
||||
|
||||
bool ModuleListProperties::GetEnableBackgroundLookup() const {
|
||||
const uint32_t idx = ePropertyEnableBackgroundLookup;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_modulelist_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_modulelist_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
FileSpec ModuleListProperties::GetClangModulesCachePath() const {
|
||||
@@ -136,31 +135,30 @@ bool ModuleListProperties::SetLLDBIndexCachePath(const FileSpec &path) {
|
||||
|
||||
bool ModuleListProperties::GetEnableLLDBIndexCache() const {
|
||||
const uint32_t idx = ePropertyEnableLLDBIndexCache;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_modulelist_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_modulelist_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
bool ModuleListProperties::SetEnableLLDBIndexCache(bool new_value) {
|
||||
return m_collection_sp->SetPropertyAtIndexAsBoolean(
|
||||
ePropertyEnableLLDBIndexCache, new_value);
|
||||
return SetPropertyAtIndex(ePropertyEnableLLDBIndexCache, new_value);
|
||||
}
|
||||
|
||||
uint64_t ModuleListProperties::GetLLDBIndexCacheMaxByteSize() {
|
||||
const uint32_t idx = ePropertyLLDBIndexCacheMaxByteSize;
|
||||
return m_collection_sp->GetPropertyAtIndexAsUInt64(idx).value_or(
|
||||
g_modulelist_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<uint64_t>(
|
||||
idx, g_modulelist_properties[idx].default_uint_value);
|
||||
}
|
||||
|
||||
uint64_t ModuleListProperties::GetLLDBIndexCacheMaxPercent() {
|
||||
const uint32_t idx = ePropertyLLDBIndexCacheMaxPercent;
|
||||
return m_collection_sp->GetPropertyAtIndexAsUInt64(idx).value_or(
|
||||
g_modulelist_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<uint64_t>(
|
||||
idx, g_modulelist_properties[idx].default_uint_value);
|
||||
}
|
||||
|
||||
uint64_t ModuleListProperties::GetLLDBIndexCacheExpirationDays() {
|
||||
const uint32_t idx = ePropertyLLDBIndexCacheExpirationDays;
|
||||
return m_collection_sp->GetPropertyAtIndexAsUInt64(idx).value_or(
|
||||
g_modulelist_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<uint64_t>(
|
||||
idx, g_modulelist_properties[idx].default_uint_value);
|
||||
}
|
||||
|
||||
void ModuleListProperties::UpdateSymlinkMappings() {
|
||||
@@ -186,8 +184,8 @@ PathMappingList ModuleListProperties::GetSymlinkMappings() const {
|
||||
|
||||
bool ModuleListProperties::GetLoadSymbolOnDemand() {
|
||||
const uint32_t idx = ePropertyLoadSymbolOnDemand;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_modulelist_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_modulelist_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
ModuleList::ModuleList() : m_modules(), m_modules_mutex() {}
|
||||
|
||||
@@ -146,41 +146,41 @@ CommandInterpreter::CommandInterpreter(Debugger &debugger,
|
||||
|
||||
bool CommandInterpreter::GetExpandRegexAliases() const {
|
||||
const uint32_t idx = ePropertyExpandRegexAliases;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_interpreter_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_interpreter_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
bool CommandInterpreter::GetPromptOnQuit() const {
|
||||
const uint32_t idx = ePropertyPromptOnQuit;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_interpreter_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_interpreter_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
void CommandInterpreter::SetPromptOnQuit(bool enable) {
|
||||
const uint32_t idx = ePropertyPromptOnQuit;
|
||||
m_collection_sp->SetPropertyAtIndexAsBoolean(idx, enable);
|
||||
SetPropertyAtIndex(idx, enable);
|
||||
}
|
||||
|
||||
bool CommandInterpreter::GetSaveSessionOnQuit() const {
|
||||
const uint32_t idx = ePropertySaveSessionOnQuit;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_interpreter_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_interpreter_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
void CommandInterpreter::SetSaveSessionOnQuit(bool enable) {
|
||||
const uint32_t idx = ePropertySaveSessionOnQuit;
|
||||
m_collection_sp->SetPropertyAtIndexAsBoolean(idx, enable);
|
||||
SetPropertyAtIndex(idx, enable);
|
||||
}
|
||||
|
||||
bool CommandInterpreter::GetOpenTranscriptInEditor() const {
|
||||
const uint32_t idx = ePropertyOpenTranscriptInEditor;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_interpreter_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_interpreter_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
void CommandInterpreter::SetOpenTranscriptInEditor(bool enable) {
|
||||
const uint32_t idx = ePropertyOpenTranscriptInEditor;
|
||||
m_collection_sp->SetPropertyAtIndexAsBoolean(idx, enable);
|
||||
SetPropertyAtIndex(idx, enable);
|
||||
}
|
||||
|
||||
FileSpec CommandInterpreter::GetSaveSessionDirectory() const {
|
||||
@@ -190,29 +190,29 @@ FileSpec CommandInterpreter::GetSaveSessionDirectory() const {
|
||||
|
||||
void CommandInterpreter::SetSaveSessionDirectory(llvm::StringRef path) {
|
||||
const uint32_t idx = ePropertySaveSessionDirectory;
|
||||
m_collection_sp->SetPropertyAtIndexAsString(idx, path);
|
||||
SetPropertyAtIndex(idx, path);
|
||||
}
|
||||
|
||||
bool CommandInterpreter::GetEchoCommands() const {
|
||||
const uint32_t idx = ePropertyEchoCommands;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_interpreter_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_interpreter_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
void CommandInterpreter::SetEchoCommands(bool enable) {
|
||||
const uint32_t idx = ePropertyEchoCommands;
|
||||
m_collection_sp->SetPropertyAtIndexAsBoolean(idx, enable);
|
||||
SetPropertyAtIndex(idx, enable);
|
||||
}
|
||||
|
||||
bool CommandInterpreter::GetEchoCommentCommands() const {
|
||||
const uint32_t idx = ePropertyEchoCommentCommands;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_interpreter_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_interpreter_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
void CommandInterpreter::SetEchoCommentCommands(bool enable) {
|
||||
const uint32_t idx = ePropertyEchoCommentCommands;
|
||||
m_collection_sp->SetPropertyAtIndexAsBoolean(idx, enable);
|
||||
SetPropertyAtIndex(idx, enable);
|
||||
}
|
||||
|
||||
void CommandInterpreter::AllowExitCodeOnQuit(bool allow) {
|
||||
@@ -246,26 +246,26 @@ void CommandInterpreter::ResolveCommand(const char *command_line,
|
||||
|
||||
bool CommandInterpreter::GetStopCmdSourceOnError() const {
|
||||
const uint32_t idx = ePropertyStopCmdSourceOnError;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_interpreter_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_interpreter_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
bool CommandInterpreter::GetSpaceReplPrompts() const {
|
||||
const uint32_t idx = ePropertySpaceReplPrompts;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_interpreter_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_interpreter_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
bool CommandInterpreter::GetRepeatPreviousCommand() const {
|
||||
const uint32_t idx = ePropertyRepeatPreviousCommand;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_interpreter_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_interpreter_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
bool CommandInterpreter::GetRequireCommandOverwrite() const {
|
||||
const uint32_t idx = ePropertyRequireCommandOverwrite;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_interpreter_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_interpreter_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
void CommandInterpreter::Initialize() {
|
||||
|
||||
@@ -277,28 +277,6 @@ bool OptionValueProperties::SetPropertyAtIndexFromArgs(
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<bool> OptionValueProperties::GetPropertyAtIndexAsBoolean(
|
||||
uint32_t idx, const ExecutionContext *exe_ctx) const {
|
||||
if (const Property *property = GetPropertyAtIndex(idx, exe_ctx)) {
|
||||
if (OptionValue *value = property->GetValue().get())
|
||||
return value->GetBooleanValue();
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
bool OptionValueProperties::SetPropertyAtIndexAsBoolean(
|
||||
uint32_t idx, bool new_value, const ExecutionContext *exe_ctx) {
|
||||
const Property *property = GetPropertyAtIndex(idx, exe_ctx);
|
||||
if (property) {
|
||||
OptionValue *value = property->GetValue().get();
|
||||
if (value) {
|
||||
value->SetBooleanValue(new_value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
OptionValueDictionary *
|
||||
OptionValueProperties::GetPropertyAtIndexAsOptionValueDictionary(
|
||||
uint32_t idx, const ExecutionContext *exe_ctx) const {
|
||||
@@ -308,38 +286,6 @@ OptionValueProperties::GetPropertyAtIndexAsOptionValueDictionary(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::optional<int64_t> OptionValueProperties::GetPropertyAtIndexAsEnumeration(
|
||||
uint32_t idx, const ExecutionContext *exe_ctx) const {
|
||||
if (const Property *property = GetPropertyAtIndex(idx, exe_ctx)) {
|
||||
if (OptionValue *value = property->GetValue().get())
|
||||
return value->GetEnumerationValue();
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
bool OptionValueProperties::SetPropertyAtIndexAsEnumeration(
|
||||
uint32_t idx, int64_t new_value, const ExecutionContext *exe_ctx) {
|
||||
const Property *property = GetPropertyAtIndex(idx, exe_ctx);
|
||||
if (property) {
|
||||
OptionValue *value = property->GetValue().get();
|
||||
if (value)
|
||||
return value->SetEnumerationValue(new_value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const FormatEntity::Entry *
|
||||
OptionValueProperties::GetPropertyAtIndexAsFormatEntity(
|
||||
uint32_t idx, const ExecutionContext *exe_ctx) {
|
||||
const Property *property = GetPropertyAtIndex(idx, exe_ctx);
|
||||
if (property) {
|
||||
OptionValue *value = property->GetValue().get();
|
||||
if (value)
|
||||
return value->GetFormatEntity();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
OptionValueFileSpec *
|
||||
OptionValueProperties::GetPropertyAtIndexAsOptionValueFileSpec(
|
||||
uint32_t idx, const ExecutionContext *exe_ctx) const {
|
||||
@@ -375,18 +321,6 @@ bool OptionValueProperties::SetPropertyAtIndexAsFileSpec(
|
||||
return false;
|
||||
}
|
||||
|
||||
const RegularExpression *
|
||||
OptionValueProperties::GetPropertyAtIndexAsOptionValueRegex(
|
||||
uint32_t idx, const ExecutionContext *exe_ctx) const {
|
||||
const Property *property = GetPropertyAtIndex(idx, exe_ctx);
|
||||
if (property) {
|
||||
OptionValue *value = property->GetValue().get();
|
||||
if (value)
|
||||
return value->GetRegexValue();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
OptionValueSInt64 *OptionValueProperties::GetPropertyAtIndexAsOptionValueSInt64(
|
||||
uint32_t idx, const ExecutionContext *exe_ctx) const {
|
||||
const Property *property = GetPropertyAtIndex(idx, exe_ctx);
|
||||
@@ -409,47 +343,6 @@ OptionValueUInt64 *OptionValueProperties::GetPropertyAtIndexAsOptionValueUInt64(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::optional<int64_t> OptionValueProperties::GetPropertyAtIndexAsSInt64(
|
||||
uint32_t idx, const ExecutionContext *exe_ctx) const {
|
||||
if (const Property *property = GetPropertyAtIndex(idx, exe_ctx)) {
|
||||
if (OptionValue *value = property->GetValue().get())
|
||||
return value->GetSInt64Value();
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
bool OptionValueProperties::SetPropertyAtIndexAsSInt64(
|
||||
uint32_t idx, int64_t new_value, const ExecutionContext *exe_ctx) {
|
||||
const Property *property = GetPropertyAtIndex(idx, exe_ctx);
|
||||
if (property) {
|
||||
OptionValue *value = property->GetValue().get();
|
||||
if (value)
|
||||
return value->SetSInt64Value(new_value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<llvm::StringRef>
|
||||
OptionValueProperties::GetPropertyAtIndexAsString(
|
||||
uint32_t idx, const ExecutionContext *exe_ctx) const {
|
||||
if (const Property *property = GetPropertyAtIndex(idx, exe_ctx)) {
|
||||
if (OptionValue *value = property->GetValue().get())
|
||||
return value->GetStringValue();
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
bool OptionValueProperties::SetPropertyAtIndexAsString(
|
||||
uint32_t idx, llvm::StringRef new_value, const ExecutionContext *exe_ctx) {
|
||||
const Property *property = GetPropertyAtIndex(idx, exe_ctx);
|
||||
if (property) {
|
||||
OptionValue *value = property->GetValue().get();
|
||||
if (value)
|
||||
return value->SetStringValue(new_value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
OptionValueString *OptionValueProperties::GetPropertyAtIndexAsOptionValueString(
|
||||
uint32_t idx, const ExecutionContext *exe_ctx) const {
|
||||
OptionValueSP value_sp(GetPropertyValueAtIndex(idx, exe_ctx));
|
||||
@@ -458,26 +351,6 @@ OptionValueString *OptionValueProperties::GetPropertyAtIndexAsOptionValueString(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::optional<uint64_t> OptionValueProperties::GetPropertyAtIndexAsUInt64(
|
||||
uint32_t idx, const ExecutionContext *exe_ctx) const {
|
||||
if (const Property *property = GetPropertyAtIndex(idx, exe_ctx)) {
|
||||
if (OptionValue *value = property->GetValue().get())
|
||||
return value->GetUInt64Value();
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
bool OptionValueProperties::SetPropertyAtIndexAsUInt64(
|
||||
uint32_t idx, uint64_t new_value, const ExecutionContext *exe_ctx) {
|
||||
const Property *property = GetPropertyAtIndex(idx, exe_ctx);
|
||||
if (property) {
|
||||
OptionValue *value = property->GetValue().get();
|
||||
if (value)
|
||||
return value->SetUInt64Value(new_value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void OptionValueProperties::Clear() {
|
||||
const size_t num_properties = m_properties.size();
|
||||
for (size_t i = 0; i < num_properties; ++i)
|
||||
|
||||
@@ -226,6 +226,7 @@ Property::Property(const PropertyDefinition &definition)
|
||||
}
|
||||
break;
|
||||
}
|
||||
assert(m_value_sp && "invalid property definition");
|
||||
}
|
||||
|
||||
Property::Property(llvm::StringRef name, llvm::StringRef desc, bool is_global,
|
||||
|
||||
@@ -113,15 +113,17 @@ public:
|
||||
|
||||
bool GetLoadKexts() const {
|
||||
const uint32_t idx = ePropertyLoadKexts;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx,
|
||||
g_dynamicloaderdarwinkernel_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
KASLRScanType GetScanType() const {
|
||||
const uint32_t idx = ePropertyScanType;
|
||||
return (KASLRScanType)m_collection_sp->GetPropertyAtIndexAsEnumeration(idx)
|
||||
.value_or(
|
||||
g_dynamicloaderdarwinkernel_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<KASLRScanType>(
|
||||
idx,
|
||||
static_cast<KASLRScanType>(
|
||||
g_dynamicloaderdarwinkernel_properties[idx].default_uint_value));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -99,10 +99,10 @@ public:
|
||||
}
|
||||
|
||||
EnableJITLoaderGDB GetEnable() const {
|
||||
return (EnableJITLoaderGDB)m_collection_sp
|
||||
->GetPropertyAtIndexAsEnumeration(ePropertyEnable)
|
||||
.value_or(
|
||||
g_jitloadergdb_properties[ePropertyEnable].default_uint_value);
|
||||
return GetPropertyAtIndexAs<EnableJITLoaderGDB>(
|
||||
ePropertyEnable,
|
||||
static_cast<EnableJITLoaderGDB>(
|
||||
g_jitloadergdb_properties[ePropertyEnable].default_uint_value));
|
||||
}
|
||||
};
|
||||
} // namespace
|
||||
|
||||
@@ -90,9 +90,8 @@ public:
|
||||
}
|
||||
|
||||
llvm::Triple::EnvironmentType ABI() const {
|
||||
return (llvm::Triple::EnvironmentType)m_collection_sp
|
||||
->GetPropertyAtIndexAsEnumeration(ePropertyABI)
|
||||
.value_or(llvm::Triple::UnknownEnvironment);
|
||||
return GetPropertyAtIndexAs<llvm::Triple::EnvironmentType>(
|
||||
ePropertyABI, llvm::Triple::UnknownEnvironment);
|
||||
}
|
||||
|
||||
OptionValueDictionary *ModuleABIMap() const {
|
||||
|
||||
@@ -41,8 +41,7 @@ public:
|
||||
}
|
||||
|
||||
llvm::StringRef GetArchitecture() {
|
||||
return m_collection_sp->GetPropertyAtIndexAsString(ePropertyArchitecture)
|
||||
.value_or("");
|
||||
return GetPropertyAtIndexAs<llvm::StringRef>(ePropertyArchitecture, "");
|
||||
}
|
||||
|
||||
FileSpec GetEmulatorPath() {
|
||||
|
||||
@@ -78,8 +78,8 @@ public:
|
||||
|
||||
uint64_t GetPacketTimeout() {
|
||||
const uint32_t idx = ePropertyKDPPacketTimeout;
|
||||
return m_collection_sp->GetPropertyAtIndexAsUInt64(idx).value_or(
|
||||
g_processkdp_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<uint64_t>(
|
||||
idx, g_processkdp_properties[idx].default_uint_value);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -142,13 +142,13 @@ public:
|
||||
|
||||
uint64_t GetPacketTimeout() {
|
||||
const uint32_t idx = ePropertyPacketTimeout;
|
||||
return m_collection_sp->GetPropertyAtIndexAsUInt64(idx).value_or(
|
||||
g_processgdbremote_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<uint64_t>(
|
||||
idx, g_processgdbremote_properties[idx].default_uint_value);
|
||||
}
|
||||
|
||||
bool SetPacketTimeout(uint64_t timeout) {
|
||||
const uint32_t idx = ePropertyPacketTimeout;
|
||||
return m_collection_sp->SetPropertyAtIndexAsUInt64(idx, timeout);
|
||||
return SetPropertyAtIndex(idx, timeout);
|
||||
}
|
||||
|
||||
FileSpec GetTargetDefinitionFile() const {
|
||||
@@ -158,13 +158,13 @@ public:
|
||||
|
||||
bool GetUseSVR4() const {
|
||||
const uint32_t idx = ePropertyUseSVR4;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_processgdbremote_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_processgdbremote_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
bool GetUseGPacketForReading() const {
|
||||
const uint32_t idx = ePropertyUseGPacketForReading;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(true);
|
||||
return GetPropertyAtIndexAs<bool>(idx, true);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -131,14 +131,14 @@ public:
|
||||
|
||||
bool GetEnableOnStartup() const {
|
||||
const uint32_t idx = ePropertyEnableOnStartup;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_darwinlog_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_darwinlog_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
llvm::StringRef GetAutoEnableOptions() const {
|
||||
const uint32_t idx = ePropertyAutoEnableOptions;
|
||||
return m_collection_sp->GetPropertyAtIndexAsString(idx).value_or(
|
||||
g_darwinlog_properties[idx].default_cstr_value);
|
||||
return GetPropertyAtIndexAs<llvm::StringRef>(
|
||||
idx, g_darwinlog_properties[idx].default_cstr_value);
|
||||
}
|
||||
|
||||
const char *GetLoggingModuleName() const { return "libsystem_trace.dylib"; }
|
||||
|
||||
@@ -125,8 +125,7 @@ public:
|
||||
}
|
||||
|
||||
bool IgnoreFileIndexes() const {
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(ePropertyIgnoreIndexes)
|
||||
.value_or(false);
|
||||
return GetPropertyAtIndexAs<bool>(ePropertyIgnoreIndexes, false);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -99,13 +99,12 @@ PlatformProperties::PlatformProperties() {
|
||||
|
||||
bool PlatformProperties::GetUseModuleCache() const {
|
||||
const auto idx = ePropertyUseModuleCache;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_platform_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_platform_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
bool PlatformProperties::SetUseModuleCache(bool use_module_cache) {
|
||||
return m_collection_sp->SetPropertyAtIndexAsBoolean(ePropertyUseModuleCache,
|
||||
use_module_cache);
|
||||
return SetPropertyAtIndex(ePropertyUseModuleCache, use_module_cache);
|
||||
}
|
||||
|
||||
FileSpec PlatformProperties::GetModuleCacheDirectory() const {
|
||||
|
||||
@@ -190,14 +190,14 @@ ProcessProperties::~ProcessProperties() = default;
|
||||
|
||||
bool ProcessProperties::GetDisableMemoryCache() const {
|
||||
const uint32_t idx = ePropertyDisableMemCache;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_process_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_process_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
uint64_t ProcessProperties::GetMemoryCacheLineSize() const {
|
||||
const uint32_t idx = ePropertyMemCacheLineSize;
|
||||
return m_collection_sp->GetPropertyAtIndexAsUInt64(idx).value_or(
|
||||
g_process_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<uint64_t>(
|
||||
idx, g_process_properties[idx].default_uint_value);
|
||||
}
|
||||
|
||||
Args ProcessProperties::GetExtraStartupCommands() const {
|
||||
@@ -219,13 +219,13 @@ FileSpec ProcessProperties::GetPythonOSPluginPath() const {
|
||||
|
||||
uint32_t ProcessProperties::GetVirtualAddressableBits() const {
|
||||
const uint32_t idx = ePropertyVirtualAddressableBits;
|
||||
return m_collection_sp->GetPropertyAtIndexAsUInt64(idx).value_or(
|
||||
g_process_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<uint64_t>(
|
||||
idx, g_process_properties[idx].default_uint_value);
|
||||
}
|
||||
|
||||
void ProcessProperties::SetVirtualAddressableBits(uint32_t bits) {
|
||||
const uint32_t idx = ePropertyVirtualAddressableBits;
|
||||
m_collection_sp->SetPropertyAtIndexAsUInt64(idx, bits);
|
||||
SetPropertyAtIndex(idx, bits);
|
||||
}
|
||||
void ProcessProperties::SetPythonOSPluginPath(const FileSpec &file) {
|
||||
const uint32_t idx = ePropertyPythonOSPluginPath;
|
||||
@@ -234,96 +234,96 @@ void ProcessProperties::SetPythonOSPluginPath(const FileSpec &file) {
|
||||
|
||||
bool ProcessProperties::GetIgnoreBreakpointsInExpressions() const {
|
||||
const uint32_t idx = ePropertyIgnoreBreakpointsInExpressions;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_process_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_process_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
void ProcessProperties::SetIgnoreBreakpointsInExpressions(bool ignore) {
|
||||
const uint32_t idx = ePropertyIgnoreBreakpointsInExpressions;
|
||||
m_collection_sp->SetPropertyAtIndexAsBoolean(idx, ignore);
|
||||
SetPropertyAtIndex(idx, ignore);
|
||||
}
|
||||
|
||||
bool ProcessProperties::GetUnwindOnErrorInExpressions() const {
|
||||
const uint32_t idx = ePropertyUnwindOnErrorInExpressions;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_process_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_process_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
void ProcessProperties::SetUnwindOnErrorInExpressions(bool ignore) {
|
||||
const uint32_t idx = ePropertyUnwindOnErrorInExpressions;
|
||||
m_collection_sp->SetPropertyAtIndexAsBoolean(idx, ignore);
|
||||
SetPropertyAtIndex(idx, ignore);
|
||||
}
|
||||
|
||||
bool ProcessProperties::GetStopOnSharedLibraryEvents() const {
|
||||
const uint32_t idx = ePropertyStopOnSharedLibraryEvents;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_process_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_process_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
void ProcessProperties::SetStopOnSharedLibraryEvents(bool stop) {
|
||||
const uint32_t idx = ePropertyStopOnSharedLibraryEvents;
|
||||
m_collection_sp->SetPropertyAtIndexAsBoolean(idx, stop);
|
||||
SetPropertyAtIndex(idx, stop);
|
||||
}
|
||||
|
||||
bool ProcessProperties::GetDisableLangRuntimeUnwindPlans() const {
|
||||
const uint32_t idx = ePropertyDisableLangRuntimeUnwindPlans;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_process_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_process_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
void ProcessProperties::SetDisableLangRuntimeUnwindPlans(bool disable) {
|
||||
const uint32_t idx = ePropertyDisableLangRuntimeUnwindPlans;
|
||||
m_collection_sp->SetPropertyAtIndexAsBoolean(idx, disable);
|
||||
SetPropertyAtIndex(idx, disable);
|
||||
m_process->Flush();
|
||||
}
|
||||
|
||||
bool ProcessProperties::GetDetachKeepsStopped() const {
|
||||
const uint32_t idx = ePropertyDetachKeepsStopped;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_process_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_process_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
void ProcessProperties::SetDetachKeepsStopped(bool stop) {
|
||||
const uint32_t idx = ePropertyDetachKeepsStopped;
|
||||
m_collection_sp->SetPropertyAtIndexAsBoolean(idx, stop);
|
||||
SetPropertyAtIndex(idx, stop);
|
||||
}
|
||||
|
||||
bool ProcessProperties::GetWarningsOptimization() const {
|
||||
const uint32_t idx = ePropertyWarningOptimization;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_process_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_process_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
bool ProcessProperties::GetWarningsUnsupportedLanguage() const {
|
||||
const uint32_t idx = ePropertyWarningUnsupportedLanguage;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_process_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_process_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
bool ProcessProperties::GetStopOnExec() const {
|
||||
const uint32_t idx = ePropertyStopOnExec;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_process_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_process_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
std::chrono::seconds ProcessProperties::GetUtilityExpressionTimeout() const {
|
||||
const uint32_t idx = ePropertyUtilityExpressionTimeout;
|
||||
uint64_t value = m_collection_sp->GetPropertyAtIndexAsUInt64(idx).value_or(
|
||||
g_process_properties[idx].default_uint_value);
|
||||
uint64_t value = GetPropertyAtIndexAs<uint64_t>(
|
||||
idx, g_process_properties[idx].default_uint_value);
|
||||
return std::chrono::seconds(value);
|
||||
}
|
||||
|
||||
std::chrono::seconds ProcessProperties::GetInterruptTimeout() const {
|
||||
const uint32_t idx = ePropertyInterruptTimeout;
|
||||
uint64_t value = m_collection_sp->GetPropertyAtIndexAsUInt64(idx).value_or(
|
||||
g_process_properties[idx].default_uint_value);
|
||||
uint64_t value = GetPropertyAtIndexAs<uint64_t>(
|
||||
idx, g_process_properties[idx].default_uint_value);
|
||||
return std::chrono::seconds(value);
|
||||
}
|
||||
|
||||
bool ProcessProperties::GetSteppingRunsAllThreads() const {
|
||||
const uint32_t idx = ePropertySteppingRunsAllThreads;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_process_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_process_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
bool ProcessProperties::GetOSPluginReportsAllThreads() const {
|
||||
@@ -336,7 +336,7 @@ bool ProcessProperties::GetOSPluginReportsAllThreads() const {
|
||||
return fail_value;
|
||||
|
||||
return exp_values
|
||||
->GetPropertyAtIndexAsBoolean(ePropertyOSPluginReportsAllThreads)
|
||||
->GetPropertyAtIndexAs<bool>(ePropertyOSPluginReportsAllThreads)
|
||||
.value_or(fail_value);
|
||||
}
|
||||
|
||||
@@ -346,14 +346,15 @@ void ProcessProperties::SetOSPluginReportsAllThreads(bool does_report) {
|
||||
OptionValueProperties *exp_values =
|
||||
exp_property->GetValue()->GetAsProperties();
|
||||
if (exp_values)
|
||||
exp_values->SetPropertyAtIndexAsBoolean(ePropertyOSPluginReportsAllThreads,
|
||||
does_report);
|
||||
exp_values->SetPropertyAtIndex(ePropertyOSPluginReportsAllThreads,
|
||||
does_report);
|
||||
}
|
||||
|
||||
FollowForkMode ProcessProperties::GetFollowForkMode() const {
|
||||
const uint32_t idx = ePropertyFollowForkMode;
|
||||
return (FollowForkMode)m_collection_sp->GetPropertyAtIndexAsEnumeration(idx)
|
||||
.value_or(g_process_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<FollowForkMode>(
|
||||
idx, static_cast<FollowForkMode>(
|
||||
g_process_properties[idx].default_uint_value));
|
||||
}
|
||||
|
||||
ProcessSP Process::FindPlugin(lldb::TargetSP target_sp,
|
||||
|
||||
@@ -4136,7 +4136,7 @@ bool TargetProperties::GetInjectLocalVariables(
|
||||
exp_property->GetValue()->GetAsProperties();
|
||||
if (exp_values)
|
||||
return exp_values
|
||||
->GetPropertyAtIndexAsBoolean(ePropertyInjectLocalVars, exe_ctx)
|
||||
->GetPropertyAtIndexAs<bool>(ePropertyInjectLocalVars, exe_ctx)
|
||||
.value_or(true);
|
||||
else
|
||||
return true;
|
||||
@@ -4149,8 +4149,7 @@ void TargetProperties::SetInjectLocalVariables(ExecutionContext *exe_ctx,
|
||||
OptionValueProperties *exp_values =
|
||||
exp_property->GetValue()->GetAsProperties();
|
||||
if (exp_values)
|
||||
exp_values->SetPropertyAtIndexAsBoolean(ePropertyInjectLocalVars, true,
|
||||
exe_ctx);
|
||||
exp_values->SetPropertyAtIndex(ePropertyInjectLocalVars, true, exe_ctx);
|
||||
}
|
||||
|
||||
ArchSpec TargetProperties::GetDefaultArchitecture() const {
|
||||
@@ -4170,75 +4169,75 @@ void TargetProperties::SetDefaultArchitecture(const ArchSpec &arch) {
|
||||
|
||||
bool TargetProperties::GetMoveToNearestCode() const {
|
||||
const uint32_t idx = ePropertyMoveToNearestCode;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_target_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
lldb::DynamicValueType TargetProperties::GetPreferDynamicValue() const {
|
||||
const uint32_t idx = ePropertyPreferDynamic;
|
||||
return (lldb::DynamicValueType)m_collection_sp
|
||||
->GetPropertyAtIndexAsEnumeration(idx)
|
||||
.value_or(g_target_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<lldb::DynamicValueType>(
|
||||
idx, static_cast<lldb::DynamicValueType>(
|
||||
g_target_properties[idx].default_uint_value));
|
||||
}
|
||||
|
||||
bool TargetProperties::SetPreferDynamicValue(lldb::DynamicValueType d) {
|
||||
const uint32_t idx = ePropertyPreferDynamic;
|
||||
return m_collection_sp->SetPropertyAtIndexAsEnumeration(idx, d);
|
||||
return SetPropertyAtIndex(idx, d);
|
||||
}
|
||||
|
||||
bool TargetProperties::GetPreloadSymbols() const {
|
||||
const uint32_t idx = ePropertyPreloadSymbols;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_target_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
void TargetProperties::SetPreloadSymbols(bool b) {
|
||||
const uint32_t idx = ePropertyPreloadSymbols;
|
||||
m_collection_sp->SetPropertyAtIndexAsBoolean(idx, b);
|
||||
SetPropertyAtIndex(idx, b);
|
||||
}
|
||||
|
||||
bool TargetProperties::GetDisableASLR() const {
|
||||
const uint32_t idx = ePropertyDisableASLR;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_target_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
void TargetProperties::SetDisableASLR(bool b) {
|
||||
const uint32_t idx = ePropertyDisableASLR;
|
||||
m_collection_sp->SetPropertyAtIndexAsBoolean(idx, b);
|
||||
SetPropertyAtIndex(idx, b);
|
||||
}
|
||||
|
||||
bool TargetProperties::GetInheritTCC() const {
|
||||
const uint32_t idx = ePropertyInheritTCC;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_target_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
void TargetProperties::SetInheritTCC(bool b) {
|
||||
const uint32_t idx = ePropertyInheritTCC;
|
||||
m_collection_sp->SetPropertyAtIndexAsBoolean(idx, b);
|
||||
SetPropertyAtIndex(idx, b);
|
||||
}
|
||||
|
||||
bool TargetProperties::GetDetachOnError() const {
|
||||
const uint32_t idx = ePropertyDetachOnError;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_target_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
void TargetProperties::SetDetachOnError(bool b) {
|
||||
const uint32_t idx = ePropertyDetachOnError;
|
||||
m_collection_sp->SetPropertyAtIndexAsBoolean(idx, b);
|
||||
SetPropertyAtIndex(idx, b);
|
||||
}
|
||||
|
||||
bool TargetProperties::GetDisableSTDIO() const {
|
||||
const uint32_t idx = ePropertyDisableSTDIO;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_target_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
void TargetProperties::SetDisableSTDIO(bool b) {
|
||||
const uint32_t idx = ePropertyDisableSTDIO;
|
||||
m_collection_sp->SetPropertyAtIndexAsBoolean(idx, b);
|
||||
SetPropertyAtIndex(idx, b);
|
||||
}
|
||||
|
||||
const char *TargetProperties::GetDisassemblyFlavor() const {
|
||||
@@ -4246,28 +4245,30 @@ const char *TargetProperties::GetDisassemblyFlavor() const {
|
||||
const char *return_value;
|
||||
|
||||
x86DisassemblyFlavor flavor_value =
|
||||
(x86DisassemblyFlavor)m_collection_sp
|
||||
->GetPropertyAtIndexAsEnumeration(idx)
|
||||
.value_or(g_target_properties[idx].default_uint_value);
|
||||
GetPropertyAtIndexAs<x86DisassemblyFlavor>(
|
||||
idx, static_cast<x86DisassemblyFlavor>(
|
||||
g_target_properties[idx].default_uint_value));
|
||||
|
||||
return_value = g_x86_dis_flavor_value_types[flavor_value].string_value;
|
||||
return return_value;
|
||||
}
|
||||
|
||||
InlineStrategy TargetProperties::GetInlineStrategy() const {
|
||||
const uint32_t idx = ePropertyInlineStrategy;
|
||||
return (InlineStrategy)m_collection_sp->GetPropertyAtIndexAsEnumeration(idx)
|
||||
.value_or(g_target_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<InlineStrategy>(
|
||||
idx,
|
||||
static_cast<InlineStrategy>(g_target_properties[idx].default_uint_value));
|
||||
}
|
||||
|
||||
llvm::StringRef TargetProperties::GetArg0() const {
|
||||
const uint32_t idx = ePropertyArg0;
|
||||
return m_collection_sp->GetPropertyAtIndexAsString(idx).value_or(
|
||||
g_target_properties[idx].default_cstr_value);
|
||||
return GetPropertyAtIndexAs<llvm::StringRef>(
|
||||
idx, g_target_properties[idx].default_cstr_value);
|
||||
}
|
||||
|
||||
void TargetProperties::SetArg0(llvm::StringRef arg) {
|
||||
const uint32_t idx = ePropertyArg0;
|
||||
m_collection_sp->SetPropertyAtIndexAsString(idx, arg);
|
||||
SetPropertyAtIndex(idx, arg);
|
||||
m_launch_info.SetArg0(arg);
|
||||
}
|
||||
|
||||
@@ -4286,10 +4287,9 @@ Environment TargetProperties::ComputeEnvironment() const {
|
||||
Environment env;
|
||||
|
||||
if (m_target &&
|
||||
m_collection_sp->GetPropertyAtIndexAsBoolean(ePropertyInheritEnv)
|
||||
.value_or(
|
||||
g_target_properties[ePropertyInheritEnv].default_uint_value !=
|
||||
0)) {
|
||||
GetPropertyAtIndexAs<bool>(
|
||||
ePropertyInheritEnv,
|
||||
g_target_properties[ePropertyInheritEnv].default_uint_value != 0)) {
|
||||
if (auto platform_sp = m_target->GetPlatform()) {
|
||||
Environment platform_env = platform_sp->GetEnvironment();
|
||||
for (const auto &KV : platform_env)
|
||||
@@ -4321,10 +4321,9 @@ Environment TargetProperties::GetInheritedEnvironment() const {
|
||||
if (m_target == nullptr)
|
||||
return environment;
|
||||
|
||||
if (!m_collection_sp->GetPropertyAtIndexAsBoolean(ePropertyInheritEnv)
|
||||
.value_or(
|
||||
g_target_properties[ePropertyInheritEnv].default_uint_value !=
|
||||
0))
|
||||
if (!GetPropertyAtIndexAs<bool>(
|
||||
ePropertyInheritEnv,
|
||||
g_target_properties[ePropertyInheritEnv].default_uint_value != 0))
|
||||
return environment;
|
||||
|
||||
PlatformSP platform_sp = m_target->GetPlatform();
|
||||
@@ -4363,8 +4362,8 @@ void TargetProperties::SetEnvironment(Environment env) {
|
||||
|
||||
bool TargetProperties::GetSkipPrologue() const {
|
||||
const uint32_t idx = ePropertySkipPrologue;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_target_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
PathMappingList &TargetProperties::GetSourcePathMap() const {
|
||||
@@ -4377,8 +4376,8 @@ PathMappingList &TargetProperties::GetSourcePathMap() const {
|
||||
|
||||
bool TargetProperties::GetAutoSourceMapRelative() const {
|
||||
const uint32_t idx = ePropertyAutoSourceMapRelative;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_target_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
void TargetProperties::AppendExecutableSearchPaths(const FileSpec &dir) {
|
||||
@@ -4415,39 +4414,40 @@ FileSpecList TargetProperties::GetClangModuleSearchPaths() {
|
||||
|
||||
bool TargetProperties::GetEnableAutoImportClangModules() const {
|
||||
const uint32_t idx = ePropertyAutoImportClangModules;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_target_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
ImportStdModule TargetProperties::GetImportStdModule() const {
|
||||
const uint32_t idx = ePropertyImportStdModule;
|
||||
return (ImportStdModule)m_collection_sp->GetPropertyAtIndexAsEnumeration(idx)
|
||||
.value_or(g_target_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<ImportStdModule>(
|
||||
idx, static_cast<ImportStdModule>(
|
||||
g_target_properties[idx].default_uint_value));
|
||||
}
|
||||
|
||||
DynamicClassInfoHelper TargetProperties::GetDynamicClassInfoHelper() const {
|
||||
const uint32_t idx = ePropertyDynamicClassInfoHelper;
|
||||
return (DynamicClassInfoHelper)m_collection_sp
|
||||
->GetPropertyAtIndexAsEnumeration(idx)
|
||||
.value_or(g_target_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<DynamicClassInfoHelper>(
|
||||
idx, static_cast<DynamicClassInfoHelper>(
|
||||
g_target_properties[idx].default_uint_value));
|
||||
}
|
||||
|
||||
bool TargetProperties::GetEnableAutoApplyFixIts() const {
|
||||
const uint32_t idx = ePropertyAutoApplyFixIts;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_target_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
uint64_t TargetProperties::GetNumberOfRetriesWithFixits() const {
|
||||
const uint32_t idx = ePropertyRetriesWithFixIts;
|
||||
return m_collection_sp->GetPropertyAtIndexAsUInt64(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<uint64_t>(
|
||||
idx, g_target_properties[idx].default_uint_value);
|
||||
}
|
||||
|
||||
bool TargetProperties::GetEnableNotifyAboutFixIts() const {
|
||||
const uint32_t idx = ePropertyNotifyAboutFixIts;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_target_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
FileSpec TargetProperties::GetSaveJITObjectsDir() const {
|
||||
@@ -4490,20 +4490,20 @@ void TargetProperties::CheckJITObjectsDir() {
|
||||
|
||||
bool TargetProperties::GetEnableSyntheticValue() const {
|
||||
const uint32_t idx = ePropertyEnableSynthetic;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_target_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
uint32_t TargetProperties::GetMaxZeroPaddingInFloatFormat() const {
|
||||
const uint32_t idx = ePropertyMaxZeroPaddingInFloatFormat;
|
||||
return m_collection_sp->GetPropertyAtIndexAsUInt64(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<uint64_t>(
|
||||
idx, g_target_properties[idx].default_uint_value);
|
||||
}
|
||||
|
||||
uint32_t TargetProperties::GetMaximumNumberOfChildrenToDisplay() const {
|
||||
const uint32_t idx = ePropertyMaxChildrenCount;
|
||||
return m_collection_sp->GetPropertyAtIndexAsSInt64(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<int64_t>(
|
||||
idx, g_target_properties[idx].default_uint_value);
|
||||
}
|
||||
|
||||
std::pair<uint32_t, bool>
|
||||
@@ -4517,14 +4517,14 @@ TargetProperties::GetMaximumDepthOfChildrenToDisplay() const {
|
||||
|
||||
uint32_t TargetProperties::GetMaximumSizeOfStringSummary() const {
|
||||
const uint32_t idx = ePropertyMaxSummaryLength;
|
||||
return m_collection_sp->GetPropertyAtIndexAsSInt64(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<uint64_t>(
|
||||
idx, g_target_properties[idx].default_uint_value);
|
||||
}
|
||||
|
||||
uint32_t TargetProperties::GetMaximumMemReadSize() const {
|
||||
const uint32_t idx = ePropertyMaxMemReadSize;
|
||||
return m_collection_sp->GetPropertyAtIndexAsSInt64(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<uint64_t>(
|
||||
idx, g_target_properties[idx].default_uint_value);
|
||||
}
|
||||
|
||||
FileSpec TargetProperties::GetStandardInputPath() const {
|
||||
@@ -4534,7 +4534,7 @@ FileSpec TargetProperties::GetStandardInputPath() const {
|
||||
|
||||
void TargetProperties::SetStandardInputPath(llvm::StringRef path) {
|
||||
const uint32_t idx = ePropertyInputPath;
|
||||
m_collection_sp->SetPropertyAtIndexAsString(idx, path);
|
||||
SetPropertyAtIndex(idx, path);
|
||||
}
|
||||
|
||||
FileSpec TargetProperties::GetStandardOutputPath() const {
|
||||
@@ -4544,7 +4544,7 @@ FileSpec TargetProperties::GetStandardOutputPath() const {
|
||||
|
||||
void TargetProperties::SetStandardOutputPath(llvm::StringRef path) {
|
||||
const uint32_t idx = ePropertyOutputPath;
|
||||
m_collection_sp->SetPropertyAtIndexAsString(idx, path);
|
||||
SetPropertyAtIndex(idx, path);
|
||||
}
|
||||
|
||||
FileSpec TargetProperties::GetStandardErrorPath() const {
|
||||
@@ -4554,7 +4554,7 @@ FileSpec TargetProperties::GetStandardErrorPath() const {
|
||||
|
||||
void TargetProperties::SetStandardErrorPath(llvm::StringRef path) {
|
||||
const uint32_t idx = ePropertyErrorPath;
|
||||
m_collection_sp->SetPropertyAtIndexAsString(idx, path);
|
||||
SetPropertyAtIndex(idx, path);
|
||||
}
|
||||
|
||||
LanguageType TargetProperties::GetLanguage() const {
|
||||
@@ -4582,78 +4582,78 @@ llvm::StringRef TargetProperties::GetExpressionPrefixContents() {
|
||||
|
||||
uint64_t TargetProperties::GetExprErrorLimit() const {
|
||||
const uint32_t idx = ePropertyExprErrorLimit;
|
||||
return m_collection_sp->GetPropertyAtIndexAsUInt64(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<uint64_t>(
|
||||
idx, g_target_properties[idx].default_uint_value);
|
||||
}
|
||||
|
||||
uint64_t TargetProperties::GetExprAllocAddress() const {
|
||||
const uint32_t idx = ePropertyExprAllocAddress;
|
||||
return m_collection_sp->GetPropertyAtIndexAsUInt64(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<uint64_t>(
|
||||
idx, g_target_properties[idx].default_uint_value);
|
||||
}
|
||||
|
||||
uint64_t TargetProperties::GetExprAllocSize() const {
|
||||
const uint32_t idx = ePropertyExprAllocSize;
|
||||
return m_collection_sp->GetPropertyAtIndexAsUInt64(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<uint64_t>(
|
||||
idx, g_target_properties[idx].default_uint_value);
|
||||
}
|
||||
|
||||
uint64_t TargetProperties::GetExprAllocAlign() const {
|
||||
const uint32_t idx = ePropertyExprAllocAlign;
|
||||
return m_collection_sp->GetPropertyAtIndexAsUInt64(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<uint64_t>(
|
||||
idx, g_target_properties[idx].default_uint_value);
|
||||
}
|
||||
|
||||
bool TargetProperties::GetBreakpointsConsultPlatformAvoidList() {
|
||||
const uint32_t idx = ePropertyBreakpointUseAvoidList;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_target_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
bool TargetProperties::GetUseHexImmediates() const {
|
||||
const uint32_t idx = ePropertyUseHexImmediates;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_target_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
bool TargetProperties::GetUseFastStepping() const {
|
||||
const uint32_t idx = ePropertyUseFastStepping;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_target_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
bool TargetProperties::GetDisplayExpressionsInCrashlogs() const {
|
||||
const uint32_t idx = ePropertyDisplayExpressionsInCrashlogs;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_target_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
LoadScriptFromSymFile TargetProperties::GetLoadScriptFromSymbolFile() const {
|
||||
const uint32_t idx = ePropertyLoadScriptFromSymbolFile;
|
||||
return (LoadScriptFromSymFile)m_collection_sp
|
||||
->GetPropertyAtIndexAsEnumeration(idx)
|
||||
.value_or(g_target_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<LoadScriptFromSymFile>(
|
||||
idx, static_cast<LoadScriptFromSymFile>(
|
||||
g_target_properties[idx].default_uint_value));
|
||||
}
|
||||
|
||||
LoadCWDlldbinitFile TargetProperties::GetLoadCWDlldbinitFile() const {
|
||||
const uint32_t idx = ePropertyLoadCWDlldbinitFile;
|
||||
return (LoadCWDlldbinitFile)m_collection_sp
|
||||
->GetPropertyAtIndexAsEnumeration(idx)
|
||||
.value_or(g_target_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<LoadCWDlldbinitFile>(
|
||||
idx, static_cast<LoadCWDlldbinitFile>(
|
||||
g_target_properties[idx].default_uint_value));
|
||||
}
|
||||
|
||||
Disassembler::HexImmediateStyle TargetProperties::GetHexImmediateStyle() const {
|
||||
const uint32_t idx = ePropertyHexImmediateStyle;
|
||||
return (Disassembler::HexImmediateStyle)m_collection_sp
|
||||
->GetPropertyAtIndexAsEnumeration(idx)
|
||||
.value_or(g_target_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<Disassembler::HexImmediateStyle>(
|
||||
idx, static_cast<Disassembler::HexImmediateStyle>(
|
||||
g_target_properties[idx].default_uint_value));
|
||||
}
|
||||
|
||||
MemoryModuleLoadLevel TargetProperties::GetMemoryModuleLoadLevel() const {
|
||||
const uint32_t idx = ePropertyMemoryModuleLoadLevel;
|
||||
return (MemoryModuleLoadLevel)m_collection_sp
|
||||
->GetPropertyAtIndexAsEnumeration(idx)
|
||||
.value_or(g_target_properties[idx].default_uint_value);
|
||||
return GetPropertyAtIndexAs<MemoryModuleLoadLevel>(
|
||||
idx, static_cast<MemoryModuleLoadLevel>(
|
||||
g_target_properties[idx].default_uint_value));
|
||||
}
|
||||
|
||||
bool TargetProperties::GetUserSpecifiedTrapHandlerNames(Args &args) const {
|
||||
@@ -4668,24 +4668,24 @@ void TargetProperties::SetUserSpecifiedTrapHandlerNames(const Args &args) {
|
||||
|
||||
bool TargetProperties::GetDisplayRuntimeSupportValues() const {
|
||||
const uint32_t idx = ePropertyDisplayRuntimeSupportValues;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_target_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
void TargetProperties::SetDisplayRuntimeSupportValues(bool b) {
|
||||
const uint32_t idx = ePropertyDisplayRuntimeSupportValues;
|
||||
m_collection_sp->SetPropertyAtIndexAsBoolean(idx, b);
|
||||
SetPropertyAtIndex(idx, b);
|
||||
}
|
||||
|
||||
bool TargetProperties::GetDisplayRecognizedArguments() const {
|
||||
const uint32_t idx = ePropertyDisplayRecognizedArguments;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_target_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
void TargetProperties::SetDisplayRecognizedArguments(bool b) {
|
||||
const uint32_t idx = ePropertyDisplayRecognizedArguments;
|
||||
m_collection_sp->SetPropertyAtIndexAsBoolean(idx, b);
|
||||
SetPropertyAtIndex(idx, b);
|
||||
}
|
||||
|
||||
const ProcessLaunchInfo &TargetProperties::GetProcessLaunchInfo() const {
|
||||
@@ -4722,19 +4722,19 @@ void TargetProperties::SetProcessLaunchInfo(
|
||||
|
||||
bool TargetProperties::GetRequireHardwareBreakpoints() const {
|
||||
const uint32_t idx = ePropertyRequireHardwareBreakpoints;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_target_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
void TargetProperties::SetRequireHardwareBreakpoints(bool b) {
|
||||
const uint32_t idx = ePropertyRequireHardwareBreakpoints;
|
||||
m_collection_sp->SetPropertyAtIndexAsBoolean(idx, b);
|
||||
m_collection_sp->SetPropertyAtIndex(idx, b);
|
||||
}
|
||||
|
||||
bool TargetProperties::GetAutoInstallMainExecutable() const {
|
||||
const uint32_t idx = ePropertyAutoInstallMainExecutable;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_target_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
void TargetProperties::Arg0ValueChangedCallback() {
|
||||
@@ -4796,13 +4796,13 @@ void TargetProperties::DisableSTDIOValueChangedCallback() {
|
||||
|
||||
bool TargetProperties::GetDebugUtilityExpression() const {
|
||||
const uint32_t idx = ePropertyDebugUtilityExpression;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_target_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_target_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
void TargetProperties::SetDebugUtilityExpression(bool debug) {
|
||||
const uint32_t idx = ePropertyDebugUtilityExpression;
|
||||
m_collection_sp->SetPropertyAtIndexAsBoolean(idx, debug);
|
||||
SetPropertyAtIndex(idx, debug);
|
||||
}
|
||||
|
||||
// Target::TargetEventData
|
||||
|
||||
@@ -112,7 +112,7 @@ ThreadProperties::~ThreadProperties() = default;
|
||||
|
||||
const RegularExpression *ThreadProperties::GetSymbolsToAvoidRegexp() {
|
||||
const uint32_t idx = ePropertyStepAvoidRegex;
|
||||
return m_collection_sp->GetPropertyAtIndexAsOptionValueRegex(idx);
|
||||
return GetPropertyAtIndexAs<const RegularExpression *>(idx);
|
||||
}
|
||||
|
||||
FileSpecList ThreadProperties::GetLibrariesToAvoid() const {
|
||||
@@ -125,26 +125,26 @@ FileSpecList ThreadProperties::GetLibrariesToAvoid() const {
|
||||
|
||||
bool ThreadProperties::GetTraceEnabledState() const {
|
||||
const uint32_t idx = ePropertyEnableThreadTrace;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_thread_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_thread_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
bool ThreadProperties::GetStepInAvoidsNoDebug() const {
|
||||
const uint32_t idx = ePropertyStepInAvoidsNoDebug;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_thread_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_thread_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
bool ThreadProperties::GetStepOutAvoidsNoDebug() const {
|
||||
const uint32_t idx = ePropertyStepOutAvoidsNoDebug;
|
||||
return m_collection_sp->GetPropertyAtIndexAsBoolean(idx).value_or(
|
||||
g_thread_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<bool>(
|
||||
idx, g_thread_properties[idx].default_uint_value != 0);
|
||||
}
|
||||
|
||||
uint64_t ThreadProperties::GetMaxBacktraceDepth() const {
|
||||
const uint32_t idx = ePropertyMaxBacktraceDepth;
|
||||
return m_collection_sp->GetPropertyAtIndexAsUInt64(idx).value_or(
|
||||
g_thread_properties[idx].default_uint_value != 0);
|
||||
return GetPropertyAtIndexAs<uint64_t>(
|
||||
idx, g_thread_properties[idx].default_uint_value);
|
||||
}
|
||||
|
||||
// Thread Event Data
|
||||
|
||||
Reference in New Issue
Block a user