1254721Semaste//===-- ValueObjectRegister.h -----------------------------------*- C++ -*-===// 2254721Semaste// 3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4353358Sdim// See https://llvm.org/LICENSE.txt for license information. 5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6254721Semaste// 7254721Semaste//===----------------------------------------------------------------------===// 8254721Semaste 9254721Semaste#ifndef liblldb_ValueObjectRegister_h_ 10254721Semaste#define liblldb_ValueObjectRegister_h_ 11254721Semaste 12254721Semaste#include "lldb/Core/ValueObject.h" 13344779Sdim#include "lldb/Symbol/CompilerType.h" 14344779Sdim#include "lldb/Utility/ConstString.h" 15344779Sdim#include "lldb/Utility/RegisterValue.h" 16344779Sdim#include "lldb/lldb-defines.h" 17344779Sdim#include "lldb/lldb-enumerations.h" 18344779Sdim#include "lldb/lldb-forward.h" 19344779Sdim#include "lldb/lldb-private-types.h" 20254721Semaste 21344779Sdim#include <stddef.h> 22344779Sdim#include <stdint.h> 23321369Sdim 24254721Semastenamespace lldb_private { 25321369Sdimclass DataExtractor; 26321369Sdimclass Status; 27321369Sdimclass ExecutionContextScope; 28321369Sdimclass Scalar; 29321369Sdimclass Stream; 30254721Semaste 31254721Semaste// A ValueObject that contains a root variable that may or may not 32254721Semaste// have children. 33314564Sdimclass ValueObjectRegisterContext : public ValueObject { 34254721Semastepublic: 35314564Sdim ~ValueObjectRegisterContext() override; 36254721Semaste 37314564Sdim uint64_t GetByteSize() override; 38254721Semaste 39314564Sdim lldb::ValueType GetValueType() const override { 40314564Sdim return lldb::eValueTypeRegisterSet; 41314564Sdim } 42254721Semaste 43314564Sdim ConstString GetTypeName() override; 44254721Semaste 45314564Sdim ConstString GetQualifiedTypeName() override; 46254721Semaste 47314564Sdim ConstString GetDisplayTypeName() override; 48254721Semaste 49314564Sdim size_t CalculateNumChildren(uint32_t max) override; 50314564Sdim 51314564Sdim ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member, 52314564Sdim int32_t synthetic_index) override; 53314564Sdim 54254721Semasteprotected: 55314564Sdim bool UpdateValue() override; 56254721Semaste 57314564Sdim CompilerType GetCompilerTypeImpl() override; 58254721Semaste 59314564Sdim lldb::RegisterContextSP m_reg_ctx_sp; 60314564Sdim 61254721Semasteprivate: 62314564Sdim ValueObjectRegisterContext(ValueObject &parent, 63314564Sdim lldb::RegisterContextSP ®_ctx_sp); 64314564Sdim // For ValueObject only 65314564Sdim DISALLOW_COPY_AND_ASSIGN(ValueObjectRegisterContext); 66254721Semaste}; 67254721Semaste 68314564Sdimclass ValueObjectRegisterSet : public ValueObject { 69254721Semastepublic: 70314564Sdim ~ValueObjectRegisterSet() override; 71296417Sdim 72314564Sdim static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, 73314564Sdim lldb::RegisterContextSP ®_ctx_sp, 74314564Sdim uint32_t set_idx); 75254721Semaste 76314564Sdim uint64_t GetByteSize() override; 77254721Semaste 78314564Sdim lldb::ValueType GetValueType() const override { 79314564Sdim return lldb::eValueTypeRegisterSet; 80314564Sdim } 81254721Semaste 82314564Sdim ConstString GetTypeName() override; 83254721Semaste 84314564Sdim ConstString GetQualifiedTypeName() override; 85254721Semaste 86314564Sdim size_t CalculateNumChildren(uint32_t max) override; 87254721Semaste 88314564Sdim ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member, 89314564Sdim int32_t synthetic_index) override; 90254721Semaste 91353358Sdim lldb::ValueObjectSP GetChildMemberWithName(ConstString name, 92314564Sdim bool can_create) override; 93314564Sdim 94353358Sdim size_t GetIndexOfChildWithName(ConstString name) override; 95314564Sdim 96254721Semasteprotected: 97314564Sdim bool UpdateValue() override; 98254721Semaste 99314564Sdim CompilerType GetCompilerTypeImpl() override; 100254721Semaste 101314564Sdim lldb::RegisterContextSP m_reg_ctx_sp; 102314564Sdim const RegisterSet *m_reg_set; 103314564Sdim uint32_t m_reg_set_idx; 104314564Sdim 105254721Semasteprivate: 106314564Sdim friend class ValueObjectRegisterContext; 107296417Sdim 108314564Sdim ValueObjectRegisterSet(ExecutionContextScope *exe_scope, 109314564Sdim lldb::RegisterContextSP ®_ctx_sp, uint32_t set_idx); 110254721Semaste 111314564Sdim // For ValueObject only 112314564Sdim DISALLOW_COPY_AND_ASSIGN(ValueObjectRegisterSet); 113254721Semaste}; 114254721Semaste 115314564Sdimclass ValueObjectRegister : public ValueObject { 116254721Semastepublic: 117314564Sdim ~ValueObjectRegister() override; 118296417Sdim 119314564Sdim static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, 120314564Sdim lldb::RegisterContextSP ®_ctx_sp, 121314564Sdim uint32_t reg_num); 122254721Semaste 123314564Sdim uint64_t GetByteSize() override; 124254721Semaste 125314564Sdim lldb::ValueType GetValueType() const override { 126314564Sdim return lldb::eValueTypeRegister; 127314564Sdim } 128254721Semaste 129314564Sdim ConstString GetTypeName() override; 130254721Semaste 131314564Sdim size_t CalculateNumChildren(uint32_t max) override; 132254721Semaste 133321369Sdim bool SetValueFromCString(const char *value_str, Status &error) override; 134254721Semaste 135321369Sdim bool SetData(DataExtractor &data, Status &error) override; 136314564Sdim 137314564Sdim bool ResolveValue(Scalar &scalar) override; 138314564Sdim 139314564Sdim void 140314564Sdim GetExpressionPath(Stream &s, bool qualify_cxx_base_classes, 141314564Sdim GetExpressionPathFormat epformat = 142314564Sdim eGetExpressionPathFormatDereferencePointers) override; 143314564Sdim 144254721Semasteprotected: 145314564Sdim bool UpdateValue() override; 146254721Semaste 147314564Sdim CompilerType GetCompilerTypeImpl() override; 148254721Semaste 149314564Sdim lldb::RegisterContextSP m_reg_ctx_sp; 150314564Sdim RegisterInfo m_reg_info; 151314564Sdim RegisterValue m_reg_value; 152314564Sdim ConstString m_type_name; 153314564Sdim CompilerType m_compiler_type; 154314564Sdim 155254721Semasteprivate: 156314564Sdim void ConstructObject(uint32_t reg_num); 157296417Sdim 158314564Sdim friend class ValueObjectRegisterSet; 159254721Semaste 160314564Sdim ValueObjectRegister(ValueObject &parent, lldb::RegisterContextSP ®_ctx_sp, 161314564Sdim uint32_t reg_num); 162314564Sdim ValueObjectRegister(ExecutionContextScope *exe_scope, 163314564Sdim lldb::RegisterContextSP ®_ctx_sp, uint32_t reg_num); 164314564Sdim 165314564Sdim // For ValueObject only 166314564Sdim DISALLOW_COPY_AND_ASSIGN(ValueObjectRegister); 167254721Semaste}; 168254721Semaste 169254721Semaste} // namespace lldb_private 170254721Semaste 171296417Sdim#endif // liblldb_ValueObjectRegister_h_ 172