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
73
75
77
79
81
83
85
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
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
lldb_private::Address * get()
lldb::SBSection GetSection()
bool operator!=(const SBAddress &rhs) const
Definition SBAddress.cpp:66
lldb::SBSymbol GetSymbol()
lldb::SBLineEntry GetLineEntry()
lldb::SBBlock GetBlock()
bool OffsetAddress(addr_t offset)
friend class SBQueueItem
Definition SBAddress.h:105
addr_t GetLoadAddress(const lldb::SBTarget &target) const
lldb_private::Address & ref()
friend class SBInstruction
Definition SBAddress.h:96
bool IsValid() const
Definition SBAddress.cpp:72
friend class SBSymbol
Definition SBAddress.h:99
friend class SBTarget
Definition SBAddress.h:101
friend class SBAddressRange
Definition SBAddress.h:89
friend class SBModule
Definition SBAddress.h:97
friend class SBBreakpoint
Definition SBAddress.h:91
friend class SBSymbolContext
Definition SBAddress.h:100
std::unique_ptr< lldb_private::Address > m_opaque_up
Definition SBAddress.h:126
friend class SBValue
Definition SBAddress.h:104
bool GetDescription(lldb::SBStream &description)
friend class SBThread
Definition SBAddress.h:102
friend class SBLineEntry
Definition SBAddress.h:95
friend class SBBlock
Definition SBAddress.h:90
friend class SBThreadPlan
Definition SBAddress.h:103
void SetLoadAddress(lldb::addr_t load_addr, lldb::SBTarget &target)
addr_t GetFileAddress() const
Definition SBAddress.cpp:98
lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope)
lldb::SBModule GetModule()
lldb::SBFunction GetFunction()
lldb_private::Address * operator->()
friend class SBFrame
Definition SBAddress.h:93
const lldb::SBAddress & operator=(const lldb::SBAddress &rhs)
Definition SBAddress.cpp:52
friend class SBSection
Definition SBAddress.h:98
friend class SBFunction
Definition SBAddress.h:94
friend class SBBreakpointLocation
Definition SBAddress.h:92
void SetAddress(lldb::SBSection section, lldb::addr_t offset)
Definition SBAddress.cpp:88
lldb::addr_t GetOffset()
friend bool LLDB_API operator==(const SBAddress &lhs, const SBAddress &rhs)
lldb::SBCompileUnit GetCompileUnit()
A section + offset based address class.
Definition Address.h:62
uint64_t addr_t
Definition lldb-types.h:80
bool LLDB_API operator==(const SBAddress &lhs, const SBAddress &rhs)
Definition SBAddress.cpp:60