SBAddress.h revision 1b925206e3c4867fea9eb55a4c6460962cf32564
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::addr_t
80    GetOffset ();
81
82    lldb::SBModule
83    GetModule ();
84
85    lldb::SBCompileUnit
86    GetCompileUnit ();
87
88    lldb::SBFunction
89    GetFunction ();
90
91    lldb::SBBlock
92    GetBlock ();
93
94    lldb::SBSymbol
95    GetSymbol ();
96
97    lldb::SBLineEntry
98    GetLineEntry ();
99
100
101protected:
102
103    friend class SBBlock;
104    friend class SBBreakpointLocation;
105    friend class SBFrame;
106    friend class SBFunction;
107    friend class SBLineEntry;
108    friend class SBInstruction;
109    friend class SBModule;
110    friend class SBSection;
111    friend class SBSymbol;
112    friend class SBSymbolContext;
113    friend class SBTarget;
114    friend class SBThread;
115    friend class SBValue;
116
117#ifndef SWIG
118
119    lldb_private::Address *
120    operator->();
121
122    const lldb_private::Address *
123    operator->() const;
124
125    lldb_private::Address *
126    get ();
127
128    lldb_private::Address &
129    ref();
130
131    const lldb_private::Address &
132    ref() const;
133
134#endif
135
136
137    SBAddress (const lldb_private::Address *lldb_object_ptr);
138
139    void
140    SetAddress (const lldb_private::Address *lldb_object_ptr);
141
142private:
143
144    std::auto_ptr<lldb_private::AddressImpl> m_opaque_ap;
145};
146
147
148} // namespace lldb
149
150#endif // LLDB_SBAddress_h_
151