1 //===-- SBExpressionOptions.cpp ---------------------------------------------*- 2 //C++ -*-===// 3 // 4 // The LLVM Compiler Infrastructure 5 // 6 // This file is distributed under the University of Illinois Open Source 7 // License. See LICENSE.TXT for details. 8 // 9 //===----------------------------------------------------------------------===// 10 11 #include "lldb/API/SBExpressionOptions.h" 12 #include "lldb/API/SBStream.h" 13 14 #include "lldb/Target/Target.h" 15 16 using namespace lldb; 17 using namespace lldb_private; 18 SBExpressionOptions()19SBExpressionOptions::SBExpressionOptions() 20 : m_opaque_ap(new EvaluateExpressionOptions()) {} 21 SBExpressionOptions(const SBExpressionOptions & rhs)22SBExpressionOptions::SBExpressionOptions(const SBExpressionOptions &rhs) { 23 m_opaque_ap.reset(new EvaluateExpressionOptions()); 24 *(m_opaque_ap.get()) = rhs.ref(); 25 } 26 27 const SBExpressionOptions &SBExpressionOptions:: operator =(const SBExpressionOptions & rhs)28operator=(const SBExpressionOptions &rhs) { 29 if (this != &rhs) { 30 this->ref() = rhs.ref(); 31 } 32 return *this; 33 } 34 ~SBExpressionOptions()35SBExpressionOptions::~SBExpressionOptions() {} 36 GetCoerceResultToId() const37bool SBExpressionOptions::GetCoerceResultToId() const { 38 return m_opaque_ap->DoesCoerceToId(); 39 } 40 SetCoerceResultToId(bool coerce)41void SBExpressionOptions::SetCoerceResultToId(bool coerce) { 42 m_opaque_ap->SetCoerceToId(coerce); 43 } 44 GetUnwindOnError() const45bool SBExpressionOptions::GetUnwindOnError() const { 46 return m_opaque_ap->DoesUnwindOnError(); 47 } 48 SetUnwindOnError(bool unwind)49void SBExpressionOptions::SetUnwindOnError(bool unwind) { 50 m_opaque_ap->SetUnwindOnError(unwind); 51 } 52 GetIgnoreBreakpoints() const53bool SBExpressionOptions::GetIgnoreBreakpoints() const { 54 return m_opaque_ap->DoesIgnoreBreakpoints(); 55 } 56 SetIgnoreBreakpoints(bool ignore)57void SBExpressionOptions::SetIgnoreBreakpoints(bool ignore) { 58 m_opaque_ap->SetIgnoreBreakpoints(ignore); 59 } 60 GetFetchDynamicValue() const61lldb::DynamicValueType SBExpressionOptions::GetFetchDynamicValue() const { 62 return m_opaque_ap->GetUseDynamic(); 63 } 64 SetFetchDynamicValue(lldb::DynamicValueType dynamic)65void SBExpressionOptions::SetFetchDynamicValue(lldb::DynamicValueType dynamic) { 66 m_opaque_ap->SetUseDynamic(dynamic); 67 } 68 GetTimeoutInMicroSeconds() const69uint32_t SBExpressionOptions::GetTimeoutInMicroSeconds() const { 70 return m_opaque_ap->GetTimeout() ? m_opaque_ap->GetTimeout()->count() : 0; 71 } 72 SetTimeoutInMicroSeconds(uint32_t timeout)73void SBExpressionOptions::SetTimeoutInMicroSeconds(uint32_t timeout) { 74 m_opaque_ap->SetTimeout(timeout == 0 ? Timeout<std::micro>(llvm::None) 75 : std::chrono::microseconds(timeout)); 76 } 77 GetOneThreadTimeoutInMicroSeconds() const78uint32_t SBExpressionOptions::GetOneThreadTimeoutInMicroSeconds() const { 79 return m_opaque_ap->GetOneThreadTimeout() ? m_opaque_ap->GetOneThreadTimeout()->count() : 0; 80 } 81 SetOneThreadTimeoutInMicroSeconds(uint32_t timeout)82void SBExpressionOptions::SetOneThreadTimeoutInMicroSeconds(uint32_t timeout) { 83 m_opaque_ap->SetOneThreadTimeout(timeout == 0 84 ? Timeout<std::micro>(llvm::None) 85 : std::chrono::microseconds(timeout)); 86 } 87 GetTryAllThreads() const88bool SBExpressionOptions::GetTryAllThreads() const { 89 return m_opaque_ap->GetTryAllThreads(); 90 } 91 SetTryAllThreads(bool run_others)92void SBExpressionOptions::SetTryAllThreads(bool run_others) { 93 m_opaque_ap->SetTryAllThreads(run_others); 94 } 95 GetStopOthers() const96bool SBExpressionOptions::GetStopOthers() const { 97 return m_opaque_ap->GetStopOthers(); 98 } 99 SetStopOthers(bool run_others)100void SBExpressionOptions::SetStopOthers(bool run_others) { 101 m_opaque_ap->SetStopOthers(run_others); 102 } 103 GetTrapExceptions() const104bool SBExpressionOptions::GetTrapExceptions() const { 105 return m_opaque_ap->GetTrapExceptions(); 106 } 107 SetTrapExceptions(bool trap_exceptions)108void SBExpressionOptions::SetTrapExceptions(bool trap_exceptions) { 109 m_opaque_ap->SetTrapExceptions(trap_exceptions); 110 } 111 SetLanguage(lldb::LanguageType language)112void SBExpressionOptions::SetLanguage(lldb::LanguageType language) { 113 m_opaque_ap->SetLanguage(language); 114 } 115 SetCancelCallback(lldb::ExpressionCancelCallback callback,void * baton)116void SBExpressionOptions::SetCancelCallback( 117 lldb::ExpressionCancelCallback callback, void *baton) { 118 m_opaque_ap->SetCancelCallback(callback, baton); 119 } 120 GetGenerateDebugInfo()121bool SBExpressionOptions::GetGenerateDebugInfo() { 122 return m_opaque_ap->GetGenerateDebugInfo(); 123 } 124 SetGenerateDebugInfo(bool b)125void SBExpressionOptions::SetGenerateDebugInfo(bool b) { 126 return m_opaque_ap->SetGenerateDebugInfo(b); 127 } 128 GetSuppressPersistentResult()129bool SBExpressionOptions::GetSuppressPersistentResult() { 130 return m_opaque_ap->GetResultIsInternal(); 131 } 132 SetSuppressPersistentResult(bool b)133void SBExpressionOptions::SetSuppressPersistentResult(bool b) { 134 return m_opaque_ap->SetResultIsInternal(b); 135 } 136 GetPrefix() const137const char *SBExpressionOptions::GetPrefix() const { 138 return m_opaque_ap->GetPrefix(); 139 } 140 SetPrefix(const char * prefix)141void SBExpressionOptions::SetPrefix(const char *prefix) { 142 return m_opaque_ap->SetPrefix(prefix); 143 } 144 GetAutoApplyFixIts()145bool SBExpressionOptions::GetAutoApplyFixIts() { 146 return m_opaque_ap->GetAutoApplyFixIts(); 147 } 148 SetAutoApplyFixIts(bool b)149void SBExpressionOptions::SetAutoApplyFixIts(bool b) { 150 return m_opaque_ap->SetAutoApplyFixIts(b); 151 } 152 GetTopLevel()153bool SBExpressionOptions::GetTopLevel() { 154 return m_opaque_ap->GetExecutionPolicy() == eExecutionPolicyTopLevel; 155 } 156 SetTopLevel(bool b)157void SBExpressionOptions::SetTopLevel(bool b) { 158 m_opaque_ap->SetExecutionPolicy(b ? eExecutionPolicyTopLevel 159 : m_opaque_ap->default_execution_policy); 160 } 161 GetAllowJIT()162bool SBExpressionOptions::GetAllowJIT() { 163 return m_opaque_ap->GetExecutionPolicy() != eExecutionPolicyNever; 164 } 165 SetAllowJIT(bool allow)166void SBExpressionOptions::SetAllowJIT(bool allow) { 167 m_opaque_ap->SetExecutionPolicy(allow ? m_opaque_ap->default_execution_policy 168 : eExecutionPolicyNever); 169 } 170 get() const171EvaluateExpressionOptions *SBExpressionOptions::get() const { 172 return m_opaque_ap.get(); 173 } 174 ref() const175EvaluateExpressionOptions &SBExpressionOptions::ref() const { 176 return *(m_opaque_ap.get()); 177 } 178