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