SBAddress.h revision 23b8abbe214c252028f6e09f79169529c846409d
1//===-- SBAddress.h ---------------------------------------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef LLDB_SBAddress_h_
11#define LLDB_SBAddress_h_
12
13#include "lldb/API/SBDefines.h"
14#include "lldb/API/SBModule.h"
15
16namespace lldb {
17
18class SBAddress
19{
20public:
21
22    SBAddress ();
23
24    SBAddress (const lldb::SBAddress &rhs);
25
26    // Create an address by resolving a load address using the supplied target
27    SBAddress (lldb::addr_t load_addr, lldb::SBTarget &target);
28
29    ~SBAddress ();
30
31#ifndef SWIG
32    const lldb::SBAddress &
33    operator = (const lldb::SBAddress &rhs);
34#endif
35
36    bool
37    IsValid () const;
38
39    void
40    Clear ();
41
42    addr_t
43    GetFileAddress () const;
44
45    addr_t
46    GetLoadAddress (const lldb::SBTarget &target) const;
47
48    void
49    SetLoadAddress (lldb::addr_t load_addr,
50                    lldb::SBTarget &target);
51    bool
52    OffsetAddress (addr_t offset);
53
54    bool
55    GetDescription (lldb::SBStream &description);
56
57    // The following queries can lookup symbol information for a given address.
58    // An address might refer to code or data from an existing module, or it
59    // might refer to something on the stack or heap. The following functions
60    // will only return valid values if the address has been resolved to a code
61    // or data address using "void SBAddress::SetLoadAddress(...)" or
62    // "lldb::SBAddress SBTarget::ResolveLoadAddress (...)".
63    lldb::SBSymbolContext
64    GetSymbolContext (uint32_t resolve_scope);
65
66
67    // The following functions grab individual objects for a given address and
68    // are less efficient if you want more than one symbol related objects.
69    // Use one of the following when you want multiple debug symbol related
70    // objects for an address:
71    //    lldb::SBSymbolContext SBAddress::GetSymbolContext (uint32_t resolve_scope);
72    //    lldb::SBSymbolContext SBTarget::ResolveSymbolContextForAddress (const SBAddress &addr, uint32_t resolve_scope);
73    // One or more bits from the SymbolContextItem enumerations can be logically
74    // OR'ed together to more efficiently retrieve multiple symbol objects.
75
76    lldb::SBSection
77    GetSection ();
78
79    lldb::SBModule
80    GetModule ();
81
82    lldb::SBCompileUnit
83    GetCompileUnit ();
84
85    lldb::SBFunction
86    GetFunction ();
87
88    lldb::SBBlock
89    GetBlock ();
90
91    lldb::SBSymbol
92    GetSymbol ();
93
94    lldb::SBLineEntry
95    GetLineEntry ();
96
97
98protected:
99
100    friend class SBBlock;
101    friend class SBBreakpointLocation;
102    friend class SBFrame;
103    friend class SBFunction;
104    friend class SBLineEntry;
105    friend class SBInstruction;
106    friend class SBModule;
107    friend class SBSection;
108    friend class SBSymbol;
109    friend class SBSymbolContext;
110    friend class SBTarget;
111    friend class SBThread;
112    friend class SBValue;
113
114#ifndef SWIG
115
116    lldb_private::Address *
117    operator->();
118
119    const lldb_private::Address *
120    operator->() const;
121
122    lldb_private::Address *
123    get ();
124
125    lldb_private::Address &
126    ref();
127
128    const lldb_private::Address &
129    ref() const;
130
131#endif
132
133
134    SBAddress (const lldb_private::Address *lldb_object_ptr);
135
136    void
137    SetAddress (const lldb_private::Address *lldb_object_ptr);
138
139private:
140
141    std::auto_ptr<lldb_private::AddressImpl> m_opaque_ap;
142};
143
144
145} // namespace lldb
146
147#endif // LLDB_SBAddress_h_
148