SBModule.h revision 423d8d0d1207c88d8cff25ee0c2ccdf96ddb66b9
1//===-- SBModule.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_SBModule_h_
11#define LLDB_SBModule_h_
12
13#include "lldb/API/SBDefines.h"
14#include "lldb/API/SBSymbolContext.h"
15#include "lldb/API/SBValueList.h"
16
17namespace lldb {
18
19#ifdef SWIG
20%feature("docstring",
21         "Represents an executable image and its associated object and symbol"
22         " files.\n"
23         "\n"
24         "The module is designed to be able to select a single slice of an\n"
25         "executable image as it would appear on disk and during program\n"
26         "execution."
27         ) SBModule;
28#endif
29class SBModule
30{
31#ifdef SWIG
32    %feature("autodoc", "1");
33#endif
34
35public:
36
37    SBModule ();
38
39    SBModule (const SBModule &rhs);
40
41#ifndef SWIG
42    const SBModule &
43    operator = (const SBModule &rhs);
44#endif
45
46    ~SBModule ();
47
48    bool
49    IsValid () const;
50
51#ifdef SWIG
52    %feature("docstring", "
53#endif
54    //------------------------------------------------------------------
55    /// Get const accessor for the module file specification.
56    ///
57    /// This function returns the file for the module on the host system
58    /// that is running LLDB. This can differ from the path on the
59    /// platform since we might be doing remote debugging.
60    ///
61    /// @return
62    ///     A const reference to the file specification object.
63    //------------------------------------------------------------------
64#ifdef SWIG
65    ") GetFileSpec;
66#endif
67    lldb::SBFileSpec
68    GetFileSpec () const;
69
70#ifdef SWIG
71    %feature("docstring", "
72#endif
73    //------------------------------------------------------------------
74    /// Get accessor for the module platform file specification.
75    ///
76    /// Platform file refers to the path of the module as it is known on
77    /// the remote system on which it is being debugged. For local
78    /// debugging this is always the same as Module::GetFileSpec(). But
79    /// remote debugging might mention a file '/usr/lib/liba.dylib'
80    /// which might be locally downloaded and cached. In this case the
81    /// platform file could be something like:
82    /// '/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib'
83    /// The file could also be cached in a local developer kit directory.
84    ///
85    /// @return
86    ///     A const reference to the file specification object.
87    //------------------------------------------------------------------
88#ifdef SWIG
89    ") GetPlatformFileSpec;
90#endif
91    lldb::SBFileSpec
92    GetPlatformFileSpec () const;
93
94    bool
95    SetPlatformFileSpec (const lldb::SBFileSpec &platform_file);
96
97#ifndef SWIG
98    const uint8_t *
99    GetUUIDBytes () const;
100#endif
101
102#ifdef SWIG
103    %feature("docstring",
104             "Returns the UUID of the module as a Python string."
105             ) GetUUIDString;
106#endif
107    const char *
108    GetUUIDString () const;
109
110#ifndef SWIG
111    bool
112    operator == (const lldb::SBModule &rhs) const;
113
114    bool
115    operator != (const lldb::SBModule &rhs) const;
116
117#endif
118
119    bool
120    ResolveFileAddress (lldb::addr_t vm_addr,
121                        lldb::SBAddress& addr);
122
123    lldb::SBSymbolContext
124    ResolveSymbolContextForAddress (const lldb::SBAddress& addr,
125                                    uint32_t resolve_scope);
126
127    bool
128    GetDescription (lldb::SBStream &description);
129
130    size_t
131    GetNumSymbols ();
132
133    lldb::SBSymbol
134    GetSymbolAtIndex (size_t idx);
135
136#ifdef SWIG
137    %feature("docstring", "
138#endif
139    //------------------------------------------------------------------
140    /// Find functions by name.
141    ///
142    /// @param[in] name
143    ///     The name of the function we are looking for.
144    ///
145    /// @param[in] name_type_mask
146    ///     A logical OR of one or more FunctionNameType enum bits that
147    ///     indicate what kind of names should be used when doing the
148    ///     lookup. Bits include fully qualified names, base names,
149    ///     C++ methods, or ObjC selectors.
150    ///     See FunctionNameType for more details.
151    ///
152    /// @param[in] append
153    ///     If true, any matches will be appended to \a sc_list, else
154    ///     matches replace the contents of \a sc_list.
155    ///
156    /// @param[out] sc_list
157    ///     A symbol context list that gets filled in with all of the
158    ///     matches.
159    ///
160    /// @return
161    ///     The number of matches added to \a sc_list.
162    //------------------------------------------------------------------
163#ifdef SWIG
164    ") FindFunctions;
165#endif
166    uint32_t
167    FindFunctions (const char *name,
168                   uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
169                   bool append,
170                   lldb::SBSymbolContextList& sc_list);
171
172#ifdef SWIG
173    %feature("docstring", "
174#endif
175    //------------------------------------------------------------------
176    /// Find global and static variables by name.
177    ///
178    /// @param[in] target
179    ///     A valid SBTarget instance representing the debuggee.
180    ///
181    /// @param[in] name
182    ///     The name of the global or static variable we are looking
183    ///     for.
184    ///
185    /// @param[in] max_matches
186    ///     Allow the number of matches to be limited to \a max_matches.
187    ///
188    /// @return
189    ///     A list of matched variables in an SBValueList.
190    //------------------------------------------------------------------
191#ifdef SWIG
192    ") FindGlobalVariables;
193#endif
194    lldb::SBValueList
195    FindGlobalVariables (lldb::SBTarget &target,
196                         const char *name,
197                         uint32_t max_matches);
198
199
200private:
201    friend class SBAddress;
202    friend class SBFrame;
203    friend class SBSymbolContext;
204    friend class SBTarget;
205
206    explicit SBModule (const lldb::ModuleSP& module_sp);
207
208    void
209    SetModule (const lldb::ModuleSP& module_sp);
210#ifndef SWIG
211
212    lldb::ModuleSP &
213    operator *();
214
215
216    lldb_private::Module *
217    operator ->();
218
219    const lldb_private::Module *
220    operator ->() const;
221
222    lldb_private::Module *
223    get();
224
225    const lldb_private::Module *
226    get() const;
227
228#endif
229
230    lldb::ModuleSP m_opaque_sp;
231};
232
233
234} // namespace lldb
235
236#endif // LLDB_SBModule_h_
237