#include "lldb/Core/ValueObject.h"
#include "lldb/Core/Address.h"
#include "lldb/Core/Declaration.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ValueObjectCast.h"
#include "lldb/Core/ValueObjectChild.h"
#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/Core/ValueObjectDynamicValue.h"
#include "lldb/Core/ValueObjectMemory.h"
#include "lldb/Core/ValueObjectSyntheticFilter.h"
#include "lldb/Core/ValueObjectVTable.h"
#include "lldb/DataFormatters/DataVisualization.h"
#include "lldb/DataFormatters/DumpValueObjectOptions.h"
#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/DataFormatters/StringPrinter.h"
#include "lldb/DataFormatters/TypeFormat.h"
#include "lldb/DataFormatters/TypeSummary.h"
#include "lldb/DataFormatters/ValueObjectPrinter.h"
#include "lldb/Expression/ExpressionVariable.h"
#include "lldb/Host/Config.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/Type.h"
#include "lldb/Symbol/Variable.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Language.h"
#include "lldb/Target/LanguageRuntime.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadList.h"
#include "lldb/Utility/DataBuffer.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/Flags.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Scalar.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/lldb-private-types.h"
#include "llvm/Support/Compiler.h"
#include <algorithm>
#include <cstdint>
#include <cstdlib>
#include <memory>
#include <optional>
#include <tuple>
#include <cassert>
#include <cinttypes>
#include <cstdio>
#include <cstring>
#include <lldb/Core/ValueObject.h>
namespace lldb_private {
class ExecutionContextScope;
}
namespace lldb_private {
class SymbolContextScope;
}
usingnamespacelldb;
usingnamespacelldb_private;
static user_id_t g_value_obj_uid = …;
ValueObject::ValueObject(ValueObject &parent)
: … { … }
ValueObject::ValueObject(ExecutionContextScope *exe_scope,
ValueObjectManager &manager,
AddressType child_ptr_or_ref_addr_type)
: … { … }
ValueObject::~ValueObject() = default;
bool ValueObject::UpdateValueIfNeeded(bool update_format) { … }
bool ValueObject::UpdateFormatsIfNeeded() { … }
void ValueObject::SetNeedsUpdate() { … }
void ValueObject::ClearDynamicTypeInformation() { … }
CompilerType ValueObject::MaybeCalculateCompleteType() { … }
DataExtractor &ValueObject::GetDataExtractor() { … }
const Status &ValueObject::GetError() { … }
const char *ValueObject::GetLocationAsCStringImpl(const Value &value,
const DataExtractor &data) { … }
bool ValueObject::ResolveValue(Scalar &scalar) { … }
bool ValueObject::IsLogicalTrue(Status &error) { … }
ValueObjectSP ValueObject::GetChildAtIndex(uint32_t idx, bool can_create) { … }
lldb::ValueObjectSP
ValueObject::GetChildAtNamePath(llvm::ArrayRef<llvm::StringRef> names) { … }
size_t ValueObject::GetIndexOfChildWithName(llvm::StringRef name) { … }
ValueObjectSP ValueObject::GetChildMemberWithName(llvm::StringRef name,
bool can_create) { … }
llvm::Expected<uint32_t> ValueObject::GetNumChildren(uint32_t max) { … }
uint32_t ValueObject::GetNumChildrenIgnoringErrors(uint32_t max) { … }
bool ValueObject::MightHaveChildren() { … }
void ValueObject::SetNumChildren(uint32_t num_children) { … }
ValueObject *ValueObject::CreateChildAtIndex(size_t idx) { … }
ValueObject *ValueObject::CreateSyntheticArrayMember(size_t idx) { … }
bool ValueObject::GetSummaryAsCString(TypeSummaryImpl *summary_ptr,
std::string &destination,
lldb::LanguageType lang) { … }
bool ValueObject::GetSummaryAsCString(TypeSummaryImpl *summary_ptr,
std::string &destination,
const TypeSummaryOptions &options) { … }
const char *ValueObject::GetSummaryAsCString(lldb::LanguageType lang) { … }
bool ValueObject::GetSummaryAsCString(std::string &destination,
const TypeSummaryOptions &options) { … }
bool ValueObject::IsCStringContainer(bool check_pointer) { … }
size_t ValueObject::GetPointeeData(DataExtractor &data, uint32_t item_idx,
uint32_t item_count) { … }
uint64_t ValueObject::GetData(DataExtractor &data, Status &error) { … }
bool ValueObject::SetData(DataExtractor &data, Status &error) { … }
static bool CopyStringDataToBufferSP(const StreamString &source,
lldb::WritableDataBufferSP &destination) { … }
std::pair<size_t, bool>
ValueObject::ReadPointedString(lldb::WritableDataBufferSP &buffer_sp,
Status &error, bool honor_array) { … }
llvm::Expected<std::string> ValueObject::GetObjectDescription() { … }
bool ValueObject::GetValueAsCString(const lldb_private::TypeFormatImpl &format,
std::string &destination) { … }
bool ValueObject::GetValueAsCString(lldb::Format format,
std::string &destination) { … }
const char *ValueObject::GetValueAsCString() { … }
uint64_t ValueObject::GetValueAsUnsigned(uint64_t fail_value, bool *success) { … }
int64_t ValueObject::GetValueAsSigned(int64_t fail_value, bool *success) { … }
llvm::Expected<llvm::APSInt> ValueObject::GetValueAsAPSInt() { … }
llvm::Expected<llvm::APFloat> ValueObject::GetValueAsAPFloat() { … }
llvm::Expected<bool> ValueObject::GetValueAsBool() { … }
void ValueObject::SetValueFromInteger(const llvm::APInt &value, Status &error) { … }
void ValueObject::SetValueFromInteger(lldb::ValueObjectSP new_val_sp,
Status &error) { … }
bool ValueObject::HasSpecialPrintableRepresentation(
ValueObjectRepresentationStyle val_obj_display, Format custom_format) { … }
bool ValueObject::DumpPrintableRepresentation(
Stream &s, ValueObjectRepresentationStyle val_obj_display,
Format custom_format, PrintableRepresentationSpecialCases special,
bool do_dump_error) { … }
addr_t ValueObject::GetAddressOf(bool scalar_is_load_address,
AddressType *address_type) { … }
addr_t ValueObject::GetPointerValue(AddressType *address_type) { … }
bool ValueObject::SetValueFromCString(const char *value_str, Status &error) { … }
bool ValueObject::GetDeclaration(Declaration &decl) { … }
void ValueObject::AddSyntheticChild(ConstString key,
ValueObject *valobj) { … }
ValueObjectSP ValueObject::GetSyntheticChild(ConstString key) const { … }
bool ValueObject::IsPossibleDynamicType() { … }
bool ValueObject::IsRuntimeSupportValue() { … }
bool ValueObject::IsNilReference() { … }
bool ValueObject::IsUninitializedReference() { … }
ValueObjectSP ValueObject::GetSyntheticArrayMember(size_t index,
bool can_create) { … }
ValueObjectSP ValueObject::GetSyntheticBitFieldChild(uint32_t from, uint32_t to,
bool can_create) { … }
ValueObjectSP ValueObject::GetSyntheticChildAtOffset(
uint32_t offset, const CompilerType &type, bool can_create,
ConstString name_const_str) { … }
ValueObjectSP ValueObject::GetSyntheticBase(uint32_t offset,
const CompilerType &type,
bool can_create,
ConstString name_const_str) { … }
static const char *SkipLeadingExpressionPathSeparators(const char *expression) { … }
ValueObjectSP
ValueObject::GetSyntheticExpressionPathChild(const char *expression,
bool can_create) { … }
void ValueObject::CalculateSyntheticValue() { … }
void ValueObject::CalculateDynamicValue(DynamicValueType use_dynamic) { … }
ValueObjectSP ValueObject::GetDynamicValue(DynamicValueType use_dynamic) { … }
ValueObjectSP ValueObject::GetSyntheticValue() { … }
bool ValueObject::HasSyntheticValue() { … }
ValueObject *ValueObject::GetNonBaseClassParent() { … }
bool ValueObject::IsBaseClass(uint32_t &depth) { … }
void ValueObject::GetExpressionPath(Stream &s,
GetExpressionPathFormat epformat) { … }
ValueObjectSP ValueObject::GetValueForExpressionPath(
llvm::StringRef expression, ExpressionPathScanEndReason *reason_to_stop,
ExpressionPathEndResultType *final_value_type,
const GetValueForExpressionPathOptions &options,
ExpressionPathAftermath *final_task_on_target) { … }
ValueObjectSP ValueObject::GetValueForExpressionPath_Impl(
llvm::StringRef expression, ExpressionPathScanEndReason *reason_to_stop,
ExpressionPathEndResultType *final_result,
const GetValueForExpressionPathOptions &options,
ExpressionPathAftermath *what_next) { … }
llvm::Error ValueObject::Dump(Stream &s) { … }
llvm::Error ValueObject::Dump(Stream &s,
const DumpValueObjectOptions &options) { … }
ValueObjectSP ValueObject::CreateConstantValue(ConstString name) { … }
ValueObjectSP ValueObject::GetQualifiedRepresentationIfAvailable(
lldb::DynamicValueType dynValue, bool synthValue) { … }
ValueObjectSP ValueObject::Dereference(Status &error) { … }
ValueObjectSP ValueObject::AddressOf(Status &error) { … }
ValueObjectSP ValueObject::DoCast(const CompilerType &compiler_type) { … }
ValueObjectSP ValueObject::Cast(const CompilerType &compiler_type) { … }
lldb::ValueObjectSP ValueObject::Clone(ConstString new_name) { … }
ValueObjectSP ValueObject::CastPointerType(const char *name,
CompilerType &compiler_type) { … }
ValueObjectSP ValueObject::CastPointerType(const char *name, TypeSP &type_sp) { … }
lldb::addr_t ValueObject::GetLoadAddress() { … }
llvm::Expected<lldb::ValueObjectSP> ValueObject::CastDerivedToBaseType(
CompilerType type, const llvm::ArrayRef<uint32_t> &base_type_indices) { … }
llvm::Expected<lldb::ValueObjectSP>
ValueObject::CastBaseToDerivedType(CompilerType type, uint64_t offset) { … }
lldb::ValueObjectSP ValueObject::CastToBasicType(CompilerType type) { … }
lldb::ValueObjectSP ValueObject::CastToEnumType(CompilerType type) { … }
ValueObject::EvaluationPoint::EvaluationPoint() : … { … }
ValueObject::EvaluationPoint::EvaluationPoint(ExecutionContextScope *exe_scope,
bool use_selected)
: … { … }
ValueObject::EvaluationPoint::EvaluationPoint(
const ValueObject::EvaluationPoint &rhs)
: … { … }
ValueObject::EvaluationPoint::~EvaluationPoint() = default;
bool ValueObject::EvaluationPoint::SyncWithProcessState(
bool accept_invalid_exe_ctx) { … }
void ValueObject::EvaluationPoint::SetUpdated() { … }
void ValueObject::ClearUserVisibleData(uint32_t clear_mask) { … }
SymbolContextScope *ValueObject::GetSymbolContextScope() { … }
lldb::ValueObjectSP
ValueObject::CreateValueObjectFromExpression(llvm::StringRef name,
llvm::StringRef expression,
const ExecutionContext &exe_ctx) { … }
lldb::ValueObjectSP ValueObject::CreateValueObjectFromExpression(
llvm::StringRef name, llvm::StringRef expression,
const ExecutionContext &exe_ctx, const EvaluateExpressionOptions &options) { … }
lldb::ValueObjectSP ValueObject::CreateValueObjectFromAddress(
llvm::StringRef name, uint64_t address, const ExecutionContext &exe_ctx,
CompilerType type, bool do_deref) { … }
lldb::ValueObjectSP ValueObject::CreateValueObjectFromData(
llvm::StringRef name, const DataExtractor &data,
const ExecutionContext &exe_ctx, CompilerType type) { … }
lldb::ValueObjectSP
ValueObject::CreateValueObjectFromAPInt(lldb::TargetSP target,
const llvm::APInt &v, CompilerType type,
llvm::StringRef name) { … }
lldb::ValueObjectSP ValueObject::CreateValueObjectFromAPFloat(
lldb::TargetSP target, const llvm::APFloat &v, CompilerType type,
llvm::StringRef name) { … }
lldb::ValueObjectSP
ValueObject::CreateValueObjectFromBool(lldb::TargetSP target, bool value,
llvm::StringRef name) { … }
lldb::ValueObjectSP ValueObject::CreateValueObjectFromNullptr(
lldb::TargetSP target, CompilerType type, llvm::StringRef name) { … }
ModuleSP ValueObject::GetModule() { … }
ValueObject *ValueObject::GetRoot() { … }
ValueObject *
ValueObject::FollowParentChain(std::function<bool(ValueObject *)> f) { … }
AddressType ValueObject::GetAddressTypeOfChildren() { … }
lldb::DynamicValueType ValueObject::GetDynamicValueType() { … }
lldb::Format ValueObject::GetFormat() const { … }
lldb::LanguageType ValueObject::GetPreferredDisplayLanguage() { … }
void ValueObject::SetPreferredDisplayLanguageIfNeeded(lldb::LanguageType lt) { … }
bool ValueObject::CanProvideValue() { … }
ValueObjectSP ValueObject::Persist() { … }
lldb::ValueObjectSP ValueObject::GetVTable() { … }