LLDB  mainline
ValueObjectConstResult.h
Go to the documentation of this file.
1 //===-- ValueObjectConstResult.h --------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef liblldb_ValueObjectConstResult_h_
10 #define liblldb_ValueObjectConstResult_h_
11 
12 #include "lldb/Core/Value.h"
13 #include "lldb/Core/ValueObject.h"
17 #include "lldb/Utility/Status.h"
18 #include "lldb/lldb-defines.h"
19 #include "lldb/lldb-enumerations.h"
20 #include "lldb/lldb-forward.h"
22 #include "lldb/lldb-types.h"
23 
24 #include <stddef.h>
25 #include <stdint.h>
26 
27 namespace lldb_private {
28 class DataExtractor;
29 }
30 namespace lldb_private {
31 class ExecutionContextScope;
32 }
33 namespace lldb_private {
34 class Module;
35 }
36 namespace lldb_private {
37 
38 // A frozen ValueObject copied into host memory
40 public:
41  ~ValueObjectConstResult() override;
42 
43  static lldb::ValueObjectSP
44  Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order,
45  uint32_t addr_byte_size, lldb::addr_t address = LLDB_INVALID_ADDRESS);
46 
47  static lldb::ValueObjectSP
48  Create(ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
49  ConstString name, const DataExtractor &data,
51 
52  static lldb::ValueObjectSP
53  Create(ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
54  ConstString name, const lldb::DataBufferSP &result_data_sp,
55  lldb::ByteOrder byte_order, uint32_t addr_size,
57 
58  static lldb::ValueObjectSP
59  Create(ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
60  ConstString name, lldb::addr_t address,
61  AddressType address_type, uint32_t addr_byte_size);
62 
63  static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
64  Value &value, ConstString name,
65  Module *module = nullptr);
66 
67  // When an expression fails to evaluate, we return an error
68  static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
69  const Status &error);
70 
71  uint64_t GetByteSize() override;
72 
73  lldb::ValueType GetValueType() const override;
74 
75  size_t CalculateNumChildren(uint32_t max) override;
76 
77  ConstString GetTypeName() override;
78 
80 
81  bool IsInScope() override;
82 
83  void SetByteSize(size_t size);
84 
85  lldb::ValueObjectSP Dereference(Status &error) override;
86 
87  ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member,
88  int32_t synthetic_index) override;
89 
90  lldb::ValueObjectSP GetSyntheticChildAtOffset(
91  uint32_t offset, const CompilerType &type, bool can_create,
92  ConstString name_const_str = ConstString()) override;
93 
94  lldb::ValueObjectSP AddressOf(Status &error) override;
95 
96  lldb::addr_t GetAddressOf(bool scalar_is_load_address = true,
97  AddressType *address_type = nullptr) override;
98 
99  size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0,
100  uint32_t item_count = 1) override;
101 
103 
105  AddressType address_type = eAddressTypeLoad) override {
106  m_impl.SetLiveAddress(addr, address_type);
107  }
108 
109  lldb::ValueObjectSP
110  GetDynamicValue(lldb::DynamicValueType valueType) override;
111 
113 
114  lldb::ValueObjectSP Cast(const CompilerType &compiler_type) override;
115 
116 protected:
117  bool UpdateValue() override;
118 
120 
122  uint64_t m_byte_size;
123 
125 
126 private:
128 
130  lldb::ByteOrder byte_order, uint32_t addr_byte_size,
131  lldb::addr_t address);
132 
134  const CompilerType &compiler_type,
135  ConstString name, const DataExtractor &data,
136  lldb::addr_t address);
137 
139  const CompilerType &compiler_type,
140  ConstString name,
141  const lldb::DataBufferSP &result_data_sp,
142  lldb::ByteOrder byte_order, uint32_t addr_size,
143  lldb::addr_t address);
144 
146  const CompilerType &compiler_type,
147  ConstString name, lldb::addr_t address,
148  AddressType address_type, uint32_t addr_byte_size);
149 
150  ValueObjectConstResult(ExecutionContextScope *exe_scope, const Value &value,
151  ConstString name, Module *module = nullptr);
152 
153  ValueObjectConstResult(ExecutionContextScope *exe_scope, const Status &error);
154 
155  DISALLOW_COPY_AND_ASSIGN(ValueObjectConstResult);
156 };
157 
158 } // namespace lldb_private
159 
160 #endif // liblldb_ValueObjectConstResult_h_
An data extractor class.
Definition: DataExtractor.h:47
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
lldb::ValueObjectSP AddressOf(Status &error) override
lldb::ValueObjectSP Dereference(Status &error) override
lldb::ValueObjectSP Cast(const CompilerType &compiler_type) override
lldb::LanguageType GetPreferredDisplayLanguage() override
size_t GetPointeeData(DataExtractor &data, uint32_t item_idx=0, uint32_t item_count=1) override
lldb::ValueObjectSP GetSyntheticChildAtOffset(uint32_t offset, const CompilerType &type, bool can_create, ConstString name_const_str=ConstString()) override
#define LLDB_INVALID_ADDRESS
Invalid value definitions.
Definition: lldb-defines.h:85
LanguageType
Programming language type.
lldb::ValueObjectSP GetDynamicValue(lldb::DynamicValueType valueType) override
void SetLiveAddress(lldb::addr_t addr=LLDB_INVALID_ADDRESS, AddressType address_type=eAddressTypeLoad)
void SetLiveAddress(lldb::addr_t addr=LLDB_INVALID_ADDRESS, AddressType address_type=eAddressTypeLoad) override
lldb::ValueType GetValueType() const override
A class that describes an executable image and its associated object and symbol files.
Definition: Module.h:109
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
ValueObject * CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index) override
uint64_t addr_t
Definition: lldb-types.h:83
A uniqued constant string class.
Definition: ConstString.h:38
size_t CalculateNumChildren(uint32_t max) override
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, uint32_t addr_byte_size, lldb::addr_t address=LLDB_INVALID_ADDRESS)
Address is an address as in the current target inferior process.
lldb::addr_t GetAddressOf(bool scalar_is_load_address=true, AddressType *address_type=nullptr) override
An error handling class.
Definition: Status.h:44