1 //===-- SBModule.h ----------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLDB_SBModule_h_
11 #define LLDB_SBModule_h_
13 #include "lldb/API/SBDefines.h"
14 #include "lldb/API/SBError.h"
15 #include "lldb/API/SBSection.h"
16 #include "lldb/API/SBSymbolContext.h"
17 #include "lldb/API/SBValueList.h"
27 SBModule (const SBModule &rhs);
29 SBModule (const SBModuleSpec &module_spec);
32 operator = (const SBModule &rhs);
34 SBModule (lldb::SBProcess &process,
35 lldb::addr_t header_addr);
45 //------------------------------------------------------------------
46 /// Get const accessor for the module file specification.
48 /// This function returns the file for the module on the host system
49 /// that is running LLDB. This can differ from the path on the
50 /// platform since we might be doing remote debugging.
53 /// A const reference to the file specification object.
54 //------------------------------------------------------------------
58 //------------------------------------------------------------------
59 /// Get accessor for the module platform file specification.
61 /// Platform file refers to the path of the module as it is known on
62 /// the remote system on which it is being debugged. For local
63 /// debugging this is always the same as Module::GetFileSpec(). But
64 /// remote debugging might mention a file '/usr/lib/liba.dylib'
65 /// which might be locally downloaded and cached. In this case the
66 /// platform file could be something like:
67 /// '/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib'
68 /// The file could also be cached in a local developer kit directory.
71 /// A const reference to the file specification object.
72 //------------------------------------------------------------------
74 GetPlatformFileSpec () const;
77 SetPlatformFileSpec (const lldb::SBFileSpec &platform_file);
89 GetUUIDBytes () const;
92 GetUUIDString () const;
95 operator == (const lldb::SBModule &rhs) const;
98 operator != (const lldb::SBModule &rhs) const;
101 FindSection (const char *sect_name);
104 ResolveFileAddress (lldb::addr_t vm_addr);
106 lldb::SBSymbolContext
107 ResolveSymbolContextForAddress (const lldb::SBAddress& addr,
108 uint32_t resolve_scope);
111 GetDescription (lldb::SBStream &description);
114 GetNumCompileUnits();
117 GetCompileUnitAtIndex (uint32_t);
123 GetSymbolAtIndex (size_t idx);
126 FindSymbol (const char *name,
127 lldb::SymbolType type = eSymbolTypeAny);
129 lldb::SBSymbolContextList
130 FindSymbols (const char *name,
131 lldb::SymbolType type = eSymbolTypeAny);
137 GetSectionAtIndex (size_t idx);
138 //------------------------------------------------------------------
139 /// Find functions by name.
142 /// The name of the function we are looking for.
144 /// @param[in] name_type_mask
145 /// A logical OR of one or more FunctionNameType enum bits that
146 /// indicate what kind of names should be used when doing the
147 /// lookup. Bits include fully qualified names, base names,
148 /// C++ methods, or ObjC selectors.
149 /// See FunctionNameType for more details.
152 /// A lldb::SBSymbolContextList that gets filled in with all of
153 /// the symbol contexts for all the matches.
154 //------------------------------------------------------------------
155 lldb::SBSymbolContextList
156 FindFunctions (const char *name,
157 uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
159 //------------------------------------------------------------------
160 /// Find global and static variables by name.
162 /// @param[in] target
163 /// A valid SBTarget instance representing the debuggee.
166 /// The name of the global or static variable we are looking
169 /// @param[in] max_matches
170 /// Allow the number of matches to be limited to \a max_matches.
173 /// A list of matched variables in an SBValueList.
174 //------------------------------------------------------------------
176 FindGlobalVariables (lldb::SBTarget &target,
178 uint32_t max_matches);
180 //------------------------------------------------------------------
181 /// Find the first global (or static) variable by name.
183 /// @param[in] target
184 /// A valid SBTarget instance representing the debuggee.
187 /// The name of the global or static variable we are looking
191 /// An SBValue that gets filled in with the found variable (if any).
192 //------------------------------------------------------------------
194 FindFirstGlobalVariable (lldb::SBTarget &target, const char *name);
197 FindFirstType (const char* name);
200 FindTypes (const char* type);
203 GetBasicType(lldb::BasicType type);
205 //------------------------------------------------------------------
206 /// Get all types matching \a type_mask from debug info in this
209 /// @param[in] type_mask
210 /// A bitfield that consists of one or more bits logically OR'ed
211 /// together from the lldb::TypeClass enumeration. This allows
212 /// you to request only structure types, or only class, struct
213 /// and union types. Passing in lldb::eTypeClassAny will return
214 /// all types found in the debug information for this module.
217 /// A list of types in this module that match \a type_mask
218 //------------------------------------------------------------------
220 GetTypes (uint32_t type_mask = lldb::eTypeClassAny);
222 //------------------------------------------------------------------
223 /// Get the module version numbers.
225 /// Many object files have a set of version numbers that describe
226 /// the version of the executable or shared library. Typically there
227 /// are major, minor and build, but there may be more. This function
228 /// will extract the versions from object files if they are available.
230 /// If \a versions is NULL, or if \a num_versions is 0, the return
231 /// value will indicate how many version numbers are available in
232 /// this object file. Then a subsequent call can be made to this
233 /// function with a value of \a versions and \a num_versions that
234 /// has enough storage to store some or all version numbers.
236 /// @param[out] versions
237 /// A pointer to an array of uint32_t types that is \a num_versions
238 /// long. If this value is NULL, the return value will indicate
239 /// how many version numbers are required for a subsequent call
240 /// to this function so that all versions can be retrieved. If
241 /// the value is non-NULL, then at most \a num_versions of the
242 /// existing versions numbers will be filled into \a versions.
243 /// If there is no version information available, \a versions
244 /// will be filled with \a num_versions UINT32_MAX values
245 /// and zero will be returned.
247 /// @param[in] num_versions
248 /// The maximum number of entries to fill into \a versions. If
249 /// this value is zero, then the return value will indicate
250 /// how many version numbers there are in total so another call
251 /// to this function can be make with adequate storage in
252 /// \a versions to get all of the version numbers. If \a
253 /// num_versions is less than the actual number of version
254 /// numbers in this object file, only \a num_versions will be
255 /// filled into \a versions (if \a versions is non-NULL).
258 /// This function always returns the number of version numbers
259 /// that this object file has regardless of the number of
260 /// version numbers that were copied into \a versions.
261 //------------------------------------------------------------------
263 GetVersion (uint32_t *versions,
264 uint32_t num_versions);
267 friend class SBAddress;
268 friend class SBFrame;
269 friend class SBSection;
270 friend class SBSymbolContext;
271 friend class SBTarget;
273 explicit SBModule (const lldb::ModuleSP& module_sp);
279 SetSP (const ModuleSP &module_sp);
281 lldb::ModuleSP m_opaque_sp;
287 #endif // LLDB_SBModule_h_