1435933ddSDimitry Andric //===-- SBVariablesOptions.cpp --------------------------------------*- C++ 2435933ddSDimitry Andric //-*-===// 31c3bbb01SEd Maste // 41c3bbb01SEd Maste // The LLVM Compiler Infrastructure 51c3bbb01SEd Maste // 61c3bbb01SEd Maste // This file is distributed under the University of Illinois Open Source 71c3bbb01SEd Maste // License. See LICENSE.TXT for details. 81c3bbb01SEd Maste // 91c3bbb01SEd Maste //===----------------------------------------------------------------------===// 101c3bbb01SEd Maste 111c3bbb01SEd Maste #include "lldb/API/SBVariablesOptions.h" 12*b5893f02SDimitry Andric #include "lldb/API/SBTarget.h" 13*b5893f02SDimitry Andric #include "lldb/Target/Target.h" 14*b5893f02SDimitry Andric 15*b5893f02SDimitry Andric #include "lldb/lldb-private.h" 161c3bbb01SEd Maste 171c3bbb01SEd Maste using namespace lldb; 181c3bbb01SEd Maste using namespace lldb_private; 191c3bbb01SEd Maste 20435933ddSDimitry Andric class VariablesOptionsImpl { 211c3bbb01SEd Maste public: VariablesOptionsImpl()22435933ddSDimitry Andric VariablesOptionsImpl() 23435933ddSDimitry Andric : m_include_arguments(false), m_include_locals(false), 24435933ddSDimitry Andric m_include_statics(false), m_in_scope_only(false), 251c3bbb01SEd Maste m_include_runtime_support_values(false), 26*b5893f02SDimitry Andric m_include_recognized_arguments(eLazyBoolCalculate), 27435933ddSDimitry Andric m_use_dynamic(lldb::eNoDynamicValues) {} 281c3bbb01SEd Maste 291c3bbb01SEd Maste VariablesOptionsImpl(const VariablesOptionsImpl &) = default; 301c3bbb01SEd Maste 311c3bbb01SEd Maste ~VariablesOptionsImpl() = default; 321c3bbb01SEd Maste 33435933ddSDimitry Andric VariablesOptionsImpl &operator=(const VariablesOptionsImpl &) = default; 341c3bbb01SEd Maste GetIncludeArguments() const35435933ddSDimitry Andric bool GetIncludeArguments() const { return m_include_arguments; } 361c3bbb01SEd Maste SetIncludeArguments(bool b)37435933ddSDimitry Andric void SetIncludeArguments(bool b) { m_include_arguments = b; } 381c3bbb01SEd Maste GetIncludeRecognizedArguments(const lldb::TargetSP & target_sp) const39*b5893f02SDimitry Andric bool GetIncludeRecognizedArguments(const lldb::TargetSP &target_sp) const { 40*b5893f02SDimitry Andric if (m_include_recognized_arguments != eLazyBoolCalculate) 41*b5893f02SDimitry Andric return m_include_recognized_arguments; 42*b5893f02SDimitry Andric return target_sp ? target_sp->GetDisplayRecognizedArguments() : false; 43*b5893f02SDimitry Andric } 44*b5893f02SDimitry Andric SetIncludeRecognizedArguments(bool b)45*b5893f02SDimitry Andric void SetIncludeRecognizedArguments(bool b) { 46*b5893f02SDimitry Andric m_include_recognized_arguments = b ? eLazyBoolYes : eLazyBoolNo; 47*b5893f02SDimitry Andric } 48*b5893f02SDimitry Andric GetIncludeLocals() const49435933ddSDimitry Andric bool GetIncludeLocals() const { return m_include_locals; } 501c3bbb01SEd Maste SetIncludeLocals(bool b)51435933ddSDimitry Andric void SetIncludeLocals(bool b) { m_include_locals = b; } 521c3bbb01SEd Maste GetIncludeStatics() const53435933ddSDimitry Andric bool GetIncludeStatics() const { return m_include_statics; } 541c3bbb01SEd Maste SetIncludeStatics(bool b)55435933ddSDimitry Andric void SetIncludeStatics(bool b) { m_include_statics = b; } 561c3bbb01SEd Maste GetInScopeOnly() const57435933ddSDimitry Andric bool GetInScopeOnly() const { return m_in_scope_only; } 581c3bbb01SEd Maste SetInScopeOnly(bool b)59435933ddSDimitry Andric void SetInScopeOnly(bool b) { m_in_scope_only = b; } 601c3bbb01SEd Maste GetIncludeRuntimeSupportValues() const61435933ddSDimitry Andric bool GetIncludeRuntimeSupportValues() const { 621c3bbb01SEd Maste return m_include_runtime_support_values; 631c3bbb01SEd Maste } 641c3bbb01SEd Maste SetIncludeRuntimeSupportValues(bool b)65435933ddSDimitry Andric void SetIncludeRuntimeSupportValues(bool b) { 661c3bbb01SEd Maste m_include_runtime_support_values = b; 671c3bbb01SEd Maste } 681c3bbb01SEd Maste GetUseDynamic() const69435933ddSDimitry Andric lldb::DynamicValueType GetUseDynamic() const { return m_use_dynamic; } 701c3bbb01SEd Maste SetUseDynamic(lldb::DynamicValueType d)71435933ddSDimitry Andric void SetUseDynamic(lldb::DynamicValueType d) { m_use_dynamic = d; } 721c3bbb01SEd Maste 731c3bbb01SEd Maste private: 741c3bbb01SEd Maste bool m_include_arguments : 1; 751c3bbb01SEd Maste bool m_include_locals : 1; 761c3bbb01SEd Maste bool m_include_statics : 1; 771c3bbb01SEd Maste bool m_in_scope_only : 1; 781c3bbb01SEd Maste bool m_include_runtime_support_values : 1; 79*b5893f02SDimitry Andric LazyBool m_include_recognized_arguments; // can be overridden with a setting 801c3bbb01SEd Maste lldb::DynamicValueType m_use_dynamic; 811c3bbb01SEd Maste }; 821c3bbb01SEd Maste SBVariablesOptions()83435933ddSDimitry AndricSBVariablesOptions::SBVariablesOptions() 84435933ddSDimitry Andric : m_opaque_ap(new VariablesOptionsImpl()) {} 851c3bbb01SEd Maste SBVariablesOptions(const SBVariablesOptions & options)86435933ddSDimitry AndricSBVariablesOptions::SBVariablesOptions(const SBVariablesOptions &options) 87435933ddSDimitry Andric : m_opaque_ap(new VariablesOptionsImpl(options.ref())) {} 881c3bbb01SEd Maste 89435933ddSDimitry Andric SBVariablesOptions &SBVariablesOptions:: operator =(const SBVariablesOptions & options)90435933ddSDimitry Andricoperator=(const SBVariablesOptions &options) { 911c3bbb01SEd Maste m_opaque_ap.reset(new VariablesOptionsImpl(options.ref())); 921c3bbb01SEd Maste return *this; 931c3bbb01SEd Maste } 941c3bbb01SEd Maste 951c3bbb01SEd Maste SBVariablesOptions::~SBVariablesOptions() = default; 961c3bbb01SEd Maste IsValid() const97*b5893f02SDimitry Andricbool SBVariablesOptions::IsValid() const { return m_opaque_ap != nullptr; } 981c3bbb01SEd Maste GetIncludeArguments() const99435933ddSDimitry Andricbool SBVariablesOptions::GetIncludeArguments() const { 1001c3bbb01SEd Maste return m_opaque_ap->GetIncludeArguments(); 1011c3bbb01SEd Maste } 1021c3bbb01SEd Maste SetIncludeArguments(bool arguments)103435933ddSDimitry Andricvoid SBVariablesOptions::SetIncludeArguments(bool arguments) { 1041c3bbb01SEd Maste m_opaque_ap->SetIncludeArguments(arguments); 1051c3bbb01SEd Maste } 1061c3bbb01SEd Maste GetIncludeRecognizedArguments(const lldb::SBTarget & target) const107*b5893f02SDimitry Andricbool SBVariablesOptions::GetIncludeRecognizedArguments( 108*b5893f02SDimitry Andric const lldb::SBTarget &target) const { 109*b5893f02SDimitry Andric return m_opaque_ap->GetIncludeRecognizedArguments(target.GetSP()); 110*b5893f02SDimitry Andric } 111*b5893f02SDimitry Andric SetIncludeRecognizedArguments(bool arguments)112*b5893f02SDimitry Andricvoid SBVariablesOptions::SetIncludeRecognizedArguments(bool arguments) { 113*b5893f02SDimitry Andric m_opaque_ap->SetIncludeRecognizedArguments(arguments); 114*b5893f02SDimitry Andric } 115*b5893f02SDimitry Andric GetIncludeLocals() const116435933ddSDimitry Andricbool SBVariablesOptions::GetIncludeLocals() const { 1171c3bbb01SEd Maste return m_opaque_ap->GetIncludeLocals(); 1181c3bbb01SEd Maste } 1191c3bbb01SEd Maste SetIncludeLocals(bool locals)120435933ddSDimitry Andricvoid SBVariablesOptions::SetIncludeLocals(bool locals) { 1211c3bbb01SEd Maste m_opaque_ap->SetIncludeLocals(locals); 1221c3bbb01SEd Maste } 1231c3bbb01SEd Maste GetIncludeStatics() const124435933ddSDimitry Andricbool SBVariablesOptions::GetIncludeStatics() const { 1251c3bbb01SEd Maste return m_opaque_ap->GetIncludeStatics(); 1261c3bbb01SEd Maste } 1271c3bbb01SEd Maste SetIncludeStatics(bool statics)128435933ddSDimitry Andricvoid SBVariablesOptions::SetIncludeStatics(bool statics) { 1291c3bbb01SEd Maste m_opaque_ap->SetIncludeStatics(statics); 1301c3bbb01SEd Maste } 1311c3bbb01SEd Maste GetInScopeOnly() const132435933ddSDimitry Andricbool SBVariablesOptions::GetInScopeOnly() const { 1331c3bbb01SEd Maste return m_opaque_ap->GetInScopeOnly(); 1341c3bbb01SEd Maste } 1351c3bbb01SEd Maste SetInScopeOnly(bool in_scope_only)136435933ddSDimitry Andricvoid SBVariablesOptions::SetInScopeOnly(bool in_scope_only) { 1371c3bbb01SEd Maste m_opaque_ap->SetInScopeOnly(in_scope_only); 1381c3bbb01SEd Maste } 1391c3bbb01SEd Maste GetIncludeRuntimeSupportValues() const140435933ddSDimitry Andricbool SBVariablesOptions::GetIncludeRuntimeSupportValues() const { 1411c3bbb01SEd Maste return m_opaque_ap->GetIncludeRuntimeSupportValues(); 1421c3bbb01SEd Maste } 1431c3bbb01SEd Maste SetIncludeRuntimeSupportValues(bool runtime_support_values)144435933ddSDimitry Andricvoid SBVariablesOptions::SetIncludeRuntimeSupportValues( 145435933ddSDimitry Andric bool runtime_support_values) { 1461c3bbb01SEd Maste m_opaque_ap->SetIncludeRuntimeSupportValues(runtime_support_values); 1471c3bbb01SEd Maste } 1481c3bbb01SEd Maste GetUseDynamic() const149435933ddSDimitry Andriclldb::DynamicValueType SBVariablesOptions::GetUseDynamic() const { 1501c3bbb01SEd Maste return m_opaque_ap->GetUseDynamic(); 1511c3bbb01SEd Maste } 1521c3bbb01SEd Maste SetUseDynamic(lldb::DynamicValueType dynamic)153435933ddSDimitry Andricvoid SBVariablesOptions::SetUseDynamic(lldb::DynamicValueType dynamic) { 1541c3bbb01SEd Maste m_opaque_ap->SetUseDynamic(dynamic); 1551c3bbb01SEd Maste } 1561c3bbb01SEd Maste operator ->()157435933ddSDimitry AndricVariablesOptionsImpl *SBVariablesOptions::operator->() { 1581c3bbb01SEd Maste return m_opaque_ap.operator->(); 1591c3bbb01SEd Maste } 1601c3bbb01SEd Maste operator ->() const161435933ddSDimitry Andricconst VariablesOptionsImpl *SBVariablesOptions::operator->() const { 1621c3bbb01SEd Maste return m_opaque_ap.operator->(); 1631c3bbb01SEd Maste } 1641c3bbb01SEd Maste get()165435933ddSDimitry AndricVariablesOptionsImpl *SBVariablesOptions::get() { return m_opaque_ap.get(); } 1661c3bbb01SEd Maste ref()167435933ddSDimitry AndricVariablesOptionsImpl &SBVariablesOptions::ref() { return *m_opaque_ap; } 168435933ddSDimitry Andric ref() const169435933ddSDimitry Andricconst VariablesOptionsImpl &SBVariablesOptions::ref() const { 1701c3bbb01SEd Maste return *m_opaque_ap; 1711c3bbb01SEd Maste } 1721c3bbb01SEd Maste SBVariablesOptions(VariablesOptionsImpl * lldb_object_ptr)173435933ddSDimitry AndricSBVariablesOptions::SBVariablesOptions(VariablesOptionsImpl *lldb_object_ptr) 174435933ddSDimitry Andric : m_opaque_ap(std::move(lldb_object_ptr)) {} 1751c3bbb01SEd Maste SetOptions(VariablesOptionsImpl * lldb_object_ptr)176435933ddSDimitry Andricvoid SBVariablesOptions::SetOptions(VariablesOptionsImpl *lldb_object_ptr) { 1771c3bbb01SEd Maste m_opaque_ap.reset(std::move(lldb_object_ptr)); 1781c3bbb01SEd Maste } 179