LLDB mainline
SBAddress.h
Go to the documentation of this file.
1//===-- SBAddress.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_API_SBADDRESS_H
10#define LLDB_API_SBADDRESS_H
11
12#include "lldb/API/SBDefines.h"
13#include "lldb/API/SBModule.h"
14
15namespace lldb {
16
18public:
19 SBAddress();
20
21 SBAddress(const lldb::SBAddress &rhs);
22
23 SBAddress(lldb::SBSection section, lldb::addr_t offset);
24
25 // Create an address by resolving a load address using the supplied target
26 SBAddress(lldb::addr_t load_addr, lldb::SBTarget &target);
27
29
30 const lldb::SBAddress &operator=(const lldb::SBAddress &rhs);
31
32 explicit operator bool() const;
33
34 // operator== is a free function
35
36 bool operator!=(const SBAddress &rhs) const;
37
38 bool IsValid() const;
39
40 void Clear();
41
42 addr_t GetFileAddress() const;
43
44 addr_t GetLoadAddress(const lldb::SBTarget &target) const;
45
46 void SetAddress(lldb::SBSection section, lldb::addr_t offset);
47
48 void SetLoadAddress(lldb::addr_t load_addr, lldb::SBTarget &target);
49 bool OffsetAddress(addr_t offset);
50
51 bool GetDescription(lldb::SBStream &description);
52
53 // The following queries can lookup symbol information for a given address.
54 // An address might refer to code or data from an existing module, or it
55 // might refer to something on the stack or heap. The following functions
56 // will only return valid values if the address has been resolved to a code
57 // or data address using "void SBAddress::SetLoadAddress(...)" or
58 // "lldb::SBAddress SBTarget::ResolveLoadAddress (...)".
59 lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope);
60
61 // The following functions grab individual objects for a given address and
62 // are less efficient if you want more than one symbol related objects. Use
63 // one of the following when you want multiple debug symbol related objects
64 // for an address:
65 // lldb::SBSymbolContext SBAddress::GetSymbolContext (uint32_t
66 // resolve_scope);
67 // lldb::SBSymbolContext SBTarget::ResolveSymbolContextForAddress (const
68 // SBAddress &addr, uint32_t resolve_scope);
69 // One or more bits from the SymbolContextItem enumerations can be logically
70 // OR'ed together to more efficiently retrieve multiple symbol objects.
71
72 lldb::SBSection GetSection();
73
74 lldb::addr_t GetOffset();
75
76 lldb::SBModule GetModule();
77
78 lldb::SBCompileUnit GetCompileUnit();
79
80 lldb::SBFunction GetFunction();
81
82 lldb::SBBlock GetBlock();
83
84 lldb::SBSymbol GetSymbol();
85
86 lldb::SBLineEntry GetLineEntry();
87
88protected:
89 friend class SBAddressRange;
90 friend class SBBlock;
91 friend class SBBreakpoint;
93 friend class SBFrame;
94 friend class SBFunction;
95 friend class SBLineEntry;
96 friend class SBInstruction;
97 friend class SBModule;
98 friend class SBSection;
99 friend class SBSymbol;
100 friend class SBSymbolContext;
101 friend class SBTarget;
102 friend class SBThread;
103 friend class SBThreadPlan;
104 friend class SBValue;
105 friend class SBQueueItem;
106
107 lldb_private::Address *operator->();
108
109 const lldb_private::Address *operator->() const;
110
111#ifndef SWIG
112 friend bool LLDB_API operator==(const SBAddress &lhs, const SBAddress &rhs);
113#endif
114
116
118
119 const lldb_private::Address &ref() const;
120
121 SBAddress(const lldb_private::Address &address);
122
123 void SetAddress(const lldb_private::Address &address);
124
125private:
126 std::unique_ptr<lldb_private::Address> m_opaque_up;
127};
128
129#ifndef SWIG
130bool LLDB_API operator==(const SBAddress &lhs, const SBAddress &rhs);
131#endif
132
133} // namespace lldb
134
135#endif // LLDB_API_SBADDRESS_H
#define LLDB_API
Definition: SBDefines.h:28
std::unique_ptr< lldb_private::Address > m_opaque_up
Definition: SBAddress.h:126
friend bool LLDB_API operator==(const SBAddress &lhs, const SBAddress &rhs)
A section + offset based address class.
Definition: Address.h:62
Definition: SBAddress.h:15
uint64_t addr_t
Definition: lldb-types.h:80
bool LLDB_API operator==(const SBAddress &lhs, const SBAddress &rhs)
Definition: SBAddress.cpp:60