SBModule.h revision e0bd571a8050da2b3462c35c9f209cbc9755c750
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#ifndef SWIG 77 const uint8_t * 78 GetUUIDBytes () const; 79#endif 80 81 const char * 82 GetUUIDString () const; 83 84#ifndef SWIG 85 bool 86 operator == (const lldb::SBModule &rhs) const; 87 88 bool 89 operator != (const lldb::SBModule &rhs) const; 90 91#endif 92 lldb::SBSection 93 FindSection (const char *sect_name); 94 95 lldb::SBAddress 96 ResolveFileAddress (lldb::addr_t vm_addr); 97 98 lldb::SBSymbolContext 99 ResolveSymbolContextForAddress (const lldb::SBAddress& addr, 100 uint32_t resolve_scope); 101 102 bool 103 GetDescription (lldb::SBStream &description); 104 105 size_t 106 GetNumSymbols (); 107 108 lldb::SBSymbol 109 GetSymbolAtIndex (size_t idx); 110 111 size_t 112 GetNumSections (); 113 114 lldb::SBSection 115 GetSectionAtIndex (size_t idx); 116 //------------------------------------------------------------------ 117 /// Find functions by name. 118 /// 119 /// @param[in] name 120 /// The name of the function we are looking for. 121 /// 122 /// @param[in] name_type_mask 123 /// A logical OR of one or more FunctionNameType enum bits that 124 /// indicate what kind of names should be used when doing the 125 /// lookup. Bits include fully qualified names, base names, 126 /// C++ methods, or ObjC selectors. 127 /// See FunctionNameType for more details. 128 /// 129 /// @param[in] append 130 /// If true, any matches will be appended to \a sc_list, else 131 /// matches replace the contents of \a sc_list. 132 /// 133 /// @param[out] sc_list 134 /// A symbol context list that gets filled in with all of the 135 /// matches. 136 /// 137 /// @return 138 /// The number of matches added to \a sc_list. 139 //------------------------------------------------------------------ 140 uint32_t 141 FindFunctions (const char *name, 142 uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits 143 bool append, 144 lldb::SBSymbolContextList& sc_list); 145 146 //------------------------------------------------------------------ 147 /// Find global and static variables by name. 148 /// 149 /// @param[in] target 150 /// A valid SBTarget instance representing the debuggee. 151 /// 152 /// @param[in] name 153 /// The name of the global or static variable we are looking 154 /// for. 155 /// 156 /// @param[in] max_matches 157 /// Allow the number of matches to be limited to \a max_matches. 158 /// 159 /// @return 160 /// A list of matched variables in an SBValueList. 161 //------------------------------------------------------------------ 162 lldb::SBValueList 163 FindGlobalVariables (lldb::SBTarget &target, 164 const char *name, 165 uint32_t max_matches); 166 167 lldb::SBType 168 FindFirstType (const char* name); 169 170 lldb::SBTypeList 171 FindTypes (const char* type); 172 173private: 174 friend class SBAddress; 175 friend class SBFrame; 176 friend class SBSection; 177 friend class SBSymbolContext; 178 friend class SBTarget; 179 180 explicit SBModule (const lldb::ModuleSP& module_sp); 181 182 void 183 SetModule (const lldb::ModuleSP& module_sp); 184#ifndef SWIG 185 186 lldb::ModuleSP & 187 operator *(); 188 189 190 lldb_private::Module * 191 operator ->(); 192 193 const lldb_private::Module * 194 operator ->() const; 195 196 lldb_private::Module * 197 get(); 198 199 const lldb_private::Module * 200 get() const; 201 202 const lldb::ModuleSP & 203 get_sp() const; 204 205 206#endif 207 208 lldb::ModuleSP m_opaque_sp; 209}; 210 211 212} // namespace lldb 213 214#endif // LLDB_SBModule_h_ 215