Path: blob/main/contrib/llvm-project/lldb/source/API/SBExpressionOptions.cpp
39587 views
//===-- SBExpressionOptions.cpp -------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "lldb/API/SBExpressionOptions.h"9#include "Utils.h"10#include "lldb/API/SBStream.h"11#include "lldb/Target/Target.h"12#include "lldb/Utility/Instrumentation.h"1314using namespace lldb;15using namespace lldb_private;1617SBExpressionOptions::SBExpressionOptions()18: m_opaque_up(new EvaluateExpressionOptions()) {19LLDB_INSTRUMENT_VA(this);20}2122SBExpressionOptions::SBExpressionOptions(const SBExpressionOptions &rhs) {23LLDB_INSTRUMENT_VA(this, rhs);2425m_opaque_up = clone(rhs.m_opaque_up);26}2728const SBExpressionOptions &SBExpressionOptions::29operator=(const SBExpressionOptions &rhs) {30LLDB_INSTRUMENT_VA(this, rhs);3132if (this != &rhs)33m_opaque_up = clone(rhs.m_opaque_up);34return *this;35}3637SBExpressionOptions::~SBExpressionOptions() = default;3839bool SBExpressionOptions::GetCoerceResultToId() const {40LLDB_INSTRUMENT_VA(this);4142return m_opaque_up->DoesCoerceToId();43}4445void SBExpressionOptions::SetCoerceResultToId(bool coerce) {46LLDB_INSTRUMENT_VA(this, coerce);4748m_opaque_up->SetCoerceToId(coerce);49}5051bool SBExpressionOptions::GetUnwindOnError() const {52LLDB_INSTRUMENT_VA(this);5354return m_opaque_up->DoesUnwindOnError();55}5657void SBExpressionOptions::SetUnwindOnError(bool unwind) {58LLDB_INSTRUMENT_VA(this, unwind);5960m_opaque_up->SetUnwindOnError(unwind);61}6263bool SBExpressionOptions::GetIgnoreBreakpoints() const {64LLDB_INSTRUMENT_VA(this);6566return m_opaque_up->DoesIgnoreBreakpoints();67}6869void SBExpressionOptions::SetIgnoreBreakpoints(bool ignore) {70LLDB_INSTRUMENT_VA(this, ignore);7172m_opaque_up->SetIgnoreBreakpoints(ignore);73}7475lldb::DynamicValueType SBExpressionOptions::GetFetchDynamicValue() const {76LLDB_INSTRUMENT_VA(this);7778return m_opaque_up->GetUseDynamic();79}8081void SBExpressionOptions::SetFetchDynamicValue(lldb::DynamicValueType dynamic) {82LLDB_INSTRUMENT_VA(this, dynamic);8384m_opaque_up->SetUseDynamic(dynamic);85}8687uint32_t SBExpressionOptions::GetTimeoutInMicroSeconds() const {88LLDB_INSTRUMENT_VA(this);8990return m_opaque_up->GetTimeout() ? m_opaque_up->GetTimeout()->count() : 0;91}9293void SBExpressionOptions::SetTimeoutInMicroSeconds(uint32_t timeout) {94LLDB_INSTRUMENT_VA(this, timeout);9596m_opaque_up->SetTimeout(timeout == 0 ? Timeout<std::micro>(std::nullopt)97: std::chrono::microseconds(timeout));98}99100uint32_t SBExpressionOptions::GetOneThreadTimeoutInMicroSeconds() const {101LLDB_INSTRUMENT_VA(this);102103return m_opaque_up->GetOneThreadTimeout()104? m_opaque_up->GetOneThreadTimeout()->count()105: 0;106}107108void SBExpressionOptions::SetOneThreadTimeoutInMicroSeconds(uint32_t timeout) {109LLDB_INSTRUMENT_VA(this, timeout);110111m_opaque_up->SetOneThreadTimeout(timeout == 0112? Timeout<std::micro>(std::nullopt)113: std::chrono::microseconds(timeout));114}115116bool SBExpressionOptions::GetTryAllThreads() const {117LLDB_INSTRUMENT_VA(this);118119return m_opaque_up->GetTryAllThreads();120}121122void SBExpressionOptions::SetTryAllThreads(bool run_others) {123LLDB_INSTRUMENT_VA(this, run_others);124125m_opaque_up->SetTryAllThreads(run_others);126}127128bool SBExpressionOptions::GetStopOthers() const {129LLDB_INSTRUMENT_VA(this);130131return m_opaque_up->GetStopOthers();132}133134void SBExpressionOptions::SetStopOthers(bool run_others) {135LLDB_INSTRUMENT_VA(this, run_others);136137m_opaque_up->SetStopOthers(run_others);138}139140bool SBExpressionOptions::GetTrapExceptions() const {141LLDB_INSTRUMENT_VA(this);142143return m_opaque_up->GetTrapExceptions();144}145146void SBExpressionOptions::SetTrapExceptions(bool trap_exceptions) {147LLDB_INSTRUMENT_VA(this, trap_exceptions);148149m_opaque_up->SetTrapExceptions(trap_exceptions);150}151152void SBExpressionOptions::SetLanguage(lldb::LanguageType language) {153LLDB_INSTRUMENT_VA(this, language);154155m_opaque_up->SetLanguage(language);156}157158void SBExpressionOptions::SetLanguage(lldb::SBSourceLanguageName name,159uint32_t version) {160LLDB_INSTRUMENT_VA(this, name, version);161162m_opaque_up->SetLanguage(name, version);163}164165void SBExpressionOptions::SetCancelCallback(166lldb::ExpressionCancelCallback callback, void *baton) {167LLDB_INSTRUMENT_VA(this, callback, baton);168169m_opaque_up->SetCancelCallback(callback, baton);170}171172bool SBExpressionOptions::GetGenerateDebugInfo() {173LLDB_INSTRUMENT_VA(this);174175return m_opaque_up->GetGenerateDebugInfo();176}177178void SBExpressionOptions::SetGenerateDebugInfo(bool b) {179LLDB_INSTRUMENT_VA(this, b);180181return m_opaque_up->SetGenerateDebugInfo(b);182}183184bool SBExpressionOptions::GetSuppressPersistentResult() {185LLDB_INSTRUMENT_VA(this);186187return m_opaque_up->GetSuppressPersistentResult();188}189190void SBExpressionOptions::SetSuppressPersistentResult(bool b) {191LLDB_INSTRUMENT_VA(this, b);192193return m_opaque_up->SetSuppressPersistentResult(b);194}195196const char *SBExpressionOptions::GetPrefix() const {197LLDB_INSTRUMENT_VA(this);198199return ConstString(m_opaque_up->GetPrefix()).GetCString();200}201202void SBExpressionOptions::SetPrefix(const char *prefix) {203LLDB_INSTRUMENT_VA(this, prefix);204205return m_opaque_up->SetPrefix(prefix);206}207208bool SBExpressionOptions::GetAutoApplyFixIts() {209LLDB_INSTRUMENT_VA(this);210211return m_opaque_up->GetAutoApplyFixIts();212}213214void SBExpressionOptions::SetAutoApplyFixIts(bool b) {215LLDB_INSTRUMENT_VA(this, b);216217return m_opaque_up->SetAutoApplyFixIts(b);218}219220uint64_t SBExpressionOptions::GetRetriesWithFixIts() {221LLDB_INSTRUMENT_VA(this);222223return m_opaque_up->GetRetriesWithFixIts();224}225226void SBExpressionOptions::SetRetriesWithFixIts(uint64_t retries) {227LLDB_INSTRUMENT_VA(this, retries);228229return m_opaque_up->SetRetriesWithFixIts(retries);230}231232bool SBExpressionOptions::GetTopLevel() {233LLDB_INSTRUMENT_VA(this);234235return m_opaque_up->GetExecutionPolicy() == eExecutionPolicyTopLevel;236}237238void SBExpressionOptions::SetTopLevel(bool b) {239LLDB_INSTRUMENT_VA(this, b);240241m_opaque_up->SetExecutionPolicy(b ? eExecutionPolicyTopLevel242: m_opaque_up->default_execution_policy);243}244245bool SBExpressionOptions::GetAllowJIT() {246LLDB_INSTRUMENT_VA(this);247248return m_opaque_up->GetExecutionPolicy() != eExecutionPolicyNever;249}250251void SBExpressionOptions::SetAllowJIT(bool allow) {252LLDB_INSTRUMENT_VA(this, allow);253254m_opaque_up->SetExecutionPolicy(allow ? m_opaque_up->default_execution_policy255: eExecutionPolicyNever);256}257258EvaluateExpressionOptions *SBExpressionOptions::get() const {259return m_opaque_up.get();260}261262EvaluateExpressionOptions &SBExpressionOptions::ref() const {263return *m_opaque_up;264}265266267