1//===-- ValueObjectConstResultImpl.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 LLDB_CORE_VALUEOBJECTCONSTRESULTIMPL_H
10#define LLDB_CORE_VALUEOBJECTCONSTRESULTIMPL_H
11
12#include "lldb/Utility/ConstString.h"
13#include "lldb/lldb-defines.h"
14#include "lldb/lldb-forward.h"
15#include "lldb/lldb-private-enumerations.h"
16#include "lldb/lldb-types.h"
17
18#include <cstddef>
19#include <cstdint>
20namespace lldb_private {
21class CompilerType;
22class DataExtractor;
23class Status;
24class ValueObject;
25}
26
27namespace lldb_private {
28
29/// A class wrapping common implementation details for operations in
30/// ValueObjectConstResult ( & Child ) that may need to jump from the host
31/// memory space into the target's memory space.
32class ValueObjectConstResultImpl {
33public:
34 ValueObjectConstResultImpl(ValueObject *valobj,
35 lldb::addr_t live_address = LLDB_INVALID_ADDRESS);
36
37 virtual ~ValueObjectConstResultImpl() = default;
38
39 lldb::ValueObjectSP Dereference(Status &error);
40
41 ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member,
42 int32_t synthetic_index);
43
44 lldb::ValueObjectSP
45 GetSyntheticChildAtOffset(uint32_t offset, const CompilerType &type,
46 bool can_create,
47 ConstString name_const_str = ConstString());
48
49 lldb::ValueObjectSP AddressOf(Status &error);
50
51 lldb::addr_t GetLiveAddress() { return m_live_address; }
52
53 lldb::ValueObjectSP Cast(const CompilerType &compiler_type);
54
55 void SetLiveAddress(lldb::addr_t addr = LLDB_INVALID_ADDRESS,
56 AddressType address_type = eAddressTypeLoad) {
57 m_live_address = addr;
58 m_live_address_type = address_type;
59 }
60
61 virtual lldb::addr_t GetAddressOf(bool scalar_is_load_address = true,
62 AddressType *address_type = nullptr);
63
64 virtual size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0,
65 uint32_t item_count = 1);
66
67private:
68 ValueObject *m_impl_backend;
69 lldb::addr_t m_live_address;
70 AddressType m_live_address_type;
71 lldb::ValueObjectSP m_address_of_backend;
72
73 ValueObjectConstResultImpl(const ValueObjectConstResultImpl &) = delete;
74 const ValueObjectConstResultImpl &
75 operator=(const ValueObjectConstResultImpl &) = delete;
76};
77
78} // namespace lldb_private
79
80#endif // LLDB_CORE_VALUEOBJECTCONSTRESULTIMPL_H
81

source code of lldb/include/lldb/Core/ValueObjectConstResultImpl.h