aboutsummaryrefslogtreecommitdiff
path: root/include/lldb/API/SBAddress.h
blob: 58a7d2bfb1dab19d28a7f8daf7a247203aa256e3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
//===-- SBAddress.h ---------------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLDB_SBAddress_h_
#define LLDB_SBAddress_h_

#include "lldb/API/SBDefines.h"
#include "lldb/API/SBModule.h"

namespace lldb {

class SBAddress
{
public:

    SBAddress ();

    SBAddress (const lldb::SBAddress &rhs);

    SBAddress (lldb::SBSection section, lldb::addr_t offset);

    // Create an address by resolving a load address using the supplied target
    SBAddress (lldb::addr_t load_addr, lldb::SBTarget &target);

    ~SBAddress ();

    const lldb::SBAddress &
    operator = (const lldb::SBAddress &rhs);

    bool
    IsValid () const;

    void
    Clear ();

    addr_t
    GetFileAddress () const;

    addr_t
    GetLoadAddress (const lldb::SBTarget &target) const;

    void
    SetAddress (lldb::SBSection section, lldb::addr_t offset);

    void
    SetLoadAddress (lldb::addr_t load_addr, 
                    lldb::SBTarget &target);
    bool
    OffsetAddress (addr_t offset);

    bool
    GetDescription (lldb::SBStream &description);

    // The following queries can lookup symbol information for a given address.
    // An address might refer to code or data from an existing module, or it
    // might refer to something on the stack or heap. The following functions
    // will only return valid values if the address has been resolved to a code
    // or data address using "void SBAddress::SetLoadAddress(...)" or 
    // "lldb::SBAddress SBTarget::ResolveLoadAddress (...)". 
    lldb::SBSymbolContext
    GetSymbolContext (uint32_t resolve_scope);

    
    // The following functions grab individual objects for a given address and
    // are less efficient if you want more than one symbol related objects. 
    // Use one of the following when you want multiple debug symbol related 
    // objects for an address:
    //    lldb::SBSymbolContext SBAddress::GetSymbolContext (uint32_t resolve_scope);
    //    lldb::SBSymbolContext SBTarget::ResolveSymbolContextForAddress (const SBAddress &addr, uint32_t resolve_scope);
    // One or more bits from the SymbolContextItem enumerations can be logically
    // OR'ed together to more efficiently retrieve multiple symbol objects.

    lldb::SBSection
    GetSection ();

    lldb::addr_t
    GetOffset ();

    lldb::SBModule
    GetModule ();
    
    lldb::SBCompileUnit
    GetCompileUnit ();

    lldb::SBFunction
    GetFunction ();

    lldb::SBBlock
    GetBlock ();

    lldb::SBSymbol
    GetSymbol ();

    lldb::SBLineEntry
    GetLineEntry ();
    
    lldb::AddressClass
    GetAddressClass ();

protected:

    friend class SBBlock;
    friend class SBBreakpointLocation;
    friend class SBFrame;
    friend class SBFunction;
    friend class SBLineEntry;
    friend class SBInstruction;
    friend class SBModule;
    friend class SBSection;
    friend class SBSymbol;
    friend class SBSymbolContext;
    friend class SBTarget;
    friend class SBThread;
    friend class SBValue;
    friend class SBQueueItem;

    lldb_private::Address *
    operator->();

    const lldb_private::Address *
    operator->() const;

    lldb_private::Address *
    get ();

    lldb_private::Address &
    ref();

    const lldb_private::Address &
    ref() const;

    SBAddress (const lldb_private::Address *lldb_object_ptr);

    void
    SetAddress (const lldb_private::Address *lldb_object_ptr);

private:

    std::unique_ptr<lldb_private::Address> m_opaque_ap;
};


} // namespace lldb

#endif // LLDB_SBAddress_h_